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 x = GetExecutionRequest::new().set_name("example");
2034 /// ```
2035 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2036 self.name = v.into();
2037 self
2038 }
2039}
2040
2041impl wkt::message::Message for GetExecutionRequest {
2042 fn typename() -> &'static str {
2043 "type.googleapis.com/google.cloud.run.v2.GetExecutionRequest"
2044 }
2045}
2046
2047/// Request message for retrieving a list of Executions.
2048#[derive(Clone, Default, PartialEq)]
2049#[non_exhaustive]
2050pub struct ListExecutionsRequest {
2051 /// Required. The Execution from which the Executions should be listed.
2052 /// To list all Executions across Jobs, use "-" instead of Job name.
2053 /// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
2054 /// `{project}` can be project id or number.
2055 pub parent: std::string::String,
2056
2057 /// Maximum number of Executions to return in this call.
2058 pub page_size: i32,
2059
2060 /// A page token received from a previous call to ListExecutions.
2061 /// All other parameters must match.
2062 pub page_token: std::string::String,
2063
2064 /// If true, returns deleted (but unexpired) resources along with active ones.
2065 pub show_deleted: bool,
2066
2067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2068}
2069
2070impl ListExecutionsRequest {
2071 /// Creates a new default instance.
2072 pub fn new() -> Self {
2073 std::default::Default::default()
2074 }
2075
2076 /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
2077 ///
2078 /// # Example
2079 /// ```ignore,no_run
2080 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2081 /// let x = ListExecutionsRequest::new().set_parent("example");
2082 /// ```
2083 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2084 self.parent = v.into();
2085 self
2086 }
2087
2088 /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
2089 ///
2090 /// # Example
2091 /// ```ignore,no_run
2092 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2093 /// let x = ListExecutionsRequest::new().set_page_size(42);
2094 /// ```
2095 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2096 self.page_size = v.into();
2097 self
2098 }
2099
2100 /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
2101 ///
2102 /// # Example
2103 /// ```ignore,no_run
2104 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2105 /// let x = ListExecutionsRequest::new().set_page_token("example");
2106 /// ```
2107 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2108 self.page_token = v.into();
2109 self
2110 }
2111
2112 /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
2113 ///
2114 /// # Example
2115 /// ```ignore,no_run
2116 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2117 /// let x = ListExecutionsRequest::new().set_show_deleted(true);
2118 /// ```
2119 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2120 self.show_deleted = v.into();
2121 self
2122 }
2123}
2124
2125impl wkt::message::Message for ListExecutionsRequest {
2126 fn typename() -> &'static str {
2127 "type.googleapis.com/google.cloud.run.v2.ListExecutionsRequest"
2128 }
2129}
2130
2131/// Response message containing a list of Executions.
2132#[derive(Clone, Default, PartialEq)]
2133#[non_exhaustive]
2134pub struct ListExecutionsResponse {
2135 /// The resulting list of Executions.
2136 pub executions: std::vec::Vec<crate::model::Execution>,
2137
2138 /// A token indicating there are more items than page_size. Use it in the next
2139 /// ListExecutions request to continue.
2140 pub next_page_token: std::string::String,
2141
2142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2143}
2144
2145impl ListExecutionsResponse {
2146 /// Creates a new default instance.
2147 pub fn new() -> Self {
2148 std::default::Default::default()
2149 }
2150
2151 /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
2152 ///
2153 /// # Example
2154 /// ```ignore,no_run
2155 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2156 /// use google_cloud_run_v2::model::Execution;
2157 /// let x = ListExecutionsResponse::new()
2158 /// .set_executions([
2159 /// Execution::default()/* use setters */,
2160 /// Execution::default()/* use (different) setters */,
2161 /// ]);
2162 /// ```
2163 pub fn set_executions<T, V>(mut self, v: T) -> Self
2164 where
2165 T: std::iter::IntoIterator<Item = V>,
2166 V: std::convert::Into<crate::model::Execution>,
2167 {
2168 use std::iter::Iterator;
2169 self.executions = v.into_iter().map(|i| i.into()).collect();
2170 self
2171 }
2172
2173 /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
2174 ///
2175 /// # Example
2176 /// ```ignore,no_run
2177 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2178 /// let x = ListExecutionsResponse::new().set_next_page_token("example");
2179 /// ```
2180 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2181 self.next_page_token = v.into();
2182 self
2183 }
2184}
2185
2186impl wkt::message::Message for ListExecutionsResponse {
2187 fn typename() -> &'static str {
2188 "type.googleapis.com/google.cloud.run.v2.ListExecutionsResponse"
2189 }
2190}
2191
2192#[doc(hidden)]
2193impl google_cloud_gax::paginator::internal::PageableResponse for ListExecutionsResponse {
2194 type PageItem = crate::model::Execution;
2195
2196 fn items(self) -> std::vec::Vec<Self::PageItem> {
2197 self.executions
2198 }
2199
2200 fn next_page_token(&self) -> std::string::String {
2201 use std::clone::Clone;
2202 self.next_page_token.clone()
2203 }
2204}
2205
2206/// Request message for deleting an Execution.
2207#[derive(Clone, Default, PartialEq)]
2208#[non_exhaustive]
2209pub struct DeleteExecutionRequest {
2210 /// Required. The name of the Execution to delete.
2211 /// Format:
2212 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2213 /// where `{project}` can be project id or number.
2214 pub name: std::string::String,
2215
2216 /// Indicates that the request should be validated without actually
2217 /// deleting any resources.
2218 pub validate_only: bool,
2219
2220 /// A system-generated fingerprint for this version of the resource.
2221 /// This may be used to detect modification conflict during updates.
2222 pub etag: std::string::String,
2223
2224 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2225}
2226
2227impl DeleteExecutionRequest {
2228 /// Creates a new default instance.
2229 pub fn new() -> Self {
2230 std::default::Default::default()
2231 }
2232
2233 /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
2234 ///
2235 /// # Example
2236 /// ```ignore,no_run
2237 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2238 /// let x = DeleteExecutionRequest::new().set_name("example");
2239 /// ```
2240 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2241 self.name = v.into();
2242 self
2243 }
2244
2245 /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
2246 ///
2247 /// # Example
2248 /// ```ignore,no_run
2249 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2250 /// let x = DeleteExecutionRequest::new().set_validate_only(true);
2251 /// ```
2252 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2253 self.validate_only = v.into();
2254 self
2255 }
2256
2257 /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
2258 ///
2259 /// # Example
2260 /// ```ignore,no_run
2261 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2262 /// let x = DeleteExecutionRequest::new().set_etag("example");
2263 /// ```
2264 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2265 self.etag = v.into();
2266 self
2267 }
2268}
2269
2270impl wkt::message::Message for DeleteExecutionRequest {
2271 fn typename() -> &'static str {
2272 "type.googleapis.com/google.cloud.run.v2.DeleteExecutionRequest"
2273 }
2274}
2275
2276/// Request message for deleting an Execution.
2277#[derive(Clone, Default, PartialEq)]
2278#[non_exhaustive]
2279pub struct CancelExecutionRequest {
2280 /// Required. The name of the Execution to cancel.
2281 /// Format:
2282 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2283 /// where `{project}` can be project id or number.
2284 pub name: std::string::String,
2285
2286 /// Indicates that the request should be validated without actually
2287 /// cancelling any resources.
2288 pub validate_only: bool,
2289
2290 /// A system-generated fingerprint for this version of the resource.
2291 /// This may be used to detect modification conflict during updates.
2292 pub etag: std::string::String,
2293
2294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2295}
2296
2297impl CancelExecutionRequest {
2298 /// Creates a new default instance.
2299 pub fn new() -> Self {
2300 std::default::Default::default()
2301 }
2302
2303 /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
2304 ///
2305 /// # Example
2306 /// ```ignore,no_run
2307 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2308 /// let x = CancelExecutionRequest::new().set_name("example");
2309 /// ```
2310 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2311 self.name = v.into();
2312 self
2313 }
2314
2315 /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
2316 ///
2317 /// # Example
2318 /// ```ignore,no_run
2319 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2320 /// let x = CancelExecutionRequest::new().set_validate_only(true);
2321 /// ```
2322 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2323 self.validate_only = v.into();
2324 self
2325 }
2326
2327 /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
2328 ///
2329 /// # Example
2330 /// ```ignore,no_run
2331 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2332 /// let x = CancelExecutionRequest::new().set_etag("example");
2333 /// ```
2334 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2335 self.etag = v.into();
2336 self
2337 }
2338}
2339
2340impl wkt::message::Message for CancelExecutionRequest {
2341 fn typename() -> &'static str {
2342 "type.googleapis.com/google.cloud.run.v2.CancelExecutionRequest"
2343 }
2344}
2345
2346/// Execution represents the configuration of a single execution. A execution an
2347/// immutable resource that references a container image which is run to
2348/// completion.
2349#[derive(Clone, Default, PartialEq)]
2350#[non_exhaustive]
2351pub struct Execution {
2352 /// Output only. The unique name of this Execution.
2353 pub name: std::string::String,
2354
2355 /// Output only. Server assigned unique identifier for the Execution. The value
2356 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
2357 /// deleted.
2358 pub uid: std::string::String,
2359
2360 /// Output only. Email address of the authenticated creator.
2361 pub creator: std::string::String,
2362
2363 /// Output only. A number that monotonically increases every time the user
2364 /// modifies the desired state.
2365 pub generation: i64,
2366
2367 /// Output only. Unstructured key value map that can be used to organize and
2368 /// categorize objects. User-provided labels are shared with Google's billing
2369 /// system, so they can be used to filter, or break down billing charges by
2370 /// team, component, environment, state, etc. For more information, visit
2371 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
2372 /// <https://cloud.google.com/run/docs/configuring/labels>
2373 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2374
2375 /// Output only. Unstructured key value map that may
2376 /// be set by external tools to store and arbitrary metadata.
2377 /// They are not queryable and should be preserved
2378 /// when modifying objects.
2379 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2380
2381 /// Output only. Represents time when the execution was acknowledged by the
2382 /// execution controller. It is not guaranteed to be set in happens-before
2383 /// order across separate operations.
2384 pub create_time: std::option::Option<wkt::Timestamp>,
2385
2386 /// Output only. Represents time when the execution started to run.
2387 /// It is not guaranteed to be set in happens-before order across separate
2388 /// operations.
2389 pub start_time: std::option::Option<wkt::Timestamp>,
2390
2391 /// Output only. Represents time when the execution was completed. It is not
2392 /// guaranteed to be set in happens-before order across separate operations.
2393 pub completion_time: std::option::Option<wkt::Timestamp>,
2394
2395 /// Output only. The last-modified time.
2396 pub update_time: std::option::Option<wkt::Timestamp>,
2397
2398 /// Output only. For a deleted resource, the deletion time. It is only
2399 /// populated as a response to a Delete request.
2400 pub delete_time: std::option::Option<wkt::Timestamp>,
2401
2402 /// Output only. For a deleted resource, the time after which it will be
2403 /// permamently deleted. It is only populated as a response to a Delete
2404 /// request.
2405 pub expire_time: std::option::Option<wkt::Timestamp>,
2406
2407 /// The least stable launch stage needed to create this resource, as defined by
2408 /// [Google Cloud Platform Launch
2409 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
2410 /// `ALPHA`, `BETA`, and `GA`.
2411 ///
2412 /// Note that this value might not be what was used
2413 /// as input. For example, if ALPHA was provided as input in the parent
2414 /// resource, but only BETA and GA-level features are were, this field will be
2415 /// BETA.
2416 pub launch_stage: google_cloud_api::model::LaunchStage,
2417
2418 /// Output only. The name of the parent Job.
2419 pub job: std::string::String,
2420
2421 /// Output only. Specifies the maximum desired number of tasks the execution
2422 /// should run at any given time. Must be <= task_count. The actual number of
2423 /// tasks running in steady state will be less than this number when
2424 /// ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
2425 /// the work left to do is less than max parallelism.
2426 pub parallelism: i32,
2427
2428 /// Output only. Specifies the desired number of tasks the execution should
2429 /// run. Setting to 1 means that parallelism is limited to 1 and the success of
2430 /// that task signals the success of the execution.
2431 pub task_count: i32,
2432
2433 /// Output only. The template used to create tasks for this execution.
2434 pub template: std::option::Option<crate::model::TaskTemplate>,
2435
2436 /// Output only. Indicates whether the resource's reconciliation is still in
2437 /// progress. See comments in `Job.reconciling` for additional information on
2438 /// reconciliation process in Cloud Run.
2439 pub reconciling: bool,
2440
2441 /// Output only. The Condition of this Execution, containing its readiness
2442 /// status, and detailed error information in case it did not reach the desired
2443 /// state.
2444 pub conditions: std::vec::Vec<crate::model::Condition>,
2445
2446 /// Output only. The generation of this Execution. See comments in
2447 /// `reconciling` for additional information on reconciliation process in Cloud
2448 /// Run.
2449 pub observed_generation: i64,
2450
2451 /// Output only. The number of actively running tasks.
2452 pub running_count: i32,
2453
2454 /// Output only. The number of tasks which reached phase Succeeded.
2455 pub succeeded_count: i32,
2456
2457 /// Output only. The number of tasks which reached phase Failed.
2458 pub failed_count: i32,
2459
2460 /// Output only. The number of tasks which reached phase Cancelled.
2461 pub cancelled_count: i32,
2462
2463 /// Output only. The number of tasks which have retried at least once.
2464 pub retried_count: i32,
2465
2466 /// Output only. URI where logs for this execution can be found in Cloud
2467 /// Console.
2468 pub log_uri: std::string::String,
2469
2470 /// Output only. Reserved for future use.
2471 pub satisfies_pzs: bool,
2472
2473 /// Output only. A system-generated fingerprint for this version of the
2474 /// resource. May be used to detect modification conflict during updates.
2475 pub etag: std::string::String,
2476
2477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2478}
2479
2480impl Execution {
2481 /// Creates a new default instance.
2482 pub fn new() -> Self {
2483 std::default::Default::default()
2484 }
2485
2486 /// Sets the value of [name][crate::model::Execution::name].
2487 ///
2488 /// # Example
2489 /// ```ignore,no_run
2490 /// # use google_cloud_run_v2::model::Execution;
2491 /// let x = Execution::new().set_name("example");
2492 /// ```
2493 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2494 self.name = v.into();
2495 self
2496 }
2497
2498 /// Sets the value of [uid][crate::model::Execution::uid].
2499 ///
2500 /// # Example
2501 /// ```ignore,no_run
2502 /// # use google_cloud_run_v2::model::Execution;
2503 /// let x = Execution::new().set_uid("example");
2504 /// ```
2505 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2506 self.uid = v.into();
2507 self
2508 }
2509
2510 /// Sets the value of [creator][crate::model::Execution::creator].
2511 ///
2512 /// # Example
2513 /// ```ignore,no_run
2514 /// # use google_cloud_run_v2::model::Execution;
2515 /// let x = Execution::new().set_creator("example");
2516 /// ```
2517 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2518 self.creator = v.into();
2519 self
2520 }
2521
2522 /// Sets the value of [generation][crate::model::Execution::generation].
2523 ///
2524 /// # Example
2525 /// ```ignore,no_run
2526 /// # use google_cloud_run_v2::model::Execution;
2527 /// let x = Execution::new().set_generation(42);
2528 /// ```
2529 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2530 self.generation = v.into();
2531 self
2532 }
2533
2534 /// Sets the value of [labels][crate::model::Execution::labels].
2535 ///
2536 /// # Example
2537 /// ```ignore,no_run
2538 /// # use google_cloud_run_v2::model::Execution;
2539 /// let x = Execution::new().set_labels([
2540 /// ("key0", "abc"),
2541 /// ("key1", "xyz"),
2542 /// ]);
2543 /// ```
2544 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2545 where
2546 T: std::iter::IntoIterator<Item = (K, V)>,
2547 K: std::convert::Into<std::string::String>,
2548 V: std::convert::Into<std::string::String>,
2549 {
2550 use std::iter::Iterator;
2551 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2552 self
2553 }
2554
2555 /// Sets the value of [annotations][crate::model::Execution::annotations].
2556 ///
2557 /// # Example
2558 /// ```ignore,no_run
2559 /// # use google_cloud_run_v2::model::Execution;
2560 /// let x = Execution::new().set_annotations([
2561 /// ("key0", "abc"),
2562 /// ("key1", "xyz"),
2563 /// ]);
2564 /// ```
2565 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2566 where
2567 T: std::iter::IntoIterator<Item = (K, V)>,
2568 K: std::convert::Into<std::string::String>,
2569 V: std::convert::Into<std::string::String>,
2570 {
2571 use std::iter::Iterator;
2572 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2573 self
2574 }
2575
2576 /// Sets the value of [create_time][crate::model::Execution::create_time].
2577 ///
2578 /// # Example
2579 /// ```ignore,no_run
2580 /// # use google_cloud_run_v2::model::Execution;
2581 /// use wkt::Timestamp;
2582 /// let x = Execution::new().set_create_time(Timestamp::default()/* use setters */);
2583 /// ```
2584 pub fn set_create_time<T>(mut self, v: T) -> Self
2585 where
2586 T: std::convert::Into<wkt::Timestamp>,
2587 {
2588 self.create_time = std::option::Option::Some(v.into());
2589 self
2590 }
2591
2592 /// Sets or clears the value of [create_time][crate::model::Execution::create_time].
2593 ///
2594 /// # Example
2595 /// ```ignore,no_run
2596 /// # use google_cloud_run_v2::model::Execution;
2597 /// use wkt::Timestamp;
2598 /// let x = Execution::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2599 /// let x = Execution::new().set_or_clear_create_time(None::<Timestamp>);
2600 /// ```
2601 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2602 where
2603 T: std::convert::Into<wkt::Timestamp>,
2604 {
2605 self.create_time = v.map(|x| x.into());
2606 self
2607 }
2608
2609 /// Sets the value of [start_time][crate::model::Execution::start_time].
2610 ///
2611 /// # Example
2612 /// ```ignore,no_run
2613 /// # use google_cloud_run_v2::model::Execution;
2614 /// use wkt::Timestamp;
2615 /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
2616 /// ```
2617 pub fn set_start_time<T>(mut self, v: T) -> Self
2618 where
2619 T: std::convert::Into<wkt::Timestamp>,
2620 {
2621 self.start_time = std::option::Option::Some(v.into());
2622 self
2623 }
2624
2625 /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
2626 ///
2627 /// # Example
2628 /// ```ignore,no_run
2629 /// # use google_cloud_run_v2::model::Execution;
2630 /// use wkt::Timestamp;
2631 /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2632 /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
2633 /// ```
2634 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2635 where
2636 T: std::convert::Into<wkt::Timestamp>,
2637 {
2638 self.start_time = v.map(|x| x.into());
2639 self
2640 }
2641
2642 /// Sets the value of [completion_time][crate::model::Execution::completion_time].
2643 ///
2644 /// # Example
2645 /// ```ignore,no_run
2646 /// # use google_cloud_run_v2::model::Execution;
2647 /// use wkt::Timestamp;
2648 /// let x = Execution::new().set_completion_time(Timestamp::default()/* use setters */);
2649 /// ```
2650 pub fn set_completion_time<T>(mut self, v: T) -> Self
2651 where
2652 T: std::convert::Into<wkt::Timestamp>,
2653 {
2654 self.completion_time = std::option::Option::Some(v.into());
2655 self
2656 }
2657
2658 /// Sets or clears the value of [completion_time][crate::model::Execution::completion_time].
2659 ///
2660 /// # Example
2661 /// ```ignore,no_run
2662 /// # use google_cloud_run_v2::model::Execution;
2663 /// use wkt::Timestamp;
2664 /// let x = Execution::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
2665 /// let x = Execution::new().set_or_clear_completion_time(None::<Timestamp>);
2666 /// ```
2667 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
2668 where
2669 T: std::convert::Into<wkt::Timestamp>,
2670 {
2671 self.completion_time = v.map(|x| x.into());
2672 self
2673 }
2674
2675 /// Sets the value of [update_time][crate::model::Execution::update_time].
2676 ///
2677 /// # Example
2678 /// ```ignore,no_run
2679 /// # use google_cloud_run_v2::model::Execution;
2680 /// use wkt::Timestamp;
2681 /// let x = Execution::new().set_update_time(Timestamp::default()/* use setters */);
2682 /// ```
2683 pub fn set_update_time<T>(mut self, v: T) -> Self
2684 where
2685 T: std::convert::Into<wkt::Timestamp>,
2686 {
2687 self.update_time = std::option::Option::Some(v.into());
2688 self
2689 }
2690
2691 /// Sets or clears the value of [update_time][crate::model::Execution::update_time].
2692 ///
2693 /// # Example
2694 /// ```ignore,no_run
2695 /// # use google_cloud_run_v2::model::Execution;
2696 /// use wkt::Timestamp;
2697 /// let x = Execution::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2698 /// let x = Execution::new().set_or_clear_update_time(None::<Timestamp>);
2699 /// ```
2700 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2701 where
2702 T: std::convert::Into<wkt::Timestamp>,
2703 {
2704 self.update_time = v.map(|x| x.into());
2705 self
2706 }
2707
2708 /// Sets the value of [delete_time][crate::model::Execution::delete_time].
2709 ///
2710 /// # Example
2711 /// ```ignore,no_run
2712 /// # use google_cloud_run_v2::model::Execution;
2713 /// use wkt::Timestamp;
2714 /// let x = Execution::new().set_delete_time(Timestamp::default()/* use setters */);
2715 /// ```
2716 pub fn set_delete_time<T>(mut self, v: T) -> Self
2717 where
2718 T: std::convert::Into<wkt::Timestamp>,
2719 {
2720 self.delete_time = std::option::Option::Some(v.into());
2721 self
2722 }
2723
2724 /// Sets or clears the value of [delete_time][crate::model::Execution::delete_time].
2725 ///
2726 /// # Example
2727 /// ```ignore,no_run
2728 /// # use google_cloud_run_v2::model::Execution;
2729 /// use wkt::Timestamp;
2730 /// let x = Execution::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2731 /// let x = Execution::new().set_or_clear_delete_time(None::<Timestamp>);
2732 /// ```
2733 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2734 where
2735 T: std::convert::Into<wkt::Timestamp>,
2736 {
2737 self.delete_time = v.map(|x| x.into());
2738 self
2739 }
2740
2741 /// Sets the value of [expire_time][crate::model::Execution::expire_time].
2742 ///
2743 /// # Example
2744 /// ```ignore,no_run
2745 /// # use google_cloud_run_v2::model::Execution;
2746 /// use wkt::Timestamp;
2747 /// let x = Execution::new().set_expire_time(Timestamp::default()/* use setters */);
2748 /// ```
2749 pub fn set_expire_time<T>(mut self, v: T) -> Self
2750 where
2751 T: std::convert::Into<wkt::Timestamp>,
2752 {
2753 self.expire_time = std::option::Option::Some(v.into());
2754 self
2755 }
2756
2757 /// Sets or clears the value of [expire_time][crate::model::Execution::expire_time].
2758 ///
2759 /// # Example
2760 /// ```ignore,no_run
2761 /// # use google_cloud_run_v2::model::Execution;
2762 /// use wkt::Timestamp;
2763 /// let x = Execution::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2764 /// let x = Execution::new().set_or_clear_expire_time(None::<Timestamp>);
2765 /// ```
2766 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2767 where
2768 T: std::convert::Into<wkt::Timestamp>,
2769 {
2770 self.expire_time = v.map(|x| x.into());
2771 self
2772 }
2773
2774 /// Sets the value of [launch_stage][crate::model::Execution::launch_stage].
2775 ///
2776 /// # Example
2777 /// ```ignore,no_run
2778 /// # use google_cloud_run_v2::model::Execution;
2779 /// use google_cloud_api::model::LaunchStage;
2780 /// let x0 = Execution::new().set_launch_stage(LaunchStage::Unimplemented);
2781 /// let x1 = Execution::new().set_launch_stage(LaunchStage::Prelaunch);
2782 /// let x2 = Execution::new().set_launch_stage(LaunchStage::EarlyAccess);
2783 /// ```
2784 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
2785 mut self,
2786 v: T,
2787 ) -> Self {
2788 self.launch_stage = v.into();
2789 self
2790 }
2791
2792 /// Sets the value of [job][crate::model::Execution::job].
2793 ///
2794 /// # Example
2795 /// ```ignore,no_run
2796 /// # use google_cloud_run_v2::model::Execution;
2797 /// let x = Execution::new().set_job("example");
2798 /// ```
2799 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2800 self.job = v.into();
2801 self
2802 }
2803
2804 /// Sets the value of [parallelism][crate::model::Execution::parallelism].
2805 ///
2806 /// # Example
2807 /// ```ignore,no_run
2808 /// # use google_cloud_run_v2::model::Execution;
2809 /// let x = Execution::new().set_parallelism(42);
2810 /// ```
2811 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2812 self.parallelism = v.into();
2813 self
2814 }
2815
2816 /// Sets the value of [task_count][crate::model::Execution::task_count].
2817 ///
2818 /// # Example
2819 /// ```ignore,no_run
2820 /// # use google_cloud_run_v2::model::Execution;
2821 /// let x = Execution::new().set_task_count(42);
2822 /// ```
2823 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2824 self.task_count = v.into();
2825 self
2826 }
2827
2828 /// Sets the value of [template][crate::model::Execution::template].
2829 ///
2830 /// # Example
2831 /// ```ignore,no_run
2832 /// # use google_cloud_run_v2::model::Execution;
2833 /// use google_cloud_run_v2::model::TaskTemplate;
2834 /// let x = Execution::new().set_template(TaskTemplate::default()/* use setters */);
2835 /// ```
2836 pub fn set_template<T>(mut self, v: T) -> Self
2837 where
2838 T: std::convert::Into<crate::model::TaskTemplate>,
2839 {
2840 self.template = std::option::Option::Some(v.into());
2841 self
2842 }
2843
2844 /// Sets or clears the value of [template][crate::model::Execution::template].
2845 ///
2846 /// # Example
2847 /// ```ignore,no_run
2848 /// # use google_cloud_run_v2::model::Execution;
2849 /// use google_cloud_run_v2::model::TaskTemplate;
2850 /// let x = Execution::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
2851 /// let x = Execution::new().set_or_clear_template(None::<TaskTemplate>);
2852 /// ```
2853 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
2854 where
2855 T: std::convert::Into<crate::model::TaskTemplate>,
2856 {
2857 self.template = v.map(|x| x.into());
2858 self
2859 }
2860
2861 /// Sets the value of [reconciling][crate::model::Execution::reconciling].
2862 ///
2863 /// # Example
2864 /// ```ignore,no_run
2865 /// # use google_cloud_run_v2::model::Execution;
2866 /// let x = Execution::new().set_reconciling(true);
2867 /// ```
2868 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2869 self.reconciling = v.into();
2870 self
2871 }
2872
2873 /// Sets the value of [conditions][crate::model::Execution::conditions].
2874 ///
2875 /// # Example
2876 /// ```ignore,no_run
2877 /// # use google_cloud_run_v2::model::Execution;
2878 /// use google_cloud_run_v2::model::Condition;
2879 /// let x = Execution::new()
2880 /// .set_conditions([
2881 /// Condition::default()/* use setters */,
2882 /// Condition::default()/* use (different) setters */,
2883 /// ]);
2884 /// ```
2885 pub fn set_conditions<T, V>(mut self, v: T) -> Self
2886 where
2887 T: std::iter::IntoIterator<Item = V>,
2888 V: std::convert::Into<crate::model::Condition>,
2889 {
2890 use std::iter::Iterator;
2891 self.conditions = v.into_iter().map(|i| i.into()).collect();
2892 self
2893 }
2894
2895 /// Sets the value of [observed_generation][crate::model::Execution::observed_generation].
2896 ///
2897 /// # Example
2898 /// ```ignore,no_run
2899 /// # use google_cloud_run_v2::model::Execution;
2900 /// let x = Execution::new().set_observed_generation(42);
2901 /// ```
2902 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2903 self.observed_generation = v.into();
2904 self
2905 }
2906
2907 /// Sets the value of [running_count][crate::model::Execution::running_count].
2908 ///
2909 /// # Example
2910 /// ```ignore,no_run
2911 /// # use google_cloud_run_v2::model::Execution;
2912 /// let x = Execution::new().set_running_count(42);
2913 /// ```
2914 pub fn set_running_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2915 self.running_count = v.into();
2916 self
2917 }
2918
2919 /// Sets the value of [succeeded_count][crate::model::Execution::succeeded_count].
2920 ///
2921 /// # Example
2922 /// ```ignore,no_run
2923 /// # use google_cloud_run_v2::model::Execution;
2924 /// let x = Execution::new().set_succeeded_count(42);
2925 /// ```
2926 pub fn set_succeeded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2927 self.succeeded_count = v.into();
2928 self
2929 }
2930
2931 /// Sets the value of [failed_count][crate::model::Execution::failed_count].
2932 ///
2933 /// # Example
2934 /// ```ignore,no_run
2935 /// # use google_cloud_run_v2::model::Execution;
2936 /// let x = Execution::new().set_failed_count(42);
2937 /// ```
2938 pub fn set_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2939 self.failed_count = v.into();
2940 self
2941 }
2942
2943 /// Sets the value of [cancelled_count][crate::model::Execution::cancelled_count].
2944 ///
2945 /// # Example
2946 /// ```ignore,no_run
2947 /// # use google_cloud_run_v2::model::Execution;
2948 /// let x = Execution::new().set_cancelled_count(42);
2949 /// ```
2950 pub fn set_cancelled_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2951 self.cancelled_count = v.into();
2952 self
2953 }
2954
2955 /// Sets the value of [retried_count][crate::model::Execution::retried_count].
2956 ///
2957 /// # Example
2958 /// ```ignore,no_run
2959 /// # use google_cloud_run_v2::model::Execution;
2960 /// let x = Execution::new().set_retried_count(42);
2961 /// ```
2962 pub fn set_retried_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2963 self.retried_count = v.into();
2964 self
2965 }
2966
2967 /// Sets the value of [log_uri][crate::model::Execution::log_uri].
2968 ///
2969 /// # Example
2970 /// ```ignore,no_run
2971 /// # use google_cloud_run_v2::model::Execution;
2972 /// let x = Execution::new().set_log_uri("example");
2973 /// ```
2974 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2975 self.log_uri = v.into();
2976 self
2977 }
2978
2979 /// Sets the value of [satisfies_pzs][crate::model::Execution::satisfies_pzs].
2980 ///
2981 /// # Example
2982 /// ```ignore,no_run
2983 /// # use google_cloud_run_v2::model::Execution;
2984 /// let x = Execution::new().set_satisfies_pzs(true);
2985 /// ```
2986 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2987 self.satisfies_pzs = v.into();
2988 self
2989 }
2990
2991 /// Sets the value of [etag][crate::model::Execution::etag].
2992 ///
2993 /// # Example
2994 /// ```ignore,no_run
2995 /// # use google_cloud_run_v2::model::Execution;
2996 /// let x = Execution::new().set_etag("example");
2997 /// ```
2998 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2999 self.etag = v.into();
3000 self
3001 }
3002}
3003
3004impl wkt::message::Message for Execution {
3005 fn typename() -> &'static str {
3006 "type.googleapis.com/google.cloud.run.v2.Execution"
3007 }
3008}
3009
3010/// ExecutionTemplate describes the data an execution should have when created
3011/// from a template.
3012#[derive(Clone, Default, PartialEq)]
3013#[non_exhaustive]
3014pub struct ExecutionTemplate {
3015 /// Unstructured key value map that can be used to organize and categorize
3016 /// objects.
3017 /// User-provided labels are shared with Google's billing system, so they can
3018 /// be used to filter, or break down billing charges by team, component,
3019 /// environment, state, etc. For more information, visit
3020 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
3021 /// <https://cloud.google.com/run/docs/configuring/labels>.
3022 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3023
3024 /// Unstructured key value map that may be set by external tools to store and
3025 /// arbitrary metadata. They are not queryable and should be preserved
3026 /// when modifying objects.
3027 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3028
3029 /// Optional. Specifies the maximum desired number of tasks the execution
3030 /// should run at given time. When the job is run, if this field is 0 or unset,
3031 /// the maximum possible value will be used for that execution. The actual
3032 /// number of tasks running in steady state will be less than this number when
3033 /// there are fewer tasks waiting to be completed remaining, i.e. when the work
3034 /// left to do is less than max parallelism.
3035 pub parallelism: i32,
3036
3037 /// Specifies the desired number of tasks the execution should run.
3038 /// Setting to 1 means that parallelism is limited to 1 and the success of
3039 /// that task signals the success of the execution. Defaults to 1.
3040 pub task_count: i32,
3041
3042 /// Required. Describes the task(s) that will be created when executing an
3043 /// execution.
3044 pub template: std::option::Option<crate::model::TaskTemplate>,
3045
3046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3047}
3048
3049impl ExecutionTemplate {
3050 /// Creates a new default instance.
3051 pub fn new() -> Self {
3052 std::default::Default::default()
3053 }
3054
3055 /// Sets the value of [labels][crate::model::ExecutionTemplate::labels].
3056 ///
3057 /// # Example
3058 /// ```ignore,no_run
3059 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3060 /// let x = ExecutionTemplate::new().set_labels([
3061 /// ("key0", "abc"),
3062 /// ("key1", "xyz"),
3063 /// ]);
3064 /// ```
3065 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3066 where
3067 T: std::iter::IntoIterator<Item = (K, V)>,
3068 K: std::convert::Into<std::string::String>,
3069 V: std::convert::Into<std::string::String>,
3070 {
3071 use std::iter::Iterator;
3072 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3073 self
3074 }
3075
3076 /// Sets the value of [annotations][crate::model::ExecutionTemplate::annotations].
3077 ///
3078 /// # Example
3079 /// ```ignore,no_run
3080 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3081 /// let x = ExecutionTemplate::new().set_annotations([
3082 /// ("key0", "abc"),
3083 /// ("key1", "xyz"),
3084 /// ]);
3085 /// ```
3086 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3087 where
3088 T: std::iter::IntoIterator<Item = (K, V)>,
3089 K: std::convert::Into<std::string::String>,
3090 V: std::convert::Into<std::string::String>,
3091 {
3092 use std::iter::Iterator;
3093 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3094 self
3095 }
3096
3097 /// Sets the value of [parallelism][crate::model::ExecutionTemplate::parallelism].
3098 ///
3099 /// # Example
3100 /// ```ignore,no_run
3101 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3102 /// let x = ExecutionTemplate::new().set_parallelism(42);
3103 /// ```
3104 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3105 self.parallelism = v.into();
3106 self
3107 }
3108
3109 /// Sets the value of [task_count][crate::model::ExecutionTemplate::task_count].
3110 ///
3111 /// # Example
3112 /// ```ignore,no_run
3113 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3114 /// let x = ExecutionTemplate::new().set_task_count(42);
3115 /// ```
3116 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3117 self.task_count = v.into();
3118 self
3119 }
3120
3121 /// Sets the value of [template][crate::model::ExecutionTemplate::template].
3122 ///
3123 /// # Example
3124 /// ```ignore,no_run
3125 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3126 /// use google_cloud_run_v2::model::TaskTemplate;
3127 /// let x = ExecutionTemplate::new().set_template(TaskTemplate::default()/* use setters */);
3128 /// ```
3129 pub fn set_template<T>(mut self, v: T) -> Self
3130 where
3131 T: std::convert::Into<crate::model::TaskTemplate>,
3132 {
3133 self.template = std::option::Option::Some(v.into());
3134 self
3135 }
3136
3137 /// Sets or clears the value of [template][crate::model::ExecutionTemplate::template].
3138 ///
3139 /// # Example
3140 /// ```ignore,no_run
3141 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3142 /// use google_cloud_run_v2::model::TaskTemplate;
3143 /// let x = ExecutionTemplate::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
3144 /// let x = ExecutionTemplate::new().set_or_clear_template(None::<TaskTemplate>);
3145 /// ```
3146 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
3147 where
3148 T: std::convert::Into<crate::model::TaskTemplate>,
3149 {
3150 self.template = v.map(|x| x.into());
3151 self
3152 }
3153}
3154
3155impl wkt::message::Message for ExecutionTemplate {
3156 fn typename() -> &'static str {
3157 "type.googleapis.com/google.cloud.run.v2.ExecutionTemplate"
3158 }
3159}
3160
3161#[allow(missing_docs)]
3162#[derive(Clone, Default, PartialEq)]
3163#[non_exhaustive]
3164pub struct CreateInstanceRequest {
3165 #[allow(missing_docs)]
3166 pub parent: std::string::String,
3167
3168 #[allow(missing_docs)]
3169 pub instance: std::option::Option<crate::model::Instance>,
3170
3171 /// Required. The unique identifier for the Instance. It must begin with
3172 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
3173 /// The name of the instance becomes {parent}/instances/{instance_id}.
3174 pub instance_id: std::string::String,
3175
3176 /// Optional. Indicates that the request should be validated and default values
3177 /// populated, without persisting the request or creating any resources.
3178 pub validate_only: bool,
3179
3180 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3181}
3182
3183impl CreateInstanceRequest {
3184 /// Creates a new default instance.
3185 pub fn new() -> Self {
3186 std::default::Default::default()
3187 }
3188
3189 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3190 ///
3191 /// # Example
3192 /// ```ignore,no_run
3193 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3194 /// let x = CreateInstanceRequest::new().set_parent("example");
3195 /// ```
3196 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3197 self.parent = v.into();
3198 self
3199 }
3200
3201 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3202 ///
3203 /// # Example
3204 /// ```ignore,no_run
3205 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3206 /// use google_cloud_run_v2::model::Instance;
3207 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
3208 /// ```
3209 pub fn set_instance<T>(mut self, v: T) -> Self
3210 where
3211 T: std::convert::Into<crate::model::Instance>,
3212 {
3213 self.instance = std::option::Option::Some(v.into());
3214 self
3215 }
3216
3217 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3218 ///
3219 /// # Example
3220 /// ```ignore,no_run
3221 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3222 /// use google_cloud_run_v2::model::Instance;
3223 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
3224 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
3225 /// ```
3226 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3227 where
3228 T: std::convert::Into<crate::model::Instance>,
3229 {
3230 self.instance = v.map(|x| x.into());
3231 self
3232 }
3233
3234 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3235 ///
3236 /// # Example
3237 /// ```ignore,no_run
3238 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3239 /// let x = CreateInstanceRequest::new().set_instance_id("example");
3240 /// ```
3241 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3242 self.instance_id = v.into();
3243 self
3244 }
3245
3246 /// Sets the value of [validate_only][crate::model::CreateInstanceRequest::validate_only].
3247 ///
3248 /// # Example
3249 /// ```ignore,no_run
3250 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3251 /// let x = CreateInstanceRequest::new().set_validate_only(true);
3252 /// ```
3253 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3254 self.validate_only = v.into();
3255 self
3256 }
3257}
3258
3259impl wkt::message::Message for CreateInstanceRequest {
3260 fn typename() -> &'static str {
3261 "type.googleapis.com/google.cloud.run.v2.CreateInstanceRequest"
3262 }
3263}
3264
3265#[allow(missing_docs)]
3266#[derive(Clone, Default, PartialEq)]
3267#[non_exhaustive]
3268pub struct GetInstanceRequest {
3269 #[allow(missing_docs)]
3270 pub name: std::string::String,
3271
3272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3273}
3274
3275impl GetInstanceRequest {
3276 /// Creates a new default instance.
3277 pub fn new() -> Self {
3278 std::default::Default::default()
3279 }
3280
3281 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3282 ///
3283 /// # Example
3284 /// ```ignore,no_run
3285 /// # use google_cloud_run_v2::model::GetInstanceRequest;
3286 /// let x = GetInstanceRequest::new().set_name("example");
3287 /// ```
3288 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3289 self.name = v.into();
3290 self
3291 }
3292}
3293
3294impl wkt::message::Message for GetInstanceRequest {
3295 fn typename() -> &'static str {
3296 "type.googleapis.com/google.cloud.run.v2.GetInstanceRequest"
3297 }
3298}
3299
3300#[allow(missing_docs)]
3301#[derive(Clone, Default, PartialEq)]
3302#[non_exhaustive]
3303pub struct DeleteInstanceRequest {
3304 #[allow(missing_docs)]
3305 pub name: std::string::String,
3306
3307 /// Optional. Indicates that the request should be validated without actually
3308 /// deleting any resources.
3309 pub validate_only: bool,
3310
3311 /// Optional. A system-generated fingerprint for this version of the
3312 /// resource. May be used to detect modification conflict during updates.
3313 pub etag: std::string::String,
3314
3315 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3316}
3317
3318impl DeleteInstanceRequest {
3319 /// Creates a new default instance.
3320 pub fn new() -> Self {
3321 std::default::Default::default()
3322 }
3323
3324 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3325 ///
3326 /// # Example
3327 /// ```ignore,no_run
3328 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3329 /// let x = DeleteInstanceRequest::new().set_name("example");
3330 /// ```
3331 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3332 self.name = v.into();
3333 self
3334 }
3335
3336 /// Sets the value of [validate_only][crate::model::DeleteInstanceRequest::validate_only].
3337 ///
3338 /// # Example
3339 /// ```ignore,no_run
3340 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3341 /// let x = DeleteInstanceRequest::new().set_validate_only(true);
3342 /// ```
3343 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3344 self.validate_only = v.into();
3345 self
3346 }
3347
3348 /// Sets the value of [etag][crate::model::DeleteInstanceRequest::etag].
3349 ///
3350 /// # Example
3351 /// ```ignore,no_run
3352 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3353 /// let x = DeleteInstanceRequest::new().set_etag("example");
3354 /// ```
3355 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3356 self.etag = v.into();
3357 self
3358 }
3359}
3360
3361impl wkt::message::Message for DeleteInstanceRequest {
3362 fn typename() -> &'static str {
3363 "type.googleapis.com/google.cloud.run.v2.DeleteInstanceRequest"
3364 }
3365}
3366
3367/// Request message for retrieving a list of Instances.
3368#[derive(Clone, Default, PartialEq)]
3369#[non_exhaustive]
3370pub struct ListInstancesRequest {
3371 /// Required. The location and project to list resources on.
3372 /// Format: projects/{project}/locations/{location}, where {project} can be
3373 /// project id or number.
3374 pub parent: std::string::String,
3375
3376 /// Optional. Maximum number of Instances to return in this call.
3377 pub page_size: i32,
3378
3379 /// Optional. A page token received from a previous call to ListInstances.
3380 /// All other parameters must match.
3381 pub page_token: std::string::String,
3382
3383 /// Optional. If true, returns deleted (but unexpired) resources along with
3384 /// active ones.
3385 pub show_deleted: bool,
3386
3387 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3388}
3389
3390impl ListInstancesRequest {
3391 /// Creates a new default instance.
3392 pub fn new() -> Self {
3393 std::default::Default::default()
3394 }
3395
3396 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
3397 ///
3398 /// # Example
3399 /// ```ignore,no_run
3400 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3401 /// let x = ListInstancesRequest::new().set_parent("example");
3402 /// ```
3403 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3404 self.parent = v.into();
3405 self
3406 }
3407
3408 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
3409 ///
3410 /// # Example
3411 /// ```ignore,no_run
3412 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3413 /// let x = ListInstancesRequest::new().set_page_size(42);
3414 /// ```
3415 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3416 self.page_size = v.into();
3417 self
3418 }
3419
3420 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
3421 ///
3422 /// # Example
3423 /// ```ignore,no_run
3424 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3425 /// let x = ListInstancesRequest::new().set_page_token("example");
3426 /// ```
3427 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3428 self.page_token = v.into();
3429 self
3430 }
3431
3432 /// Sets the value of [show_deleted][crate::model::ListInstancesRequest::show_deleted].
3433 ///
3434 /// # Example
3435 /// ```ignore,no_run
3436 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3437 /// let x = ListInstancesRequest::new().set_show_deleted(true);
3438 /// ```
3439 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3440 self.show_deleted = v.into();
3441 self
3442 }
3443}
3444
3445impl wkt::message::Message for ListInstancesRequest {
3446 fn typename() -> &'static str {
3447 "type.googleapis.com/google.cloud.run.v2.ListInstancesRequest"
3448 }
3449}
3450
3451/// Response message containing a list of Instances.
3452#[derive(Clone, Default, PartialEq)]
3453#[non_exhaustive]
3454pub struct ListInstancesResponse {
3455 /// The resulting list of Instances.
3456 pub instances: std::vec::Vec<crate::model::Instance>,
3457
3458 /// A token indicating there are more items than page_size. Use it in the next
3459 /// ListInstances request to continue.
3460 pub next_page_token: std::string::String,
3461
3462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3463}
3464
3465impl ListInstancesResponse {
3466 /// Creates a new default instance.
3467 pub fn new() -> Self {
3468 std::default::Default::default()
3469 }
3470
3471 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
3472 ///
3473 /// # Example
3474 /// ```ignore,no_run
3475 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3476 /// use google_cloud_run_v2::model::Instance;
3477 /// let x = ListInstancesResponse::new()
3478 /// .set_instances([
3479 /// Instance::default()/* use setters */,
3480 /// Instance::default()/* use (different) setters */,
3481 /// ]);
3482 /// ```
3483 pub fn set_instances<T, V>(mut self, v: T) -> Self
3484 where
3485 T: std::iter::IntoIterator<Item = V>,
3486 V: std::convert::Into<crate::model::Instance>,
3487 {
3488 use std::iter::Iterator;
3489 self.instances = v.into_iter().map(|i| i.into()).collect();
3490 self
3491 }
3492
3493 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
3494 ///
3495 /// # Example
3496 /// ```ignore,no_run
3497 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3498 /// let x = ListInstancesResponse::new().set_next_page_token("example");
3499 /// ```
3500 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3501 self.next_page_token = v.into();
3502 self
3503 }
3504}
3505
3506impl wkt::message::Message for ListInstancesResponse {
3507 fn typename() -> &'static str {
3508 "type.googleapis.com/google.cloud.run.v2.ListInstancesResponse"
3509 }
3510}
3511
3512#[doc(hidden)]
3513impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
3514 type PageItem = crate::model::Instance;
3515
3516 fn items(self) -> std::vec::Vec<Self::PageItem> {
3517 self.instances
3518 }
3519
3520 fn next_page_token(&self) -> std::string::String {
3521 use std::clone::Clone;
3522 self.next_page_token.clone()
3523 }
3524}
3525
3526/// Request message for deleting an Instance.
3527#[derive(Clone, Default, PartialEq)]
3528#[non_exhaustive]
3529pub struct StopInstanceRequest {
3530 /// Required. The name of the Instance to stop.
3531 /// Format:
3532 /// `projects/{project}/locations/{location}/instances/{instance}`,
3533 /// where `{project}` can be project id or number.
3534 pub name: std::string::String,
3535
3536 /// Optional. Indicates that the request should be validated without actually
3537 /// stopping any resources.
3538 pub validate_only: bool,
3539
3540 /// Optional. A system-generated fingerprint for this version of the resource.
3541 /// This may be used to detect modification conflict during updates.
3542 pub etag: std::string::String,
3543
3544 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3545}
3546
3547impl StopInstanceRequest {
3548 /// Creates a new default instance.
3549 pub fn new() -> Self {
3550 std::default::Default::default()
3551 }
3552
3553 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
3554 ///
3555 /// # Example
3556 /// ```ignore,no_run
3557 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3558 /// let x = StopInstanceRequest::new().set_name("example");
3559 /// ```
3560 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3561 self.name = v.into();
3562 self
3563 }
3564
3565 /// Sets the value of [validate_only][crate::model::StopInstanceRequest::validate_only].
3566 ///
3567 /// # Example
3568 /// ```ignore,no_run
3569 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3570 /// let x = StopInstanceRequest::new().set_validate_only(true);
3571 /// ```
3572 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3573 self.validate_only = v.into();
3574 self
3575 }
3576
3577 /// Sets the value of [etag][crate::model::StopInstanceRequest::etag].
3578 ///
3579 /// # Example
3580 /// ```ignore,no_run
3581 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3582 /// let x = StopInstanceRequest::new().set_etag("example");
3583 /// ```
3584 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3585 self.etag = v.into();
3586 self
3587 }
3588}
3589
3590impl wkt::message::Message for StopInstanceRequest {
3591 fn typename() -> &'static str {
3592 "type.googleapis.com/google.cloud.run.v2.StopInstanceRequest"
3593 }
3594}
3595
3596/// Request message for starting an Instance.
3597#[derive(Clone, Default, PartialEq)]
3598#[non_exhaustive]
3599pub struct StartInstanceRequest {
3600 /// Required. The name of the Instance to stop.
3601 /// Format:
3602 /// `projects/{project}/locations/{location}/instances/{instance}`,
3603 /// where `{project}` can be project id or number.
3604 pub name: std::string::String,
3605
3606 /// Optional. Indicates that the request should be validated without actually
3607 /// stopping any resources.
3608 pub validate_only: bool,
3609
3610 /// Optional. A system-generated fingerprint for this version of the resource.
3611 /// This may be used to detect modification conflict during updates.
3612 pub etag: std::string::String,
3613
3614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3615}
3616
3617impl StartInstanceRequest {
3618 /// Creates a new default instance.
3619 pub fn new() -> Self {
3620 std::default::Default::default()
3621 }
3622
3623 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
3624 ///
3625 /// # Example
3626 /// ```ignore,no_run
3627 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3628 /// let x = StartInstanceRequest::new().set_name("example");
3629 /// ```
3630 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3631 self.name = v.into();
3632 self
3633 }
3634
3635 /// Sets the value of [validate_only][crate::model::StartInstanceRequest::validate_only].
3636 ///
3637 /// # Example
3638 /// ```ignore,no_run
3639 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3640 /// let x = StartInstanceRequest::new().set_validate_only(true);
3641 /// ```
3642 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3643 self.validate_only = v.into();
3644 self
3645 }
3646
3647 /// Sets the value of [etag][crate::model::StartInstanceRequest::etag].
3648 ///
3649 /// # Example
3650 /// ```ignore,no_run
3651 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3652 /// let x = StartInstanceRequest::new().set_etag("example");
3653 /// ```
3654 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3655 self.etag = v.into();
3656 self
3657 }
3658}
3659
3660impl wkt::message::Message for StartInstanceRequest {
3661 fn typename() -> &'static str {
3662 "type.googleapis.com/google.cloud.run.v2.StartInstanceRequest"
3663 }
3664}
3665
3666/// A Cloud Run Instance represents a single group of containers running in a
3667/// region.
3668#[derive(Clone, Default, PartialEq)]
3669#[non_exhaustive]
3670pub struct Instance {
3671 /// The fully qualified name of this Instance. In CreateInstanceRequest, this
3672 /// field is ignored, and instead composed from CreateInstanceRequest.parent
3673 /// and CreateInstanceRequest.instance_id.
3674 ///
3675 /// Format:
3676 /// projects/{project}/locations/{location}/instances/{instance_id}
3677 pub name: std::string::String,
3678
3679 /// User-provided description of the Instance. This field currently has a
3680 /// 512-character limit.
3681 pub description: std::string::String,
3682
3683 /// Output only. Server assigned unique identifier for the trigger. The value
3684 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
3685 /// deleted.
3686 pub uid: std::string::String,
3687
3688 /// Output only. A number that monotonically increases every time the user
3689 /// modifies the desired state.
3690 /// Please note that unlike v1, this is an int64 value. As with most Google
3691 /// APIs, its JSON representation will be a `string` instead of an `integer`.
3692 pub generation: i64,
3693
3694 #[allow(missing_docs)]
3695 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3696
3697 #[allow(missing_docs)]
3698 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3699
3700 /// Output only. The creation time.
3701 pub create_time: std::option::Option<wkt::Timestamp>,
3702
3703 /// Output only. The last-modified time.
3704 pub update_time: std::option::Option<wkt::Timestamp>,
3705
3706 /// Output only. The deletion time.
3707 pub delete_time: std::option::Option<wkt::Timestamp>,
3708
3709 /// Output only. For a deleted resource, the time after which it will be
3710 /// permamently deleted.
3711 pub expire_time: std::option::Option<wkt::Timestamp>,
3712
3713 /// Output only. Email address of the authenticated creator.
3714 pub creator: std::string::String,
3715
3716 /// Output only. Email address of the last authenticated modifier.
3717 pub last_modifier: std::string::String,
3718
3719 /// Arbitrary identifier for the API client.
3720 pub client: std::string::String,
3721
3722 /// Arbitrary version identifier for the API client.
3723 pub client_version: std::string::String,
3724
3725 /// The launch stage as defined by [Google Cloud Platform
3726 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
3727 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
3728 /// is assumed.
3729 /// Set the launch stage to a preview stage on input to allow use of preview
3730 /// features in that stage. On read (or output), describes whether the
3731 /// resource uses preview features.
3732 pub launch_stage: google_cloud_api::model::LaunchStage,
3733
3734 /// Settings for the Binary Authorization feature.
3735 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
3736
3737 /// Optional. VPC Access configuration to use for this Revision. For more
3738 /// information, visit
3739 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
3740 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
3741
3742 #[allow(missing_docs)]
3743 pub service_account: std::string::String,
3744
3745 /// Required. Holds the single container that defines the unit of execution for
3746 /// this Instance.
3747 pub containers: std::vec::Vec<crate::model::Container>,
3748
3749 /// A list of Volumes to make available to containers.
3750 pub volumes: std::vec::Vec<crate::model::Volume>,
3751
3752 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
3753 /// this container image. For more information, go to
3754 /// <https://cloud.google.com/run/docs/securing/using-cmek>
3755 pub encryption_key: std::string::String,
3756
3757 /// The action to take if the encryption key is revoked.
3758 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
3759
3760 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
3761 /// shutting down all instances. The minimum increment is 1 hour.
3762 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
3763
3764 /// Optional. The node selector for the instance.
3765 pub node_selector: std::option::Option<crate::model::NodeSelector>,
3766
3767 /// Optional. True if GPU zonal redundancy is disabled on this instance.
3768 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
3769
3770 /// Optional. Provides the ingress settings for this Instance. On output,
3771 /// returns the currently observed ingress settings, or
3772 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
3773 pub ingress: crate::model::IngressTraffic,
3774
3775 /// Optional. Disables IAM permission check for run.routes.invoke for callers
3776 /// of this Instance. For more information, visit
3777 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
3778 pub invoker_iam_disabled: bool,
3779
3780 /// Optional. IAP settings on the Instance.
3781 pub iap_enabled: bool,
3782
3783 /// Output only. The generation of this Instance currently serving traffic. See
3784 /// comments in `reconciling` for additional information on reconciliation
3785 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
3786 /// As with most Google APIs, its JSON representation will be a `string`
3787 /// instead of an `integer`.
3788 pub observed_generation: i64,
3789
3790 /// Output only. The Google Console URI to obtain logs for the Instance.
3791 pub log_uri: std::string::String,
3792
3793 /// Output only. The Condition of this Instance, containing its readiness
3794 /// status, and detailed error information in case it did not reach a serving
3795 /// state. See comments in `reconciling` for additional information on
3796 /// reconciliation process in Cloud Run.
3797 pub terminal_condition: std::option::Option<crate::model::Condition>,
3798
3799 /// Output only. The Conditions of all other associated sub-resources. They
3800 /// contain additional diagnostics information in case the Instance does not
3801 /// reach its Serving state. See comments in `reconciling` for additional
3802 /// information on reconciliation process in Cloud Run.
3803 pub conditions: std::vec::Vec<crate::model::Condition>,
3804
3805 /// Output only. Status information for each of the specified containers. The
3806 /// status includes the resolved digest for specified images.
3807 pub container_statuses: std::vec::Vec<crate::model::ContainerStatus>,
3808
3809 /// Output only. Reserved for future use.
3810 pub satisfies_pzs: bool,
3811
3812 /// Output only. All URLs serving traffic for this Instance.
3813 pub urls: std::vec::Vec<std::string::String>,
3814
3815 /// Output only. Returns true if the Instance is currently being acted upon by
3816 /// the system to bring it into the desired state.
3817 ///
3818 /// When a new Instance is created, or an existing one is updated, Cloud Run
3819 /// will asynchronously perform all necessary steps to bring the Instance to
3820 /// the desired serving state. This process is called reconciliation. While
3821 /// reconciliation is in process, `observed_generation` will have a transient
3822 /// value that might mismatch the intended state.
3823 /// Once reconciliation is over (and this field is false), there are two
3824 /// possible outcomes: reconciliation succeeded and the serving state matches
3825 /// the Instance, or there was an error, and reconciliation failed. This state
3826 /// can be found in `terminal_condition.state`.
3827 pub reconciling: bool,
3828
3829 /// Optional. A system-generated fingerprint for this version of the
3830 /// resource. May be used to detect modification conflict during updates.
3831 pub etag: std::string::String,
3832
3833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3834}
3835
3836impl Instance {
3837 /// Creates a new default instance.
3838 pub fn new() -> Self {
3839 std::default::Default::default()
3840 }
3841
3842 /// Sets the value of [name][crate::model::Instance::name].
3843 ///
3844 /// # Example
3845 /// ```ignore,no_run
3846 /// # use google_cloud_run_v2::model::Instance;
3847 /// let x = Instance::new().set_name("example");
3848 /// ```
3849 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3850 self.name = v.into();
3851 self
3852 }
3853
3854 /// Sets the value of [description][crate::model::Instance::description].
3855 ///
3856 /// # Example
3857 /// ```ignore,no_run
3858 /// # use google_cloud_run_v2::model::Instance;
3859 /// let x = Instance::new().set_description("example");
3860 /// ```
3861 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3862 self.description = v.into();
3863 self
3864 }
3865
3866 /// Sets the value of [uid][crate::model::Instance::uid].
3867 ///
3868 /// # Example
3869 /// ```ignore,no_run
3870 /// # use google_cloud_run_v2::model::Instance;
3871 /// let x = Instance::new().set_uid("example");
3872 /// ```
3873 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3874 self.uid = v.into();
3875 self
3876 }
3877
3878 /// Sets the value of [generation][crate::model::Instance::generation].
3879 ///
3880 /// # Example
3881 /// ```ignore,no_run
3882 /// # use google_cloud_run_v2::model::Instance;
3883 /// let x = Instance::new().set_generation(42);
3884 /// ```
3885 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3886 self.generation = v.into();
3887 self
3888 }
3889
3890 /// Sets the value of [labels][crate::model::Instance::labels].
3891 ///
3892 /// # Example
3893 /// ```ignore,no_run
3894 /// # use google_cloud_run_v2::model::Instance;
3895 /// let x = Instance::new().set_labels([
3896 /// ("key0", "abc"),
3897 /// ("key1", "xyz"),
3898 /// ]);
3899 /// ```
3900 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3901 where
3902 T: std::iter::IntoIterator<Item = (K, V)>,
3903 K: std::convert::Into<std::string::String>,
3904 V: std::convert::Into<std::string::String>,
3905 {
3906 use std::iter::Iterator;
3907 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3908 self
3909 }
3910
3911 /// Sets the value of [annotations][crate::model::Instance::annotations].
3912 ///
3913 /// # Example
3914 /// ```ignore,no_run
3915 /// # use google_cloud_run_v2::model::Instance;
3916 /// let x = Instance::new().set_annotations([
3917 /// ("key0", "abc"),
3918 /// ("key1", "xyz"),
3919 /// ]);
3920 /// ```
3921 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3922 where
3923 T: std::iter::IntoIterator<Item = (K, V)>,
3924 K: std::convert::Into<std::string::String>,
3925 V: std::convert::Into<std::string::String>,
3926 {
3927 use std::iter::Iterator;
3928 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3929 self
3930 }
3931
3932 /// Sets the value of [create_time][crate::model::Instance::create_time].
3933 ///
3934 /// # Example
3935 /// ```ignore,no_run
3936 /// # use google_cloud_run_v2::model::Instance;
3937 /// use wkt::Timestamp;
3938 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
3939 /// ```
3940 pub fn set_create_time<T>(mut self, v: T) -> Self
3941 where
3942 T: std::convert::Into<wkt::Timestamp>,
3943 {
3944 self.create_time = std::option::Option::Some(v.into());
3945 self
3946 }
3947
3948 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
3949 ///
3950 /// # Example
3951 /// ```ignore,no_run
3952 /// # use google_cloud_run_v2::model::Instance;
3953 /// use wkt::Timestamp;
3954 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3955 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
3956 /// ```
3957 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3958 where
3959 T: std::convert::Into<wkt::Timestamp>,
3960 {
3961 self.create_time = v.map(|x| x.into());
3962 self
3963 }
3964
3965 /// Sets the value of [update_time][crate::model::Instance::update_time].
3966 ///
3967 /// # Example
3968 /// ```ignore,no_run
3969 /// # use google_cloud_run_v2::model::Instance;
3970 /// use wkt::Timestamp;
3971 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
3972 /// ```
3973 pub fn set_update_time<T>(mut self, v: T) -> Self
3974 where
3975 T: std::convert::Into<wkt::Timestamp>,
3976 {
3977 self.update_time = std::option::Option::Some(v.into());
3978 self
3979 }
3980
3981 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
3982 ///
3983 /// # Example
3984 /// ```ignore,no_run
3985 /// # use google_cloud_run_v2::model::Instance;
3986 /// use wkt::Timestamp;
3987 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3988 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
3989 /// ```
3990 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3991 where
3992 T: std::convert::Into<wkt::Timestamp>,
3993 {
3994 self.update_time = v.map(|x| x.into());
3995 self
3996 }
3997
3998 /// Sets the value of [delete_time][crate::model::Instance::delete_time].
3999 ///
4000 /// # Example
4001 /// ```ignore,no_run
4002 /// # use google_cloud_run_v2::model::Instance;
4003 /// use wkt::Timestamp;
4004 /// let x = Instance::new().set_delete_time(Timestamp::default()/* use setters */);
4005 /// ```
4006 pub fn set_delete_time<T>(mut self, v: T) -> Self
4007 where
4008 T: std::convert::Into<wkt::Timestamp>,
4009 {
4010 self.delete_time = std::option::Option::Some(v.into());
4011 self
4012 }
4013
4014 /// Sets or clears the value of [delete_time][crate::model::Instance::delete_time].
4015 ///
4016 /// # Example
4017 /// ```ignore,no_run
4018 /// # use google_cloud_run_v2::model::Instance;
4019 /// use wkt::Timestamp;
4020 /// let x = Instance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
4021 /// let x = Instance::new().set_or_clear_delete_time(None::<Timestamp>);
4022 /// ```
4023 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
4024 where
4025 T: std::convert::Into<wkt::Timestamp>,
4026 {
4027 self.delete_time = v.map(|x| x.into());
4028 self
4029 }
4030
4031 /// Sets the value of [expire_time][crate::model::Instance::expire_time].
4032 ///
4033 /// # Example
4034 /// ```ignore,no_run
4035 /// # use google_cloud_run_v2::model::Instance;
4036 /// use wkt::Timestamp;
4037 /// let x = Instance::new().set_expire_time(Timestamp::default()/* use setters */);
4038 /// ```
4039 pub fn set_expire_time<T>(mut self, v: T) -> Self
4040 where
4041 T: std::convert::Into<wkt::Timestamp>,
4042 {
4043 self.expire_time = std::option::Option::Some(v.into());
4044 self
4045 }
4046
4047 /// Sets or clears the value of [expire_time][crate::model::Instance::expire_time].
4048 ///
4049 /// # Example
4050 /// ```ignore,no_run
4051 /// # use google_cloud_run_v2::model::Instance;
4052 /// use wkt::Timestamp;
4053 /// let x = Instance::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4054 /// let x = Instance::new().set_or_clear_expire_time(None::<Timestamp>);
4055 /// ```
4056 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4057 where
4058 T: std::convert::Into<wkt::Timestamp>,
4059 {
4060 self.expire_time = v.map(|x| x.into());
4061 self
4062 }
4063
4064 /// Sets the value of [creator][crate::model::Instance::creator].
4065 ///
4066 /// # Example
4067 /// ```ignore,no_run
4068 /// # use google_cloud_run_v2::model::Instance;
4069 /// let x = Instance::new().set_creator("example");
4070 /// ```
4071 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4072 self.creator = v.into();
4073 self
4074 }
4075
4076 /// Sets the value of [last_modifier][crate::model::Instance::last_modifier].
4077 ///
4078 /// # Example
4079 /// ```ignore,no_run
4080 /// # use google_cloud_run_v2::model::Instance;
4081 /// let x = Instance::new().set_last_modifier("example");
4082 /// ```
4083 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4084 self.last_modifier = v.into();
4085 self
4086 }
4087
4088 /// Sets the value of [client][crate::model::Instance::client].
4089 ///
4090 /// # Example
4091 /// ```ignore,no_run
4092 /// # use google_cloud_run_v2::model::Instance;
4093 /// let x = Instance::new().set_client("example");
4094 /// ```
4095 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4096 self.client = v.into();
4097 self
4098 }
4099
4100 /// Sets the value of [client_version][crate::model::Instance::client_version].
4101 ///
4102 /// # Example
4103 /// ```ignore,no_run
4104 /// # use google_cloud_run_v2::model::Instance;
4105 /// let x = Instance::new().set_client_version("example");
4106 /// ```
4107 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4108 self.client_version = v.into();
4109 self
4110 }
4111
4112 /// Sets the value of [launch_stage][crate::model::Instance::launch_stage].
4113 ///
4114 /// # Example
4115 /// ```ignore,no_run
4116 /// # use google_cloud_run_v2::model::Instance;
4117 /// use google_cloud_api::model::LaunchStage;
4118 /// let x0 = Instance::new().set_launch_stage(LaunchStage::Unimplemented);
4119 /// let x1 = Instance::new().set_launch_stage(LaunchStage::Prelaunch);
4120 /// let x2 = Instance::new().set_launch_stage(LaunchStage::EarlyAccess);
4121 /// ```
4122 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
4123 mut self,
4124 v: T,
4125 ) -> Self {
4126 self.launch_stage = v.into();
4127 self
4128 }
4129
4130 /// Sets the value of [binary_authorization][crate::model::Instance::binary_authorization].
4131 ///
4132 /// # Example
4133 /// ```ignore,no_run
4134 /// # use google_cloud_run_v2::model::Instance;
4135 /// use google_cloud_run_v2::model::BinaryAuthorization;
4136 /// let x = Instance::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
4137 /// ```
4138 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
4139 where
4140 T: std::convert::Into<crate::model::BinaryAuthorization>,
4141 {
4142 self.binary_authorization = std::option::Option::Some(v.into());
4143 self
4144 }
4145
4146 /// Sets or clears the value of [binary_authorization][crate::model::Instance::binary_authorization].
4147 ///
4148 /// # Example
4149 /// ```ignore,no_run
4150 /// # use google_cloud_run_v2::model::Instance;
4151 /// use google_cloud_run_v2::model::BinaryAuthorization;
4152 /// let x = Instance::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
4153 /// let x = Instance::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
4154 /// ```
4155 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
4156 where
4157 T: std::convert::Into<crate::model::BinaryAuthorization>,
4158 {
4159 self.binary_authorization = v.map(|x| x.into());
4160 self
4161 }
4162
4163 /// Sets the value of [vpc_access][crate::model::Instance::vpc_access].
4164 ///
4165 /// # Example
4166 /// ```ignore,no_run
4167 /// # use google_cloud_run_v2::model::Instance;
4168 /// use google_cloud_run_v2::model::VpcAccess;
4169 /// let x = Instance::new().set_vpc_access(VpcAccess::default()/* use setters */);
4170 /// ```
4171 pub fn set_vpc_access<T>(mut self, v: T) -> Self
4172 where
4173 T: std::convert::Into<crate::model::VpcAccess>,
4174 {
4175 self.vpc_access = std::option::Option::Some(v.into());
4176 self
4177 }
4178
4179 /// Sets or clears the value of [vpc_access][crate::model::Instance::vpc_access].
4180 ///
4181 /// # Example
4182 /// ```ignore,no_run
4183 /// # use google_cloud_run_v2::model::Instance;
4184 /// use google_cloud_run_v2::model::VpcAccess;
4185 /// let x = Instance::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
4186 /// let x = Instance::new().set_or_clear_vpc_access(None::<VpcAccess>);
4187 /// ```
4188 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
4189 where
4190 T: std::convert::Into<crate::model::VpcAccess>,
4191 {
4192 self.vpc_access = v.map(|x| x.into());
4193 self
4194 }
4195
4196 /// Sets the value of [service_account][crate::model::Instance::service_account].
4197 ///
4198 /// # Example
4199 /// ```ignore,no_run
4200 /// # use google_cloud_run_v2::model::Instance;
4201 /// let x = Instance::new().set_service_account("example");
4202 /// ```
4203 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4204 self.service_account = v.into();
4205 self
4206 }
4207
4208 /// Sets the value of [containers][crate::model::Instance::containers].
4209 ///
4210 /// # Example
4211 /// ```ignore,no_run
4212 /// # use google_cloud_run_v2::model::Instance;
4213 /// use google_cloud_run_v2::model::Container;
4214 /// let x = Instance::new()
4215 /// .set_containers([
4216 /// Container::default()/* use setters */,
4217 /// Container::default()/* use (different) setters */,
4218 /// ]);
4219 /// ```
4220 pub fn set_containers<T, V>(mut self, v: T) -> Self
4221 where
4222 T: std::iter::IntoIterator<Item = V>,
4223 V: std::convert::Into<crate::model::Container>,
4224 {
4225 use std::iter::Iterator;
4226 self.containers = v.into_iter().map(|i| i.into()).collect();
4227 self
4228 }
4229
4230 /// Sets the value of [volumes][crate::model::Instance::volumes].
4231 ///
4232 /// # Example
4233 /// ```ignore,no_run
4234 /// # use google_cloud_run_v2::model::Instance;
4235 /// use google_cloud_run_v2::model::Volume;
4236 /// let x = Instance::new()
4237 /// .set_volumes([
4238 /// Volume::default()/* use setters */,
4239 /// Volume::default()/* use (different) setters */,
4240 /// ]);
4241 /// ```
4242 pub fn set_volumes<T, V>(mut self, v: T) -> Self
4243 where
4244 T: std::iter::IntoIterator<Item = V>,
4245 V: std::convert::Into<crate::model::Volume>,
4246 {
4247 use std::iter::Iterator;
4248 self.volumes = v.into_iter().map(|i| i.into()).collect();
4249 self
4250 }
4251
4252 /// Sets the value of [encryption_key][crate::model::Instance::encryption_key].
4253 ///
4254 /// # Example
4255 /// ```ignore,no_run
4256 /// # use google_cloud_run_v2::model::Instance;
4257 /// let x = Instance::new().set_encryption_key("example");
4258 /// ```
4259 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4260 self.encryption_key = v.into();
4261 self
4262 }
4263
4264 /// Sets the value of [encryption_key_revocation_action][crate::model::Instance::encryption_key_revocation_action].
4265 ///
4266 /// # Example
4267 /// ```ignore,no_run
4268 /// # use google_cloud_run_v2::model::Instance;
4269 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
4270 /// let x0 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
4271 /// let x1 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
4272 /// ```
4273 pub fn set_encryption_key_revocation_action<
4274 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
4275 >(
4276 mut self,
4277 v: T,
4278 ) -> Self {
4279 self.encryption_key_revocation_action = v.into();
4280 self
4281 }
4282
4283 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4284 ///
4285 /// # Example
4286 /// ```ignore,no_run
4287 /// # use google_cloud_run_v2::model::Instance;
4288 /// use wkt::Duration;
4289 /// let x = Instance::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
4290 /// ```
4291 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
4292 where
4293 T: std::convert::Into<wkt::Duration>,
4294 {
4295 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
4296 self
4297 }
4298
4299 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4300 ///
4301 /// # Example
4302 /// ```ignore,no_run
4303 /// # use google_cloud_run_v2::model::Instance;
4304 /// use wkt::Duration;
4305 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
4306 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
4307 /// ```
4308 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
4309 mut self,
4310 v: std::option::Option<T>,
4311 ) -> Self
4312 where
4313 T: std::convert::Into<wkt::Duration>,
4314 {
4315 self.encryption_key_shutdown_duration = v.map(|x| x.into());
4316 self
4317 }
4318
4319 /// Sets the value of [node_selector][crate::model::Instance::node_selector].
4320 ///
4321 /// # Example
4322 /// ```ignore,no_run
4323 /// # use google_cloud_run_v2::model::Instance;
4324 /// use google_cloud_run_v2::model::NodeSelector;
4325 /// let x = Instance::new().set_node_selector(NodeSelector::default()/* use setters */);
4326 /// ```
4327 pub fn set_node_selector<T>(mut self, v: T) -> Self
4328 where
4329 T: std::convert::Into<crate::model::NodeSelector>,
4330 {
4331 self.node_selector = std::option::Option::Some(v.into());
4332 self
4333 }
4334
4335 /// Sets or clears the value of [node_selector][crate::model::Instance::node_selector].
4336 ///
4337 /// # Example
4338 /// ```ignore,no_run
4339 /// # use google_cloud_run_v2::model::Instance;
4340 /// use google_cloud_run_v2::model::NodeSelector;
4341 /// let x = Instance::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
4342 /// let x = Instance::new().set_or_clear_node_selector(None::<NodeSelector>);
4343 /// ```
4344 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
4345 where
4346 T: std::convert::Into<crate::model::NodeSelector>,
4347 {
4348 self.node_selector = v.map(|x| x.into());
4349 self
4350 }
4351
4352 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4353 ///
4354 /// # Example
4355 /// ```ignore,no_run
4356 /// # use google_cloud_run_v2::model::Instance;
4357 /// let x = Instance::new().set_gpu_zonal_redundancy_disabled(true);
4358 /// ```
4359 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
4360 where
4361 T: std::convert::Into<bool>,
4362 {
4363 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
4364 self
4365 }
4366
4367 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4368 ///
4369 /// # Example
4370 /// ```ignore,no_run
4371 /// # use google_cloud_run_v2::model::Instance;
4372 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
4373 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
4374 /// ```
4375 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
4376 mut self,
4377 v: std::option::Option<T>,
4378 ) -> Self
4379 where
4380 T: std::convert::Into<bool>,
4381 {
4382 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
4383 self
4384 }
4385
4386 /// Sets the value of [ingress][crate::model::Instance::ingress].
4387 ///
4388 /// # Example
4389 /// ```ignore,no_run
4390 /// # use google_cloud_run_v2::model::Instance;
4391 /// use google_cloud_run_v2::model::IngressTraffic;
4392 /// let x0 = Instance::new().set_ingress(IngressTraffic::All);
4393 /// let x1 = Instance::new().set_ingress(IngressTraffic::InternalOnly);
4394 /// let x2 = Instance::new().set_ingress(IngressTraffic::InternalLoadBalancer);
4395 /// ```
4396 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
4397 mut self,
4398 v: T,
4399 ) -> Self {
4400 self.ingress = v.into();
4401 self
4402 }
4403
4404 /// Sets the value of [invoker_iam_disabled][crate::model::Instance::invoker_iam_disabled].
4405 ///
4406 /// # Example
4407 /// ```ignore,no_run
4408 /// # use google_cloud_run_v2::model::Instance;
4409 /// let x = Instance::new().set_invoker_iam_disabled(true);
4410 /// ```
4411 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4412 self.invoker_iam_disabled = v.into();
4413 self
4414 }
4415
4416 /// Sets the value of [iap_enabled][crate::model::Instance::iap_enabled].
4417 ///
4418 /// # Example
4419 /// ```ignore,no_run
4420 /// # use google_cloud_run_v2::model::Instance;
4421 /// let x = Instance::new().set_iap_enabled(true);
4422 /// ```
4423 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4424 self.iap_enabled = v.into();
4425 self
4426 }
4427
4428 /// Sets the value of [observed_generation][crate::model::Instance::observed_generation].
4429 ///
4430 /// # Example
4431 /// ```ignore,no_run
4432 /// # use google_cloud_run_v2::model::Instance;
4433 /// let x = Instance::new().set_observed_generation(42);
4434 /// ```
4435 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4436 self.observed_generation = v.into();
4437 self
4438 }
4439
4440 /// Sets the value of [log_uri][crate::model::Instance::log_uri].
4441 ///
4442 /// # Example
4443 /// ```ignore,no_run
4444 /// # use google_cloud_run_v2::model::Instance;
4445 /// let x = Instance::new().set_log_uri("example");
4446 /// ```
4447 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4448 self.log_uri = v.into();
4449 self
4450 }
4451
4452 /// Sets the value of [terminal_condition][crate::model::Instance::terminal_condition].
4453 ///
4454 /// # Example
4455 /// ```ignore,no_run
4456 /// # use google_cloud_run_v2::model::Instance;
4457 /// use google_cloud_run_v2::model::Condition;
4458 /// let x = Instance::new().set_terminal_condition(Condition::default()/* use setters */);
4459 /// ```
4460 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
4461 where
4462 T: std::convert::Into<crate::model::Condition>,
4463 {
4464 self.terminal_condition = std::option::Option::Some(v.into());
4465 self
4466 }
4467
4468 /// Sets or clears the value of [terminal_condition][crate::model::Instance::terminal_condition].
4469 ///
4470 /// # Example
4471 /// ```ignore,no_run
4472 /// # use google_cloud_run_v2::model::Instance;
4473 /// use google_cloud_run_v2::model::Condition;
4474 /// let x = Instance::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
4475 /// let x = Instance::new().set_or_clear_terminal_condition(None::<Condition>);
4476 /// ```
4477 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
4478 where
4479 T: std::convert::Into<crate::model::Condition>,
4480 {
4481 self.terminal_condition = v.map(|x| x.into());
4482 self
4483 }
4484
4485 /// Sets the value of [conditions][crate::model::Instance::conditions].
4486 ///
4487 /// # Example
4488 /// ```ignore,no_run
4489 /// # use google_cloud_run_v2::model::Instance;
4490 /// use google_cloud_run_v2::model::Condition;
4491 /// let x = Instance::new()
4492 /// .set_conditions([
4493 /// Condition::default()/* use setters */,
4494 /// Condition::default()/* use (different) setters */,
4495 /// ]);
4496 /// ```
4497 pub fn set_conditions<T, V>(mut self, v: T) -> Self
4498 where
4499 T: std::iter::IntoIterator<Item = V>,
4500 V: std::convert::Into<crate::model::Condition>,
4501 {
4502 use std::iter::Iterator;
4503 self.conditions = v.into_iter().map(|i| i.into()).collect();
4504 self
4505 }
4506
4507 /// Sets the value of [container_statuses][crate::model::Instance::container_statuses].
4508 ///
4509 /// # Example
4510 /// ```ignore,no_run
4511 /// # use google_cloud_run_v2::model::Instance;
4512 /// use google_cloud_run_v2::model::ContainerStatus;
4513 /// let x = Instance::new()
4514 /// .set_container_statuses([
4515 /// ContainerStatus::default()/* use setters */,
4516 /// ContainerStatus::default()/* use (different) setters */,
4517 /// ]);
4518 /// ```
4519 pub fn set_container_statuses<T, V>(mut self, v: T) -> Self
4520 where
4521 T: std::iter::IntoIterator<Item = V>,
4522 V: std::convert::Into<crate::model::ContainerStatus>,
4523 {
4524 use std::iter::Iterator;
4525 self.container_statuses = v.into_iter().map(|i| i.into()).collect();
4526 self
4527 }
4528
4529 /// Sets the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
4530 ///
4531 /// # Example
4532 /// ```ignore,no_run
4533 /// # use google_cloud_run_v2::model::Instance;
4534 /// let x = Instance::new().set_satisfies_pzs(true);
4535 /// ```
4536 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4537 self.satisfies_pzs = v.into();
4538 self
4539 }
4540
4541 /// Sets the value of [urls][crate::model::Instance::urls].
4542 ///
4543 /// # Example
4544 /// ```ignore,no_run
4545 /// # use google_cloud_run_v2::model::Instance;
4546 /// let x = Instance::new().set_urls(["a", "b", "c"]);
4547 /// ```
4548 pub fn set_urls<T, V>(mut self, v: T) -> Self
4549 where
4550 T: std::iter::IntoIterator<Item = V>,
4551 V: std::convert::Into<std::string::String>,
4552 {
4553 use std::iter::Iterator;
4554 self.urls = v.into_iter().map(|i| i.into()).collect();
4555 self
4556 }
4557
4558 /// Sets the value of [reconciling][crate::model::Instance::reconciling].
4559 ///
4560 /// # Example
4561 /// ```ignore,no_run
4562 /// # use google_cloud_run_v2::model::Instance;
4563 /// let x = Instance::new().set_reconciling(true);
4564 /// ```
4565 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4566 self.reconciling = v.into();
4567 self
4568 }
4569
4570 /// Sets the value of [etag][crate::model::Instance::etag].
4571 ///
4572 /// # Example
4573 /// ```ignore,no_run
4574 /// # use google_cloud_run_v2::model::Instance;
4575 /// let x = Instance::new().set_etag("example");
4576 /// ```
4577 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4578 self.etag = v.into();
4579 self
4580 }
4581}
4582
4583impl wkt::message::Message for Instance {
4584 fn typename() -> &'static str {
4585 "type.googleapis.com/google.cloud.run.v2.Instance"
4586 }
4587}
4588
4589/// Holds a single instance split entry for the Worker. Allocations can be done
4590/// to a specific Revision name, or pointing to the latest Ready Revision.
4591#[derive(Clone, Default, PartialEq)]
4592#[non_exhaustive]
4593pub struct InstanceSplit {
4594 /// The allocation type for this instance split.
4595 pub r#type: crate::model::InstanceSplitAllocationType,
4596
4597 /// Revision to which to assign this portion of instances, if split allocation
4598 /// is by revision.
4599 pub revision: std::string::String,
4600
4601 /// Specifies percent of the instance split to this Revision.
4602 /// This defaults to zero if unspecified.
4603 pub percent: i32,
4604
4605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4606}
4607
4608impl InstanceSplit {
4609 /// Creates a new default instance.
4610 pub fn new() -> Self {
4611 std::default::Default::default()
4612 }
4613
4614 /// Sets the value of [r#type][crate::model::InstanceSplit::type].
4615 ///
4616 /// # Example
4617 /// ```ignore,no_run
4618 /// # use google_cloud_run_v2::model::InstanceSplit;
4619 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4620 /// let x0 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Latest);
4621 /// let x1 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Revision);
4622 /// ```
4623 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4624 mut self,
4625 v: T,
4626 ) -> Self {
4627 self.r#type = v.into();
4628 self
4629 }
4630
4631 /// Sets the value of [revision][crate::model::InstanceSplit::revision].
4632 ///
4633 /// # Example
4634 /// ```ignore,no_run
4635 /// # use google_cloud_run_v2::model::InstanceSplit;
4636 /// let x = InstanceSplit::new().set_revision("example");
4637 /// ```
4638 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4639 self.revision = v.into();
4640 self
4641 }
4642
4643 /// Sets the value of [percent][crate::model::InstanceSplit::percent].
4644 ///
4645 /// # Example
4646 /// ```ignore,no_run
4647 /// # use google_cloud_run_v2::model::InstanceSplit;
4648 /// let x = InstanceSplit::new().set_percent(42);
4649 /// ```
4650 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4651 self.percent = v.into();
4652 self
4653 }
4654}
4655
4656impl wkt::message::Message for InstanceSplit {
4657 fn typename() -> &'static str {
4658 "type.googleapis.com/google.cloud.run.v2.InstanceSplit"
4659 }
4660}
4661
4662/// Represents the observed state of a single `InstanceSplit` entry.
4663#[derive(Clone, Default, PartialEq)]
4664#[non_exhaustive]
4665pub struct InstanceSplitStatus {
4666 /// The allocation type for this instance split.
4667 pub r#type: crate::model::InstanceSplitAllocationType,
4668
4669 /// Revision to which this instance split is assigned.
4670 pub revision: std::string::String,
4671
4672 /// Specifies percent of the instance split to this Revision.
4673 pub percent: i32,
4674
4675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4676}
4677
4678impl InstanceSplitStatus {
4679 /// Creates a new default instance.
4680 pub fn new() -> Self {
4681 std::default::Default::default()
4682 }
4683
4684 /// Sets the value of [r#type][crate::model::InstanceSplitStatus::type].
4685 ///
4686 /// # Example
4687 /// ```ignore,no_run
4688 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4689 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4690 /// let x0 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Latest);
4691 /// let x1 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Revision);
4692 /// ```
4693 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4694 mut self,
4695 v: T,
4696 ) -> Self {
4697 self.r#type = v.into();
4698 self
4699 }
4700
4701 /// Sets the value of [revision][crate::model::InstanceSplitStatus::revision].
4702 ///
4703 /// # Example
4704 /// ```ignore,no_run
4705 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4706 /// let x = InstanceSplitStatus::new().set_revision("example");
4707 /// ```
4708 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4709 self.revision = v.into();
4710 self
4711 }
4712
4713 /// Sets the value of [percent][crate::model::InstanceSplitStatus::percent].
4714 ///
4715 /// # Example
4716 /// ```ignore,no_run
4717 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4718 /// let x = InstanceSplitStatus::new().set_percent(42);
4719 /// ```
4720 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4721 self.percent = v.into();
4722 self
4723 }
4724}
4725
4726impl wkt::message::Message for InstanceSplitStatus {
4727 fn typename() -> &'static str {
4728 "type.googleapis.com/google.cloud.run.v2.InstanceSplitStatus"
4729 }
4730}
4731
4732/// Request message for creating a Job.
4733#[derive(Clone, Default, PartialEq)]
4734#[non_exhaustive]
4735pub struct CreateJobRequest {
4736 /// Required. The location and project in which this Job should be created.
4737 /// Format: projects/{project}/locations/{location}, where {project} can be
4738 /// project id or number.
4739 pub parent: std::string::String,
4740
4741 /// Required. The Job instance to create.
4742 pub job: std::option::Option<crate::model::Job>,
4743
4744 /// Required. The unique identifier for the Job. The name of the job becomes
4745 /// {parent}/jobs/{job_id}.
4746 pub job_id: std::string::String,
4747
4748 /// Indicates that the request should be validated and default values
4749 /// populated, without persisting the request or creating any resources.
4750 pub validate_only: bool,
4751
4752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4753}
4754
4755impl CreateJobRequest {
4756 /// Creates a new default instance.
4757 pub fn new() -> Self {
4758 std::default::Default::default()
4759 }
4760
4761 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
4762 ///
4763 /// # Example
4764 /// ```ignore,no_run
4765 /// # use google_cloud_run_v2::model::CreateJobRequest;
4766 /// let x = CreateJobRequest::new().set_parent("example");
4767 /// ```
4768 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4769 self.parent = v.into();
4770 self
4771 }
4772
4773 /// Sets the value of [job][crate::model::CreateJobRequest::job].
4774 ///
4775 /// # Example
4776 /// ```ignore,no_run
4777 /// # use google_cloud_run_v2::model::CreateJobRequest;
4778 /// use google_cloud_run_v2::model::Job;
4779 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
4780 /// ```
4781 pub fn set_job<T>(mut self, v: T) -> Self
4782 where
4783 T: std::convert::Into<crate::model::Job>,
4784 {
4785 self.job = std::option::Option::Some(v.into());
4786 self
4787 }
4788
4789 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
4790 ///
4791 /// # Example
4792 /// ```ignore,no_run
4793 /// # use google_cloud_run_v2::model::CreateJobRequest;
4794 /// use google_cloud_run_v2::model::Job;
4795 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4796 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
4797 /// ```
4798 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4799 where
4800 T: std::convert::Into<crate::model::Job>,
4801 {
4802 self.job = v.map(|x| x.into());
4803 self
4804 }
4805
4806 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
4807 ///
4808 /// # Example
4809 /// ```ignore,no_run
4810 /// # use google_cloud_run_v2::model::CreateJobRequest;
4811 /// let x = CreateJobRequest::new().set_job_id("example");
4812 /// ```
4813 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4814 self.job_id = v.into();
4815 self
4816 }
4817
4818 /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
4819 ///
4820 /// # Example
4821 /// ```ignore,no_run
4822 /// # use google_cloud_run_v2::model::CreateJobRequest;
4823 /// let x = CreateJobRequest::new().set_validate_only(true);
4824 /// ```
4825 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4826 self.validate_only = v.into();
4827 self
4828 }
4829}
4830
4831impl wkt::message::Message for CreateJobRequest {
4832 fn typename() -> &'static str {
4833 "type.googleapis.com/google.cloud.run.v2.CreateJobRequest"
4834 }
4835}
4836
4837/// Request message for obtaining a Job by its full name.
4838#[derive(Clone, Default, PartialEq)]
4839#[non_exhaustive]
4840pub struct GetJobRequest {
4841 /// Required. The full name of the Job.
4842 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
4843 /// can be project id or number.
4844 pub name: std::string::String,
4845
4846 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4847}
4848
4849impl GetJobRequest {
4850 /// Creates a new default instance.
4851 pub fn new() -> Self {
4852 std::default::Default::default()
4853 }
4854
4855 /// Sets the value of [name][crate::model::GetJobRequest::name].
4856 ///
4857 /// # Example
4858 /// ```ignore,no_run
4859 /// # use google_cloud_run_v2::model::GetJobRequest;
4860 /// let x = GetJobRequest::new().set_name("example");
4861 /// ```
4862 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4863 self.name = v.into();
4864 self
4865 }
4866}
4867
4868impl wkt::message::Message for GetJobRequest {
4869 fn typename() -> &'static str {
4870 "type.googleapis.com/google.cloud.run.v2.GetJobRequest"
4871 }
4872}
4873
4874/// Request message for updating a Job.
4875#[derive(Clone, Default, PartialEq)]
4876#[non_exhaustive]
4877pub struct UpdateJobRequest {
4878 /// Required. The Job to be updated.
4879 pub job: std::option::Option<crate::model::Job>,
4880
4881 /// Indicates that the request should be validated and default values
4882 /// populated, without persisting the request or updating any resources.
4883 pub validate_only: bool,
4884
4885 /// Optional. If set to true, and if the Job does not exist, it will create a
4886 /// new one. Caller must have both create and update permissions for this call
4887 /// if this is set to true.
4888 pub allow_missing: bool,
4889
4890 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4891}
4892
4893impl UpdateJobRequest {
4894 /// Creates a new default instance.
4895 pub fn new() -> Self {
4896 std::default::Default::default()
4897 }
4898
4899 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
4900 ///
4901 /// # Example
4902 /// ```ignore,no_run
4903 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4904 /// use google_cloud_run_v2::model::Job;
4905 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
4906 /// ```
4907 pub fn set_job<T>(mut self, v: T) -> Self
4908 where
4909 T: std::convert::Into<crate::model::Job>,
4910 {
4911 self.job = std::option::Option::Some(v.into());
4912 self
4913 }
4914
4915 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
4916 ///
4917 /// # Example
4918 /// ```ignore,no_run
4919 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4920 /// use google_cloud_run_v2::model::Job;
4921 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4922 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
4923 /// ```
4924 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4925 where
4926 T: std::convert::Into<crate::model::Job>,
4927 {
4928 self.job = v.map(|x| x.into());
4929 self
4930 }
4931
4932 /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
4933 ///
4934 /// # Example
4935 /// ```ignore,no_run
4936 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4937 /// let x = UpdateJobRequest::new().set_validate_only(true);
4938 /// ```
4939 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4940 self.validate_only = v.into();
4941 self
4942 }
4943
4944 /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
4945 ///
4946 /// # Example
4947 /// ```ignore,no_run
4948 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4949 /// let x = UpdateJobRequest::new().set_allow_missing(true);
4950 /// ```
4951 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4952 self.allow_missing = v.into();
4953 self
4954 }
4955}
4956
4957impl wkt::message::Message for UpdateJobRequest {
4958 fn typename() -> &'static str {
4959 "type.googleapis.com/google.cloud.run.v2.UpdateJobRequest"
4960 }
4961}
4962
4963/// Request message for retrieving a list of Jobs.
4964#[derive(Clone, Default, PartialEq)]
4965#[non_exhaustive]
4966pub struct ListJobsRequest {
4967 /// Required. The location and project to list resources on.
4968 /// Format: projects/{project}/locations/{location}, where {project} can be
4969 /// project id or number.
4970 pub parent: std::string::String,
4971
4972 /// Maximum number of Jobs to return in this call.
4973 pub page_size: i32,
4974
4975 /// A page token received from a previous call to ListJobs.
4976 /// All other parameters must match.
4977 pub page_token: std::string::String,
4978
4979 /// If true, returns deleted (but unexpired) resources along with active ones.
4980 pub show_deleted: bool,
4981
4982 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4983}
4984
4985impl ListJobsRequest {
4986 /// Creates a new default instance.
4987 pub fn new() -> Self {
4988 std::default::Default::default()
4989 }
4990
4991 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
4992 ///
4993 /// # Example
4994 /// ```ignore,no_run
4995 /// # use google_cloud_run_v2::model::ListJobsRequest;
4996 /// let x = ListJobsRequest::new().set_parent("example");
4997 /// ```
4998 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4999 self.parent = v.into();
5000 self
5001 }
5002
5003 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
5004 ///
5005 /// # Example
5006 /// ```ignore,no_run
5007 /// # use google_cloud_run_v2::model::ListJobsRequest;
5008 /// let x = ListJobsRequest::new().set_page_size(42);
5009 /// ```
5010 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5011 self.page_size = v.into();
5012 self
5013 }
5014
5015 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
5016 ///
5017 /// # Example
5018 /// ```ignore,no_run
5019 /// # use google_cloud_run_v2::model::ListJobsRequest;
5020 /// let x = ListJobsRequest::new().set_page_token("example");
5021 /// ```
5022 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5023 self.page_token = v.into();
5024 self
5025 }
5026
5027 /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
5028 ///
5029 /// # Example
5030 /// ```ignore,no_run
5031 /// # use google_cloud_run_v2::model::ListJobsRequest;
5032 /// let x = ListJobsRequest::new().set_show_deleted(true);
5033 /// ```
5034 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5035 self.show_deleted = v.into();
5036 self
5037 }
5038}
5039
5040impl wkt::message::Message for ListJobsRequest {
5041 fn typename() -> &'static str {
5042 "type.googleapis.com/google.cloud.run.v2.ListJobsRequest"
5043 }
5044}
5045
5046/// Response message containing a list of Jobs.
5047#[derive(Clone, Default, PartialEq)]
5048#[non_exhaustive]
5049pub struct ListJobsResponse {
5050 /// The resulting list of Jobs.
5051 pub jobs: std::vec::Vec<crate::model::Job>,
5052
5053 /// A token indicating there are more items than page_size. Use it in the next
5054 /// ListJobs request to continue.
5055 pub next_page_token: std::string::String,
5056
5057 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5058}
5059
5060impl ListJobsResponse {
5061 /// Creates a new default instance.
5062 pub fn new() -> Self {
5063 std::default::Default::default()
5064 }
5065
5066 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
5067 ///
5068 /// # Example
5069 /// ```ignore,no_run
5070 /// # use google_cloud_run_v2::model::ListJobsResponse;
5071 /// use google_cloud_run_v2::model::Job;
5072 /// let x = ListJobsResponse::new()
5073 /// .set_jobs([
5074 /// Job::default()/* use setters */,
5075 /// Job::default()/* use (different) setters */,
5076 /// ]);
5077 /// ```
5078 pub fn set_jobs<T, V>(mut self, v: T) -> Self
5079 where
5080 T: std::iter::IntoIterator<Item = V>,
5081 V: std::convert::Into<crate::model::Job>,
5082 {
5083 use std::iter::Iterator;
5084 self.jobs = v.into_iter().map(|i| i.into()).collect();
5085 self
5086 }
5087
5088 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
5089 ///
5090 /// # Example
5091 /// ```ignore,no_run
5092 /// # use google_cloud_run_v2::model::ListJobsResponse;
5093 /// let x = ListJobsResponse::new().set_next_page_token("example");
5094 /// ```
5095 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5096 self.next_page_token = v.into();
5097 self
5098 }
5099}
5100
5101impl wkt::message::Message for ListJobsResponse {
5102 fn typename() -> &'static str {
5103 "type.googleapis.com/google.cloud.run.v2.ListJobsResponse"
5104 }
5105}
5106
5107#[doc(hidden)]
5108impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
5109 type PageItem = crate::model::Job;
5110
5111 fn items(self) -> std::vec::Vec<Self::PageItem> {
5112 self.jobs
5113 }
5114
5115 fn next_page_token(&self) -> std::string::String {
5116 use std::clone::Clone;
5117 self.next_page_token.clone()
5118 }
5119}
5120
5121/// Request message to delete a Job by its full name.
5122#[derive(Clone, Default, PartialEq)]
5123#[non_exhaustive]
5124pub struct DeleteJobRequest {
5125 /// Required. The full name of the Job.
5126 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5127 /// can be project id or number.
5128 pub name: std::string::String,
5129
5130 /// Indicates that the request should be validated without actually
5131 /// deleting any resources.
5132 pub validate_only: bool,
5133
5134 /// A system-generated fingerprint for this version of the
5135 /// resource. May be used to detect modification conflict during updates.
5136 pub etag: std::string::String,
5137
5138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5139}
5140
5141impl DeleteJobRequest {
5142 /// Creates a new default instance.
5143 pub fn new() -> Self {
5144 std::default::Default::default()
5145 }
5146
5147 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
5148 ///
5149 /// # Example
5150 /// ```ignore,no_run
5151 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5152 /// let x = DeleteJobRequest::new().set_name("example");
5153 /// ```
5154 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5155 self.name = v.into();
5156 self
5157 }
5158
5159 /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
5160 ///
5161 /// # Example
5162 /// ```ignore,no_run
5163 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5164 /// let x = DeleteJobRequest::new().set_validate_only(true);
5165 /// ```
5166 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5167 self.validate_only = v.into();
5168 self
5169 }
5170
5171 /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
5172 ///
5173 /// # Example
5174 /// ```ignore,no_run
5175 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5176 /// let x = DeleteJobRequest::new().set_etag("example");
5177 /// ```
5178 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5179 self.etag = v.into();
5180 self
5181 }
5182}
5183
5184impl wkt::message::Message for DeleteJobRequest {
5185 fn typename() -> &'static str {
5186 "type.googleapis.com/google.cloud.run.v2.DeleteJobRequest"
5187 }
5188}
5189
5190/// Request message to create a new Execution of a Job.
5191#[derive(Clone, Default, PartialEq)]
5192#[non_exhaustive]
5193pub struct RunJobRequest {
5194 /// Required. The full name of the Job.
5195 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5196 /// can be project id or number.
5197 pub name: std::string::String,
5198
5199 /// Indicates that the request should be validated without actually
5200 /// deleting any resources.
5201 pub validate_only: bool,
5202
5203 /// A system-generated fingerprint for this version of the
5204 /// resource. May be used to detect modification conflict during updates.
5205 pub etag: std::string::String,
5206
5207 /// Overrides specification for a given execution of a job. If provided,
5208 /// overrides will be applied to update the execution or task spec.
5209 pub overrides: std::option::Option<crate::model::run_job_request::Overrides>,
5210
5211 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5212}
5213
5214impl RunJobRequest {
5215 /// Creates a new default instance.
5216 pub fn new() -> Self {
5217 std::default::Default::default()
5218 }
5219
5220 /// Sets the value of [name][crate::model::RunJobRequest::name].
5221 ///
5222 /// # Example
5223 /// ```ignore,no_run
5224 /// # use google_cloud_run_v2::model::RunJobRequest;
5225 /// let x = RunJobRequest::new().set_name("example");
5226 /// ```
5227 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5228 self.name = v.into();
5229 self
5230 }
5231
5232 /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
5233 ///
5234 /// # Example
5235 /// ```ignore,no_run
5236 /// # use google_cloud_run_v2::model::RunJobRequest;
5237 /// let x = RunJobRequest::new().set_validate_only(true);
5238 /// ```
5239 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5240 self.validate_only = v.into();
5241 self
5242 }
5243
5244 /// Sets the value of [etag][crate::model::RunJobRequest::etag].
5245 ///
5246 /// # Example
5247 /// ```ignore,no_run
5248 /// # use google_cloud_run_v2::model::RunJobRequest;
5249 /// let x = RunJobRequest::new().set_etag("example");
5250 /// ```
5251 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5252 self.etag = v.into();
5253 self
5254 }
5255
5256 /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
5257 ///
5258 /// # Example
5259 /// ```ignore,no_run
5260 /// # use google_cloud_run_v2::model::RunJobRequest;
5261 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5262 /// let x = RunJobRequest::new().set_overrides(Overrides::default()/* use setters */);
5263 /// ```
5264 pub fn set_overrides<T>(mut self, v: T) -> Self
5265 where
5266 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5267 {
5268 self.overrides = std::option::Option::Some(v.into());
5269 self
5270 }
5271
5272 /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
5273 ///
5274 /// # Example
5275 /// ```ignore,no_run
5276 /// # use google_cloud_run_v2::model::RunJobRequest;
5277 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5278 /// let x = RunJobRequest::new().set_or_clear_overrides(Some(Overrides::default()/* use setters */));
5279 /// let x = RunJobRequest::new().set_or_clear_overrides(None::<Overrides>);
5280 /// ```
5281 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
5282 where
5283 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5284 {
5285 self.overrides = v.map(|x| x.into());
5286 self
5287 }
5288}
5289
5290impl wkt::message::Message for RunJobRequest {
5291 fn typename() -> &'static str {
5292 "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
5293 }
5294}
5295
5296/// Defines additional types related to [RunJobRequest].
5297pub mod run_job_request {
5298 #[allow(unused_imports)]
5299 use super::*;
5300
5301 /// RunJob Overrides that contains Execution fields to be overridden.
5302 #[derive(Clone, Default, PartialEq)]
5303 #[non_exhaustive]
5304 pub struct Overrides {
5305 /// Per container override specification.
5306 pub container_overrides:
5307 std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>,
5308
5309 /// Optional. The desired number of tasks the execution should run. Will
5310 /// replace existing task_count value.
5311 pub task_count: i32,
5312
5313 /// Duration in seconds the task may be active before the system will
5314 /// actively try to mark it failed and kill associated containers. Will
5315 /// replace existing timeout_seconds value.
5316 pub timeout: std::option::Option<wkt::Duration>,
5317
5318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5319 }
5320
5321 impl Overrides {
5322 /// Creates a new default instance.
5323 pub fn new() -> Self {
5324 std::default::Default::default()
5325 }
5326
5327 /// Sets the value of [container_overrides][crate::model::run_job_request::Overrides::container_overrides].
5328 ///
5329 /// # Example
5330 /// ```ignore,no_run
5331 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5332 /// use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5333 /// let x = Overrides::new()
5334 /// .set_container_overrides([
5335 /// ContainerOverride::default()/* use setters */,
5336 /// ContainerOverride::default()/* use (different) setters */,
5337 /// ]);
5338 /// ```
5339 pub fn set_container_overrides<T, V>(mut self, v: T) -> Self
5340 where
5341 T: std::iter::IntoIterator<Item = V>,
5342 V: std::convert::Into<crate::model::run_job_request::overrides::ContainerOverride>,
5343 {
5344 use std::iter::Iterator;
5345 self.container_overrides = v.into_iter().map(|i| i.into()).collect();
5346 self
5347 }
5348
5349 /// Sets the value of [task_count][crate::model::run_job_request::Overrides::task_count].
5350 ///
5351 /// # Example
5352 /// ```ignore,no_run
5353 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5354 /// let x = Overrides::new().set_task_count(42);
5355 /// ```
5356 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5357 self.task_count = v.into();
5358 self
5359 }
5360
5361 /// Sets the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5362 ///
5363 /// # Example
5364 /// ```ignore,no_run
5365 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5366 /// use wkt::Duration;
5367 /// let x = Overrides::new().set_timeout(Duration::default()/* use setters */);
5368 /// ```
5369 pub fn set_timeout<T>(mut self, v: T) -> Self
5370 where
5371 T: std::convert::Into<wkt::Duration>,
5372 {
5373 self.timeout = std::option::Option::Some(v.into());
5374 self
5375 }
5376
5377 /// Sets or clears the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5378 ///
5379 /// # Example
5380 /// ```ignore,no_run
5381 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5382 /// use wkt::Duration;
5383 /// let x = Overrides::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
5384 /// let x = Overrides::new().set_or_clear_timeout(None::<Duration>);
5385 /// ```
5386 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5387 where
5388 T: std::convert::Into<wkt::Duration>,
5389 {
5390 self.timeout = v.map(|x| x.into());
5391 self
5392 }
5393 }
5394
5395 impl wkt::message::Message for Overrides {
5396 fn typename() -> &'static str {
5397 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
5398 }
5399 }
5400
5401 /// Defines additional types related to [Overrides].
5402 pub mod overrides {
5403 #[allow(unused_imports)]
5404 use super::*;
5405
5406 /// Per-container override specification.
5407 #[derive(Clone, Default, PartialEq)]
5408 #[non_exhaustive]
5409 pub struct ContainerOverride {
5410 /// The name of the container specified as a DNS_LABEL.
5411 pub name: std::string::String,
5412
5413 /// Optional. Arguments to the entrypoint. Will replace existing args for
5414 /// override.
5415 pub args: std::vec::Vec<std::string::String>,
5416
5417 /// List of environment variables to set in the container. Will be merged
5418 /// with existing env for override.
5419 pub env: std::vec::Vec<crate::model::EnvVar>,
5420
5421 /// Optional. True if the intention is to clear out existing args list.
5422 pub clear_args: bool,
5423
5424 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5425 }
5426
5427 impl ContainerOverride {
5428 /// Creates a new default instance.
5429 pub fn new() -> Self {
5430 std::default::Default::default()
5431 }
5432
5433 /// Sets the value of [name][crate::model::run_job_request::overrides::ContainerOverride::name].
5434 ///
5435 /// # Example
5436 /// ```ignore,no_run
5437 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5438 /// let x = ContainerOverride::new().set_name("example");
5439 /// ```
5440 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5441 self.name = v.into();
5442 self
5443 }
5444
5445 /// Sets the value of [args][crate::model::run_job_request::overrides::ContainerOverride::args].
5446 ///
5447 /// # Example
5448 /// ```ignore,no_run
5449 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5450 /// let x = ContainerOverride::new().set_args(["a", "b", "c"]);
5451 /// ```
5452 pub fn set_args<T, V>(mut self, v: T) -> Self
5453 where
5454 T: std::iter::IntoIterator<Item = V>,
5455 V: std::convert::Into<std::string::String>,
5456 {
5457 use std::iter::Iterator;
5458 self.args = v.into_iter().map(|i| i.into()).collect();
5459 self
5460 }
5461
5462 /// Sets the value of [env][crate::model::run_job_request::overrides::ContainerOverride::env].
5463 ///
5464 /// # Example
5465 /// ```ignore,no_run
5466 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5467 /// use google_cloud_run_v2::model::EnvVar;
5468 /// let x = ContainerOverride::new()
5469 /// .set_env([
5470 /// EnvVar::default()/* use setters */,
5471 /// EnvVar::default()/* use (different) setters */,
5472 /// ]);
5473 /// ```
5474 pub fn set_env<T, V>(mut self, v: T) -> Self
5475 where
5476 T: std::iter::IntoIterator<Item = V>,
5477 V: std::convert::Into<crate::model::EnvVar>,
5478 {
5479 use std::iter::Iterator;
5480 self.env = v.into_iter().map(|i| i.into()).collect();
5481 self
5482 }
5483
5484 /// Sets the value of [clear_args][crate::model::run_job_request::overrides::ContainerOverride::clear_args].
5485 ///
5486 /// # Example
5487 /// ```ignore,no_run
5488 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5489 /// let x = ContainerOverride::new().set_clear_args(true);
5490 /// ```
5491 pub fn set_clear_args<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5492 self.clear_args = v.into();
5493 self
5494 }
5495 }
5496
5497 impl wkt::message::Message for ContainerOverride {
5498 fn typename() -> &'static str {
5499 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
5500 }
5501 }
5502 }
5503}
5504
5505/// Job represents the configuration of a single job, which references a
5506/// container image that is run to completion.
5507#[derive(Clone, Default, PartialEq)]
5508#[non_exhaustive]
5509pub struct Job {
5510 /// The fully qualified name of this Job.
5511 ///
5512 /// Format:
5513 /// projects/{project}/locations/{location}/jobs/{job}
5514 pub name: std::string::String,
5515
5516 /// Output only. Server assigned unique identifier for the Execution. The value
5517 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
5518 /// deleted.
5519 pub uid: std::string::String,
5520
5521 /// Output only. A number that monotonically increases every time the user
5522 /// modifies the desired state.
5523 pub generation: i64,
5524
5525 /// Unstructured key value map that can be used to organize and categorize
5526 /// objects.
5527 /// User-provided labels are shared with Google's billing system, so they can
5528 /// be used to filter, or break down billing charges by team, component,
5529 /// environment, state, etc. For more information, visit
5530 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
5531 /// <https://cloud.google.com/run/docs/configuring/labels>.
5532 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5533
5534 /// Unstructured key value map that may
5535 /// be set by external tools to store and arbitrary metadata.
5536 /// They are not queryable and should be preserved
5537 /// when modifying objects.
5538 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
5539
5540 /// Output only. The creation time.
5541 pub create_time: std::option::Option<wkt::Timestamp>,
5542
5543 /// Output only. The last-modified time.
5544 pub update_time: std::option::Option<wkt::Timestamp>,
5545
5546 /// Output only. The deletion time. It is only populated as a response to a
5547 /// Delete request.
5548 pub delete_time: std::option::Option<wkt::Timestamp>,
5549
5550 /// Output only. For a deleted resource, the time after which it will be
5551 /// permamently deleted.
5552 pub expire_time: std::option::Option<wkt::Timestamp>,
5553
5554 /// Output only. Email address of the authenticated creator.
5555 pub creator: std::string::String,
5556
5557 /// Output only. Email address of the last authenticated modifier.
5558 pub last_modifier: std::string::String,
5559
5560 /// Arbitrary identifier for the API client.
5561 pub client: std::string::String,
5562
5563 /// Arbitrary version identifier for the API client.
5564 pub client_version: std::string::String,
5565
5566 /// The launch stage as defined by [Google Cloud Platform
5567 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
5568 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
5569 /// is assumed.
5570 /// Set the launch stage to a preview stage on input to allow use of preview
5571 /// features in that stage. On read (or output), describes whether the resource
5572 /// uses preview features.
5573 ///
5574 /// For example, if ALPHA is provided as input, but only BETA and GA-level
5575 /// features are used, this field will be BETA on output.
5576 pub launch_stage: google_cloud_api::model::LaunchStage,
5577
5578 /// Settings for the Binary Authorization feature.
5579 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
5580
5581 /// Required. The template used to create executions for this Job.
5582 pub template: std::option::Option<crate::model::ExecutionTemplate>,
5583
5584 /// Output only. The generation of this Job. See comments in `reconciling` for
5585 /// additional information on reconciliation process in Cloud Run.
5586 pub observed_generation: i64,
5587
5588 /// Output only. The Condition of this Job, containing its readiness status,
5589 /// and detailed error information in case it did not reach the desired state.
5590 pub terminal_condition: std::option::Option<crate::model::Condition>,
5591
5592 /// Output only. The Conditions of all other associated sub-resources. They
5593 /// contain additional diagnostics information in case the Job does not reach
5594 /// its desired state. See comments in `reconciling` for additional information
5595 /// on reconciliation process in Cloud Run.
5596 pub conditions: std::vec::Vec<crate::model::Condition>,
5597
5598 /// Output only. Number of executions created for this job.
5599 pub execution_count: i32,
5600
5601 /// Output only. Name of the last created execution.
5602 pub latest_created_execution: std::option::Option<crate::model::ExecutionReference>,
5603
5604 /// Output only. Returns true if the Job is currently being acted upon by the
5605 /// system to bring it into the desired state.
5606 ///
5607 /// When a new Job is created, or an existing one is updated, Cloud Run
5608 /// will asynchronously perform all necessary steps to bring the Job to the
5609 /// desired state. This process is called reconciliation.
5610 /// While reconciliation is in process, `observed_generation` and
5611 /// `latest_succeeded_execution`, will have transient values that might
5612 /// mismatch the intended state: Once reconciliation is over (and this field is
5613 /// false), there are two possible outcomes: reconciliation succeeded and the
5614 /// state matches the Job, or there was an error, and reconciliation failed.
5615 /// This state can be found in `terminal_condition.state`.
5616 ///
5617 /// If reconciliation succeeded, the following fields will match:
5618 /// `observed_generation` and `generation`, `latest_succeeded_execution` and
5619 /// `latest_created_execution`.
5620 ///
5621 /// If reconciliation failed, `observed_generation` and
5622 /// `latest_succeeded_execution` will have the state of the last succeeded
5623 /// execution or empty for newly created Job. Additional information on the
5624 /// failure can be found in `terminal_condition` and `conditions`.
5625 pub reconciling: bool,
5626
5627 /// Output only. Reserved for future use.
5628 pub satisfies_pzs: bool,
5629
5630 /// Optional. A system-generated fingerprint for this version of the
5631 /// resource. May be used to detect modification conflict during updates.
5632 pub etag: std::string::String,
5633
5634 #[allow(missing_docs)]
5635 pub create_execution: std::option::Option<crate::model::job::CreateExecution>,
5636
5637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5638}
5639
5640impl Job {
5641 /// Creates a new default instance.
5642 pub fn new() -> Self {
5643 std::default::Default::default()
5644 }
5645
5646 /// Sets the value of [name][crate::model::Job::name].
5647 ///
5648 /// # Example
5649 /// ```ignore,no_run
5650 /// # use google_cloud_run_v2::model::Job;
5651 /// let x = Job::new().set_name("example");
5652 /// ```
5653 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5654 self.name = v.into();
5655 self
5656 }
5657
5658 /// Sets the value of [uid][crate::model::Job::uid].
5659 ///
5660 /// # Example
5661 /// ```ignore,no_run
5662 /// # use google_cloud_run_v2::model::Job;
5663 /// let x = Job::new().set_uid("example");
5664 /// ```
5665 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5666 self.uid = v.into();
5667 self
5668 }
5669
5670 /// Sets the value of [generation][crate::model::Job::generation].
5671 ///
5672 /// # Example
5673 /// ```ignore,no_run
5674 /// # use google_cloud_run_v2::model::Job;
5675 /// let x = Job::new().set_generation(42);
5676 /// ```
5677 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5678 self.generation = v.into();
5679 self
5680 }
5681
5682 /// Sets the value of [labels][crate::model::Job::labels].
5683 ///
5684 /// # Example
5685 /// ```ignore,no_run
5686 /// # use google_cloud_run_v2::model::Job;
5687 /// let x = Job::new().set_labels([
5688 /// ("key0", "abc"),
5689 /// ("key1", "xyz"),
5690 /// ]);
5691 /// ```
5692 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5693 where
5694 T: std::iter::IntoIterator<Item = (K, V)>,
5695 K: std::convert::Into<std::string::String>,
5696 V: std::convert::Into<std::string::String>,
5697 {
5698 use std::iter::Iterator;
5699 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5700 self
5701 }
5702
5703 /// Sets the value of [annotations][crate::model::Job::annotations].
5704 ///
5705 /// # Example
5706 /// ```ignore,no_run
5707 /// # use google_cloud_run_v2::model::Job;
5708 /// let x = Job::new().set_annotations([
5709 /// ("key0", "abc"),
5710 /// ("key1", "xyz"),
5711 /// ]);
5712 /// ```
5713 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5714 where
5715 T: std::iter::IntoIterator<Item = (K, V)>,
5716 K: std::convert::Into<std::string::String>,
5717 V: std::convert::Into<std::string::String>,
5718 {
5719 use std::iter::Iterator;
5720 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5721 self
5722 }
5723
5724 /// Sets the value of [create_time][crate::model::Job::create_time].
5725 ///
5726 /// # Example
5727 /// ```ignore,no_run
5728 /// # use google_cloud_run_v2::model::Job;
5729 /// use wkt::Timestamp;
5730 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
5731 /// ```
5732 pub fn set_create_time<T>(mut self, v: T) -> Self
5733 where
5734 T: std::convert::Into<wkt::Timestamp>,
5735 {
5736 self.create_time = std::option::Option::Some(v.into());
5737 self
5738 }
5739
5740 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
5741 ///
5742 /// # Example
5743 /// ```ignore,no_run
5744 /// # use google_cloud_run_v2::model::Job;
5745 /// use wkt::Timestamp;
5746 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5747 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
5748 /// ```
5749 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5750 where
5751 T: std::convert::Into<wkt::Timestamp>,
5752 {
5753 self.create_time = v.map(|x| x.into());
5754 self
5755 }
5756
5757 /// Sets the value of [update_time][crate::model::Job::update_time].
5758 ///
5759 /// # Example
5760 /// ```ignore,no_run
5761 /// # use google_cloud_run_v2::model::Job;
5762 /// use wkt::Timestamp;
5763 /// let x = Job::new().set_update_time(Timestamp::default()/* use setters */);
5764 /// ```
5765 pub fn set_update_time<T>(mut self, v: T) -> Self
5766 where
5767 T: std::convert::Into<wkt::Timestamp>,
5768 {
5769 self.update_time = std::option::Option::Some(v.into());
5770 self
5771 }
5772
5773 /// Sets or clears the value of [update_time][crate::model::Job::update_time].
5774 ///
5775 /// # Example
5776 /// ```ignore,no_run
5777 /// # use google_cloud_run_v2::model::Job;
5778 /// use wkt::Timestamp;
5779 /// let x = Job::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5780 /// let x = Job::new().set_or_clear_update_time(None::<Timestamp>);
5781 /// ```
5782 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5783 where
5784 T: std::convert::Into<wkt::Timestamp>,
5785 {
5786 self.update_time = v.map(|x| x.into());
5787 self
5788 }
5789
5790 /// Sets the value of [delete_time][crate::model::Job::delete_time].
5791 ///
5792 /// # Example
5793 /// ```ignore,no_run
5794 /// # use google_cloud_run_v2::model::Job;
5795 /// use wkt::Timestamp;
5796 /// let x = Job::new().set_delete_time(Timestamp::default()/* use setters */);
5797 /// ```
5798 pub fn set_delete_time<T>(mut self, v: T) -> Self
5799 where
5800 T: std::convert::Into<wkt::Timestamp>,
5801 {
5802 self.delete_time = std::option::Option::Some(v.into());
5803 self
5804 }
5805
5806 /// Sets or clears the value of [delete_time][crate::model::Job::delete_time].
5807 ///
5808 /// # Example
5809 /// ```ignore,no_run
5810 /// # use google_cloud_run_v2::model::Job;
5811 /// use wkt::Timestamp;
5812 /// let x = Job::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
5813 /// let x = Job::new().set_or_clear_delete_time(None::<Timestamp>);
5814 /// ```
5815 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
5816 where
5817 T: std::convert::Into<wkt::Timestamp>,
5818 {
5819 self.delete_time = v.map(|x| x.into());
5820 self
5821 }
5822
5823 /// Sets the value of [expire_time][crate::model::Job::expire_time].
5824 ///
5825 /// # Example
5826 /// ```ignore,no_run
5827 /// # use google_cloud_run_v2::model::Job;
5828 /// use wkt::Timestamp;
5829 /// let x = Job::new().set_expire_time(Timestamp::default()/* use setters */);
5830 /// ```
5831 pub fn set_expire_time<T>(mut self, v: T) -> Self
5832 where
5833 T: std::convert::Into<wkt::Timestamp>,
5834 {
5835 self.expire_time = std::option::Option::Some(v.into());
5836 self
5837 }
5838
5839 /// Sets or clears the value of [expire_time][crate::model::Job::expire_time].
5840 ///
5841 /// # Example
5842 /// ```ignore,no_run
5843 /// # use google_cloud_run_v2::model::Job;
5844 /// use wkt::Timestamp;
5845 /// let x = Job::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5846 /// let x = Job::new().set_or_clear_expire_time(None::<Timestamp>);
5847 /// ```
5848 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5849 where
5850 T: std::convert::Into<wkt::Timestamp>,
5851 {
5852 self.expire_time = v.map(|x| x.into());
5853 self
5854 }
5855
5856 /// Sets the value of [creator][crate::model::Job::creator].
5857 ///
5858 /// # Example
5859 /// ```ignore,no_run
5860 /// # use google_cloud_run_v2::model::Job;
5861 /// let x = Job::new().set_creator("example");
5862 /// ```
5863 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5864 self.creator = v.into();
5865 self
5866 }
5867
5868 /// Sets the value of [last_modifier][crate::model::Job::last_modifier].
5869 ///
5870 /// # Example
5871 /// ```ignore,no_run
5872 /// # use google_cloud_run_v2::model::Job;
5873 /// let x = Job::new().set_last_modifier("example");
5874 /// ```
5875 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5876 self.last_modifier = v.into();
5877 self
5878 }
5879
5880 /// Sets the value of [client][crate::model::Job::client].
5881 ///
5882 /// # Example
5883 /// ```ignore,no_run
5884 /// # use google_cloud_run_v2::model::Job;
5885 /// let x = Job::new().set_client("example");
5886 /// ```
5887 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5888 self.client = v.into();
5889 self
5890 }
5891
5892 /// Sets the value of [client_version][crate::model::Job::client_version].
5893 ///
5894 /// # Example
5895 /// ```ignore,no_run
5896 /// # use google_cloud_run_v2::model::Job;
5897 /// let x = Job::new().set_client_version("example");
5898 /// ```
5899 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5900 self.client_version = v.into();
5901 self
5902 }
5903
5904 /// Sets the value of [launch_stage][crate::model::Job::launch_stage].
5905 ///
5906 /// # Example
5907 /// ```ignore,no_run
5908 /// # use google_cloud_run_v2::model::Job;
5909 /// use google_cloud_api::model::LaunchStage;
5910 /// let x0 = Job::new().set_launch_stage(LaunchStage::Unimplemented);
5911 /// let x1 = Job::new().set_launch_stage(LaunchStage::Prelaunch);
5912 /// let x2 = Job::new().set_launch_stage(LaunchStage::EarlyAccess);
5913 /// ```
5914 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
5915 mut self,
5916 v: T,
5917 ) -> Self {
5918 self.launch_stage = v.into();
5919 self
5920 }
5921
5922 /// Sets the value of [binary_authorization][crate::model::Job::binary_authorization].
5923 ///
5924 /// # Example
5925 /// ```ignore,no_run
5926 /// # use google_cloud_run_v2::model::Job;
5927 /// use google_cloud_run_v2::model::BinaryAuthorization;
5928 /// let x = Job::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
5929 /// ```
5930 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
5931 where
5932 T: std::convert::Into<crate::model::BinaryAuthorization>,
5933 {
5934 self.binary_authorization = std::option::Option::Some(v.into());
5935 self
5936 }
5937
5938 /// Sets or clears the value of [binary_authorization][crate::model::Job::binary_authorization].
5939 ///
5940 /// # Example
5941 /// ```ignore,no_run
5942 /// # use google_cloud_run_v2::model::Job;
5943 /// use google_cloud_run_v2::model::BinaryAuthorization;
5944 /// let x = Job::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
5945 /// let x = Job::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
5946 /// ```
5947 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
5948 where
5949 T: std::convert::Into<crate::model::BinaryAuthorization>,
5950 {
5951 self.binary_authorization = v.map(|x| x.into());
5952 self
5953 }
5954
5955 /// Sets the value of [template][crate::model::Job::template].
5956 ///
5957 /// # Example
5958 /// ```ignore,no_run
5959 /// # use google_cloud_run_v2::model::Job;
5960 /// use google_cloud_run_v2::model::ExecutionTemplate;
5961 /// let x = Job::new().set_template(ExecutionTemplate::default()/* use setters */);
5962 /// ```
5963 pub fn set_template<T>(mut self, v: T) -> Self
5964 where
5965 T: std::convert::Into<crate::model::ExecutionTemplate>,
5966 {
5967 self.template = std::option::Option::Some(v.into());
5968 self
5969 }
5970
5971 /// Sets or clears the value of [template][crate::model::Job::template].
5972 ///
5973 /// # Example
5974 /// ```ignore,no_run
5975 /// # use google_cloud_run_v2::model::Job;
5976 /// use google_cloud_run_v2::model::ExecutionTemplate;
5977 /// let x = Job::new().set_or_clear_template(Some(ExecutionTemplate::default()/* use setters */));
5978 /// let x = Job::new().set_or_clear_template(None::<ExecutionTemplate>);
5979 /// ```
5980 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
5981 where
5982 T: std::convert::Into<crate::model::ExecutionTemplate>,
5983 {
5984 self.template = v.map(|x| x.into());
5985 self
5986 }
5987
5988 /// Sets the value of [observed_generation][crate::model::Job::observed_generation].
5989 ///
5990 /// # Example
5991 /// ```ignore,no_run
5992 /// # use google_cloud_run_v2::model::Job;
5993 /// let x = Job::new().set_observed_generation(42);
5994 /// ```
5995 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5996 self.observed_generation = v.into();
5997 self
5998 }
5999
6000 /// Sets the value of [terminal_condition][crate::model::Job::terminal_condition].
6001 ///
6002 /// # Example
6003 /// ```ignore,no_run
6004 /// # use google_cloud_run_v2::model::Job;
6005 /// use google_cloud_run_v2::model::Condition;
6006 /// let x = Job::new().set_terminal_condition(Condition::default()/* use setters */);
6007 /// ```
6008 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
6009 where
6010 T: std::convert::Into<crate::model::Condition>,
6011 {
6012 self.terminal_condition = std::option::Option::Some(v.into());
6013 self
6014 }
6015
6016 /// Sets or clears the value of [terminal_condition][crate::model::Job::terminal_condition].
6017 ///
6018 /// # Example
6019 /// ```ignore,no_run
6020 /// # use google_cloud_run_v2::model::Job;
6021 /// use google_cloud_run_v2::model::Condition;
6022 /// let x = Job::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
6023 /// let x = Job::new().set_or_clear_terminal_condition(None::<Condition>);
6024 /// ```
6025 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
6026 where
6027 T: std::convert::Into<crate::model::Condition>,
6028 {
6029 self.terminal_condition = v.map(|x| x.into());
6030 self
6031 }
6032
6033 /// Sets the value of [conditions][crate::model::Job::conditions].
6034 ///
6035 /// # Example
6036 /// ```ignore,no_run
6037 /// # use google_cloud_run_v2::model::Job;
6038 /// use google_cloud_run_v2::model::Condition;
6039 /// let x = Job::new()
6040 /// .set_conditions([
6041 /// Condition::default()/* use setters */,
6042 /// Condition::default()/* use (different) setters */,
6043 /// ]);
6044 /// ```
6045 pub fn set_conditions<T, V>(mut self, v: T) -> Self
6046 where
6047 T: std::iter::IntoIterator<Item = V>,
6048 V: std::convert::Into<crate::model::Condition>,
6049 {
6050 use std::iter::Iterator;
6051 self.conditions = v.into_iter().map(|i| i.into()).collect();
6052 self
6053 }
6054
6055 /// Sets the value of [execution_count][crate::model::Job::execution_count].
6056 ///
6057 /// # Example
6058 /// ```ignore,no_run
6059 /// # use google_cloud_run_v2::model::Job;
6060 /// let x = Job::new().set_execution_count(42);
6061 /// ```
6062 pub fn set_execution_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6063 self.execution_count = v.into();
6064 self
6065 }
6066
6067 /// Sets the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6068 ///
6069 /// # Example
6070 /// ```ignore,no_run
6071 /// # use google_cloud_run_v2::model::Job;
6072 /// use google_cloud_run_v2::model::ExecutionReference;
6073 /// let x = Job::new().set_latest_created_execution(ExecutionReference::default()/* use setters */);
6074 /// ```
6075 pub fn set_latest_created_execution<T>(mut self, v: T) -> Self
6076 where
6077 T: std::convert::Into<crate::model::ExecutionReference>,
6078 {
6079 self.latest_created_execution = std::option::Option::Some(v.into());
6080 self
6081 }
6082
6083 /// Sets or clears the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6084 ///
6085 /// # Example
6086 /// ```ignore,no_run
6087 /// # use google_cloud_run_v2::model::Job;
6088 /// use google_cloud_run_v2::model::ExecutionReference;
6089 /// let x = Job::new().set_or_clear_latest_created_execution(Some(ExecutionReference::default()/* use setters */));
6090 /// let x = Job::new().set_or_clear_latest_created_execution(None::<ExecutionReference>);
6091 /// ```
6092 pub fn set_or_clear_latest_created_execution<T>(mut self, v: std::option::Option<T>) -> Self
6093 where
6094 T: std::convert::Into<crate::model::ExecutionReference>,
6095 {
6096 self.latest_created_execution = v.map(|x| x.into());
6097 self
6098 }
6099
6100 /// Sets the value of [reconciling][crate::model::Job::reconciling].
6101 ///
6102 /// # Example
6103 /// ```ignore,no_run
6104 /// # use google_cloud_run_v2::model::Job;
6105 /// let x = Job::new().set_reconciling(true);
6106 /// ```
6107 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6108 self.reconciling = v.into();
6109 self
6110 }
6111
6112 /// Sets the value of [satisfies_pzs][crate::model::Job::satisfies_pzs].
6113 ///
6114 /// # Example
6115 /// ```ignore,no_run
6116 /// # use google_cloud_run_v2::model::Job;
6117 /// let x = Job::new().set_satisfies_pzs(true);
6118 /// ```
6119 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6120 self.satisfies_pzs = v.into();
6121 self
6122 }
6123
6124 /// Sets the value of [etag][crate::model::Job::etag].
6125 ///
6126 /// # Example
6127 /// ```ignore,no_run
6128 /// # use google_cloud_run_v2::model::Job;
6129 /// let x = Job::new().set_etag("example");
6130 /// ```
6131 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6132 self.etag = v.into();
6133 self
6134 }
6135
6136 /// Sets the value of [create_execution][crate::model::Job::create_execution].
6137 ///
6138 /// Note that all the setters affecting `create_execution` are mutually
6139 /// exclusive.
6140 ///
6141 /// # Example
6142 /// ```ignore,no_run
6143 /// # use google_cloud_run_v2::model::Job;
6144 /// use google_cloud_run_v2::model::job::CreateExecution;
6145 /// let x = Job::new().set_create_execution(Some(CreateExecution::StartExecutionToken("example".to_string())));
6146 /// ```
6147 pub fn set_create_execution<
6148 T: std::convert::Into<std::option::Option<crate::model::job::CreateExecution>>,
6149 >(
6150 mut self,
6151 v: T,
6152 ) -> Self {
6153 self.create_execution = v.into();
6154 self
6155 }
6156
6157 /// The value of [create_execution][crate::model::Job::create_execution]
6158 /// if it holds a `StartExecutionToken`, `None` if the field is not set or
6159 /// holds a different branch.
6160 pub fn start_execution_token(&self) -> std::option::Option<&std::string::String> {
6161 #[allow(unreachable_patterns)]
6162 self.create_execution.as_ref().and_then(|v| match v {
6163 crate::model::job::CreateExecution::StartExecutionToken(v) => {
6164 std::option::Option::Some(v)
6165 }
6166 _ => std::option::Option::None,
6167 })
6168 }
6169
6170 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6171 /// to hold a `StartExecutionToken`.
6172 ///
6173 /// Note that all the setters affecting `create_execution` are
6174 /// mutually exclusive.
6175 ///
6176 /// # Example
6177 /// ```ignore,no_run
6178 /// # use google_cloud_run_v2::model::Job;
6179 /// let x = Job::new().set_start_execution_token("example");
6180 /// assert!(x.start_execution_token().is_some());
6181 /// assert!(x.run_execution_token().is_none());
6182 /// ```
6183 pub fn set_start_execution_token<T: std::convert::Into<std::string::String>>(
6184 mut self,
6185 v: T,
6186 ) -> Self {
6187 self.create_execution = std::option::Option::Some(
6188 crate::model::job::CreateExecution::StartExecutionToken(v.into()),
6189 );
6190 self
6191 }
6192
6193 /// The value of [create_execution][crate::model::Job::create_execution]
6194 /// if it holds a `RunExecutionToken`, `None` if the field is not set or
6195 /// holds a different branch.
6196 pub fn run_execution_token(&self) -> std::option::Option<&std::string::String> {
6197 #[allow(unreachable_patterns)]
6198 self.create_execution.as_ref().and_then(|v| match v {
6199 crate::model::job::CreateExecution::RunExecutionToken(v) => {
6200 std::option::Option::Some(v)
6201 }
6202 _ => std::option::Option::None,
6203 })
6204 }
6205
6206 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6207 /// to hold a `RunExecutionToken`.
6208 ///
6209 /// Note that all the setters affecting `create_execution` are
6210 /// mutually exclusive.
6211 ///
6212 /// # Example
6213 /// ```ignore,no_run
6214 /// # use google_cloud_run_v2::model::Job;
6215 /// let x = Job::new().set_run_execution_token("example");
6216 /// assert!(x.run_execution_token().is_some());
6217 /// assert!(x.start_execution_token().is_none());
6218 /// ```
6219 pub fn set_run_execution_token<T: std::convert::Into<std::string::String>>(
6220 mut self,
6221 v: T,
6222 ) -> Self {
6223 self.create_execution = std::option::Option::Some(
6224 crate::model::job::CreateExecution::RunExecutionToken(v.into()),
6225 );
6226 self
6227 }
6228}
6229
6230impl wkt::message::Message for Job {
6231 fn typename() -> &'static str {
6232 "type.googleapis.com/google.cloud.run.v2.Job"
6233 }
6234}
6235
6236/// Defines additional types related to [Job].
6237pub mod job {
6238 #[allow(unused_imports)]
6239 use super::*;
6240
6241 #[allow(missing_docs)]
6242 #[derive(Clone, Debug, PartialEq)]
6243 #[non_exhaustive]
6244 pub enum CreateExecution {
6245 /// A unique string used as a suffix creating a new execution. The Job will
6246 /// become ready when the execution is successfully started.
6247 /// The sum of job name and token length must be fewer than 63 characters.
6248 StartExecutionToken(std::string::String),
6249 /// A unique string used as a suffix for creating a new execution. The Job
6250 /// will become ready when the execution is successfully completed.
6251 /// The sum of job name and token length must be fewer than 63 characters.
6252 RunExecutionToken(std::string::String),
6253 }
6254}
6255
6256/// Reference to an Execution. Use /Executions.GetExecution with the given name
6257/// to get full execution including the latest status.
6258#[derive(Clone, Default, PartialEq)]
6259#[non_exhaustive]
6260pub struct ExecutionReference {
6261 /// Name of the execution.
6262 pub name: std::string::String,
6263
6264 /// Creation timestamp of the execution.
6265 pub create_time: std::option::Option<wkt::Timestamp>,
6266
6267 /// Creation timestamp of the execution.
6268 pub completion_time: std::option::Option<wkt::Timestamp>,
6269
6270 /// The deletion time of the execution. It is only
6271 /// populated as a response to a Delete request.
6272 pub delete_time: std::option::Option<wkt::Timestamp>,
6273
6274 /// Status for the execution completion.
6275 pub completion_status: crate::model::execution_reference::CompletionStatus,
6276
6277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6278}
6279
6280impl ExecutionReference {
6281 /// Creates a new default instance.
6282 pub fn new() -> Self {
6283 std::default::Default::default()
6284 }
6285
6286 /// Sets the value of [name][crate::model::ExecutionReference::name].
6287 ///
6288 /// # Example
6289 /// ```ignore,no_run
6290 /// # use google_cloud_run_v2::model::ExecutionReference;
6291 /// let x = ExecutionReference::new().set_name("example");
6292 /// ```
6293 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6294 self.name = v.into();
6295 self
6296 }
6297
6298 /// Sets the value of [create_time][crate::model::ExecutionReference::create_time].
6299 ///
6300 /// # Example
6301 /// ```ignore,no_run
6302 /// # use google_cloud_run_v2::model::ExecutionReference;
6303 /// use wkt::Timestamp;
6304 /// let x = ExecutionReference::new().set_create_time(Timestamp::default()/* use setters */);
6305 /// ```
6306 pub fn set_create_time<T>(mut self, v: T) -> Self
6307 where
6308 T: std::convert::Into<wkt::Timestamp>,
6309 {
6310 self.create_time = std::option::Option::Some(v.into());
6311 self
6312 }
6313
6314 /// Sets or clears the value of [create_time][crate::model::ExecutionReference::create_time].
6315 ///
6316 /// # Example
6317 /// ```ignore,no_run
6318 /// # use google_cloud_run_v2::model::ExecutionReference;
6319 /// use wkt::Timestamp;
6320 /// let x = ExecutionReference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6321 /// let x = ExecutionReference::new().set_or_clear_create_time(None::<Timestamp>);
6322 /// ```
6323 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6324 where
6325 T: std::convert::Into<wkt::Timestamp>,
6326 {
6327 self.create_time = v.map(|x| x.into());
6328 self
6329 }
6330
6331 /// Sets the value of [completion_time][crate::model::ExecutionReference::completion_time].
6332 ///
6333 /// # Example
6334 /// ```ignore,no_run
6335 /// # use google_cloud_run_v2::model::ExecutionReference;
6336 /// use wkt::Timestamp;
6337 /// let x = ExecutionReference::new().set_completion_time(Timestamp::default()/* use setters */);
6338 /// ```
6339 pub fn set_completion_time<T>(mut self, v: T) -> Self
6340 where
6341 T: std::convert::Into<wkt::Timestamp>,
6342 {
6343 self.completion_time = std::option::Option::Some(v.into());
6344 self
6345 }
6346
6347 /// Sets or clears the value of [completion_time][crate::model::ExecutionReference::completion_time].
6348 ///
6349 /// # Example
6350 /// ```ignore,no_run
6351 /// # use google_cloud_run_v2::model::ExecutionReference;
6352 /// use wkt::Timestamp;
6353 /// let x = ExecutionReference::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
6354 /// let x = ExecutionReference::new().set_or_clear_completion_time(None::<Timestamp>);
6355 /// ```
6356 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
6357 where
6358 T: std::convert::Into<wkt::Timestamp>,
6359 {
6360 self.completion_time = v.map(|x| x.into());
6361 self
6362 }
6363
6364 /// Sets the value of [delete_time][crate::model::ExecutionReference::delete_time].
6365 ///
6366 /// # Example
6367 /// ```ignore,no_run
6368 /// # use google_cloud_run_v2::model::ExecutionReference;
6369 /// use wkt::Timestamp;
6370 /// let x = ExecutionReference::new().set_delete_time(Timestamp::default()/* use setters */);
6371 /// ```
6372 pub fn set_delete_time<T>(mut self, v: T) -> Self
6373 where
6374 T: std::convert::Into<wkt::Timestamp>,
6375 {
6376 self.delete_time = std::option::Option::Some(v.into());
6377 self
6378 }
6379
6380 /// Sets or clears the value of [delete_time][crate::model::ExecutionReference::delete_time].
6381 ///
6382 /// # Example
6383 /// ```ignore,no_run
6384 /// # use google_cloud_run_v2::model::ExecutionReference;
6385 /// use wkt::Timestamp;
6386 /// let x = ExecutionReference::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
6387 /// let x = ExecutionReference::new().set_or_clear_delete_time(None::<Timestamp>);
6388 /// ```
6389 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
6390 where
6391 T: std::convert::Into<wkt::Timestamp>,
6392 {
6393 self.delete_time = v.map(|x| x.into());
6394 self
6395 }
6396
6397 /// Sets the value of [completion_status][crate::model::ExecutionReference::completion_status].
6398 ///
6399 /// # Example
6400 /// ```ignore,no_run
6401 /// # use google_cloud_run_v2::model::ExecutionReference;
6402 /// use google_cloud_run_v2::model::execution_reference::CompletionStatus;
6403 /// let x0 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionSucceeded);
6404 /// let x1 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionFailed);
6405 /// let x2 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionRunning);
6406 /// ```
6407 pub fn set_completion_status<
6408 T: std::convert::Into<crate::model::execution_reference::CompletionStatus>,
6409 >(
6410 mut self,
6411 v: T,
6412 ) -> Self {
6413 self.completion_status = v.into();
6414 self
6415 }
6416}
6417
6418impl wkt::message::Message for ExecutionReference {
6419 fn typename() -> &'static str {
6420 "type.googleapis.com/google.cloud.run.v2.ExecutionReference"
6421 }
6422}
6423
6424/// Defines additional types related to [ExecutionReference].
6425pub mod execution_reference {
6426 #[allow(unused_imports)]
6427 use super::*;
6428
6429 /// Possible execution completion status.
6430 ///
6431 /// # Working with unknown values
6432 ///
6433 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6434 /// additional enum variants at any time. Adding new variants is not considered
6435 /// a breaking change. Applications should write their code in anticipation of:
6436 ///
6437 /// - New values appearing in future releases of the client library, **and**
6438 /// - New values received dynamically, without application changes.
6439 ///
6440 /// Please consult the [Working with enums] section in the user guide for some
6441 /// guidelines.
6442 ///
6443 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6444 #[derive(Clone, Debug, PartialEq)]
6445 #[non_exhaustive]
6446 pub enum CompletionStatus {
6447 /// The default value. This value is used if the state is omitted.
6448 Unspecified,
6449 /// Job execution has succeeded.
6450 ExecutionSucceeded,
6451 /// Job execution has failed.
6452 ExecutionFailed,
6453 /// Job execution is running normally.
6454 ExecutionRunning,
6455 /// Waiting for backing resources to be provisioned.
6456 ExecutionPending,
6457 /// Job execution has been cancelled by the user.
6458 ExecutionCancelled,
6459 /// If set, the enum was initialized with an unknown value.
6460 ///
6461 /// Applications can examine the value using [CompletionStatus::value] or
6462 /// [CompletionStatus::name].
6463 UnknownValue(completion_status::UnknownValue),
6464 }
6465
6466 #[doc(hidden)]
6467 pub mod completion_status {
6468 #[allow(unused_imports)]
6469 use super::*;
6470 #[derive(Clone, Debug, PartialEq)]
6471 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6472 }
6473
6474 impl CompletionStatus {
6475 /// Gets the enum value.
6476 ///
6477 /// Returns `None` if the enum contains an unknown value deserialized from
6478 /// the string representation of enums.
6479 pub fn value(&self) -> std::option::Option<i32> {
6480 match self {
6481 Self::Unspecified => std::option::Option::Some(0),
6482 Self::ExecutionSucceeded => std::option::Option::Some(1),
6483 Self::ExecutionFailed => std::option::Option::Some(2),
6484 Self::ExecutionRunning => std::option::Option::Some(3),
6485 Self::ExecutionPending => std::option::Option::Some(4),
6486 Self::ExecutionCancelled => std::option::Option::Some(5),
6487 Self::UnknownValue(u) => u.0.value(),
6488 }
6489 }
6490
6491 /// Gets the enum value as a string.
6492 ///
6493 /// Returns `None` if the enum contains an unknown value deserialized from
6494 /// the integer representation of enums.
6495 pub fn name(&self) -> std::option::Option<&str> {
6496 match self {
6497 Self::Unspecified => std::option::Option::Some("COMPLETION_STATUS_UNSPECIFIED"),
6498 Self::ExecutionSucceeded => std::option::Option::Some("EXECUTION_SUCCEEDED"),
6499 Self::ExecutionFailed => std::option::Option::Some("EXECUTION_FAILED"),
6500 Self::ExecutionRunning => std::option::Option::Some("EXECUTION_RUNNING"),
6501 Self::ExecutionPending => std::option::Option::Some("EXECUTION_PENDING"),
6502 Self::ExecutionCancelled => std::option::Option::Some("EXECUTION_CANCELLED"),
6503 Self::UnknownValue(u) => u.0.name(),
6504 }
6505 }
6506 }
6507
6508 impl std::default::Default for CompletionStatus {
6509 fn default() -> Self {
6510 use std::convert::From;
6511 Self::from(0)
6512 }
6513 }
6514
6515 impl std::fmt::Display for CompletionStatus {
6516 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6517 wkt::internal::display_enum(f, self.name(), self.value())
6518 }
6519 }
6520
6521 impl std::convert::From<i32> for CompletionStatus {
6522 fn from(value: i32) -> Self {
6523 match value {
6524 0 => Self::Unspecified,
6525 1 => Self::ExecutionSucceeded,
6526 2 => Self::ExecutionFailed,
6527 3 => Self::ExecutionRunning,
6528 4 => Self::ExecutionPending,
6529 5 => Self::ExecutionCancelled,
6530 _ => Self::UnknownValue(completion_status::UnknownValue(
6531 wkt::internal::UnknownEnumValue::Integer(value),
6532 )),
6533 }
6534 }
6535 }
6536
6537 impl std::convert::From<&str> for CompletionStatus {
6538 fn from(value: &str) -> Self {
6539 use std::string::ToString;
6540 match value {
6541 "COMPLETION_STATUS_UNSPECIFIED" => Self::Unspecified,
6542 "EXECUTION_SUCCEEDED" => Self::ExecutionSucceeded,
6543 "EXECUTION_FAILED" => Self::ExecutionFailed,
6544 "EXECUTION_RUNNING" => Self::ExecutionRunning,
6545 "EXECUTION_PENDING" => Self::ExecutionPending,
6546 "EXECUTION_CANCELLED" => Self::ExecutionCancelled,
6547 _ => Self::UnknownValue(completion_status::UnknownValue(
6548 wkt::internal::UnknownEnumValue::String(value.to_string()),
6549 )),
6550 }
6551 }
6552 }
6553
6554 impl serde::ser::Serialize for CompletionStatus {
6555 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6556 where
6557 S: serde::Serializer,
6558 {
6559 match self {
6560 Self::Unspecified => serializer.serialize_i32(0),
6561 Self::ExecutionSucceeded => serializer.serialize_i32(1),
6562 Self::ExecutionFailed => serializer.serialize_i32(2),
6563 Self::ExecutionRunning => serializer.serialize_i32(3),
6564 Self::ExecutionPending => serializer.serialize_i32(4),
6565 Self::ExecutionCancelled => serializer.serialize_i32(5),
6566 Self::UnknownValue(u) => u.0.serialize(serializer),
6567 }
6568 }
6569 }
6570
6571 impl<'de> serde::de::Deserialize<'de> for CompletionStatus {
6572 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6573 where
6574 D: serde::Deserializer<'de>,
6575 {
6576 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionStatus>::new(
6577 ".google.cloud.run.v2.ExecutionReference.CompletionStatus",
6578 ))
6579 }
6580 }
6581}
6582
6583/// A single application container.
6584/// This specifies both the container to run, the command to run in the container
6585/// and the arguments to supply to it.
6586/// Note that additional arguments can be supplied by the system to the container
6587/// at runtime.
6588#[derive(Clone, Default, PartialEq)]
6589#[non_exhaustive]
6590pub struct Container {
6591 /// Name of the container specified as a DNS_LABEL (RFC 1123).
6592 pub name: std::string::String,
6593
6594 /// Required. Name of the container image in Dockerhub, Google Artifact
6595 /// Registry, or Google Container Registry. If the host is not provided,
6596 /// Dockerhub is assumed.
6597 pub image: std::string::String,
6598
6599 /// Optional. Location of the source.
6600 pub source_code: std::option::Option<crate::model::SourceCode>,
6601
6602 /// Entrypoint array. Not executed within a shell.
6603 /// The docker image's ENTRYPOINT is used if this is not provided.
6604 pub command: std::vec::Vec<std::string::String>,
6605
6606 /// Arguments to the entrypoint.
6607 /// The docker image's CMD is used if this is not provided.
6608 pub args: std::vec::Vec<std::string::String>,
6609
6610 /// List of environment variables to set in the container.
6611 pub env: std::vec::Vec<crate::model::EnvVar>,
6612
6613 /// Compute Resource requirements by this container.
6614 pub resources: std::option::Option<crate::model::ResourceRequirements>,
6615
6616 /// List of ports to expose from the container. Only a single port can be
6617 /// specified. The specified ports must be listening on all interfaces
6618 /// (0.0.0.0) within the container to be accessible.
6619 ///
6620 /// If omitted, a port number will be chosen and passed to the container
6621 /// through the PORT environment variable for the container to listen on.
6622 pub ports: std::vec::Vec<crate::model::ContainerPort>,
6623
6624 /// Volume to mount into the container's filesystem.
6625 pub volume_mounts: std::vec::Vec<crate::model::VolumeMount>,
6626
6627 /// Container's working directory.
6628 /// If not specified, the container runtime's default will be used, which
6629 /// might be configured in the container image.
6630 pub working_dir: std::string::String,
6631
6632 /// Periodic probe of container liveness.
6633 /// Container will be restarted if the probe fails.
6634 pub liveness_probe: std::option::Option<crate::model::Probe>,
6635
6636 /// Startup probe of application within the container.
6637 /// All other probes are disabled if a startup probe is provided, until it
6638 /// succeeds. Container will not be added to service endpoints if the probe
6639 /// fails.
6640 pub startup_probe: std::option::Option<crate::model::Probe>,
6641
6642 /// Readiness probe to be used for health checks.
6643 pub readiness_probe: std::option::Option<crate::model::Probe>,
6644
6645 /// Names of the containers that must start before this container.
6646 pub depends_on: std::vec::Vec<std::string::String>,
6647
6648 /// Base image for this container. Only supported for services. If set, it
6649 /// indicates that the service is enrolled into automatic base image update.
6650 pub base_image_uri: std::string::String,
6651
6652 /// Output only. The build info of the container image.
6653 pub build_info: std::option::Option<crate::model::BuildInfo>,
6654
6655 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6656}
6657
6658impl Container {
6659 /// Creates a new default instance.
6660 pub fn new() -> Self {
6661 std::default::Default::default()
6662 }
6663
6664 /// Sets the value of [name][crate::model::Container::name].
6665 ///
6666 /// # Example
6667 /// ```ignore,no_run
6668 /// # use google_cloud_run_v2::model::Container;
6669 /// let x = Container::new().set_name("example");
6670 /// ```
6671 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6672 self.name = v.into();
6673 self
6674 }
6675
6676 /// Sets the value of [image][crate::model::Container::image].
6677 ///
6678 /// # Example
6679 /// ```ignore,no_run
6680 /// # use google_cloud_run_v2::model::Container;
6681 /// let x = Container::new().set_image("example");
6682 /// ```
6683 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6684 self.image = v.into();
6685 self
6686 }
6687
6688 /// Sets the value of [source_code][crate::model::Container::source_code].
6689 ///
6690 /// # Example
6691 /// ```ignore,no_run
6692 /// # use google_cloud_run_v2::model::Container;
6693 /// use google_cloud_run_v2::model::SourceCode;
6694 /// let x = Container::new().set_source_code(SourceCode::default()/* use setters */);
6695 /// ```
6696 pub fn set_source_code<T>(mut self, v: T) -> Self
6697 where
6698 T: std::convert::Into<crate::model::SourceCode>,
6699 {
6700 self.source_code = std::option::Option::Some(v.into());
6701 self
6702 }
6703
6704 /// Sets or clears the value of [source_code][crate::model::Container::source_code].
6705 ///
6706 /// # Example
6707 /// ```ignore,no_run
6708 /// # use google_cloud_run_v2::model::Container;
6709 /// use google_cloud_run_v2::model::SourceCode;
6710 /// let x = Container::new().set_or_clear_source_code(Some(SourceCode::default()/* use setters */));
6711 /// let x = Container::new().set_or_clear_source_code(None::<SourceCode>);
6712 /// ```
6713 pub fn set_or_clear_source_code<T>(mut self, v: std::option::Option<T>) -> Self
6714 where
6715 T: std::convert::Into<crate::model::SourceCode>,
6716 {
6717 self.source_code = v.map(|x| x.into());
6718 self
6719 }
6720
6721 /// Sets the value of [command][crate::model::Container::command].
6722 ///
6723 /// # Example
6724 /// ```ignore,no_run
6725 /// # use google_cloud_run_v2::model::Container;
6726 /// let x = Container::new().set_command(["a", "b", "c"]);
6727 /// ```
6728 pub fn set_command<T, V>(mut self, v: T) -> Self
6729 where
6730 T: std::iter::IntoIterator<Item = V>,
6731 V: std::convert::Into<std::string::String>,
6732 {
6733 use std::iter::Iterator;
6734 self.command = v.into_iter().map(|i| i.into()).collect();
6735 self
6736 }
6737
6738 /// Sets the value of [args][crate::model::Container::args].
6739 ///
6740 /// # Example
6741 /// ```ignore,no_run
6742 /// # use google_cloud_run_v2::model::Container;
6743 /// let x = Container::new().set_args(["a", "b", "c"]);
6744 /// ```
6745 pub fn set_args<T, V>(mut self, v: T) -> Self
6746 where
6747 T: std::iter::IntoIterator<Item = V>,
6748 V: std::convert::Into<std::string::String>,
6749 {
6750 use std::iter::Iterator;
6751 self.args = v.into_iter().map(|i| i.into()).collect();
6752 self
6753 }
6754
6755 /// Sets the value of [env][crate::model::Container::env].
6756 ///
6757 /// # Example
6758 /// ```ignore,no_run
6759 /// # use google_cloud_run_v2::model::Container;
6760 /// use google_cloud_run_v2::model::EnvVar;
6761 /// let x = Container::new()
6762 /// .set_env([
6763 /// EnvVar::default()/* use setters */,
6764 /// EnvVar::default()/* use (different) setters */,
6765 /// ]);
6766 /// ```
6767 pub fn set_env<T, V>(mut self, v: T) -> Self
6768 where
6769 T: std::iter::IntoIterator<Item = V>,
6770 V: std::convert::Into<crate::model::EnvVar>,
6771 {
6772 use std::iter::Iterator;
6773 self.env = v.into_iter().map(|i| i.into()).collect();
6774 self
6775 }
6776
6777 /// Sets the value of [resources][crate::model::Container::resources].
6778 ///
6779 /// # Example
6780 /// ```ignore,no_run
6781 /// # use google_cloud_run_v2::model::Container;
6782 /// use google_cloud_run_v2::model::ResourceRequirements;
6783 /// let x = Container::new().set_resources(ResourceRequirements::default()/* use setters */);
6784 /// ```
6785 pub fn set_resources<T>(mut self, v: T) -> Self
6786 where
6787 T: std::convert::Into<crate::model::ResourceRequirements>,
6788 {
6789 self.resources = std::option::Option::Some(v.into());
6790 self
6791 }
6792
6793 /// Sets or clears the value of [resources][crate::model::Container::resources].
6794 ///
6795 /// # Example
6796 /// ```ignore,no_run
6797 /// # use google_cloud_run_v2::model::Container;
6798 /// use google_cloud_run_v2::model::ResourceRequirements;
6799 /// let x = Container::new().set_or_clear_resources(Some(ResourceRequirements::default()/* use setters */));
6800 /// let x = Container::new().set_or_clear_resources(None::<ResourceRequirements>);
6801 /// ```
6802 pub fn set_or_clear_resources<T>(mut self, v: std::option::Option<T>) -> Self
6803 where
6804 T: std::convert::Into<crate::model::ResourceRequirements>,
6805 {
6806 self.resources = v.map(|x| x.into());
6807 self
6808 }
6809
6810 /// Sets the value of [ports][crate::model::Container::ports].
6811 ///
6812 /// # Example
6813 /// ```ignore,no_run
6814 /// # use google_cloud_run_v2::model::Container;
6815 /// use google_cloud_run_v2::model::ContainerPort;
6816 /// let x = Container::new()
6817 /// .set_ports([
6818 /// ContainerPort::default()/* use setters */,
6819 /// ContainerPort::default()/* use (different) setters */,
6820 /// ]);
6821 /// ```
6822 pub fn set_ports<T, V>(mut self, v: T) -> Self
6823 where
6824 T: std::iter::IntoIterator<Item = V>,
6825 V: std::convert::Into<crate::model::ContainerPort>,
6826 {
6827 use std::iter::Iterator;
6828 self.ports = v.into_iter().map(|i| i.into()).collect();
6829 self
6830 }
6831
6832 /// Sets the value of [volume_mounts][crate::model::Container::volume_mounts].
6833 ///
6834 /// # Example
6835 /// ```ignore,no_run
6836 /// # use google_cloud_run_v2::model::Container;
6837 /// use google_cloud_run_v2::model::VolumeMount;
6838 /// let x = Container::new()
6839 /// .set_volume_mounts([
6840 /// VolumeMount::default()/* use setters */,
6841 /// VolumeMount::default()/* use (different) setters */,
6842 /// ]);
6843 /// ```
6844 pub fn set_volume_mounts<T, V>(mut self, v: T) -> Self
6845 where
6846 T: std::iter::IntoIterator<Item = V>,
6847 V: std::convert::Into<crate::model::VolumeMount>,
6848 {
6849 use std::iter::Iterator;
6850 self.volume_mounts = v.into_iter().map(|i| i.into()).collect();
6851 self
6852 }
6853
6854 /// Sets the value of [working_dir][crate::model::Container::working_dir].
6855 ///
6856 /// # Example
6857 /// ```ignore,no_run
6858 /// # use google_cloud_run_v2::model::Container;
6859 /// let x = Container::new().set_working_dir("example");
6860 /// ```
6861 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6862 self.working_dir = v.into();
6863 self
6864 }
6865
6866 /// Sets the value of [liveness_probe][crate::model::Container::liveness_probe].
6867 ///
6868 /// # Example
6869 /// ```ignore,no_run
6870 /// # use google_cloud_run_v2::model::Container;
6871 /// use google_cloud_run_v2::model::Probe;
6872 /// let x = Container::new().set_liveness_probe(Probe::default()/* use setters */);
6873 /// ```
6874 pub fn set_liveness_probe<T>(mut self, v: T) -> Self
6875 where
6876 T: std::convert::Into<crate::model::Probe>,
6877 {
6878 self.liveness_probe = std::option::Option::Some(v.into());
6879 self
6880 }
6881
6882 /// Sets or clears the value of [liveness_probe][crate::model::Container::liveness_probe].
6883 ///
6884 /// # Example
6885 /// ```ignore,no_run
6886 /// # use google_cloud_run_v2::model::Container;
6887 /// use google_cloud_run_v2::model::Probe;
6888 /// let x = Container::new().set_or_clear_liveness_probe(Some(Probe::default()/* use setters */));
6889 /// let x = Container::new().set_or_clear_liveness_probe(None::<Probe>);
6890 /// ```
6891 pub fn set_or_clear_liveness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6892 where
6893 T: std::convert::Into<crate::model::Probe>,
6894 {
6895 self.liveness_probe = v.map(|x| x.into());
6896 self
6897 }
6898
6899 /// Sets the value of [startup_probe][crate::model::Container::startup_probe].
6900 ///
6901 /// # Example
6902 /// ```ignore,no_run
6903 /// # use google_cloud_run_v2::model::Container;
6904 /// use google_cloud_run_v2::model::Probe;
6905 /// let x = Container::new().set_startup_probe(Probe::default()/* use setters */);
6906 /// ```
6907 pub fn set_startup_probe<T>(mut self, v: T) -> Self
6908 where
6909 T: std::convert::Into<crate::model::Probe>,
6910 {
6911 self.startup_probe = std::option::Option::Some(v.into());
6912 self
6913 }
6914
6915 /// Sets or clears the value of [startup_probe][crate::model::Container::startup_probe].
6916 ///
6917 /// # Example
6918 /// ```ignore,no_run
6919 /// # use google_cloud_run_v2::model::Container;
6920 /// use google_cloud_run_v2::model::Probe;
6921 /// let x = Container::new().set_or_clear_startup_probe(Some(Probe::default()/* use setters */));
6922 /// let x = Container::new().set_or_clear_startup_probe(None::<Probe>);
6923 /// ```
6924 pub fn set_or_clear_startup_probe<T>(mut self, v: std::option::Option<T>) -> Self
6925 where
6926 T: std::convert::Into<crate::model::Probe>,
6927 {
6928 self.startup_probe = v.map(|x| x.into());
6929 self
6930 }
6931
6932 /// Sets the value of [readiness_probe][crate::model::Container::readiness_probe].
6933 ///
6934 /// # Example
6935 /// ```ignore,no_run
6936 /// # use google_cloud_run_v2::model::Container;
6937 /// use google_cloud_run_v2::model::Probe;
6938 /// let x = Container::new().set_readiness_probe(Probe::default()/* use setters */);
6939 /// ```
6940 pub fn set_readiness_probe<T>(mut self, v: T) -> Self
6941 where
6942 T: std::convert::Into<crate::model::Probe>,
6943 {
6944 self.readiness_probe = std::option::Option::Some(v.into());
6945 self
6946 }
6947
6948 /// Sets or clears the value of [readiness_probe][crate::model::Container::readiness_probe].
6949 ///
6950 /// # Example
6951 /// ```ignore,no_run
6952 /// # use google_cloud_run_v2::model::Container;
6953 /// use google_cloud_run_v2::model::Probe;
6954 /// let x = Container::new().set_or_clear_readiness_probe(Some(Probe::default()/* use setters */));
6955 /// let x = Container::new().set_or_clear_readiness_probe(None::<Probe>);
6956 /// ```
6957 pub fn set_or_clear_readiness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6958 where
6959 T: std::convert::Into<crate::model::Probe>,
6960 {
6961 self.readiness_probe = v.map(|x| x.into());
6962 self
6963 }
6964
6965 /// Sets the value of [depends_on][crate::model::Container::depends_on].
6966 ///
6967 /// # Example
6968 /// ```ignore,no_run
6969 /// # use google_cloud_run_v2::model::Container;
6970 /// let x = Container::new().set_depends_on(["a", "b", "c"]);
6971 /// ```
6972 pub fn set_depends_on<T, V>(mut self, v: T) -> Self
6973 where
6974 T: std::iter::IntoIterator<Item = V>,
6975 V: std::convert::Into<std::string::String>,
6976 {
6977 use std::iter::Iterator;
6978 self.depends_on = v.into_iter().map(|i| i.into()).collect();
6979 self
6980 }
6981
6982 /// Sets the value of [base_image_uri][crate::model::Container::base_image_uri].
6983 ///
6984 /// # Example
6985 /// ```ignore,no_run
6986 /// # use google_cloud_run_v2::model::Container;
6987 /// let x = Container::new().set_base_image_uri("example");
6988 /// ```
6989 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6990 self.base_image_uri = v.into();
6991 self
6992 }
6993
6994 /// Sets the value of [build_info][crate::model::Container::build_info].
6995 ///
6996 /// # Example
6997 /// ```ignore,no_run
6998 /// # use google_cloud_run_v2::model::Container;
6999 /// use google_cloud_run_v2::model::BuildInfo;
7000 /// let x = Container::new().set_build_info(BuildInfo::default()/* use setters */);
7001 /// ```
7002 pub fn set_build_info<T>(mut self, v: T) -> Self
7003 where
7004 T: std::convert::Into<crate::model::BuildInfo>,
7005 {
7006 self.build_info = std::option::Option::Some(v.into());
7007 self
7008 }
7009
7010 /// Sets or clears the value of [build_info][crate::model::Container::build_info].
7011 ///
7012 /// # Example
7013 /// ```ignore,no_run
7014 /// # use google_cloud_run_v2::model::Container;
7015 /// use google_cloud_run_v2::model::BuildInfo;
7016 /// let x = Container::new().set_or_clear_build_info(Some(BuildInfo::default()/* use setters */));
7017 /// let x = Container::new().set_or_clear_build_info(None::<BuildInfo>);
7018 /// ```
7019 pub fn set_or_clear_build_info<T>(mut self, v: std::option::Option<T>) -> Self
7020 where
7021 T: std::convert::Into<crate::model::BuildInfo>,
7022 {
7023 self.build_info = v.map(|x| x.into());
7024 self
7025 }
7026}
7027
7028impl wkt::message::Message for Container {
7029 fn typename() -> &'static str {
7030 "type.googleapis.com/google.cloud.run.v2.Container"
7031 }
7032}
7033
7034/// ResourceRequirements describes the compute resource requirements.
7035#[derive(Clone, Default, PartialEq)]
7036#[non_exhaustive]
7037pub struct ResourceRequirements {
7038 /// Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.
7039 pub limits: std::collections::HashMap<std::string::String, std::string::String>,
7040
7041 /// Determines whether CPU is only allocated during requests (true by default).
7042 /// However, if ResourceRequirements is set, the caller must explicitly
7043 /// set this field to true to preserve the default behavior.
7044 pub cpu_idle: bool,
7045
7046 /// Determines whether CPU should be boosted on startup of a new container
7047 /// instance above the requested CPU threshold, this can help reduce cold-start
7048 /// latency.
7049 pub startup_cpu_boost: bool,
7050
7051 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7052}
7053
7054impl ResourceRequirements {
7055 /// Creates a new default instance.
7056 pub fn new() -> Self {
7057 std::default::Default::default()
7058 }
7059
7060 /// Sets the value of [limits][crate::model::ResourceRequirements::limits].
7061 ///
7062 /// # Example
7063 /// ```ignore,no_run
7064 /// # use google_cloud_run_v2::model::ResourceRequirements;
7065 /// let x = ResourceRequirements::new().set_limits([
7066 /// ("key0", "abc"),
7067 /// ("key1", "xyz"),
7068 /// ]);
7069 /// ```
7070 pub fn set_limits<T, K, V>(mut self, v: T) -> Self
7071 where
7072 T: std::iter::IntoIterator<Item = (K, V)>,
7073 K: std::convert::Into<std::string::String>,
7074 V: std::convert::Into<std::string::String>,
7075 {
7076 use std::iter::Iterator;
7077 self.limits = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7078 self
7079 }
7080
7081 /// Sets the value of [cpu_idle][crate::model::ResourceRequirements::cpu_idle].
7082 ///
7083 /// # Example
7084 /// ```ignore,no_run
7085 /// # use google_cloud_run_v2::model::ResourceRequirements;
7086 /// let x = ResourceRequirements::new().set_cpu_idle(true);
7087 /// ```
7088 pub fn set_cpu_idle<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7089 self.cpu_idle = v.into();
7090 self
7091 }
7092
7093 /// Sets the value of [startup_cpu_boost][crate::model::ResourceRequirements::startup_cpu_boost].
7094 ///
7095 /// # Example
7096 /// ```ignore,no_run
7097 /// # use google_cloud_run_v2::model::ResourceRequirements;
7098 /// let x = ResourceRequirements::new().set_startup_cpu_boost(true);
7099 /// ```
7100 pub fn set_startup_cpu_boost<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7101 self.startup_cpu_boost = v.into();
7102 self
7103 }
7104}
7105
7106impl wkt::message::Message for ResourceRequirements {
7107 fn typename() -> &'static str {
7108 "type.googleapis.com/google.cloud.run.v2.ResourceRequirements"
7109 }
7110}
7111
7112/// EnvVar represents an environment variable present in a Container.
7113#[derive(Clone, Default, PartialEq)]
7114#[non_exhaustive]
7115pub struct EnvVar {
7116 /// Required. Name of the environment variable. Must not exceed 32768
7117 /// characters.
7118 pub name: std::string::String,
7119
7120 #[allow(missing_docs)]
7121 pub values: std::option::Option<crate::model::env_var::Values>,
7122
7123 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7124}
7125
7126impl EnvVar {
7127 /// Creates a new default instance.
7128 pub fn new() -> Self {
7129 std::default::Default::default()
7130 }
7131
7132 /// Sets the value of [name][crate::model::EnvVar::name].
7133 ///
7134 /// # Example
7135 /// ```ignore,no_run
7136 /// # use google_cloud_run_v2::model::EnvVar;
7137 /// let x = EnvVar::new().set_name("example");
7138 /// ```
7139 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7140 self.name = v.into();
7141 self
7142 }
7143
7144 /// Sets the value of [values][crate::model::EnvVar::values].
7145 ///
7146 /// Note that all the setters affecting `values` are mutually
7147 /// exclusive.
7148 ///
7149 /// # Example
7150 /// ```ignore,no_run
7151 /// # use google_cloud_run_v2::model::EnvVar;
7152 /// use google_cloud_run_v2::model::env_var::Values;
7153 /// let x = EnvVar::new().set_values(Some(Values::Value("example".to_string())));
7154 /// ```
7155 pub fn set_values<T: std::convert::Into<std::option::Option<crate::model::env_var::Values>>>(
7156 mut self,
7157 v: T,
7158 ) -> Self {
7159 self.values = v.into();
7160 self
7161 }
7162
7163 /// The value of [values][crate::model::EnvVar::values]
7164 /// if it holds a `Value`, `None` if the field is not set or
7165 /// holds a different branch.
7166 pub fn value(&self) -> std::option::Option<&std::string::String> {
7167 #[allow(unreachable_patterns)]
7168 self.values.as_ref().and_then(|v| match v {
7169 crate::model::env_var::Values::Value(v) => std::option::Option::Some(v),
7170 _ => std::option::Option::None,
7171 })
7172 }
7173
7174 /// Sets the value of [values][crate::model::EnvVar::values]
7175 /// to hold a `Value`.
7176 ///
7177 /// Note that all the setters affecting `values` are
7178 /// mutually exclusive.
7179 ///
7180 /// # Example
7181 /// ```ignore,no_run
7182 /// # use google_cloud_run_v2::model::EnvVar;
7183 /// let x = EnvVar::new().set_value("example");
7184 /// assert!(x.value().is_some());
7185 /// assert!(x.value_source().is_none());
7186 /// ```
7187 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7188 self.values = std::option::Option::Some(crate::model::env_var::Values::Value(v.into()));
7189 self
7190 }
7191
7192 /// The value of [values][crate::model::EnvVar::values]
7193 /// if it holds a `ValueSource`, `None` if the field is not set or
7194 /// holds a different branch.
7195 pub fn value_source(
7196 &self,
7197 ) -> std::option::Option<&std::boxed::Box<crate::model::EnvVarSource>> {
7198 #[allow(unreachable_patterns)]
7199 self.values.as_ref().and_then(|v| match v {
7200 crate::model::env_var::Values::ValueSource(v) => std::option::Option::Some(v),
7201 _ => std::option::Option::None,
7202 })
7203 }
7204
7205 /// Sets the value of [values][crate::model::EnvVar::values]
7206 /// to hold a `ValueSource`.
7207 ///
7208 /// Note that all the setters affecting `values` are
7209 /// mutually exclusive.
7210 ///
7211 /// # Example
7212 /// ```ignore,no_run
7213 /// # use google_cloud_run_v2::model::EnvVar;
7214 /// use google_cloud_run_v2::model::EnvVarSource;
7215 /// let x = EnvVar::new().set_value_source(EnvVarSource::default()/* use setters */);
7216 /// assert!(x.value_source().is_some());
7217 /// assert!(x.value().is_none());
7218 /// ```
7219 pub fn set_value_source<T: std::convert::Into<std::boxed::Box<crate::model::EnvVarSource>>>(
7220 mut self,
7221 v: T,
7222 ) -> Self {
7223 self.values =
7224 std::option::Option::Some(crate::model::env_var::Values::ValueSource(v.into()));
7225 self
7226 }
7227}
7228
7229impl wkt::message::Message for EnvVar {
7230 fn typename() -> &'static str {
7231 "type.googleapis.com/google.cloud.run.v2.EnvVar"
7232 }
7233}
7234
7235/// Defines additional types related to [EnvVar].
7236pub mod env_var {
7237 #[allow(unused_imports)]
7238 use super::*;
7239
7240 #[allow(missing_docs)]
7241 #[derive(Clone, Debug, PartialEq)]
7242 #[non_exhaustive]
7243 pub enum Values {
7244 /// Literal value of the environment variable.
7245 /// Defaults to "", and the maximum length is 32768 bytes.
7246 /// Variable references are not supported in Cloud Run.
7247 Value(std::string::String),
7248 /// Source for the environment variable's value.
7249 ValueSource(std::boxed::Box<crate::model::EnvVarSource>),
7250 }
7251}
7252
7253/// EnvVarSource represents a source for the value of an EnvVar.
7254#[derive(Clone, Default, PartialEq)]
7255#[non_exhaustive]
7256pub struct EnvVarSource {
7257 /// Selects a secret and a specific version from Cloud Secret Manager.
7258 pub secret_key_ref: std::option::Option<crate::model::SecretKeySelector>,
7259
7260 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7261}
7262
7263impl EnvVarSource {
7264 /// Creates a new default instance.
7265 pub fn new() -> Self {
7266 std::default::Default::default()
7267 }
7268
7269 /// Sets the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7270 ///
7271 /// # Example
7272 /// ```ignore,no_run
7273 /// # use google_cloud_run_v2::model::EnvVarSource;
7274 /// use google_cloud_run_v2::model::SecretKeySelector;
7275 /// let x = EnvVarSource::new().set_secret_key_ref(SecretKeySelector::default()/* use setters */);
7276 /// ```
7277 pub fn set_secret_key_ref<T>(mut self, v: T) -> Self
7278 where
7279 T: std::convert::Into<crate::model::SecretKeySelector>,
7280 {
7281 self.secret_key_ref = std::option::Option::Some(v.into());
7282 self
7283 }
7284
7285 /// Sets or clears the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7286 ///
7287 /// # Example
7288 /// ```ignore,no_run
7289 /// # use google_cloud_run_v2::model::EnvVarSource;
7290 /// use google_cloud_run_v2::model::SecretKeySelector;
7291 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(Some(SecretKeySelector::default()/* use setters */));
7292 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(None::<SecretKeySelector>);
7293 /// ```
7294 pub fn set_or_clear_secret_key_ref<T>(mut self, v: std::option::Option<T>) -> Self
7295 where
7296 T: std::convert::Into<crate::model::SecretKeySelector>,
7297 {
7298 self.secret_key_ref = v.map(|x| x.into());
7299 self
7300 }
7301}
7302
7303impl wkt::message::Message for EnvVarSource {
7304 fn typename() -> &'static str {
7305 "type.googleapis.com/google.cloud.run.v2.EnvVarSource"
7306 }
7307}
7308
7309/// SecretEnvVarSource represents a source for the value of an EnvVar.
7310#[derive(Clone, Default, PartialEq)]
7311#[non_exhaustive]
7312pub struct SecretKeySelector {
7313 /// Required. The name of the secret in Cloud Secret Manager.
7314 /// Format: {secret_name} if the secret is in the same project.
7315 /// projects/{project}/secrets/{secret_name} if the secret is
7316 /// in a different project.
7317 pub secret: std::string::String,
7318
7319 /// The Cloud Secret Manager secret version.
7320 /// Can be 'latest' for the latest version, an integer for a specific version,
7321 /// or a version alias.
7322 pub version: std::string::String,
7323
7324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7325}
7326
7327impl SecretKeySelector {
7328 /// Creates a new default instance.
7329 pub fn new() -> Self {
7330 std::default::Default::default()
7331 }
7332
7333 /// Sets the value of [secret][crate::model::SecretKeySelector::secret].
7334 ///
7335 /// # Example
7336 /// ```ignore,no_run
7337 /// # use google_cloud_run_v2::model::SecretKeySelector;
7338 /// let x = SecretKeySelector::new().set_secret("example");
7339 /// ```
7340 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7341 self.secret = v.into();
7342 self
7343 }
7344
7345 /// Sets the value of [version][crate::model::SecretKeySelector::version].
7346 ///
7347 /// # Example
7348 /// ```ignore,no_run
7349 /// # use google_cloud_run_v2::model::SecretKeySelector;
7350 /// let x = SecretKeySelector::new().set_version("example");
7351 /// ```
7352 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7353 self.version = v.into();
7354 self
7355 }
7356}
7357
7358impl wkt::message::Message for SecretKeySelector {
7359 fn typename() -> &'static str {
7360 "type.googleapis.com/google.cloud.run.v2.SecretKeySelector"
7361 }
7362}
7363
7364/// ContainerPort represents a network port in a single container.
7365#[derive(Clone, Default, PartialEq)]
7366#[non_exhaustive]
7367pub struct ContainerPort {
7368 /// If specified, used to specify which protocol to use.
7369 /// Allowed values are "http1" and "h2c".
7370 pub name: std::string::String,
7371
7372 /// Port number the container listens on.
7373 /// This must be a valid TCP port number, 0 < container_port < 65536.
7374 pub container_port: i32,
7375
7376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7377}
7378
7379impl ContainerPort {
7380 /// Creates a new default instance.
7381 pub fn new() -> Self {
7382 std::default::Default::default()
7383 }
7384
7385 /// Sets the value of [name][crate::model::ContainerPort::name].
7386 ///
7387 /// # Example
7388 /// ```ignore,no_run
7389 /// # use google_cloud_run_v2::model::ContainerPort;
7390 /// let x = ContainerPort::new().set_name("example");
7391 /// ```
7392 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7393 self.name = v.into();
7394 self
7395 }
7396
7397 /// Sets the value of [container_port][crate::model::ContainerPort::container_port].
7398 ///
7399 /// # Example
7400 /// ```ignore,no_run
7401 /// # use google_cloud_run_v2::model::ContainerPort;
7402 /// let x = ContainerPort::new().set_container_port(42);
7403 /// ```
7404 pub fn set_container_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7405 self.container_port = v.into();
7406 self
7407 }
7408}
7409
7410impl wkt::message::Message for ContainerPort {
7411 fn typename() -> &'static str {
7412 "type.googleapis.com/google.cloud.run.v2.ContainerPort"
7413 }
7414}
7415
7416/// VolumeMount describes a mounting of a Volume within a container.
7417#[derive(Clone, Default, PartialEq)]
7418#[non_exhaustive]
7419pub struct VolumeMount {
7420 /// Required. This must match the Name of a Volume.
7421 pub name: std::string::String,
7422
7423 /// Required. Path within the container at which the volume should be mounted.
7424 /// Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must
7425 /// otherwise be `/cloudsql`. All instances defined in the Volume will be
7426 /// available as `/cloudsql/[instance]`. For more information on Cloud SQL
7427 /// volumes, visit <https://cloud.google.com/sql/docs/mysql/connect-run>
7428 pub mount_path: std::string::String,
7429
7430 /// Optional. Path within the volume from which the container's volume should
7431 /// be mounted. Defaults to "" (volume's root).
7432 pub sub_path: std::string::String,
7433
7434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7435}
7436
7437impl VolumeMount {
7438 /// Creates a new default instance.
7439 pub fn new() -> Self {
7440 std::default::Default::default()
7441 }
7442
7443 /// Sets the value of [name][crate::model::VolumeMount::name].
7444 ///
7445 /// # Example
7446 /// ```ignore,no_run
7447 /// # use google_cloud_run_v2::model::VolumeMount;
7448 /// let x = VolumeMount::new().set_name("example");
7449 /// ```
7450 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7451 self.name = v.into();
7452 self
7453 }
7454
7455 /// Sets the value of [mount_path][crate::model::VolumeMount::mount_path].
7456 ///
7457 /// # Example
7458 /// ```ignore,no_run
7459 /// # use google_cloud_run_v2::model::VolumeMount;
7460 /// let x = VolumeMount::new().set_mount_path("example");
7461 /// ```
7462 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7463 self.mount_path = v.into();
7464 self
7465 }
7466
7467 /// Sets the value of [sub_path][crate::model::VolumeMount::sub_path].
7468 ///
7469 /// # Example
7470 /// ```ignore,no_run
7471 /// # use google_cloud_run_v2::model::VolumeMount;
7472 /// let x = VolumeMount::new().set_sub_path("example");
7473 /// ```
7474 pub fn set_sub_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7475 self.sub_path = v.into();
7476 self
7477 }
7478}
7479
7480impl wkt::message::Message for VolumeMount {
7481 fn typename() -> &'static str {
7482 "type.googleapis.com/google.cloud.run.v2.VolumeMount"
7483 }
7484}
7485
7486/// Volume represents a named volume in a container.
7487#[derive(Clone, Default, PartialEq)]
7488#[non_exhaustive]
7489pub struct Volume {
7490 /// Required. Volume's name.
7491 pub name: std::string::String,
7492
7493 #[allow(missing_docs)]
7494 pub volume_type: std::option::Option<crate::model::volume::VolumeType>,
7495
7496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7497}
7498
7499impl Volume {
7500 /// Creates a new default instance.
7501 pub fn new() -> Self {
7502 std::default::Default::default()
7503 }
7504
7505 /// Sets the value of [name][crate::model::Volume::name].
7506 ///
7507 /// # Example
7508 /// ```ignore,no_run
7509 /// # use google_cloud_run_v2::model::Volume;
7510 /// let x = Volume::new().set_name("example");
7511 /// ```
7512 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7513 self.name = v.into();
7514 self
7515 }
7516
7517 /// Sets the value of [volume_type][crate::model::Volume::volume_type].
7518 ///
7519 /// Note that all the setters affecting `volume_type` are mutually
7520 /// exclusive.
7521 ///
7522 /// # Example
7523 /// ```ignore,no_run
7524 /// # use google_cloud_run_v2::model::Volume;
7525 /// use google_cloud_run_v2::model::SecretVolumeSource;
7526 /// let x = Volume::new().set_volume_type(Some(
7527 /// google_cloud_run_v2::model::volume::VolumeType::Secret(SecretVolumeSource::default().into())));
7528 /// ```
7529 pub fn set_volume_type<
7530 T: std::convert::Into<std::option::Option<crate::model::volume::VolumeType>>,
7531 >(
7532 mut self,
7533 v: T,
7534 ) -> Self {
7535 self.volume_type = v.into();
7536 self
7537 }
7538
7539 /// The value of [volume_type][crate::model::Volume::volume_type]
7540 /// if it holds a `Secret`, `None` if the field is not set or
7541 /// holds a different branch.
7542 pub fn secret(
7543 &self,
7544 ) -> std::option::Option<&std::boxed::Box<crate::model::SecretVolumeSource>> {
7545 #[allow(unreachable_patterns)]
7546 self.volume_type.as_ref().and_then(|v| match v {
7547 crate::model::volume::VolumeType::Secret(v) => std::option::Option::Some(v),
7548 _ => std::option::Option::None,
7549 })
7550 }
7551
7552 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7553 /// to hold a `Secret`.
7554 ///
7555 /// Note that all the setters affecting `volume_type` are
7556 /// mutually exclusive.
7557 ///
7558 /// # Example
7559 /// ```ignore,no_run
7560 /// # use google_cloud_run_v2::model::Volume;
7561 /// use google_cloud_run_v2::model::SecretVolumeSource;
7562 /// let x = Volume::new().set_secret(SecretVolumeSource::default()/* use setters */);
7563 /// assert!(x.secret().is_some());
7564 /// assert!(x.cloud_sql_instance().is_none());
7565 /// assert!(x.empty_dir().is_none());
7566 /// assert!(x.nfs().is_none());
7567 /// assert!(x.gcs().is_none());
7568 /// ```
7569 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretVolumeSource>>>(
7570 mut self,
7571 v: T,
7572 ) -> Self {
7573 self.volume_type =
7574 std::option::Option::Some(crate::model::volume::VolumeType::Secret(v.into()));
7575 self
7576 }
7577
7578 /// The value of [volume_type][crate::model::Volume::volume_type]
7579 /// if it holds a `CloudSqlInstance`, `None` if the field is not set or
7580 /// holds a different branch.
7581 pub fn cloud_sql_instance(
7582 &self,
7583 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSqlInstance>> {
7584 #[allow(unreachable_patterns)]
7585 self.volume_type.as_ref().and_then(|v| match v {
7586 crate::model::volume::VolumeType::CloudSqlInstance(v) => std::option::Option::Some(v),
7587 _ => std::option::Option::None,
7588 })
7589 }
7590
7591 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7592 /// to hold a `CloudSqlInstance`.
7593 ///
7594 /// Note that all the setters affecting `volume_type` are
7595 /// mutually exclusive.
7596 ///
7597 /// # Example
7598 /// ```ignore,no_run
7599 /// # use google_cloud_run_v2::model::Volume;
7600 /// use google_cloud_run_v2::model::CloudSqlInstance;
7601 /// let x = Volume::new().set_cloud_sql_instance(CloudSqlInstance::default()/* use setters */);
7602 /// assert!(x.cloud_sql_instance().is_some());
7603 /// assert!(x.secret().is_none());
7604 /// assert!(x.empty_dir().is_none());
7605 /// assert!(x.nfs().is_none());
7606 /// assert!(x.gcs().is_none());
7607 /// ```
7608 pub fn set_cloud_sql_instance<
7609 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlInstance>>,
7610 >(
7611 mut self,
7612 v: T,
7613 ) -> Self {
7614 self.volume_type =
7615 std::option::Option::Some(crate::model::volume::VolumeType::CloudSqlInstance(v.into()));
7616 self
7617 }
7618
7619 /// The value of [volume_type][crate::model::Volume::volume_type]
7620 /// if it holds a `EmptyDir`, `None` if the field is not set or
7621 /// holds a different branch.
7622 pub fn empty_dir(
7623 &self,
7624 ) -> std::option::Option<&std::boxed::Box<crate::model::EmptyDirVolumeSource>> {
7625 #[allow(unreachable_patterns)]
7626 self.volume_type.as_ref().and_then(|v| match v {
7627 crate::model::volume::VolumeType::EmptyDir(v) => std::option::Option::Some(v),
7628 _ => std::option::Option::None,
7629 })
7630 }
7631
7632 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7633 /// to hold a `EmptyDir`.
7634 ///
7635 /// Note that all the setters affecting `volume_type` are
7636 /// mutually exclusive.
7637 ///
7638 /// # Example
7639 /// ```ignore,no_run
7640 /// # use google_cloud_run_v2::model::Volume;
7641 /// use google_cloud_run_v2::model::EmptyDirVolumeSource;
7642 /// let x = Volume::new().set_empty_dir(EmptyDirVolumeSource::default()/* use setters */);
7643 /// assert!(x.empty_dir().is_some());
7644 /// assert!(x.secret().is_none());
7645 /// assert!(x.cloud_sql_instance().is_none());
7646 /// assert!(x.nfs().is_none());
7647 /// assert!(x.gcs().is_none());
7648 /// ```
7649 pub fn set_empty_dir<
7650 T: std::convert::Into<std::boxed::Box<crate::model::EmptyDirVolumeSource>>,
7651 >(
7652 mut self,
7653 v: T,
7654 ) -> Self {
7655 self.volume_type =
7656 std::option::Option::Some(crate::model::volume::VolumeType::EmptyDir(v.into()));
7657 self
7658 }
7659
7660 /// The value of [volume_type][crate::model::Volume::volume_type]
7661 /// if it holds a `Nfs`, `None` if the field is not set or
7662 /// holds a different branch.
7663 pub fn nfs(&self) -> std::option::Option<&std::boxed::Box<crate::model::NFSVolumeSource>> {
7664 #[allow(unreachable_patterns)]
7665 self.volume_type.as_ref().and_then(|v| match v {
7666 crate::model::volume::VolumeType::Nfs(v) => std::option::Option::Some(v),
7667 _ => std::option::Option::None,
7668 })
7669 }
7670
7671 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7672 /// to hold a `Nfs`.
7673 ///
7674 /// Note that all the setters affecting `volume_type` are
7675 /// mutually exclusive.
7676 ///
7677 /// # Example
7678 /// ```ignore,no_run
7679 /// # use google_cloud_run_v2::model::Volume;
7680 /// use google_cloud_run_v2::model::NFSVolumeSource;
7681 /// let x = Volume::new().set_nfs(NFSVolumeSource::default()/* use setters */);
7682 /// assert!(x.nfs().is_some());
7683 /// assert!(x.secret().is_none());
7684 /// assert!(x.cloud_sql_instance().is_none());
7685 /// assert!(x.empty_dir().is_none());
7686 /// assert!(x.gcs().is_none());
7687 /// ```
7688 pub fn set_nfs<T: std::convert::Into<std::boxed::Box<crate::model::NFSVolumeSource>>>(
7689 mut self,
7690 v: T,
7691 ) -> Self {
7692 self.volume_type =
7693 std::option::Option::Some(crate::model::volume::VolumeType::Nfs(v.into()));
7694 self
7695 }
7696
7697 /// The value of [volume_type][crate::model::Volume::volume_type]
7698 /// if it holds a `Gcs`, `None` if the field is not set or
7699 /// holds a different branch.
7700 pub fn gcs(&self) -> std::option::Option<&std::boxed::Box<crate::model::GCSVolumeSource>> {
7701 #[allow(unreachable_patterns)]
7702 self.volume_type.as_ref().and_then(|v| match v {
7703 crate::model::volume::VolumeType::Gcs(v) => std::option::Option::Some(v),
7704 _ => std::option::Option::None,
7705 })
7706 }
7707
7708 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7709 /// to hold a `Gcs`.
7710 ///
7711 /// Note that all the setters affecting `volume_type` are
7712 /// mutually exclusive.
7713 ///
7714 /// # Example
7715 /// ```ignore,no_run
7716 /// # use google_cloud_run_v2::model::Volume;
7717 /// use google_cloud_run_v2::model::GCSVolumeSource;
7718 /// let x = Volume::new().set_gcs(GCSVolumeSource::default()/* use setters */);
7719 /// assert!(x.gcs().is_some());
7720 /// assert!(x.secret().is_none());
7721 /// assert!(x.cloud_sql_instance().is_none());
7722 /// assert!(x.empty_dir().is_none());
7723 /// assert!(x.nfs().is_none());
7724 /// ```
7725 pub fn set_gcs<T: std::convert::Into<std::boxed::Box<crate::model::GCSVolumeSource>>>(
7726 mut self,
7727 v: T,
7728 ) -> Self {
7729 self.volume_type =
7730 std::option::Option::Some(crate::model::volume::VolumeType::Gcs(v.into()));
7731 self
7732 }
7733}
7734
7735impl wkt::message::Message for Volume {
7736 fn typename() -> &'static str {
7737 "type.googleapis.com/google.cloud.run.v2.Volume"
7738 }
7739}
7740
7741/// Defines additional types related to [Volume].
7742pub mod volume {
7743 #[allow(unused_imports)]
7744 use super::*;
7745
7746 #[allow(missing_docs)]
7747 #[derive(Clone, Debug, PartialEq)]
7748 #[non_exhaustive]
7749 pub enum VolumeType {
7750 /// Secret represents a secret that should populate this volume.
7751 Secret(std::boxed::Box<crate::model::SecretVolumeSource>),
7752 /// For Cloud SQL volumes, contains the specific instances that should be
7753 /// mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
7754 /// more information on how to connect Cloud SQL and Cloud Run.
7755 CloudSqlInstance(std::boxed::Box<crate::model::CloudSqlInstance>),
7756 /// Ephemeral storage used as a shared volume.
7757 EmptyDir(std::boxed::Box<crate::model::EmptyDirVolumeSource>),
7758 /// For NFS Voumes, contains the path to the nfs Volume
7759 Nfs(std::boxed::Box<crate::model::NFSVolumeSource>),
7760 /// Persistent storage backed by a Google Cloud Storage bucket.
7761 Gcs(std::boxed::Box<crate::model::GCSVolumeSource>),
7762 }
7763}
7764
7765/// The secret's value will be presented as the content of a file whose
7766/// name is defined in the item path. If no items are defined, the name of
7767/// the file is the secret.
7768#[derive(Clone, Default, PartialEq)]
7769#[non_exhaustive]
7770pub struct SecretVolumeSource {
7771 /// Required. The name of the secret in Cloud Secret Manager.
7772 /// Format: {secret} if the secret is in the same project.
7773 /// projects/{project}/secrets/{secret} if the secret is
7774 /// in a different project.
7775 pub secret: std::string::String,
7776
7777 /// If unspecified, the volume will expose a file whose name is the
7778 /// secret, relative to VolumeMount.mount_path + VolumeMount.sub_path.
7779 /// If specified, the key will be used as the version to fetch from Cloud
7780 /// Secret Manager and the path will be the name of the file exposed in the
7781 /// volume. When items are defined, they must specify a path and a version.
7782 pub items: std::vec::Vec<crate::model::VersionToPath>,
7783
7784 /// Integer representation of mode bits to use on created files by default.
7785 /// Must be a value between 0000 and 0777 (octal), defaulting to 0444.
7786 /// Directories within the path are not affected by this setting.
7787 ///
7788 /// Notes
7789 ///
7790 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7791 /// * This is an integer representation of the mode bits. So, the octal
7792 /// integer value should look exactly as the chmod numeric notation with a
7793 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7794 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7795 /// 493 (base-10).
7796 /// * This might be in conflict with other options that affect the
7797 /// file mode, like fsGroup, and the result can be other mode bits set.
7798 ///
7799 /// This might be in conflict with other options that affect the
7800 /// file mode, like fsGroup, and as a result, other mode bits could be set.
7801 pub default_mode: i32,
7802
7803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7804}
7805
7806impl SecretVolumeSource {
7807 /// Creates a new default instance.
7808 pub fn new() -> Self {
7809 std::default::Default::default()
7810 }
7811
7812 /// Sets the value of [secret][crate::model::SecretVolumeSource::secret].
7813 ///
7814 /// # Example
7815 /// ```ignore,no_run
7816 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7817 /// let x = SecretVolumeSource::new().set_secret("example");
7818 /// ```
7819 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7820 self.secret = v.into();
7821 self
7822 }
7823
7824 /// Sets the value of [items][crate::model::SecretVolumeSource::items].
7825 ///
7826 /// # Example
7827 /// ```ignore,no_run
7828 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7829 /// use google_cloud_run_v2::model::VersionToPath;
7830 /// let x = SecretVolumeSource::new()
7831 /// .set_items([
7832 /// VersionToPath::default()/* use setters */,
7833 /// VersionToPath::default()/* use (different) setters */,
7834 /// ]);
7835 /// ```
7836 pub fn set_items<T, V>(mut self, v: T) -> Self
7837 where
7838 T: std::iter::IntoIterator<Item = V>,
7839 V: std::convert::Into<crate::model::VersionToPath>,
7840 {
7841 use std::iter::Iterator;
7842 self.items = v.into_iter().map(|i| i.into()).collect();
7843 self
7844 }
7845
7846 /// Sets the value of [default_mode][crate::model::SecretVolumeSource::default_mode].
7847 ///
7848 /// # Example
7849 /// ```ignore,no_run
7850 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7851 /// let x = SecretVolumeSource::new().set_default_mode(42);
7852 /// ```
7853 pub fn set_default_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7854 self.default_mode = v.into();
7855 self
7856 }
7857}
7858
7859impl wkt::message::Message for SecretVolumeSource {
7860 fn typename() -> &'static str {
7861 "type.googleapis.com/google.cloud.run.v2.SecretVolumeSource"
7862 }
7863}
7864
7865/// VersionToPath maps a specific version of a secret to a relative file to mount
7866/// to, relative to VolumeMount's mount_path.
7867#[derive(Clone, Default, PartialEq)]
7868#[non_exhaustive]
7869pub struct VersionToPath {
7870 /// Required. The relative path of the secret in the container.
7871 pub path: std::string::String,
7872
7873 /// The Cloud Secret Manager secret version.
7874 /// Can be 'latest' for the latest value, or an integer or a secret alias for a
7875 /// specific version.
7876 pub version: std::string::String,
7877
7878 /// Integer octal mode bits to use on this file, must be a value between
7879 /// 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
7880 /// used.
7881 ///
7882 /// Notes
7883 ///
7884 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7885 /// * This is an integer representation of the mode bits. So, the octal
7886 /// integer value should look exactly as the chmod numeric notation with a
7887 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7888 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7889 /// 493 (base-10).
7890 /// * This might be in conflict with other options that affect the
7891 /// file mode, like fsGroup, and the result can be other mode bits set.
7892 pub mode: i32,
7893
7894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7895}
7896
7897impl VersionToPath {
7898 /// Creates a new default instance.
7899 pub fn new() -> Self {
7900 std::default::Default::default()
7901 }
7902
7903 /// Sets the value of [path][crate::model::VersionToPath::path].
7904 ///
7905 /// # Example
7906 /// ```ignore,no_run
7907 /// # use google_cloud_run_v2::model::VersionToPath;
7908 /// let x = VersionToPath::new().set_path("example");
7909 /// ```
7910 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7911 self.path = v.into();
7912 self
7913 }
7914
7915 /// Sets the value of [version][crate::model::VersionToPath::version].
7916 ///
7917 /// # Example
7918 /// ```ignore,no_run
7919 /// # use google_cloud_run_v2::model::VersionToPath;
7920 /// let x = VersionToPath::new().set_version("example");
7921 /// ```
7922 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7923 self.version = v.into();
7924 self
7925 }
7926
7927 /// Sets the value of [mode][crate::model::VersionToPath::mode].
7928 ///
7929 /// # Example
7930 /// ```ignore,no_run
7931 /// # use google_cloud_run_v2::model::VersionToPath;
7932 /// let x = VersionToPath::new().set_mode(42);
7933 /// ```
7934 pub fn set_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7935 self.mode = v.into();
7936 self
7937 }
7938}
7939
7940impl wkt::message::Message for VersionToPath {
7941 fn typename() -> &'static str {
7942 "type.googleapis.com/google.cloud.run.v2.VersionToPath"
7943 }
7944}
7945
7946/// Represents a set of Cloud SQL instances. Each one will be available under
7947/// /cloudsql/[instance]. Visit
7948/// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
7949/// how to connect Cloud SQL and Cloud Run.
7950#[derive(Clone, Default, PartialEq)]
7951#[non_exhaustive]
7952pub struct CloudSqlInstance {
7953 /// The Cloud SQL instance connection names, as can be found in
7954 /// <https://console.cloud.google.com/sql/instances>. Visit
7955 /// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
7956 /// how to connect Cloud SQL and Cloud Run. Format:
7957 /// {project}:{location}:{instance}
7958 pub instances: std::vec::Vec<std::string::String>,
7959
7960 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7961}
7962
7963impl CloudSqlInstance {
7964 /// Creates a new default instance.
7965 pub fn new() -> Self {
7966 std::default::Default::default()
7967 }
7968
7969 /// Sets the value of [instances][crate::model::CloudSqlInstance::instances].
7970 ///
7971 /// # Example
7972 /// ```ignore,no_run
7973 /// # use google_cloud_run_v2::model::CloudSqlInstance;
7974 /// let x = CloudSqlInstance::new().set_instances(["a", "b", "c"]);
7975 /// ```
7976 pub fn set_instances<T, V>(mut self, v: T) -> Self
7977 where
7978 T: std::iter::IntoIterator<Item = V>,
7979 V: std::convert::Into<std::string::String>,
7980 {
7981 use std::iter::Iterator;
7982 self.instances = v.into_iter().map(|i| i.into()).collect();
7983 self
7984 }
7985}
7986
7987impl wkt::message::Message for CloudSqlInstance {
7988 fn typename() -> &'static str {
7989 "type.googleapis.com/google.cloud.run.v2.CloudSqlInstance"
7990 }
7991}
7992
7993/// In memory (tmpfs) ephemeral storage.
7994/// It is ephemeral in the sense that when the sandbox is taken down, the data is
7995/// destroyed with it (it does not persist across sandbox runs).
7996#[derive(Clone, Default, PartialEq)]
7997#[non_exhaustive]
7998pub struct EmptyDirVolumeSource {
7999 /// The medium on which the data is stored. Acceptable values today is only
8000 /// MEMORY or none. When none, the default will currently be backed by memory
8001 /// but could change over time. +optional
8002 pub medium: crate::model::empty_dir_volume_source::Medium,
8003
8004 /// Limit on the storage usable by this EmptyDir volume.
8005 /// The size limit is also applicable for memory medium.
8006 /// The maximum usage on memory medium EmptyDir would be the minimum value
8007 /// between the SizeLimit specified here and the sum of memory limits of all
8008 /// containers. The default is nil which means that the limit is undefined.
8009 /// More info:
8010 /// <https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume>.
8011 /// Info in Kubernetes:
8012 /// <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir>
8013 pub size_limit: std::string::String,
8014
8015 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8016}
8017
8018impl EmptyDirVolumeSource {
8019 /// Creates a new default instance.
8020 pub fn new() -> Self {
8021 std::default::Default::default()
8022 }
8023
8024 /// Sets the value of [medium][crate::model::EmptyDirVolumeSource::medium].
8025 ///
8026 /// # Example
8027 /// ```ignore,no_run
8028 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
8029 /// use google_cloud_run_v2::model::empty_dir_volume_source::Medium;
8030 /// let x0 = EmptyDirVolumeSource::new().set_medium(Medium::Memory);
8031 /// ```
8032 pub fn set_medium<T: std::convert::Into<crate::model::empty_dir_volume_source::Medium>>(
8033 mut self,
8034 v: T,
8035 ) -> Self {
8036 self.medium = v.into();
8037 self
8038 }
8039
8040 /// Sets the value of [size_limit][crate::model::EmptyDirVolumeSource::size_limit].
8041 ///
8042 /// # Example
8043 /// ```ignore,no_run
8044 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
8045 /// let x = EmptyDirVolumeSource::new().set_size_limit("example");
8046 /// ```
8047 pub fn set_size_limit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8048 self.size_limit = v.into();
8049 self
8050 }
8051}
8052
8053impl wkt::message::Message for EmptyDirVolumeSource {
8054 fn typename() -> &'static str {
8055 "type.googleapis.com/google.cloud.run.v2.EmptyDirVolumeSource"
8056 }
8057}
8058
8059/// Defines additional types related to [EmptyDirVolumeSource].
8060pub mod empty_dir_volume_source {
8061 #[allow(unused_imports)]
8062 use super::*;
8063
8064 /// The different types of medium supported for EmptyDir.
8065 ///
8066 /// # Working with unknown values
8067 ///
8068 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8069 /// additional enum variants at any time. Adding new variants is not considered
8070 /// a breaking change. Applications should write their code in anticipation of:
8071 ///
8072 /// - New values appearing in future releases of the client library, **and**
8073 /// - New values received dynamically, without application changes.
8074 ///
8075 /// Please consult the [Working with enums] section in the user guide for some
8076 /// guidelines.
8077 ///
8078 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8079 #[derive(Clone, Debug, PartialEq)]
8080 #[non_exhaustive]
8081 pub enum Medium {
8082 /// When not specified, falls back to the default implementation which
8083 /// is currently in memory (this may change over time).
8084 Unspecified,
8085 /// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
8086 Memory,
8087 /// If set, the enum was initialized with an unknown value.
8088 ///
8089 /// Applications can examine the value using [Medium::value] or
8090 /// [Medium::name].
8091 UnknownValue(medium::UnknownValue),
8092 }
8093
8094 #[doc(hidden)]
8095 pub mod medium {
8096 #[allow(unused_imports)]
8097 use super::*;
8098 #[derive(Clone, Debug, PartialEq)]
8099 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8100 }
8101
8102 impl Medium {
8103 /// Gets the enum value.
8104 ///
8105 /// Returns `None` if the enum contains an unknown value deserialized from
8106 /// the string representation of enums.
8107 pub fn value(&self) -> std::option::Option<i32> {
8108 match self {
8109 Self::Unspecified => std::option::Option::Some(0),
8110 Self::Memory => std::option::Option::Some(1),
8111 Self::UnknownValue(u) => u.0.value(),
8112 }
8113 }
8114
8115 /// Gets the enum value as a string.
8116 ///
8117 /// Returns `None` if the enum contains an unknown value deserialized from
8118 /// the integer representation of enums.
8119 pub fn name(&self) -> std::option::Option<&str> {
8120 match self {
8121 Self::Unspecified => std::option::Option::Some("MEDIUM_UNSPECIFIED"),
8122 Self::Memory => std::option::Option::Some("MEMORY"),
8123 Self::UnknownValue(u) => u.0.name(),
8124 }
8125 }
8126 }
8127
8128 impl std::default::Default for Medium {
8129 fn default() -> Self {
8130 use std::convert::From;
8131 Self::from(0)
8132 }
8133 }
8134
8135 impl std::fmt::Display for Medium {
8136 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8137 wkt::internal::display_enum(f, self.name(), self.value())
8138 }
8139 }
8140
8141 impl std::convert::From<i32> for Medium {
8142 fn from(value: i32) -> Self {
8143 match value {
8144 0 => Self::Unspecified,
8145 1 => Self::Memory,
8146 _ => Self::UnknownValue(medium::UnknownValue(
8147 wkt::internal::UnknownEnumValue::Integer(value),
8148 )),
8149 }
8150 }
8151 }
8152
8153 impl std::convert::From<&str> for Medium {
8154 fn from(value: &str) -> Self {
8155 use std::string::ToString;
8156 match value {
8157 "MEDIUM_UNSPECIFIED" => Self::Unspecified,
8158 "MEMORY" => Self::Memory,
8159 _ => Self::UnknownValue(medium::UnknownValue(
8160 wkt::internal::UnknownEnumValue::String(value.to_string()),
8161 )),
8162 }
8163 }
8164 }
8165
8166 impl serde::ser::Serialize for Medium {
8167 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8168 where
8169 S: serde::Serializer,
8170 {
8171 match self {
8172 Self::Unspecified => serializer.serialize_i32(0),
8173 Self::Memory => serializer.serialize_i32(1),
8174 Self::UnknownValue(u) => u.0.serialize(serializer),
8175 }
8176 }
8177 }
8178
8179 impl<'de> serde::de::Deserialize<'de> for Medium {
8180 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8181 where
8182 D: serde::Deserializer<'de>,
8183 {
8184 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Medium>::new(
8185 ".google.cloud.run.v2.EmptyDirVolumeSource.Medium",
8186 ))
8187 }
8188 }
8189}
8190
8191/// Represents an NFS mount.
8192#[derive(Clone, Default, PartialEq)]
8193#[non_exhaustive]
8194pub struct NFSVolumeSource {
8195 /// Hostname or IP address of the NFS server
8196 pub server: std::string::String,
8197
8198 /// Path that is exported by the NFS server.
8199 pub path: std::string::String,
8200
8201 /// If true, the volume will be mounted as read only for all mounts.
8202 pub read_only: bool,
8203
8204 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8205}
8206
8207impl NFSVolumeSource {
8208 /// Creates a new default instance.
8209 pub fn new() -> Self {
8210 std::default::Default::default()
8211 }
8212
8213 /// Sets the value of [server][crate::model::NFSVolumeSource::server].
8214 ///
8215 /// # Example
8216 /// ```ignore,no_run
8217 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8218 /// let x = NFSVolumeSource::new().set_server("example");
8219 /// ```
8220 pub fn set_server<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8221 self.server = v.into();
8222 self
8223 }
8224
8225 /// Sets the value of [path][crate::model::NFSVolumeSource::path].
8226 ///
8227 /// # Example
8228 /// ```ignore,no_run
8229 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8230 /// let x = NFSVolumeSource::new().set_path("example");
8231 /// ```
8232 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8233 self.path = v.into();
8234 self
8235 }
8236
8237 /// Sets the value of [read_only][crate::model::NFSVolumeSource::read_only].
8238 ///
8239 /// # Example
8240 /// ```ignore,no_run
8241 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8242 /// let x = NFSVolumeSource::new().set_read_only(true);
8243 /// ```
8244 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8245 self.read_only = v.into();
8246 self
8247 }
8248}
8249
8250impl wkt::message::Message for NFSVolumeSource {
8251 fn typename() -> &'static str {
8252 "type.googleapis.com/google.cloud.run.v2.NFSVolumeSource"
8253 }
8254}
8255
8256/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage
8257/// FUSE.
8258#[derive(Clone, Default, PartialEq)]
8259#[non_exhaustive]
8260pub struct GCSVolumeSource {
8261 /// Cloud Storage Bucket name.
8262 pub bucket: std::string::String,
8263
8264 /// If true, the volume will be mounted as read only for all mounts.
8265 pub read_only: bool,
8266
8267 /// A list of additional flags to pass to the gcsfuse CLI.
8268 /// Options should be specified without the leading "--".
8269 pub mount_options: std::vec::Vec<std::string::String>,
8270
8271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8272}
8273
8274impl GCSVolumeSource {
8275 /// Creates a new default instance.
8276 pub fn new() -> Self {
8277 std::default::Default::default()
8278 }
8279
8280 /// Sets the value of [bucket][crate::model::GCSVolumeSource::bucket].
8281 ///
8282 /// # Example
8283 /// ```ignore,no_run
8284 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8285 /// let x = GCSVolumeSource::new().set_bucket("example");
8286 /// ```
8287 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8288 self.bucket = v.into();
8289 self
8290 }
8291
8292 /// Sets the value of [read_only][crate::model::GCSVolumeSource::read_only].
8293 ///
8294 /// # Example
8295 /// ```ignore,no_run
8296 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8297 /// let x = GCSVolumeSource::new().set_read_only(true);
8298 /// ```
8299 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8300 self.read_only = v.into();
8301 self
8302 }
8303
8304 /// Sets the value of [mount_options][crate::model::GCSVolumeSource::mount_options].
8305 ///
8306 /// # Example
8307 /// ```ignore,no_run
8308 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8309 /// let x = GCSVolumeSource::new().set_mount_options(["a", "b", "c"]);
8310 /// ```
8311 pub fn set_mount_options<T, V>(mut self, v: T) -> Self
8312 where
8313 T: std::iter::IntoIterator<Item = V>,
8314 V: std::convert::Into<std::string::String>,
8315 {
8316 use std::iter::Iterator;
8317 self.mount_options = v.into_iter().map(|i| i.into()).collect();
8318 self
8319 }
8320}
8321
8322impl wkt::message::Message for GCSVolumeSource {
8323 fn typename() -> &'static str {
8324 "type.googleapis.com/google.cloud.run.v2.GCSVolumeSource"
8325 }
8326}
8327
8328/// Probe describes a health check to be performed against a container to
8329/// determine whether it is alive or ready to receive traffic.
8330#[derive(Clone, Default, PartialEq)]
8331#[non_exhaustive]
8332pub struct Probe {
8333 /// Optional. Number of seconds after the container has started before the
8334 /// probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum
8335 /// value for liveness probe is 3600. Maximum value for startup probe is 240.
8336 pub initial_delay_seconds: i32,
8337
8338 /// Optional. Number of seconds after which the probe times out.
8339 /// Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
8340 /// Must be smaller than period_seconds.
8341 pub timeout_seconds: i32,
8342
8343 /// Optional. How often (in seconds) to perform the probe.
8344 /// Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
8345 /// is 3600. Maximum value for startup probe is 240.
8346 /// Must be greater or equal than timeout_seconds.
8347 pub period_seconds: i32,
8348
8349 /// Optional. Minimum consecutive failures for the probe to be considered
8350 /// failed after having succeeded. Defaults to 3. Minimum value is 1.
8351 pub failure_threshold: i32,
8352
8353 #[allow(missing_docs)]
8354 pub probe_type: std::option::Option<crate::model::probe::ProbeType>,
8355
8356 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8357}
8358
8359impl Probe {
8360 /// Creates a new default instance.
8361 pub fn new() -> Self {
8362 std::default::Default::default()
8363 }
8364
8365 /// Sets the value of [initial_delay_seconds][crate::model::Probe::initial_delay_seconds].
8366 ///
8367 /// # Example
8368 /// ```ignore,no_run
8369 /// # use google_cloud_run_v2::model::Probe;
8370 /// let x = Probe::new().set_initial_delay_seconds(42);
8371 /// ```
8372 pub fn set_initial_delay_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8373 self.initial_delay_seconds = v.into();
8374 self
8375 }
8376
8377 /// Sets the value of [timeout_seconds][crate::model::Probe::timeout_seconds].
8378 ///
8379 /// # Example
8380 /// ```ignore,no_run
8381 /// # use google_cloud_run_v2::model::Probe;
8382 /// let x = Probe::new().set_timeout_seconds(42);
8383 /// ```
8384 pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8385 self.timeout_seconds = v.into();
8386 self
8387 }
8388
8389 /// Sets the value of [period_seconds][crate::model::Probe::period_seconds].
8390 ///
8391 /// # Example
8392 /// ```ignore,no_run
8393 /// # use google_cloud_run_v2::model::Probe;
8394 /// let x = Probe::new().set_period_seconds(42);
8395 /// ```
8396 pub fn set_period_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8397 self.period_seconds = v.into();
8398 self
8399 }
8400
8401 /// Sets the value of [failure_threshold][crate::model::Probe::failure_threshold].
8402 ///
8403 /// # Example
8404 /// ```ignore,no_run
8405 /// # use google_cloud_run_v2::model::Probe;
8406 /// let x = Probe::new().set_failure_threshold(42);
8407 /// ```
8408 pub fn set_failure_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8409 self.failure_threshold = v.into();
8410 self
8411 }
8412
8413 /// Sets the value of [probe_type][crate::model::Probe::probe_type].
8414 ///
8415 /// Note that all the setters affecting `probe_type` are mutually
8416 /// exclusive.
8417 ///
8418 /// # Example
8419 /// ```ignore,no_run
8420 /// # use google_cloud_run_v2::model::Probe;
8421 /// use google_cloud_run_v2::model::HTTPGetAction;
8422 /// let x = Probe::new().set_probe_type(Some(
8423 /// google_cloud_run_v2::model::probe::ProbeType::HttpGet(HTTPGetAction::default().into())));
8424 /// ```
8425 pub fn set_probe_type<
8426 T: std::convert::Into<std::option::Option<crate::model::probe::ProbeType>>,
8427 >(
8428 mut self,
8429 v: T,
8430 ) -> Self {
8431 self.probe_type = v.into();
8432 self
8433 }
8434
8435 /// The value of [probe_type][crate::model::Probe::probe_type]
8436 /// if it holds a `HttpGet`, `None` if the field is not set or
8437 /// holds a different branch.
8438 pub fn http_get(&self) -> std::option::Option<&std::boxed::Box<crate::model::HTTPGetAction>> {
8439 #[allow(unreachable_patterns)]
8440 self.probe_type.as_ref().and_then(|v| match v {
8441 crate::model::probe::ProbeType::HttpGet(v) => std::option::Option::Some(v),
8442 _ => std::option::Option::None,
8443 })
8444 }
8445
8446 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8447 /// to hold a `HttpGet`.
8448 ///
8449 /// Note that all the setters affecting `probe_type` are
8450 /// mutually exclusive.
8451 ///
8452 /// # Example
8453 /// ```ignore,no_run
8454 /// # use google_cloud_run_v2::model::Probe;
8455 /// use google_cloud_run_v2::model::HTTPGetAction;
8456 /// let x = Probe::new().set_http_get(HTTPGetAction::default()/* use setters */);
8457 /// assert!(x.http_get().is_some());
8458 /// assert!(x.tcp_socket().is_none());
8459 /// assert!(x.grpc().is_none());
8460 /// ```
8461 pub fn set_http_get<T: std::convert::Into<std::boxed::Box<crate::model::HTTPGetAction>>>(
8462 mut self,
8463 v: T,
8464 ) -> Self {
8465 self.probe_type =
8466 std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(v.into()));
8467 self
8468 }
8469
8470 /// The value of [probe_type][crate::model::Probe::probe_type]
8471 /// if it holds a `TcpSocket`, `None` if the field is not set or
8472 /// holds a different branch.
8473 pub fn tcp_socket(
8474 &self,
8475 ) -> std::option::Option<&std::boxed::Box<crate::model::TCPSocketAction>> {
8476 #[allow(unreachable_patterns)]
8477 self.probe_type.as_ref().and_then(|v| match v {
8478 crate::model::probe::ProbeType::TcpSocket(v) => std::option::Option::Some(v),
8479 _ => std::option::Option::None,
8480 })
8481 }
8482
8483 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8484 /// to hold a `TcpSocket`.
8485 ///
8486 /// Note that all the setters affecting `probe_type` are
8487 /// mutually exclusive.
8488 ///
8489 /// # Example
8490 /// ```ignore,no_run
8491 /// # use google_cloud_run_v2::model::Probe;
8492 /// use google_cloud_run_v2::model::TCPSocketAction;
8493 /// let x = Probe::new().set_tcp_socket(TCPSocketAction::default()/* use setters */);
8494 /// assert!(x.tcp_socket().is_some());
8495 /// assert!(x.http_get().is_none());
8496 /// assert!(x.grpc().is_none());
8497 /// ```
8498 pub fn set_tcp_socket<T: std::convert::Into<std::boxed::Box<crate::model::TCPSocketAction>>>(
8499 mut self,
8500 v: T,
8501 ) -> Self {
8502 self.probe_type =
8503 std::option::Option::Some(crate::model::probe::ProbeType::TcpSocket(v.into()));
8504 self
8505 }
8506
8507 /// The value of [probe_type][crate::model::Probe::probe_type]
8508 /// if it holds a `Grpc`, `None` if the field is not set or
8509 /// holds a different branch.
8510 pub fn grpc(&self) -> std::option::Option<&std::boxed::Box<crate::model::GRPCAction>> {
8511 #[allow(unreachable_patterns)]
8512 self.probe_type.as_ref().and_then(|v| match v {
8513 crate::model::probe::ProbeType::Grpc(v) => std::option::Option::Some(v),
8514 _ => std::option::Option::None,
8515 })
8516 }
8517
8518 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8519 /// to hold a `Grpc`.
8520 ///
8521 /// Note that all the setters affecting `probe_type` are
8522 /// mutually exclusive.
8523 ///
8524 /// # Example
8525 /// ```ignore,no_run
8526 /// # use google_cloud_run_v2::model::Probe;
8527 /// use google_cloud_run_v2::model::GRPCAction;
8528 /// let x = Probe::new().set_grpc(GRPCAction::default()/* use setters */);
8529 /// assert!(x.grpc().is_some());
8530 /// assert!(x.http_get().is_none());
8531 /// assert!(x.tcp_socket().is_none());
8532 /// ```
8533 pub fn set_grpc<T: std::convert::Into<std::boxed::Box<crate::model::GRPCAction>>>(
8534 mut self,
8535 v: T,
8536 ) -> Self {
8537 self.probe_type = std::option::Option::Some(crate::model::probe::ProbeType::Grpc(v.into()));
8538 self
8539 }
8540}
8541
8542impl wkt::message::Message for Probe {
8543 fn typename() -> &'static str {
8544 "type.googleapis.com/google.cloud.run.v2.Probe"
8545 }
8546}
8547
8548/// Defines additional types related to [Probe].
8549pub mod probe {
8550 #[allow(unused_imports)]
8551 use super::*;
8552
8553 #[allow(missing_docs)]
8554 #[derive(Clone, Debug, PartialEq)]
8555 #[non_exhaustive]
8556 pub enum ProbeType {
8557 /// Optional. HTTPGet specifies the http request to perform.
8558 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8559 HttpGet(std::boxed::Box<crate::model::HTTPGetAction>),
8560 /// Optional. TCPSocket specifies an action involving a TCP port.
8561 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8562 TcpSocket(std::boxed::Box<crate::model::TCPSocketAction>),
8563 /// Optional. GRPC specifies an action involving a gRPC port.
8564 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8565 Grpc(std::boxed::Box<crate::model::GRPCAction>),
8566 }
8567}
8568
8569/// HTTPGetAction describes an action based on HTTP Get requests.
8570#[derive(Clone, Default, PartialEq)]
8571#[non_exhaustive]
8572pub struct HTTPGetAction {
8573 /// Optional. Path to access on the HTTP server. Defaults to '/'.
8574 pub path: std::string::String,
8575
8576 /// Optional. Custom headers to set in the request. HTTP allows repeated
8577 /// headers.
8578 pub http_headers: std::vec::Vec<crate::model::HTTPHeader>,
8579
8580 /// Optional. Port number to access on the container. Must be in the range 1 to
8581 /// 65535. If not specified, defaults to the exposed port of the container,
8582 /// which is the value of container.ports[0].containerPort.
8583 pub port: i32,
8584
8585 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8586}
8587
8588impl HTTPGetAction {
8589 /// Creates a new default instance.
8590 pub fn new() -> Self {
8591 std::default::Default::default()
8592 }
8593
8594 /// Sets the value of [path][crate::model::HTTPGetAction::path].
8595 ///
8596 /// # Example
8597 /// ```ignore,no_run
8598 /// # use google_cloud_run_v2::model::HTTPGetAction;
8599 /// let x = HTTPGetAction::new().set_path("example");
8600 /// ```
8601 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8602 self.path = v.into();
8603 self
8604 }
8605
8606 /// Sets the value of [http_headers][crate::model::HTTPGetAction::http_headers].
8607 ///
8608 /// # Example
8609 /// ```ignore,no_run
8610 /// # use google_cloud_run_v2::model::HTTPGetAction;
8611 /// use google_cloud_run_v2::model::HTTPHeader;
8612 /// let x = HTTPGetAction::new()
8613 /// .set_http_headers([
8614 /// HTTPHeader::default()/* use setters */,
8615 /// HTTPHeader::default()/* use (different) setters */,
8616 /// ]);
8617 /// ```
8618 pub fn set_http_headers<T, V>(mut self, v: T) -> Self
8619 where
8620 T: std::iter::IntoIterator<Item = V>,
8621 V: std::convert::Into<crate::model::HTTPHeader>,
8622 {
8623 use std::iter::Iterator;
8624 self.http_headers = v.into_iter().map(|i| i.into()).collect();
8625 self
8626 }
8627
8628 /// Sets the value of [port][crate::model::HTTPGetAction::port].
8629 ///
8630 /// # Example
8631 /// ```ignore,no_run
8632 /// # use google_cloud_run_v2::model::HTTPGetAction;
8633 /// let x = HTTPGetAction::new().set_port(42);
8634 /// ```
8635 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8636 self.port = v.into();
8637 self
8638 }
8639}
8640
8641impl wkt::message::Message for HTTPGetAction {
8642 fn typename() -> &'static str {
8643 "type.googleapis.com/google.cloud.run.v2.HTTPGetAction"
8644 }
8645}
8646
8647/// HTTPHeader describes a custom header to be used in HTTP probes
8648#[derive(Clone, Default, PartialEq)]
8649#[non_exhaustive]
8650pub struct HTTPHeader {
8651 /// Required. The header field name
8652 pub name: std::string::String,
8653
8654 /// Optional. The header field value
8655 pub value: std::string::String,
8656
8657 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8658}
8659
8660impl HTTPHeader {
8661 /// Creates a new default instance.
8662 pub fn new() -> Self {
8663 std::default::Default::default()
8664 }
8665
8666 /// Sets the value of [name][crate::model::HTTPHeader::name].
8667 ///
8668 /// # Example
8669 /// ```ignore,no_run
8670 /// # use google_cloud_run_v2::model::HTTPHeader;
8671 /// let x = HTTPHeader::new().set_name("example");
8672 /// ```
8673 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8674 self.name = v.into();
8675 self
8676 }
8677
8678 /// Sets the value of [value][crate::model::HTTPHeader::value].
8679 ///
8680 /// # Example
8681 /// ```ignore,no_run
8682 /// # use google_cloud_run_v2::model::HTTPHeader;
8683 /// let x = HTTPHeader::new().set_value("example");
8684 /// ```
8685 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8686 self.value = v.into();
8687 self
8688 }
8689}
8690
8691impl wkt::message::Message for HTTPHeader {
8692 fn typename() -> &'static str {
8693 "type.googleapis.com/google.cloud.run.v2.HTTPHeader"
8694 }
8695}
8696
8697/// TCPSocketAction describes an action based on opening a socket
8698#[derive(Clone, Default, PartialEq)]
8699#[non_exhaustive]
8700pub struct TCPSocketAction {
8701 /// Optional. Port number to access on the container. Must be in the range 1 to
8702 /// 65535. If not specified, defaults to the exposed port of the container,
8703 /// which is the value of container.ports[0].containerPort.
8704 pub port: i32,
8705
8706 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8707}
8708
8709impl TCPSocketAction {
8710 /// Creates a new default instance.
8711 pub fn new() -> Self {
8712 std::default::Default::default()
8713 }
8714
8715 /// Sets the value of [port][crate::model::TCPSocketAction::port].
8716 ///
8717 /// # Example
8718 /// ```ignore,no_run
8719 /// # use google_cloud_run_v2::model::TCPSocketAction;
8720 /// let x = TCPSocketAction::new().set_port(42);
8721 /// ```
8722 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8723 self.port = v.into();
8724 self
8725 }
8726}
8727
8728impl wkt::message::Message for TCPSocketAction {
8729 fn typename() -> &'static str {
8730 "type.googleapis.com/google.cloud.run.v2.TCPSocketAction"
8731 }
8732}
8733
8734/// GRPCAction describes an action involving a GRPC port.
8735#[derive(Clone, Default, PartialEq)]
8736#[non_exhaustive]
8737pub struct GRPCAction {
8738 /// Optional. Port number of the gRPC service. Number must be in the range 1 to
8739 /// 65535. If not specified, defaults to the exposed port of the container,
8740 /// which is the value of container.ports[0].containerPort.
8741 pub port: i32,
8742
8743 /// Optional. Service is the name of the service to place in the gRPC
8744 /// HealthCheckRequest (see
8745 /// <https://github.com/grpc/grpc/blob/master/doc/health-checking.md> ). If this
8746 /// is not specified, the default behavior is defined by gRPC.
8747 pub service: std::string::String,
8748
8749 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8750}
8751
8752impl GRPCAction {
8753 /// Creates a new default instance.
8754 pub fn new() -> Self {
8755 std::default::Default::default()
8756 }
8757
8758 /// Sets the value of [port][crate::model::GRPCAction::port].
8759 ///
8760 /// # Example
8761 /// ```ignore,no_run
8762 /// # use google_cloud_run_v2::model::GRPCAction;
8763 /// let x = GRPCAction::new().set_port(42);
8764 /// ```
8765 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8766 self.port = v.into();
8767 self
8768 }
8769
8770 /// Sets the value of [service][crate::model::GRPCAction::service].
8771 ///
8772 /// # Example
8773 /// ```ignore,no_run
8774 /// # use google_cloud_run_v2::model::GRPCAction;
8775 /// let x = GRPCAction::new().set_service("example");
8776 /// ```
8777 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8778 self.service = v.into();
8779 self
8780 }
8781}
8782
8783impl wkt::message::Message for GRPCAction {
8784 fn typename() -> &'static str {
8785 "type.googleapis.com/google.cloud.run.v2.GRPCAction"
8786 }
8787}
8788
8789/// Build information of the image.
8790#[derive(Clone, Default, PartialEq)]
8791#[non_exhaustive]
8792pub struct BuildInfo {
8793 /// Output only. Entry point of the function when the image is a Cloud Run
8794 /// function.
8795 pub function_target: std::string::String,
8796
8797 /// Output only. Source code location of the image.
8798 pub source_location: std::string::String,
8799
8800 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8801}
8802
8803impl BuildInfo {
8804 /// Creates a new default instance.
8805 pub fn new() -> Self {
8806 std::default::Default::default()
8807 }
8808
8809 /// Sets the value of [function_target][crate::model::BuildInfo::function_target].
8810 ///
8811 /// # Example
8812 /// ```ignore,no_run
8813 /// # use google_cloud_run_v2::model::BuildInfo;
8814 /// let x = BuildInfo::new().set_function_target("example");
8815 /// ```
8816 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8817 self.function_target = v.into();
8818 self
8819 }
8820
8821 /// Sets the value of [source_location][crate::model::BuildInfo::source_location].
8822 ///
8823 /// # Example
8824 /// ```ignore,no_run
8825 /// # use google_cloud_run_v2::model::BuildInfo;
8826 /// let x = BuildInfo::new().set_source_location("example");
8827 /// ```
8828 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8829 self.source_location = v.into();
8830 self
8831 }
8832}
8833
8834impl wkt::message::Message for BuildInfo {
8835 fn typename() -> &'static str {
8836 "type.googleapis.com/google.cloud.run.v2.BuildInfo"
8837 }
8838}
8839
8840/// Source type for the container.
8841#[derive(Clone, Default, PartialEq)]
8842#[non_exhaustive]
8843pub struct SourceCode {
8844 /// The source type.
8845 pub source_type: std::option::Option<crate::model::source_code::SourceType>,
8846
8847 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8848}
8849
8850impl SourceCode {
8851 /// Creates a new default instance.
8852 pub fn new() -> Self {
8853 std::default::Default::default()
8854 }
8855
8856 /// Sets the value of [source_type][crate::model::SourceCode::source_type].
8857 ///
8858 /// Note that all the setters affecting `source_type` are mutually
8859 /// exclusive.
8860 ///
8861 /// # Example
8862 /// ```ignore,no_run
8863 /// # use google_cloud_run_v2::model::SourceCode;
8864 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8865 /// let x = SourceCode::new().set_source_type(Some(
8866 /// google_cloud_run_v2::model::source_code::SourceType::CloudStorageSource(CloudStorageSource::default().into())));
8867 /// ```
8868 pub fn set_source_type<
8869 T: std::convert::Into<std::option::Option<crate::model::source_code::SourceType>>,
8870 >(
8871 mut self,
8872 v: T,
8873 ) -> Self {
8874 self.source_type = v.into();
8875 self
8876 }
8877
8878 /// The value of [source_type][crate::model::SourceCode::source_type]
8879 /// if it holds a `CloudStorageSource`, `None` if the field is not set or
8880 /// holds a different branch.
8881 pub fn cloud_storage_source(
8882 &self,
8883 ) -> std::option::Option<&std::boxed::Box<crate::model::source_code::CloudStorageSource>> {
8884 #[allow(unreachable_patterns)]
8885 self.source_type.as_ref().and_then(|v| match v {
8886 crate::model::source_code::SourceType::CloudStorageSource(v) => {
8887 std::option::Option::Some(v)
8888 }
8889 _ => std::option::Option::None,
8890 })
8891 }
8892
8893 /// Sets the value of [source_type][crate::model::SourceCode::source_type]
8894 /// to hold a `CloudStorageSource`.
8895 ///
8896 /// Note that all the setters affecting `source_type` are
8897 /// mutually exclusive.
8898 ///
8899 /// # Example
8900 /// ```ignore,no_run
8901 /// # use google_cloud_run_v2::model::SourceCode;
8902 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8903 /// let x = SourceCode::new().set_cloud_storage_source(CloudStorageSource::default()/* use setters */);
8904 /// assert!(x.cloud_storage_source().is_some());
8905 /// ```
8906 pub fn set_cloud_storage_source<
8907 T: std::convert::Into<std::boxed::Box<crate::model::source_code::CloudStorageSource>>,
8908 >(
8909 mut self,
8910 v: T,
8911 ) -> Self {
8912 self.source_type = std::option::Option::Some(
8913 crate::model::source_code::SourceType::CloudStorageSource(v.into()),
8914 );
8915 self
8916 }
8917}
8918
8919impl wkt::message::Message for SourceCode {
8920 fn typename() -> &'static str {
8921 "type.googleapis.com/google.cloud.run.v2.SourceCode"
8922 }
8923}
8924
8925/// Defines additional types related to [SourceCode].
8926pub mod source_code {
8927 #[allow(unused_imports)]
8928 use super::*;
8929
8930 /// Cloud Storage source.
8931 #[derive(Clone, Default, PartialEq)]
8932 #[non_exhaustive]
8933 pub struct CloudStorageSource {
8934 /// Required. The Cloud Storage bucket name.
8935 pub bucket: std::string::String,
8936
8937 /// Required. The Cloud Storage object name.
8938 pub object: std::string::String,
8939
8940 /// Optional. The Cloud Storage object generation.
8941 pub generation: i64,
8942
8943 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8944 }
8945
8946 impl CloudStorageSource {
8947 /// Creates a new default instance.
8948 pub fn new() -> Self {
8949 std::default::Default::default()
8950 }
8951
8952 /// Sets the value of [bucket][crate::model::source_code::CloudStorageSource::bucket].
8953 ///
8954 /// # Example
8955 /// ```ignore,no_run
8956 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8957 /// let x = CloudStorageSource::new().set_bucket("example");
8958 /// ```
8959 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8960 self.bucket = v.into();
8961 self
8962 }
8963
8964 /// Sets the value of [object][crate::model::source_code::CloudStorageSource::object].
8965 ///
8966 /// # Example
8967 /// ```ignore,no_run
8968 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8969 /// let x = CloudStorageSource::new().set_object("example");
8970 /// ```
8971 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8972 self.object = v.into();
8973 self
8974 }
8975
8976 /// Sets the value of [generation][crate::model::source_code::CloudStorageSource::generation].
8977 ///
8978 /// # Example
8979 /// ```ignore,no_run
8980 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8981 /// let x = CloudStorageSource::new().set_generation(42);
8982 /// ```
8983 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8984 self.generation = v.into();
8985 self
8986 }
8987 }
8988
8989 impl wkt::message::Message for CloudStorageSource {
8990 fn typename() -> &'static str {
8991 "type.googleapis.com/google.cloud.run.v2.SourceCode.CloudStorageSource"
8992 }
8993 }
8994
8995 /// The source type.
8996 #[derive(Clone, Debug, PartialEq)]
8997 #[non_exhaustive]
8998 pub enum SourceType {
8999 /// The source is a Cloud Storage bucket.
9000 CloudStorageSource(std::boxed::Box<crate::model::source_code::CloudStorageSource>),
9001 }
9002}
9003
9004/// Request message for obtaining a Revision by its full name.
9005#[derive(Clone, Default, PartialEq)]
9006#[non_exhaustive]
9007pub struct GetRevisionRequest {
9008 /// Required. The full name of the Revision.
9009 /// Format:
9010 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9011 pub name: std::string::String,
9012
9013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9014}
9015
9016impl GetRevisionRequest {
9017 /// Creates a new default instance.
9018 pub fn new() -> Self {
9019 std::default::Default::default()
9020 }
9021
9022 /// Sets the value of [name][crate::model::GetRevisionRequest::name].
9023 ///
9024 /// # Example
9025 /// ```ignore,no_run
9026 /// # use google_cloud_run_v2::model::GetRevisionRequest;
9027 /// let x = GetRevisionRequest::new().set_name("example");
9028 /// ```
9029 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9030 self.name = v.into();
9031 self
9032 }
9033}
9034
9035impl wkt::message::Message for GetRevisionRequest {
9036 fn typename() -> &'static str {
9037 "type.googleapis.com/google.cloud.run.v2.GetRevisionRequest"
9038 }
9039}
9040
9041/// Request message for retrieving a list of Revisions.
9042#[derive(Clone, Default, PartialEq)]
9043#[non_exhaustive]
9044pub struct ListRevisionsRequest {
9045 /// Required. The Service from which the Revisions should be listed.
9046 /// To list all Revisions across Services, use "-" instead of Service name.
9047 /// Format:
9048 /// projects/{project}/locations/{location}/services/{service}
9049 pub parent: std::string::String,
9050
9051 /// Maximum number of revisions to return in this call.
9052 pub page_size: i32,
9053
9054 /// A page token received from a previous call to ListRevisions.
9055 /// All other parameters must match.
9056 pub page_token: std::string::String,
9057
9058 /// If true, returns deleted (but unexpired) resources along with active ones.
9059 pub show_deleted: bool,
9060
9061 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9062}
9063
9064impl ListRevisionsRequest {
9065 /// Creates a new default instance.
9066 pub fn new() -> Self {
9067 std::default::Default::default()
9068 }
9069
9070 /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
9071 ///
9072 /// # Example
9073 /// ```ignore,no_run
9074 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9075 /// let x = ListRevisionsRequest::new().set_parent("example");
9076 /// ```
9077 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9078 self.parent = v.into();
9079 self
9080 }
9081
9082 /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
9083 ///
9084 /// # Example
9085 /// ```ignore,no_run
9086 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9087 /// let x = ListRevisionsRequest::new().set_page_size(42);
9088 /// ```
9089 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9090 self.page_size = v.into();
9091 self
9092 }
9093
9094 /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
9095 ///
9096 /// # Example
9097 /// ```ignore,no_run
9098 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9099 /// let x = ListRevisionsRequest::new().set_page_token("example");
9100 /// ```
9101 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9102 self.page_token = v.into();
9103 self
9104 }
9105
9106 /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
9107 ///
9108 /// # Example
9109 /// ```ignore,no_run
9110 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9111 /// let x = ListRevisionsRequest::new().set_show_deleted(true);
9112 /// ```
9113 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9114 self.show_deleted = v.into();
9115 self
9116 }
9117}
9118
9119impl wkt::message::Message for ListRevisionsRequest {
9120 fn typename() -> &'static str {
9121 "type.googleapis.com/google.cloud.run.v2.ListRevisionsRequest"
9122 }
9123}
9124
9125/// Response message containing a list of Revisions.
9126#[derive(Clone, Default, PartialEq)]
9127#[non_exhaustive]
9128pub struct ListRevisionsResponse {
9129 /// The resulting list of Revisions.
9130 pub revisions: std::vec::Vec<crate::model::Revision>,
9131
9132 /// A token indicating there are more items than page_size. Use it in the next
9133 /// ListRevisions request to continue.
9134 pub next_page_token: std::string::String,
9135
9136 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9137}
9138
9139impl ListRevisionsResponse {
9140 /// Creates a new default instance.
9141 pub fn new() -> Self {
9142 std::default::Default::default()
9143 }
9144
9145 /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
9146 ///
9147 /// # Example
9148 /// ```ignore,no_run
9149 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9150 /// use google_cloud_run_v2::model::Revision;
9151 /// let x = ListRevisionsResponse::new()
9152 /// .set_revisions([
9153 /// Revision::default()/* use setters */,
9154 /// Revision::default()/* use (different) setters */,
9155 /// ]);
9156 /// ```
9157 pub fn set_revisions<T, V>(mut self, v: T) -> Self
9158 where
9159 T: std::iter::IntoIterator<Item = V>,
9160 V: std::convert::Into<crate::model::Revision>,
9161 {
9162 use std::iter::Iterator;
9163 self.revisions = v.into_iter().map(|i| i.into()).collect();
9164 self
9165 }
9166
9167 /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
9168 ///
9169 /// # Example
9170 /// ```ignore,no_run
9171 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9172 /// let x = ListRevisionsResponse::new().set_next_page_token("example");
9173 /// ```
9174 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9175 self.next_page_token = v.into();
9176 self
9177 }
9178}
9179
9180impl wkt::message::Message for ListRevisionsResponse {
9181 fn typename() -> &'static str {
9182 "type.googleapis.com/google.cloud.run.v2.ListRevisionsResponse"
9183 }
9184}
9185
9186#[doc(hidden)]
9187impl google_cloud_gax::paginator::internal::PageableResponse for ListRevisionsResponse {
9188 type PageItem = crate::model::Revision;
9189
9190 fn items(self) -> std::vec::Vec<Self::PageItem> {
9191 self.revisions
9192 }
9193
9194 fn next_page_token(&self) -> std::string::String {
9195 use std::clone::Clone;
9196 self.next_page_token.clone()
9197 }
9198}
9199
9200/// Request message for deleting a retired Revision.
9201/// Revision lifecycle is usually managed by making changes to the parent
9202/// Service. Only retired revisions can be deleted with this API.
9203#[derive(Clone, Default, PartialEq)]
9204#[non_exhaustive]
9205pub struct DeleteRevisionRequest {
9206 /// Required. The name of the Revision to delete.
9207 /// Format:
9208 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9209 pub name: std::string::String,
9210
9211 /// Indicates that the request should be validated without actually
9212 /// deleting any resources.
9213 pub validate_only: bool,
9214
9215 /// A system-generated fingerprint for this version of the
9216 /// resource. This may be used to detect modification conflict during updates.
9217 pub etag: std::string::String,
9218
9219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9220}
9221
9222impl DeleteRevisionRequest {
9223 /// Creates a new default instance.
9224 pub fn new() -> Self {
9225 std::default::Default::default()
9226 }
9227
9228 /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
9229 ///
9230 /// # Example
9231 /// ```ignore,no_run
9232 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9233 /// let x = DeleteRevisionRequest::new().set_name("example");
9234 /// ```
9235 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9236 self.name = v.into();
9237 self
9238 }
9239
9240 /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
9241 ///
9242 /// # Example
9243 /// ```ignore,no_run
9244 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9245 /// let x = DeleteRevisionRequest::new().set_validate_only(true);
9246 /// ```
9247 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9248 self.validate_only = v.into();
9249 self
9250 }
9251
9252 /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
9253 ///
9254 /// # Example
9255 /// ```ignore,no_run
9256 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9257 /// let x = DeleteRevisionRequest::new().set_etag("example");
9258 /// ```
9259 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9260 self.etag = v.into();
9261 self
9262 }
9263}
9264
9265impl wkt::message::Message for DeleteRevisionRequest {
9266 fn typename() -> &'static str {
9267 "type.googleapis.com/google.cloud.run.v2.DeleteRevisionRequest"
9268 }
9269}
9270
9271/// A Revision is an immutable snapshot of code and configuration. A Revision
9272/// references a container image. Revisions are only created by updates to its
9273/// parent Service.
9274#[derive(Clone, Default, PartialEq)]
9275#[non_exhaustive]
9276pub struct Revision {
9277 /// Output only. The unique name of this Revision.
9278 pub name: std::string::String,
9279
9280 /// Output only. Server assigned unique identifier for the Revision. The value
9281 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
9282 /// deleted.
9283 pub uid: std::string::String,
9284
9285 /// Output only. A number that monotonically increases every time the user
9286 /// modifies the desired state.
9287 pub generation: i64,
9288
9289 /// Output only. Unstructured key value map that can be used to organize and
9290 /// categorize objects. User-provided labels are shared with Google's billing
9291 /// system, so they can be used to filter, or break down billing charges by
9292 /// team, component, environment, state, etc. For more information, visit
9293 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
9294 /// <https://cloud.google.com/run/docs/configuring/labels>.
9295 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9296
9297 /// Output only. Unstructured key value map that may
9298 /// be set by external tools to store and arbitrary metadata.
9299 /// They are not queryable and should be preserved
9300 /// when modifying objects.
9301 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
9302
9303 /// Output only. The creation time.
9304 pub create_time: std::option::Option<wkt::Timestamp>,
9305
9306 /// Output only. The last-modified time.
9307 pub update_time: std::option::Option<wkt::Timestamp>,
9308
9309 /// Output only. For a deleted resource, the deletion time. It is only
9310 /// populated as a response to a Delete request.
9311 pub delete_time: std::option::Option<wkt::Timestamp>,
9312
9313 /// Output only. For a deleted resource, the time after which it will be
9314 /// permamently deleted. It is only populated as a response to a Delete
9315 /// request.
9316 pub expire_time: std::option::Option<wkt::Timestamp>,
9317
9318 /// The least stable launch stage needed to create this resource, as defined by
9319 /// [Google Cloud Platform Launch
9320 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
9321 /// `ALPHA`, `BETA`, and `GA`.
9322 ///
9323 /// Note that this value might not be what was used
9324 /// as input. For example, if ALPHA was provided as input in the parent
9325 /// resource, but only BETA and GA-level features are were, this field will be
9326 /// BETA.
9327 pub launch_stage: google_cloud_api::model::LaunchStage,
9328
9329 /// Output only. The name of the parent service.
9330 pub service: std::string::String,
9331
9332 /// Scaling settings for this revision.
9333 pub scaling: std::option::Option<crate::model::RevisionScaling>,
9334
9335 /// VPC Access configuration for this Revision. For more information, visit
9336 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
9337 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
9338
9339 /// Sets the maximum number of requests that each serving instance can receive.
9340 pub max_instance_request_concurrency: i32,
9341
9342 /// Max allowed time for an instance to respond to a request.
9343 pub timeout: std::option::Option<wkt::Duration>,
9344
9345 /// Email address of the IAM service account associated with the revision of
9346 /// the service. The service account represents the identity of the running
9347 /// revision, and determines what permissions the revision has.
9348 pub service_account: std::string::String,
9349
9350 /// Holds the single container that defines the unit of execution for this
9351 /// Revision.
9352 pub containers: std::vec::Vec<crate::model::Container>,
9353
9354 /// A list of Volumes to make available to containers.
9355 pub volumes: std::vec::Vec<crate::model::Volume>,
9356
9357 /// The execution environment being used to host this Revision.
9358 pub execution_environment: crate::model::ExecutionEnvironment,
9359
9360 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
9361 /// this container image. For more information, go to
9362 /// <https://cloud.google.com/run/docs/securing/using-cmek>
9363 pub encryption_key: std::string::String,
9364
9365 /// Enables service mesh connectivity.
9366 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
9367
9368 /// The action to take if the encryption key is revoked.
9369 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
9370
9371 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
9372 /// shutting down all instances. The minimum increment is 1 hour.
9373 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
9374
9375 /// Output only. Indicates whether the resource's reconciliation is still in
9376 /// progress. See comments in `Service.reconciling` for additional information
9377 /// on reconciliation process in Cloud Run.
9378 pub reconciling: bool,
9379
9380 /// Output only. The Condition of this Revision, containing its readiness
9381 /// status, and detailed error information in case it did not reach a serving
9382 /// state.
9383 pub conditions: std::vec::Vec<crate::model::Condition>,
9384
9385 /// Output only. The generation of this Revision currently serving traffic. See
9386 /// comments in `reconciling` for additional information on reconciliation
9387 /// process in Cloud Run.
9388 pub observed_generation: i64,
9389
9390 /// Output only. The Google Console URI to obtain logs for the Revision.
9391 pub log_uri: std::string::String,
9392
9393 /// Output only. Reserved for future use.
9394 pub satisfies_pzs: bool,
9395
9396 /// Enable session affinity.
9397 pub session_affinity: bool,
9398
9399 /// Output only. The current effective scaling settings for the revision.
9400 pub scaling_status: std::option::Option<crate::model::RevisionScalingStatus>,
9401
9402 /// The node selector for the revision.
9403 pub node_selector: std::option::Option<crate::model::NodeSelector>,
9404
9405 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
9406 /// revision.
9407 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
9408
9409 /// Output only. Email address of the authenticated creator.
9410 pub creator: std::string::String,
9411
9412 /// Output only. A system-generated fingerprint for this version of the
9413 /// resource. May be used to detect modification conflict during updates.
9414 pub etag: std::string::String,
9415
9416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9417}
9418
9419impl Revision {
9420 /// Creates a new default instance.
9421 pub fn new() -> Self {
9422 std::default::Default::default()
9423 }
9424
9425 /// Sets the value of [name][crate::model::Revision::name].
9426 ///
9427 /// # Example
9428 /// ```ignore,no_run
9429 /// # use google_cloud_run_v2::model::Revision;
9430 /// let x = Revision::new().set_name("example");
9431 /// ```
9432 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9433 self.name = v.into();
9434 self
9435 }
9436
9437 /// Sets the value of [uid][crate::model::Revision::uid].
9438 ///
9439 /// # Example
9440 /// ```ignore,no_run
9441 /// # use google_cloud_run_v2::model::Revision;
9442 /// let x = Revision::new().set_uid("example");
9443 /// ```
9444 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9445 self.uid = v.into();
9446 self
9447 }
9448
9449 /// Sets the value of [generation][crate::model::Revision::generation].
9450 ///
9451 /// # Example
9452 /// ```ignore,no_run
9453 /// # use google_cloud_run_v2::model::Revision;
9454 /// let x = Revision::new().set_generation(42);
9455 /// ```
9456 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9457 self.generation = v.into();
9458 self
9459 }
9460
9461 /// Sets the value of [labels][crate::model::Revision::labels].
9462 ///
9463 /// # Example
9464 /// ```ignore,no_run
9465 /// # use google_cloud_run_v2::model::Revision;
9466 /// let x = Revision::new().set_labels([
9467 /// ("key0", "abc"),
9468 /// ("key1", "xyz"),
9469 /// ]);
9470 /// ```
9471 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9472 where
9473 T: std::iter::IntoIterator<Item = (K, V)>,
9474 K: std::convert::Into<std::string::String>,
9475 V: std::convert::Into<std::string::String>,
9476 {
9477 use std::iter::Iterator;
9478 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9479 self
9480 }
9481
9482 /// Sets the value of [annotations][crate::model::Revision::annotations].
9483 ///
9484 /// # Example
9485 /// ```ignore,no_run
9486 /// # use google_cloud_run_v2::model::Revision;
9487 /// let x = Revision::new().set_annotations([
9488 /// ("key0", "abc"),
9489 /// ("key1", "xyz"),
9490 /// ]);
9491 /// ```
9492 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
9493 where
9494 T: std::iter::IntoIterator<Item = (K, V)>,
9495 K: std::convert::Into<std::string::String>,
9496 V: std::convert::Into<std::string::String>,
9497 {
9498 use std::iter::Iterator;
9499 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9500 self
9501 }
9502
9503 /// Sets the value of [create_time][crate::model::Revision::create_time].
9504 ///
9505 /// # Example
9506 /// ```ignore,no_run
9507 /// # use google_cloud_run_v2::model::Revision;
9508 /// use wkt::Timestamp;
9509 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
9510 /// ```
9511 pub fn set_create_time<T>(mut self, v: T) -> Self
9512 where
9513 T: std::convert::Into<wkt::Timestamp>,
9514 {
9515 self.create_time = std::option::Option::Some(v.into());
9516 self
9517 }
9518
9519 /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
9520 ///
9521 /// # Example
9522 /// ```ignore,no_run
9523 /// # use google_cloud_run_v2::model::Revision;
9524 /// use wkt::Timestamp;
9525 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9526 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
9527 /// ```
9528 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9529 where
9530 T: std::convert::Into<wkt::Timestamp>,
9531 {
9532 self.create_time = v.map(|x| x.into());
9533 self
9534 }
9535
9536 /// Sets the value of [update_time][crate::model::Revision::update_time].
9537 ///
9538 /// # Example
9539 /// ```ignore,no_run
9540 /// # use google_cloud_run_v2::model::Revision;
9541 /// use wkt::Timestamp;
9542 /// let x = Revision::new().set_update_time(Timestamp::default()/* use setters */);
9543 /// ```
9544 pub fn set_update_time<T>(mut self, v: T) -> Self
9545 where
9546 T: std::convert::Into<wkt::Timestamp>,
9547 {
9548 self.update_time = std::option::Option::Some(v.into());
9549 self
9550 }
9551
9552 /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
9553 ///
9554 /// # Example
9555 /// ```ignore,no_run
9556 /// # use google_cloud_run_v2::model::Revision;
9557 /// use wkt::Timestamp;
9558 /// let x = Revision::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9559 /// let x = Revision::new().set_or_clear_update_time(None::<Timestamp>);
9560 /// ```
9561 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9562 where
9563 T: std::convert::Into<wkt::Timestamp>,
9564 {
9565 self.update_time = v.map(|x| x.into());
9566 self
9567 }
9568
9569 /// Sets the value of [delete_time][crate::model::Revision::delete_time].
9570 ///
9571 /// # Example
9572 /// ```ignore,no_run
9573 /// # use google_cloud_run_v2::model::Revision;
9574 /// use wkt::Timestamp;
9575 /// let x = Revision::new().set_delete_time(Timestamp::default()/* use setters */);
9576 /// ```
9577 pub fn set_delete_time<T>(mut self, v: T) -> Self
9578 where
9579 T: std::convert::Into<wkt::Timestamp>,
9580 {
9581 self.delete_time = std::option::Option::Some(v.into());
9582 self
9583 }
9584
9585 /// Sets or clears the value of [delete_time][crate::model::Revision::delete_time].
9586 ///
9587 /// # Example
9588 /// ```ignore,no_run
9589 /// # use google_cloud_run_v2::model::Revision;
9590 /// use wkt::Timestamp;
9591 /// let x = Revision::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
9592 /// let x = Revision::new().set_or_clear_delete_time(None::<Timestamp>);
9593 /// ```
9594 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9595 where
9596 T: std::convert::Into<wkt::Timestamp>,
9597 {
9598 self.delete_time = v.map(|x| x.into());
9599 self
9600 }
9601
9602 /// Sets the value of [expire_time][crate::model::Revision::expire_time].
9603 ///
9604 /// # Example
9605 /// ```ignore,no_run
9606 /// # use google_cloud_run_v2::model::Revision;
9607 /// use wkt::Timestamp;
9608 /// let x = Revision::new().set_expire_time(Timestamp::default()/* use setters */);
9609 /// ```
9610 pub fn set_expire_time<T>(mut self, v: T) -> Self
9611 where
9612 T: std::convert::Into<wkt::Timestamp>,
9613 {
9614 self.expire_time = std::option::Option::Some(v.into());
9615 self
9616 }
9617
9618 /// Sets or clears the value of [expire_time][crate::model::Revision::expire_time].
9619 ///
9620 /// # Example
9621 /// ```ignore,no_run
9622 /// # use google_cloud_run_v2::model::Revision;
9623 /// use wkt::Timestamp;
9624 /// let x = Revision::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9625 /// let x = Revision::new().set_or_clear_expire_time(None::<Timestamp>);
9626 /// ```
9627 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9628 where
9629 T: std::convert::Into<wkt::Timestamp>,
9630 {
9631 self.expire_time = v.map(|x| x.into());
9632 self
9633 }
9634
9635 /// Sets the value of [launch_stage][crate::model::Revision::launch_stage].
9636 ///
9637 /// # Example
9638 /// ```ignore,no_run
9639 /// # use google_cloud_run_v2::model::Revision;
9640 /// use google_cloud_api::model::LaunchStage;
9641 /// let x0 = Revision::new().set_launch_stage(LaunchStage::Unimplemented);
9642 /// let x1 = Revision::new().set_launch_stage(LaunchStage::Prelaunch);
9643 /// let x2 = Revision::new().set_launch_stage(LaunchStage::EarlyAccess);
9644 /// ```
9645 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
9646 mut self,
9647 v: T,
9648 ) -> Self {
9649 self.launch_stage = v.into();
9650 self
9651 }
9652
9653 /// Sets the value of [service][crate::model::Revision::service].
9654 ///
9655 /// # Example
9656 /// ```ignore,no_run
9657 /// # use google_cloud_run_v2::model::Revision;
9658 /// let x = Revision::new().set_service("example");
9659 /// ```
9660 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9661 self.service = v.into();
9662 self
9663 }
9664
9665 /// Sets the value of [scaling][crate::model::Revision::scaling].
9666 ///
9667 /// # Example
9668 /// ```ignore,no_run
9669 /// # use google_cloud_run_v2::model::Revision;
9670 /// use google_cloud_run_v2::model::RevisionScaling;
9671 /// let x = Revision::new().set_scaling(RevisionScaling::default()/* use setters */);
9672 /// ```
9673 pub fn set_scaling<T>(mut self, v: T) -> Self
9674 where
9675 T: std::convert::Into<crate::model::RevisionScaling>,
9676 {
9677 self.scaling = std::option::Option::Some(v.into());
9678 self
9679 }
9680
9681 /// Sets or clears the value of [scaling][crate::model::Revision::scaling].
9682 ///
9683 /// # Example
9684 /// ```ignore,no_run
9685 /// # use google_cloud_run_v2::model::Revision;
9686 /// use google_cloud_run_v2::model::RevisionScaling;
9687 /// let x = Revision::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
9688 /// let x = Revision::new().set_or_clear_scaling(None::<RevisionScaling>);
9689 /// ```
9690 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
9691 where
9692 T: std::convert::Into<crate::model::RevisionScaling>,
9693 {
9694 self.scaling = v.map(|x| x.into());
9695 self
9696 }
9697
9698 /// Sets the value of [vpc_access][crate::model::Revision::vpc_access].
9699 ///
9700 /// # Example
9701 /// ```ignore,no_run
9702 /// # use google_cloud_run_v2::model::Revision;
9703 /// use google_cloud_run_v2::model::VpcAccess;
9704 /// let x = Revision::new().set_vpc_access(VpcAccess::default()/* use setters */);
9705 /// ```
9706 pub fn set_vpc_access<T>(mut self, v: T) -> Self
9707 where
9708 T: std::convert::Into<crate::model::VpcAccess>,
9709 {
9710 self.vpc_access = std::option::Option::Some(v.into());
9711 self
9712 }
9713
9714 /// Sets or clears the value of [vpc_access][crate::model::Revision::vpc_access].
9715 ///
9716 /// # Example
9717 /// ```ignore,no_run
9718 /// # use google_cloud_run_v2::model::Revision;
9719 /// use google_cloud_run_v2::model::VpcAccess;
9720 /// let x = Revision::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
9721 /// let x = Revision::new().set_or_clear_vpc_access(None::<VpcAccess>);
9722 /// ```
9723 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
9724 where
9725 T: std::convert::Into<crate::model::VpcAccess>,
9726 {
9727 self.vpc_access = v.map(|x| x.into());
9728 self
9729 }
9730
9731 /// Sets the value of [max_instance_request_concurrency][crate::model::Revision::max_instance_request_concurrency].
9732 ///
9733 /// # Example
9734 /// ```ignore,no_run
9735 /// # use google_cloud_run_v2::model::Revision;
9736 /// let x = Revision::new().set_max_instance_request_concurrency(42);
9737 /// ```
9738 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
9739 mut self,
9740 v: T,
9741 ) -> Self {
9742 self.max_instance_request_concurrency = v.into();
9743 self
9744 }
9745
9746 /// Sets the value of [timeout][crate::model::Revision::timeout].
9747 ///
9748 /// # Example
9749 /// ```ignore,no_run
9750 /// # use google_cloud_run_v2::model::Revision;
9751 /// use wkt::Duration;
9752 /// let x = Revision::new().set_timeout(Duration::default()/* use setters */);
9753 /// ```
9754 pub fn set_timeout<T>(mut self, v: T) -> Self
9755 where
9756 T: std::convert::Into<wkt::Duration>,
9757 {
9758 self.timeout = std::option::Option::Some(v.into());
9759 self
9760 }
9761
9762 /// Sets or clears the value of [timeout][crate::model::Revision::timeout].
9763 ///
9764 /// # Example
9765 /// ```ignore,no_run
9766 /// # use google_cloud_run_v2::model::Revision;
9767 /// use wkt::Duration;
9768 /// let x = Revision::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
9769 /// let x = Revision::new().set_or_clear_timeout(None::<Duration>);
9770 /// ```
9771 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
9772 where
9773 T: std::convert::Into<wkt::Duration>,
9774 {
9775 self.timeout = v.map(|x| x.into());
9776 self
9777 }
9778
9779 /// Sets the value of [service_account][crate::model::Revision::service_account].
9780 ///
9781 /// # Example
9782 /// ```ignore,no_run
9783 /// # use google_cloud_run_v2::model::Revision;
9784 /// let x = Revision::new().set_service_account("example");
9785 /// ```
9786 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9787 self.service_account = v.into();
9788 self
9789 }
9790
9791 /// Sets the value of [containers][crate::model::Revision::containers].
9792 ///
9793 /// # Example
9794 /// ```ignore,no_run
9795 /// # use google_cloud_run_v2::model::Revision;
9796 /// use google_cloud_run_v2::model::Container;
9797 /// let x = Revision::new()
9798 /// .set_containers([
9799 /// Container::default()/* use setters */,
9800 /// Container::default()/* use (different) setters */,
9801 /// ]);
9802 /// ```
9803 pub fn set_containers<T, V>(mut self, v: T) -> Self
9804 where
9805 T: std::iter::IntoIterator<Item = V>,
9806 V: std::convert::Into<crate::model::Container>,
9807 {
9808 use std::iter::Iterator;
9809 self.containers = v.into_iter().map(|i| i.into()).collect();
9810 self
9811 }
9812
9813 /// Sets the value of [volumes][crate::model::Revision::volumes].
9814 ///
9815 /// # Example
9816 /// ```ignore,no_run
9817 /// # use google_cloud_run_v2::model::Revision;
9818 /// use google_cloud_run_v2::model::Volume;
9819 /// let x = Revision::new()
9820 /// .set_volumes([
9821 /// Volume::default()/* use setters */,
9822 /// Volume::default()/* use (different) setters */,
9823 /// ]);
9824 /// ```
9825 pub fn set_volumes<T, V>(mut self, v: T) -> Self
9826 where
9827 T: std::iter::IntoIterator<Item = V>,
9828 V: std::convert::Into<crate::model::Volume>,
9829 {
9830 use std::iter::Iterator;
9831 self.volumes = v.into_iter().map(|i| i.into()).collect();
9832 self
9833 }
9834
9835 /// Sets the value of [execution_environment][crate::model::Revision::execution_environment].
9836 ///
9837 /// # Example
9838 /// ```ignore,no_run
9839 /// # use google_cloud_run_v2::model::Revision;
9840 /// use google_cloud_run_v2::model::ExecutionEnvironment;
9841 /// let x0 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen1);
9842 /// let x1 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen2);
9843 /// ```
9844 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
9845 mut self,
9846 v: T,
9847 ) -> Self {
9848 self.execution_environment = v.into();
9849 self
9850 }
9851
9852 /// Sets the value of [encryption_key][crate::model::Revision::encryption_key].
9853 ///
9854 /// # Example
9855 /// ```ignore,no_run
9856 /// # use google_cloud_run_v2::model::Revision;
9857 /// let x = Revision::new().set_encryption_key("example");
9858 /// ```
9859 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9860 self.encryption_key = v.into();
9861 self
9862 }
9863
9864 /// Sets the value of [service_mesh][crate::model::Revision::service_mesh].
9865 ///
9866 /// # Example
9867 /// ```ignore,no_run
9868 /// # use google_cloud_run_v2::model::Revision;
9869 /// use google_cloud_run_v2::model::ServiceMesh;
9870 /// let x = Revision::new().set_service_mesh(ServiceMesh::default()/* use setters */);
9871 /// ```
9872 pub fn set_service_mesh<T>(mut self, v: T) -> Self
9873 where
9874 T: std::convert::Into<crate::model::ServiceMesh>,
9875 {
9876 self.service_mesh = std::option::Option::Some(v.into());
9877 self
9878 }
9879
9880 /// Sets or clears the value of [service_mesh][crate::model::Revision::service_mesh].
9881 ///
9882 /// # Example
9883 /// ```ignore,no_run
9884 /// # use google_cloud_run_v2::model::Revision;
9885 /// use google_cloud_run_v2::model::ServiceMesh;
9886 /// let x = Revision::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
9887 /// let x = Revision::new().set_or_clear_service_mesh(None::<ServiceMesh>);
9888 /// ```
9889 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
9890 where
9891 T: std::convert::Into<crate::model::ServiceMesh>,
9892 {
9893 self.service_mesh = v.map(|x| x.into());
9894 self
9895 }
9896
9897 /// Sets the value of [encryption_key_revocation_action][crate::model::Revision::encryption_key_revocation_action].
9898 ///
9899 /// # Example
9900 /// ```ignore,no_run
9901 /// # use google_cloud_run_v2::model::Revision;
9902 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
9903 /// let x0 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
9904 /// let x1 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
9905 /// ```
9906 pub fn set_encryption_key_revocation_action<
9907 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
9908 >(
9909 mut self,
9910 v: T,
9911 ) -> Self {
9912 self.encryption_key_revocation_action = v.into();
9913 self
9914 }
9915
9916 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
9917 ///
9918 /// # Example
9919 /// ```ignore,no_run
9920 /// # use google_cloud_run_v2::model::Revision;
9921 /// use wkt::Duration;
9922 /// let x = Revision::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
9923 /// ```
9924 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
9925 where
9926 T: std::convert::Into<wkt::Duration>,
9927 {
9928 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
9929 self
9930 }
9931
9932 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
9933 ///
9934 /// # Example
9935 /// ```ignore,no_run
9936 /// # use google_cloud_run_v2::model::Revision;
9937 /// use wkt::Duration;
9938 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
9939 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
9940 /// ```
9941 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
9942 mut self,
9943 v: std::option::Option<T>,
9944 ) -> Self
9945 where
9946 T: std::convert::Into<wkt::Duration>,
9947 {
9948 self.encryption_key_shutdown_duration = v.map(|x| x.into());
9949 self
9950 }
9951
9952 /// Sets the value of [reconciling][crate::model::Revision::reconciling].
9953 ///
9954 /// # Example
9955 /// ```ignore,no_run
9956 /// # use google_cloud_run_v2::model::Revision;
9957 /// let x = Revision::new().set_reconciling(true);
9958 /// ```
9959 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9960 self.reconciling = v.into();
9961 self
9962 }
9963
9964 /// Sets the value of [conditions][crate::model::Revision::conditions].
9965 ///
9966 /// # Example
9967 /// ```ignore,no_run
9968 /// # use google_cloud_run_v2::model::Revision;
9969 /// use google_cloud_run_v2::model::Condition;
9970 /// let x = Revision::new()
9971 /// .set_conditions([
9972 /// Condition::default()/* use setters */,
9973 /// Condition::default()/* use (different) setters */,
9974 /// ]);
9975 /// ```
9976 pub fn set_conditions<T, V>(mut self, v: T) -> Self
9977 where
9978 T: std::iter::IntoIterator<Item = V>,
9979 V: std::convert::Into<crate::model::Condition>,
9980 {
9981 use std::iter::Iterator;
9982 self.conditions = v.into_iter().map(|i| i.into()).collect();
9983 self
9984 }
9985
9986 /// Sets the value of [observed_generation][crate::model::Revision::observed_generation].
9987 ///
9988 /// # Example
9989 /// ```ignore,no_run
9990 /// # use google_cloud_run_v2::model::Revision;
9991 /// let x = Revision::new().set_observed_generation(42);
9992 /// ```
9993 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9994 self.observed_generation = v.into();
9995 self
9996 }
9997
9998 /// Sets the value of [log_uri][crate::model::Revision::log_uri].
9999 ///
10000 /// # Example
10001 /// ```ignore,no_run
10002 /// # use google_cloud_run_v2::model::Revision;
10003 /// let x = Revision::new().set_log_uri("example");
10004 /// ```
10005 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10006 self.log_uri = v.into();
10007 self
10008 }
10009
10010 /// Sets the value of [satisfies_pzs][crate::model::Revision::satisfies_pzs].
10011 ///
10012 /// # Example
10013 /// ```ignore,no_run
10014 /// # use google_cloud_run_v2::model::Revision;
10015 /// let x = Revision::new().set_satisfies_pzs(true);
10016 /// ```
10017 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10018 self.satisfies_pzs = v.into();
10019 self
10020 }
10021
10022 /// Sets the value of [session_affinity][crate::model::Revision::session_affinity].
10023 ///
10024 /// # Example
10025 /// ```ignore,no_run
10026 /// # use google_cloud_run_v2::model::Revision;
10027 /// let x = Revision::new().set_session_affinity(true);
10028 /// ```
10029 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10030 self.session_affinity = v.into();
10031 self
10032 }
10033
10034 /// Sets the value of [scaling_status][crate::model::Revision::scaling_status].
10035 ///
10036 /// # Example
10037 /// ```ignore,no_run
10038 /// # use google_cloud_run_v2::model::Revision;
10039 /// use google_cloud_run_v2::model::RevisionScalingStatus;
10040 /// let x = Revision::new().set_scaling_status(RevisionScalingStatus::default()/* use setters */);
10041 /// ```
10042 pub fn set_scaling_status<T>(mut self, v: T) -> Self
10043 where
10044 T: std::convert::Into<crate::model::RevisionScalingStatus>,
10045 {
10046 self.scaling_status = std::option::Option::Some(v.into());
10047 self
10048 }
10049
10050 /// Sets or clears the value of [scaling_status][crate::model::Revision::scaling_status].
10051 ///
10052 /// # Example
10053 /// ```ignore,no_run
10054 /// # use google_cloud_run_v2::model::Revision;
10055 /// use google_cloud_run_v2::model::RevisionScalingStatus;
10056 /// let x = Revision::new().set_or_clear_scaling_status(Some(RevisionScalingStatus::default()/* use setters */));
10057 /// let x = Revision::new().set_or_clear_scaling_status(None::<RevisionScalingStatus>);
10058 /// ```
10059 pub fn set_or_clear_scaling_status<T>(mut self, v: std::option::Option<T>) -> Self
10060 where
10061 T: std::convert::Into<crate::model::RevisionScalingStatus>,
10062 {
10063 self.scaling_status = v.map(|x| x.into());
10064 self
10065 }
10066
10067 /// Sets the value of [node_selector][crate::model::Revision::node_selector].
10068 ///
10069 /// # Example
10070 /// ```ignore,no_run
10071 /// # use google_cloud_run_v2::model::Revision;
10072 /// use google_cloud_run_v2::model::NodeSelector;
10073 /// let x = Revision::new().set_node_selector(NodeSelector::default()/* use setters */);
10074 /// ```
10075 pub fn set_node_selector<T>(mut self, v: T) -> Self
10076 where
10077 T: std::convert::Into<crate::model::NodeSelector>,
10078 {
10079 self.node_selector = std::option::Option::Some(v.into());
10080 self
10081 }
10082
10083 /// Sets or clears the value of [node_selector][crate::model::Revision::node_selector].
10084 ///
10085 /// # Example
10086 /// ```ignore,no_run
10087 /// # use google_cloud_run_v2::model::Revision;
10088 /// use google_cloud_run_v2::model::NodeSelector;
10089 /// let x = Revision::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10090 /// let x = Revision::new().set_or_clear_node_selector(None::<NodeSelector>);
10091 /// ```
10092 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10093 where
10094 T: std::convert::Into<crate::model::NodeSelector>,
10095 {
10096 self.node_selector = v.map(|x| x.into());
10097 self
10098 }
10099
10100 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10101 ///
10102 /// # Example
10103 /// ```ignore,no_run
10104 /// # use google_cloud_run_v2::model::Revision;
10105 /// let x = Revision::new().set_gpu_zonal_redundancy_disabled(true);
10106 /// ```
10107 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10108 where
10109 T: std::convert::Into<bool>,
10110 {
10111 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10112 self
10113 }
10114
10115 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10116 ///
10117 /// # Example
10118 /// ```ignore,no_run
10119 /// # use google_cloud_run_v2::model::Revision;
10120 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10121 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10122 /// ```
10123 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10124 mut self,
10125 v: std::option::Option<T>,
10126 ) -> Self
10127 where
10128 T: std::convert::Into<bool>,
10129 {
10130 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10131 self
10132 }
10133
10134 /// Sets the value of [creator][crate::model::Revision::creator].
10135 ///
10136 /// # Example
10137 /// ```ignore,no_run
10138 /// # use google_cloud_run_v2::model::Revision;
10139 /// let x = Revision::new().set_creator("example");
10140 /// ```
10141 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10142 self.creator = v.into();
10143 self
10144 }
10145
10146 /// Sets the value of [etag][crate::model::Revision::etag].
10147 ///
10148 /// # Example
10149 /// ```ignore,no_run
10150 /// # use google_cloud_run_v2::model::Revision;
10151 /// let x = Revision::new().set_etag("example");
10152 /// ```
10153 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10154 self.etag = v.into();
10155 self
10156 }
10157}
10158
10159impl wkt::message::Message for Revision {
10160 fn typename() -> &'static str {
10161 "type.googleapis.com/google.cloud.run.v2.Revision"
10162 }
10163}
10164
10165/// RevisionTemplate describes the data a revision should have when created from
10166/// a template.
10167#[derive(Clone, Default, PartialEq)]
10168#[non_exhaustive]
10169pub struct RevisionTemplate {
10170 /// Optional. The unique name for the revision. If this field is omitted, it
10171 /// will be automatically generated based on the Service name.
10172 pub revision: std::string::String,
10173
10174 /// Optional. Unstructured key value map that can be used to organize and
10175 /// categorize objects. User-provided labels are shared with Google's billing
10176 /// system, so they can be used to filter, or break down billing charges by
10177 /// team, component, environment, state, etc. For more information, visit
10178 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
10179 /// <https://cloud.google.com/run/docs/configuring/labels>.
10180 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10181
10182 /// Optional. Unstructured key value map that may be set by external tools to
10183 /// store and arbitrary metadata. They are not queryable and should be
10184 /// preserved when modifying objects.
10185 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
10186
10187 /// Optional. Scaling settings for this Revision.
10188 pub scaling: std::option::Option<crate::model::RevisionScaling>,
10189
10190 /// Optional. VPC Access configuration to use for this Revision. For more
10191 /// information, visit
10192 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
10193 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
10194
10195 /// Optional. Max allowed time for an instance to respond to a request.
10196 pub timeout: std::option::Option<wkt::Duration>,
10197
10198 /// Optional. Email address of the IAM service account associated with the
10199 /// revision of the service. The service account represents the identity of the
10200 /// running revision, and determines what permissions the revision has. If not
10201 /// provided, the revision will use the project's default service account.
10202 pub service_account: std::string::String,
10203
10204 /// Holds the single container that defines the unit of execution for this
10205 /// Revision.
10206 pub containers: std::vec::Vec<crate::model::Container>,
10207
10208 /// Optional. A list of Volumes to make available to containers.
10209 pub volumes: std::vec::Vec<crate::model::Volume>,
10210
10211 /// Optional. The sandbox environment to host this Revision.
10212 pub execution_environment: crate::model::ExecutionEnvironment,
10213
10214 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
10215 /// this container image. For more information, go to
10216 /// <https://cloud.google.com/run/docs/securing/using-cmek>
10217 pub encryption_key: std::string::String,
10218
10219 /// Optional. Sets the maximum number of requests that each serving instance
10220 /// can receive. If not specified or 0, concurrency defaults to 80 when
10221 /// requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
10222 pub max_instance_request_concurrency: i32,
10223
10224 /// Optional. Enables service mesh connectivity.
10225 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
10226
10227 /// Optional. The action to take if the encryption key is revoked.
10228 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
10229
10230 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
10231 /// before shutting down all instances. The minimum increment is 1 hour.
10232 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
10233
10234 /// Optional. Enable session affinity.
10235 pub session_affinity: bool,
10236
10237 /// Optional. Disables health checking containers during deployment.
10238 pub health_check_disabled: bool,
10239
10240 /// Optional. The node selector for the revision template.
10241 pub node_selector: std::option::Option<crate::model::NodeSelector>,
10242
10243 /// Optional. True if GPU zonal redundancy is disabled on this revision.
10244 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
10245
10246 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10247}
10248
10249impl RevisionTemplate {
10250 /// Creates a new default instance.
10251 pub fn new() -> Self {
10252 std::default::Default::default()
10253 }
10254
10255 /// Sets the value of [revision][crate::model::RevisionTemplate::revision].
10256 ///
10257 /// # Example
10258 /// ```ignore,no_run
10259 /// # use google_cloud_run_v2::model::RevisionTemplate;
10260 /// let x = RevisionTemplate::new().set_revision("example");
10261 /// ```
10262 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10263 self.revision = v.into();
10264 self
10265 }
10266
10267 /// Sets the value of [labels][crate::model::RevisionTemplate::labels].
10268 ///
10269 /// # Example
10270 /// ```ignore,no_run
10271 /// # use google_cloud_run_v2::model::RevisionTemplate;
10272 /// let x = RevisionTemplate::new().set_labels([
10273 /// ("key0", "abc"),
10274 /// ("key1", "xyz"),
10275 /// ]);
10276 /// ```
10277 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10278 where
10279 T: std::iter::IntoIterator<Item = (K, V)>,
10280 K: std::convert::Into<std::string::String>,
10281 V: std::convert::Into<std::string::String>,
10282 {
10283 use std::iter::Iterator;
10284 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10285 self
10286 }
10287
10288 /// Sets the value of [annotations][crate::model::RevisionTemplate::annotations].
10289 ///
10290 /// # Example
10291 /// ```ignore,no_run
10292 /// # use google_cloud_run_v2::model::RevisionTemplate;
10293 /// let x = RevisionTemplate::new().set_annotations([
10294 /// ("key0", "abc"),
10295 /// ("key1", "xyz"),
10296 /// ]);
10297 /// ```
10298 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
10299 where
10300 T: std::iter::IntoIterator<Item = (K, V)>,
10301 K: std::convert::Into<std::string::String>,
10302 V: std::convert::Into<std::string::String>,
10303 {
10304 use std::iter::Iterator;
10305 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10306 self
10307 }
10308
10309 /// Sets the value of [scaling][crate::model::RevisionTemplate::scaling].
10310 ///
10311 /// # Example
10312 /// ```ignore,no_run
10313 /// # use google_cloud_run_v2::model::RevisionTemplate;
10314 /// use google_cloud_run_v2::model::RevisionScaling;
10315 /// let x = RevisionTemplate::new().set_scaling(RevisionScaling::default()/* use setters */);
10316 /// ```
10317 pub fn set_scaling<T>(mut self, v: T) -> Self
10318 where
10319 T: std::convert::Into<crate::model::RevisionScaling>,
10320 {
10321 self.scaling = std::option::Option::Some(v.into());
10322 self
10323 }
10324
10325 /// Sets or clears the value of [scaling][crate::model::RevisionTemplate::scaling].
10326 ///
10327 /// # Example
10328 /// ```ignore,no_run
10329 /// # use google_cloud_run_v2::model::RevisionTemplate;
10330 /// use google_cloud_run_v2::model::RevisionScaling;
10331 /// let x = RevisionTemplate::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
10332 /// let x = RevisionTemplate::new().set_or_clear_scaling(None::<RevisionScaling>);
10333 /// ```
10334 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
10335 where
10336 T: std::convert::Into<crate::model::RevisionScaling>,
10337 {
10338 self.scaling = v.map(|x| x.into());
10339 self
10340 }
10341
10342 /// Sets the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10343 ///
10344 /// # Example
10345 /// ```ignore,no_run
10346 /// # use google_cloud_run_v2::model::RevisionTemplate;
10347 /// use google_cloud_run_v2::model::VpcAccess;
10348 /// let x = RevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
10349 /// ```
10350 pub fn set_vpc_access<T>(mut self, v: T) -> Self
10351 where
10352 T: std::convert::Into<crate::model::VpcAccess>,
10353 {
10354 self.vpc_access = std::option::Option::Some(v.into());
10355 self
10356 }
10357
10358 /// Sets or clears the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10359 ///
10360 /// # Example
10361 /// ```ignore,no_run
10362 /// # use google_cloud_run_v2::model::RevisionTemplate;
10363 /// use google_cloud_run_v2::model::VpcAccess;
10364 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
10365 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
10366 /// ```
10367 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
10368 where
10369 T: std::convert::Into<crate::model::VpcAccess>,
10370 {
10371 self.vpc_access = v.map(|x| x.into());
10372 self
10373 }
10374
10375 /// Sets the value of [timeout][crate::model::RevisionTemplate::timeout].
10376 ///
10377 /// # Example
10378 /// ```ignore,no_run
10379 /// # use google_cloud_run_v2::model::RevisionTemplate;
10380 /// use wkt::Duration;
10381 /// let x = RevisionTemplate::new().set_timeout(Duration::default()/* use setters */);
10382 /// ```
10383 pub fn set_timeout<T>(mut self, v: T) -> Self
10384 where
10385 T: std::convert::Into<wkt::Duration>,
10386 {
10387 self.timeout = std::option::Option::Some(v.into());
10388 self
10389 }
10390
10391 /// Sets or clears the value of [timeout][crate::model::RevisionTemplate::timeout].
10392 ///
10393 /// # Example
10394 /// ```ignore,no_run
10395 /// # use google_cloud_run_v2::model::RevisionTemplate;
10396 /// use wkt::Duration;
10397 /// let x = RevisionTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
10398 /// let x = RevisionTemplate::new().set_or_clear_timeout(None::<Duration>);
10399 /// ```
10400 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
10401 where
10402 T: std::convert::Into<wkt::Duration>,
10403 {
10404 self.timeout = v.map(|x| x.into());
10405 self
10406 }
10407
10408 /// Sets the value of [service_account][crate::model::RevisionTemplate::service_account].
10409 ///
10410 /// # Example
10411 /// ```ignore,no_run
10412 /// # use google_cloud_run_v2::model::RevisionTemplate;
10413 /// let x = RevisionTemplate::new().set_service_account("example");
10414 /// ```
10415 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10416 self.service_account = v.into();
10417 self
10418 }
10419
10420 /// Sets the value of [containers][crate::model::RevisionTemplate::containers].
10421 ///
10422 /// # Example
10423 /// ```ignore,no_run
10424 /// # use google_cloud_run_v2::model::RevisionTemplate;
10425 /// use google_cloud_run_v2::model::Container;
10426 /// let x = RevisionTemplate::new()
10427 /// .set_containers([
10428 /// Container::default()/* use setters */,
10429 /// Container::default()/* use (different) setters */,
10430 /// ]);
10431 /// ```
10432 pub fn set_containers<T, V>(mut self, v: T) -> Self
10433 where
10434 T: std::iter::IntoIterator<Item = V>,
10435 V: std::convert::Into<crate::model::Container>,
10436 {
10437 use std::iter::Iterator;
10438 self.containers = v.into_iter().map(|i| i.into()).collect();
10439 self
10440 }
10441
10442 /// Sets the value of [volumes][crate::model::RevisionTemplate::volumes].
10443 ///
10444 /// # Example
10445 /// ```ignore,no_run
10446 /// # use google_cloud_run_v2::model::RevisionTemplate;
10447 /// use google_cloud_run_v2::model::Volume;
10448 /// let x = RevisionTemplate::new()
10449 /// .set_volumes([
10450 /// Volume::default()/* use setters */,
10451 /// Volume::default()/* use (different) setters */,
10452 /// ]);
10453 /// ```
10454 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10455 where
10456 T: std::iter::IntoIterator<Item = V>,
10457 V: std::convert::Into<crate::model::Volume>,
10458 {
10459 use std::iter::Iterator;
10460 self.volumes = v.into_iter().map(|i| i.into()).collect();
10461 self
10462 }
10463
10464 /// Sets the value of [execution_environment][crate::model::RevisionTemplate::execution_environment].
10465 ///
10466 /// # Example
10467 /// ```ignore,no_run
10468 /// # use google_cloud_run_v2::model::RevisionTemplate;
10469 /// use google_cloud_run_v2::model::ExecutionEnvironment;
10470 /// let x0 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
10471 /// let x1 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
10472 /// ```
10473 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
10474 mut self,
10475 v: T,
10476 ) -> Self {
10477 self.execution_environment = v.into();
10478 self
10479 }
10480
10481 /// Sets the value of [encryption_key][crate::model::RevisionTemplate::encryption_key].
10482 ///
10483 /// # Example
10484 /// ```ignore,no_run
10485 /// # use google_cloud_run_v2::model::RevisionTemplate;
10486 /// let x = RevisionTemplate::new().set_encryption_key("example");
10487 /// ```
10488 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10489 self.encryption_key = v.into();
10490 self
10491 }
10492
10493 /// Sets the value of [max_instance_request_concurrency][crate::model::RevisionTemplate::max_instance_request_concurrency].
10494 ///
10495 /// # Example
10496 /// ```ignore,no_run
10497 /// # use google_cloud_run_v2::model::RevisionTemplate;
10498 /// let x = RevisionTemplate::new().set_max_instance_request_concurrency(42);
10499 /// ```
10500 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
10501 mut self,
10502 v: T,
10503 ) -> Self {
10504 self.max_instance_request_concurrency = v.into();
10505 self
10506 }
10507
10508 /// Sets the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10509 ///
10510 /// # Example
10511 /// ```ignore,no_run
10512 /// # use google_cloud_run_v2::model::RevisionTemplate;
10513 /// use google_cloud_run_v2::model::ServiceMesh;
10514 /// let x = RevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
10515 /// ```
10516 pub fn set_service_mesh<T>(mut self, v: T) -> Self
10517 where
10518 T: std::convert::Into<crate::model::ServiceMesh>,
10519 {
10520 self.service_mesh = std::option::Option::Some(v.into());
10521 self
10522 }
10523
10524 /// Sets or clears the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10525 ///
10526 /// # Example
10527 /// ```ignore,no_run
10528 /// # use google_cloud_run_v2::model::RevisionTemplate;
10529 /// use google_cloud_run_v2::model::ServiceMesh;
10530 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
10531 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
10532 /// ```
10533 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
10534 where
10535 T: std::convert::Into<crate::model::ServiceMesh>,
10536 {
10537 self.service_mesh = v.map(|x| x.into());
10538 self
10539 }
10540
10541 /// Sets the value of [encryption_key_revocation_action][crate::model::RevisionTemplate::encryption_key_revocation_action].
10542 ///
10543 /// # Example
10544 /// ```ignore,no_run
10545 /// # use google_cloud_run_v2::model::RevisionTemplate;
10546 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
10547 /// let x0 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
10548 /// let x1 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
10549 /// ```
10550 pub fn set_encryption_key_revocation_action<
10551 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
10552 >(
10553 mut self,
10554 v: T,
10555 ) -> Self {
10556 self.encryption_key_revocation_action = v.into();
10557 self
10558 }
10559
10560 /// Sets the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10561 ///
10562 /// # Example
10563 /// ```ignore,no_run
10564 /// # use google_cloud_run_v2::model::RevisionTemplate;
10565 /// use wkt::Duration;
10566 /// let x = RevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
10567 /// ```
10568 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
10569 where
10570 T: std::convert::Into<wkt::Duration>,
10571 {
10572 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
10573 self
10574 }
10575
10576 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10577 ///
10578 /// # Example
10579 /// ```ignore,no_run
10580 /// # use google_cloud_run_v2::model::RevisionTemplate;
10581 /// use wkt::Duration;
10582 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
10583 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
10584 /// ```
10585 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
10586 mut self,
10587 v: std::option::Option<T>,
10588 ) -> Self
10589 where
10590 T: std::convert::Into<wkt::Duration>,
10591 {
10592 self.encryption_key_shutdown_duration = v.map(|x| x.into());
10593 self
10594 }
10595
10596 /// Sets the value of [session_affinity][crate::model::RevisionTemplate::session_affinity].
10597 ///
10598 /// # Example
10599 /// ```ignore,no_run
10600 /// # use google_cloud_run_v2::model::RevisionTemplate;
10601 /// let x = RevisionTemplate::new().set_session_affinity(true);
10602 /// ```
10603 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10604 self.session_affinity = v.into();
10605 self
10606 }
10607
10608 /// Sets the value of [health_check_disabled][crate::model::RevisionTemplate::health_check_disabled].
10609 ///
10610 /// # Example
10611 /// ```ignore,no_run
10612 /// # use google_cloud_run_v2::model::RevisionTemplate;
10613 /// let x = RevisionTemplate::new().set_health_check_disabled(true);
10614 /// ```
10615 pub fn set_health_check_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10616 self.health_check_disabled = v.into();
10617 self
10618 }
10619
10620 /// Sets the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10621 ///
10622 /// # Example
10623 /// ```ignore,no_run
10624 /// # use google_cloud_run_v2::model::RevisionTemplate;
10625 /// use google_cloud_run_v2::model::NodeSelector;
10626 /// let x = RevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
10627 /// ```
10628 pub fn set_node_selector<T>(mut self, v: T) -> Self
10629 where
10630 T: std::convert::Into<crate::model::NodeSelector>,
10631 {
10632 self.node_selector = std::option::Option::Some(v.into());
10633 self
10634 }
10635
10636 /// Sets or clears the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10637 ///
10638 /// # Example
10639 /// ```ignore,no_run
10640 /// # use google_cloud_run_v2::model::RevisionTemplate;
10641 /// use google_cloud_run_v2::model::NodeSelector;
10642 /// let x = RevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10643 /// let x = RevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
10644 /// ```
10645 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10646 where
10647 T: std::convert::Into<crate::model::NodeSelector>,
10648 {
10649 self.node_selector = v.map(|x| x.into());
10650 self
10651 }
10652
10653 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10654 ///
10655 /// # Example
10656 /// ```ignore,no_run
10657 /// # use google_cloud_run_v2::model::RevisionTemplate;
10658 /// let x = RevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
10659 /// ```
10660 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10661 where
10662 T: std::convert::Into<bool>,
10663 {
10664 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10665 self
10666 }
10667
10668 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10669 ///
10670 /// # Example
10671 /// ```ignore,no_run
10672 /// # use google_cloud_run_v2::model::RevisionTemplate;
10673 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10674 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10675 /// ```
10676 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10677 mut self,
10678 v: std::option::Option<T>,
10679 ) -> Self
10680 where
10681 T: std::convert::Into<bool>,
10682 {
10683 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10684 self
10685 }
10686}
10687
10688impl wkt::message::Message for RevisionTemplate {
10689 fn typename() -> &'static str {
10690 "type.googleapis.com/google.cloud.run.v2.RevisionTemplate"
10691 }
10692}
10693
10694/// Request message for creating a Service.
10695#[derive(Clone, Default, PartialEq)]
10696#[non_exhaustive]
10697pub struct CreateServiceRequest {
10698 /// Required. The location and project in which this service should be created.
10699 /// Format: projects/{project}/locations/{location}, where {project} can be
10700 /// project id or number. Only lowercase characters, digits, and hyphens.
10701 pub parent: std::string::String,
10702
10703 /// Required. The Service instance to create.
10704 pub service: std::option::Option<crate::model::Service>,
10705
10706 /// Required. The unique identifier for the Service. It must begin with letter,
10707 /// and cannot end with hyphen; must contain fewer than 50 characters.
10708 /// The name of the service becomes {parent}/services/{service_id}.
10709 pub service_id: std::string::String,
10710
10711 /// Indicates that the request should be validated and default values
10712 /// populated, without persisting the request or creating any resources.
10713 pub validate_only: bool,
10714
10715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10716}
10717
10718impl CreateServiceRequest {
10719 /// Creates a new default instance.
10720 pub fn new() -> Self {
10721 std::default::Default::default()
10722 }
10723
10724 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
10725 ///
10726 /// # Example
10727 /// ```ignore,no_run
10728 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10729 /// let x = CreateServiceRequest::new().set_parent("example");
10730 /// ```
10731 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10732 self.parent = v.into();
10733 self
10734 }
10735
10736 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
10737 ///
10738 /// # Example
10739 /// ```ignore,no_run
10740 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10741 /// use google_cloud_run_v2::model::Service;
10742 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
10743 /// ```
10744 pub fn set_service<T>(mut self, v: T) -> Self
10745 where
10746 T: std::convert::Into<crate::model::Service>,
10747 {
10748 self.service = std::option::Option::Some(v.into());
10749 self
10750 }
10751
10752 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
10753 ///
10754 /// # Example
10755 /// ```ignore,no_run
10756 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10757 /// use google_cloud_run_v2::model::Service;
10758 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10759 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
10760 /// ```
10761 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10762 where
10763 T: std::convert::Into<crate::model::Service>,
10764 {
10765 self.service = v.map(|x| x.into());
10766 self
10767 }
10768
10769 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
10770 ///
10771 /// # Example
10772 /// ```ignore,no_run
10773 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10774 /// let x = CreateServiceRequest::new().set_service_id("example");
10775 /// ```
10776 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10777 self.service_id = v.into();
10778 self
10779 }
10780
10781 /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
10782 ///
10783 /// # Example
10784 /// ```ignore,no_run
10785 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10786 /// let x = CreateServiceRequest::new().set_validate_only(true);
10787 /// ```
10788 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10789 self.validate_only = v.into();
10790 self
10791 }
10792}
10793
10794impl wkt::message::Message for CreateServiceRequest {
10795 fn typename() -> &'static str {
10796 "type.googleapis.com/google.cloud.run.v2.CreateServiceRequest"
10797 }
10798}
10799
10800/// Request message for updating a service.
10801#[derive(Clone, Default, PartialEq)]
10802#[non_exhaustive]
10803pub struct UpdateServiceRequest {
10804 /// Optional. The list of fields to be updated.
10805 pub update_mask: std::option::Option<wkt::FieldMask>,
10806
10807 /// Required. The Service to be updated.
10808 pub service: std::option::Option<crate::model::Service>,
10809
10810 /// Indicates that the request should be validated and default values
10811 /// populated, without persisting the request or updating any resources.
10812 pub validate_only: bool,
10813
10814 /// Optional. If set to true, and if the Service does not exist, it will create
10815 /// a new one. The caller must have 'run.services.create' permissions if this
10816 /// is set to true and the Service does not exist.
10817 pub allow_missing: bool,
10818
10819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10820}
10821
10822impl UpdateServiceRequest {
10823 /// Creates a new default instance.
10824 pub fn new() -> Self {
10825 std::default::Default::default()
10826 }
10827
10828 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10829 ///
10830 /// # Example
10831 /// ```ignore,no_run
10832 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10833 /// use wkt::FieldMask;
10834 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10835 /// ```
10836 pub fn set_update_mask<T>(mut self, v: T) -> Self
10837 where
10838 T: std::convert::Into<wkt::FieldMask>,
10839 {
10840 self.update_mask = std::option::Option::Some(v.into());
10841 self
10842 }
10843
10844 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10845 ///
10846 /// # Example
10847 /// ```ignore,no_run
10848 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10849 /// use wkt::FieldMask;
10850 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10851 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10852 /// ```
10853 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10854 where
10855 T: std::convert::Into<wkt::FieldMask>,
10856 {
10857 self.update_mask = v.map(|x| x.into());
10858 self
10859 }
10860
10861 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
10862 ///
10863 /// # Example
10864 /// ```ignore,no_run
10865 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10866 /// use google_cloud_run_v2::model::Service;
10867 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
10868 /// ```
10869 pub fn set_service<T>(mut self, v: T) -> Self
10870 where
10871 T: std::convert::Into<crate::model::Service>,
10872 {
10873 self.service = std::option::Option::Some(v.into());
10874 self
10875 }
10876
10877 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
10878 ///
10879 /// # Example
10880 /// ```ignore,no_run
10881 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10882 /// use google_cloud_run_v2::model::Service;
10883 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10884 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
10885 /// ```
10886 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10887 where
10888 T: std::convert::Into<crate::model::Service>,
10889 {
10890 self.service = v.map(|x| x.into());
10891 self
10892 }
10893
10894 /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
10895 ///
10896 /// # Example
10897 /// ```ignore,no_run
10898 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10899 /// let x = UpdateServiceRequest::new().set_validate_only(true);
10900 /// ```
10901 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10902 self.validate_only = v.into();
10903 self
10904 }
10905
10906 /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
10907 ///
10908 /// # Example
10909 /// ```ignore,no_run
10910 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10911 /// let x = UpdateServiceRequest::new().set_allow_missing(true);
10912 /// ```
10913 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10914 self.allow_missing = v.into();
10915 self
10916 }
10917}
10918
10919impl wkt::message::Message for UpdateServiceRequest {
10920 fn typename() -> &'static str {
10921 "type.googleapis.com/google.cloud.run.v2.UpdateServiceRequest"
10922 }
10923}
10924
10925/// Request message for retrieving a list of Services.
10926#[derive(Clone, Default, PartialEq)]
10927#[non_exhaustive]
10928pub struct ListServicesRequest {
10929 /// Required. The location and project to list resources on.
10930 /// Location must be a valid Google Cloud region, and cannot be the "-"
10931 /// wildcard. Format: projects/{project}/locations/{location}, where {project}
10932 /// can be project id or number.
10933 pub parent: std::string::String,
10934
10935 /// Maximum number of Services to return in this call.
10936 pub page_size: i32,
10937
10938 /// A page token received from a previous call to ListServices.
10939 /// All other parameters must match.
10940 pub page_token: std::string::String,
10941
10942 /// If true, returns deleted (but unexpired) resources along with active ones.
10943 pub show_deleted: bool,
10944
10945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10946}
10947
10948impl ListServicesRequest {
10949 /// Creates a new default instance.
10950 pub fn new() -> Self {
10951 std::default::Default::default()
10952 }
10953
10954 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
10955 ///
10956 /// # Example
10957 /// ```ignore,no_run
10958 /// # use google_cloud_run_v2::model::ListServicesRequest;
10959 /// let x = ListServicesRequest::new().set_parent("example");
10960 /// ```
10961 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10962 self.parent = v.into();
10963 self
10964 }
10965
10966 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
10967 ///
10968 /// # Example
10969 /// ```ignore,no_run
10970 /// # use google_cloud_run_v2::model::ListServicesRequest;
10971 /// let x = ListServicesRequest::new().set_page_size(42);
10972 /// ```
10973 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10974 self.page_size = v.into();
10975 self
10976 }
10977
10978 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
10979 ///
10980 /// # Example
10981 /// ```ignore,no_run
10982 /// # use google_cloud_run_v2::model::ListServicesRequest;
10983 /// let x = ListServicesRequest::new().set_page_token("example");
10984 /// ```
10985 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10986 self.page_token = v.into();
10987 self
10988 }
10989
10990 /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
10991 ///
10992 /// # Example
10993 /// ```ignore,no_run
10994 /// # use google_cloud_run_v2::model::ListServicesRequest;
10995 /// let x = ListServicesRequest::new().set_show_deleted(true);
10996 /// ```
10997 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10998 self.show_deleted = v.into();
10999 self
11000 }
11001}
11002
11003impl wkt::message::Message for ListServicesRequest {
11004 fn typename() -> &'static str {
11005 "type.googleapis.com/google.cloud.run.v2.ListServicesRequest"
11006 }
11007}
11008
11009/// Response message containing a list of Services.
11010#[derive(Clone, Default, PartialEq)]
11011#[non_exhaustive]
11012pub struct ListServicesResponse {
11013 /// The resulting list of Services.
11014 pub services: std::vec::Vec<crate::model::Service>,
11015
11016 /// A token indicating there are more items than page_size. Use it in the next
11017 /// ListServices request to continue.
11018 pub next_page_token: std::string::String,
11019
11020 /// Output only. For global requests, returns the list of regions that could
11021 /// not be reached within the deadline.
11022 pub unreachable: std::vec::Vec<std::string::String>,
11023
11024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11025}
11026
11027impl ListServicesResponse {
11028 /// Creates a new default instance.
11029 pub fn new() -> Self {
11030 std::default::Default::default()
11031 }
11032
11033 /// Sets the value of [services][crate::model::ListServicesResponse::services].
11034 ///
11035 /// # Example
11036 /// ```ignore,no_run
11037 /// # use google_cloud_run_v2::model::ListServicesResponse;
11038 /// use google_cloud_run_v2::model::Service;
11039 /// let x = ListServicesResponse::new()
11040 /// .set_services([
11041 /// Service::default()/* use setters */,
11042 /// Service::default()/* use (different) setters */,
11043 /// ]);
11044 /// ```
11045 pub fn set_services<T, V>(mut self, v: T) -> Self
11046 where
11047 T: std::iter::IntoIterator<Item = V>,
11048 V: std::convert::Into<crate::model::Service>,
11049 {
11050 use std::iter::Iterator;
11051 self.services = v.into_iter().map(|i| i.into()).collect();
11052 self
11053 }
11054
11055 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
11056 ///
11057 /// # Example
11058 /// ```ignore,no_run
11059 /// # use google_cloud_run_v2::model::ListServicesResponse;
11060 /// let x = ListServicesResponse::new().set_next_page_token("example");
11061 /// ```
11062 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11063 self.next_page_token = v.into();
11064 self
11065 }
11066
11067 /// Sets the value of [unreachable][crate::model::ListServicesResponse::unreachable].
11068 ///
11069 /// # Example
11070 /// ```ignore,no_run
11071 /// # use google_cloud_run_v2::model::ListServicesResponse;
11072 /// let x = ListServicesResponse::new().set_unreachable(["a", "b", "c"]);
11073 /// ```
11074 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11075 where
11076 T: std::iter::IntoIterator<Item = V>,
11077 V: std::convert::Into<std::string::String>,
11078 {
11079 use std::iter::Iterator;
11080 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11081 self
11082 }
11083}
11084
11085impl wkt::message::Message for ListServicesResponse {
11086 fn typename() -> &'static str {
11087 "type.googleapis.com/google.cloud.run.v2.ListServicesResponse"
11088 }
11089}
11090
11091#[doc(hidden)]
11092impl google_cloud_gax::paginator::internal::PageableResponse for ListServicesResponse {
11093 type PageItem = crate::model::Service;
11094
11095 fn items(self) -> std::vec::Vec<Self::PageItem> {
11096 self.services
11097 }
11098
11099 fn next_page_token(&self) -> std::string::String {
11100 use std::clone::Clone;
11101 self.next_page_token.clone()
11102 }
11103}
11104
11105/// Request message for obtaining a Service by its full name.
11106#[derive(Clone, Default, PartialEq)]
11107#[non_exhaustive]
11108pub struct GetServiceRequest {
11109 /// Required. The full name of the Service.
11110 /// Format: projects/{project}/locations/{location}/services/{service}, where
11111 /// {project} can be project id or number.
11112 pub name: std::string::String,
11113
11114 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11115}
11116
11117impl GetServiceRequest {
11118 /// Creates a new default instance.
11119 pub fn new() -> Self {
11120 std::default::Default::default()
11121 }
11122
11123 /// Sets the value of [name][crate::model::GetServiceRequest::name].
11124 ///
11125 /// # Example
11126 /// ```ignore,no_run
11127 /// # use google_cloud_run_v2::model::GetServiceRequest;
11128 /// let x = GetServiceRequest::new().set_name("example");
11129 /// ```
11130 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11131 self.name = v.into();
11132 self
11133 }
11134}
11135
11136impl wkt::message::Message for GetServiceRequest {
11137 fn typename() -> &'static str {
11138 "type.googleapis.com/google.cloud.run.v2.GetServiceRequest"
11139 }
11140}
11141
11142/// Request message to delete a Service by its full name.
11143#[derive(Clone, Default, PartialEq)]
11144#[non_exhaustive]
11145pub struct DeleteServiceRequest {
11146 /// Required. The full name of the Service.
11147 /// Format: projects/{project}/locations/{location}/services/{service}, where
11148 /// {project} can be project id or number.
11149 pub name: std::string::String,
11150
11151 /// Indicates that the request should be validated without actually
11152 /// deleting any resources.
11153 pub validate_only: bool,
11154
11155 /// A system-generated fingerprint for this version of the
11156 /// resource. May be used to detect modification conflict during updates.
11157 pub etag: std::string::String,
11158
11159 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11160}
11161
11162impl DeleteServiceRequest {
11163 /// Creates a new default instance.
11164 pub fn new() -> Self {
11165 std::default::Default::default()
11166 }
11167
11168 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
11169 ///
11170 /// # Example
11171 /// ```ignore,no_run
11172 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11173 /// let x = DeleteServiceRequest::new().set_name("example");
11174 /// ```
11175 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11176 self.name = v.into();
11177 self
11178 }
11179
11180 /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
11181 ///
11182 /// # Example
11183 /// ```ignore,no_run
11184 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11185 /// let x = DeleteServiceRequest::new().set_validate_only(true);
11186 /// ```
11187 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11188 self.validate_only = v.into();
11189 self
11190 }
11191
11192 /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
11193 ///
11194 /// # Example
11195 /// ```ignore,no_run
11196 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11197 /// let x = DeleteServiceRequest::new().set_etag("example");
11198 /// ```
11199 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11200 self.etag = v.into();
11201 self
11202 }
11203}
11204
11205impl wkt::message::Message for DeleteServiceRequest {
11206 fn typename() -> &'static str {
11207 "type.googleapis.com/google.cloud.run.v2.DeleteServiceRequest"
11208 }
11209}
11210
11211/// Service acts as a top-level container that manages a set of
11212/// configurations and revision templates which implement a network service.
11213/// Service exists to provide a singular abstraction which can be access
11214/// controlled, reasoned about, and which encapsulates software lifecycle
11215/// decisions such as rollout policy and team resource ownership.
11216#[derive(Clone, Default, PartialEq)]
11217#[non_exhaustive]
11218pub struct Service {
11219 /// Identifier. The fully qualified name of this Service. In
11220 /// CreateServiceRequest, this field is ignored, and instead composed from
11221 /// CreateServiceRequest.parent and CreateServiceRequest.service_id.
11222 ///
11223 /// Format:
11224 /// projects/{project}/locations/{location}/services/{service_id}
11225 pub name: std::string::String,
11226
11227 /// User-provided description of the Service. This field currently has a
11228 /// 512-character limit.
11229 pub description: std::string::String,
11230
11231 /// Output only. Server assigned unique identifier for the trigger. The value
11232 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
11233 /// deleted.
11234 pub uid: std::string::String,
11235
11236 /// Output only. A number that monotonically increases every time the user
11237 /// modifies the desired state.
11238 /// Please note that unlike v1, this is an int64 value. As with most Google
11239 /// APIs, its JSON representation will be a `string` instead of an `integer`.
11240 pub generation: i64,
11241
11242 /// Optional. Unstructured key value map that can be used to organize and
11243 /// categorize objects. User-provided labels are shared with Google's billing
11244 /// system, so they can be used to filter, or break down billing charges by
11245 /// team, component, environment, state, etc. For more information, visit
11246 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
11247 /// <https://cloud.google.com/run/docs/configuring/labels>.
11248 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11249
11250 /// Optional. Unstructured key value map that may be set by external tools to
11251 /// store and arbitrary metadata. They are not queryable and should be
11252 /// preserved when modifying objects.
11253 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
11254
11255 /// Output only. The creation time.
11256 pub create_time: std::option::Option<wkt::Timestamp>,
11257
11258 /// Output only. The last-modified time.
11259 pub update_time: std::option::Option<wkt::Timestamp>,
11260
11261 /// Output only. The deletion time. It is only populated as a response to a
11262 /// Delete request.
11263 pub delete_time: std::option::Option<wkt::Timestamp>,
11264
11265 /// Output only. For a deleted resource, the time after which it will be
11266 /// permanently deleted.
11267 pub expire_time: std::option::Option<wkt::Timestamp>,
11268
11269 /// Output only. Email address of the authenticated creator.
11270 pub creator: std::string::String,
11271
11272 /// Output only. Email address of the last authenticated modifier.
11273 pub last_modifier: std::string::String,
11274
11275 /// Arbitrary identifier for the API client.
11276 pub client: std::string::String,
11277
11278 /// Arbitrary version identifier for the API client.
11279 pub client_version: std::string::String,
11280
11281 /// Optional. Provides the ingress settings for this Service. On output,
11282 /// returns the currently observed ingress settings, or
11283 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
11284 pub ingress: crate::model::IngressTraffic,
11285
11286 /// Optional. The launch stage as defined by [Google Cloud Platform
11287 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
11288 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
11289 /// is assumed.
11290 /// Set the launch stage to a preview stage on input to allow use of preview
11291 /// features in that stage. On read (or output), describes whether the resource
11292 /// uses preview features.
11293 ///
11294 /// For example, if ALPHA is provided as input, but only BETA and GA-level
11295 /// features are used, this field will be BETA on output.
11296 pub launch_stage: google_cloud_api::model::LaunchStage,
11297
11298 /// Optional. Settings for the Binary Authorization feature.
11299 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
11300
11301 /// Required. The template used to create revisions for this Service.
11302 pub template: std::option::Option<crate::model::RevisionTemplate>,
11303
11304 /// Optional. Specifies how to distribute traffic over a collection of
11305 /// Revisions belonging to the Service. If traffic is empty or not provided,
11306 /// defaults to 100% traffic to the latest `Ready` Revision.
11307 pub traffic: std::vec::Vec<crate::model::TrafficTarget>,
11308
11309 /// Optional. Specifies service-level scaling settings
11310 pub scaling: std::option::Option<crate::model::ServiceScaling>,
11311
11312 /// Optional. Disables IAM permission check for run.routes.invoke for callers
11313 /// of this service. For more information, visit
11314 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
11315 pub invoker_iam_disabled: bool,
11316
11317 /// Optional. Disables public resolution of the default URI of this service.
11318 pub default_uri_disabled: bool,
11319
11320 /// Output only. All URLs serving traffic for this Service.
11321 pub urls: std::vec::Vec<std::string::String>,
11322
11323 /// Optional. IAP settings on the Service.
11324 pub iap_enabled: bool,
11325
11326 /// Optional. Settings for multi-region deployment.
11327 pub multi_region_settings: std::option::Option<crate::model::service::MultiRegionSettings>,
11328
11329 /// One or more custom audiences that you want this service to support. Specify
11330 /// each custom audience as the full URL in a string. The custom audiences are
11331 /// encoded in the token and used to authenticate requests. For more
11332 /// information, see
11333 /// <https://cloud.google.com/run/docs/configuring/custom-audiences>.
11334 pub custom_audiences: std::vec::Vec<std::string::String>,
11335
11336 /// Output only. The generation of this Service currently serving traffic. See
11337 /// comments in `reconciling` for additional information on reconciliation
11338 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
11339 /// As with most Google APIs, its JSON representation will be a `string`
11340 /// instead of an `integer`.
11341 pub observed_generation: i64,
11342
11343 /// Output only. The Condition of this Service, containing its readiness
11344 /// status, and detailed error information in case it did not reach a serving
11345 /// state. See comments in `reconciling` for additional information on
11346 /// reconciliation process in Cloud Run.
11347 pub terminal_condition: std::option::Option<crate::model::Condition>,
11348
11349 /// Output only. The Conditions of all other associated sub-resources. They
11350 /// contain additional diagnostics information in case the Service does not
11351 /// reach its Serving state. See comments in `reconciling` for additional
11352 /// information on reconciliation process in Cloud Run.
11353 pub conditions: std::vec::Vec<crate::model::Condition>,
11354
11355 /// Output only. Name of the latest revision that is serving traffic. See
11356 /// comments in `reconciling` for additional information on reconciliation
11357 /// process in Cloud Run.
11358 pub latest_ready_revision: std::string::String,
11359
11360 /// Output only. Name of the last created revision. See comments in
11361 /// `reconciling` for additional information on reconciliation process in Cloud
11362 /// Run.
11363 pub latest_created_revision: std::string::String,
11364
11365 /// Output only. Detailed status information for corresponding traffic targets.
11366 /// See comments in `reconciling` for additional information on reconciliation
11367 /// process in Cloud Run.
11368 pub traffic_statuses: std::vec::Vec<crate::model::TrafficTargetStatus>,
11369
11370 /// Output only. The main URI in which this Service is serving traffic.
11371 pub uri: std::string::String,
11372
11373 /// Output only. Reserved for future use.
11374 pub satisfies_pzs: bool,
11375
11376 /// Output only. True if Cloud Run Threat Detection monitoring is enabled for
11377 /// the parent project of this Service.
11378 pub threat_detection_enabled: bool,
11379
11380 /// Optional. Configuration for building a Cloud Run function.
11381 pub build_config: std::option::Option<crate::model::BuildConfig>,
11382
11383 /// Output only. Returns true if the Service is currently being acted upon by
11384 /// the system to bring it into the desired state.
11385 ///
11386 /// When a new Service is created, or an existing one is updated, Cloud Run
11387 /// will asynchronously perform all necessary steps to bring the Service to the
11388 /// desired serving state. This process is called reconciliation.
11389 /// While reconciliation is in process, `observed_generation`,
11390 /// `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient
11391 /// values that might mismatch the intended state: Once reconciliation is over
11392 /// (and this field is false), there are two possible outcomes: reconciliation
11393 /// succeeded and the serving state matches the Service, or there was an error,
11394 /// and reconciliation failed. This state can be found in
11395 /// `terminal_condition.state`.
11396 ///
11397 /// If reconciliation succeeded, the following fields will match: `traffic` and
11398 /// `traffic_statuses`, `observed_generation` and `generation`,
11399 /// `latest_ready_revision` and `latest_created_revision`.
11400 ///
11401 /// If reconciliation failed, `traffic_statuses`, `observed_generation`, and
11402 /// `latest_ready_revision` will have the state of the last serving revision,
11403 /// or empty for newly created Services. Additional information on the failure
11404 /// can be found in `terminal_condition` and `conditions`.
11405 pub reconciling: bool,
11406
11407 /// Optional. A system-generated fingerprint for this version of the
11408 /// resource. May be used to detect modification conflict during updates.
11409 pub etag: std::string::String,
11410
11411 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11412}
11413
11414impl Service {
11415 /// Creates a new default instance.
11416 pub fn new() -> Self {
11417 std::default::Default::default()
11418 }
11419
11420 /// Sets the value of [name][crate::model::Service::name].
11421 ///
11422 /// # Example
11423 /// ```ignore,no_run
11424 /// # use google_cloud_run_v2::model::Service;
11425 /// let x = Service::new().set_name("example");
11426 /// ```
11427 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11428 self.name = v.into();
11429 self
11430 }
11431
11432 /// Sets the value of [description][crate::model::Service::description].
11433 ///
11434 /// # Example
11435 /// ```ignore,no_run
11436 /// # use google_cloud_run_v2::model::Service;
11437 /// let x = Service::new().set_description("example");
11438 /// ```
11439 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11440 self.description = v.into();
11441 self
11442 }
11443
11444 /// Sets the value of [uid][crate::model::Service::uid].
11445 ///
11446 /// # Example
11447 /// ```ignore,no_run
11448 /// # use google_cloud_run_v2::model::Service;
11449 /// let x = Service::new().set_uid("example");
11450 /// ```
11451 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11452 self.uid = v.into();
11453 self
11454 }
11455
11456 /// Sets the value of [generation][crate::model::Service::generation].
11457 ///
11458 /// # Example
11459 /// ```ignore,no_run
11460 /// # use google_cloud_run_v2::model::Service;
11461 /// let x = Service::new().set_generation(42);
11462 /// ```
11463 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11464 self.generation = v.into();
11465 self
11466 }
11467
11468 /// Sets the value of [labels][crate::model::Service::labels].
11469 ///
11470 /// # Example
11471 /// ```ignore,no_run
11472 /// # use google_cloud_run_v2::model::Service;
11473 /// let x = Service::new().set_labels([
11474 /// ("key0", "abc"),
11475 /// ("key1", "xyz"),
11476 /// ]);
11477 /// ```
11478 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11479 where
11480 T: std::iter::IntoIterator<Item = (K, V)>,
11481 K: std::convert::Into<std::string::String>,
11482 V: std::convert::Into<std::string::String>,
11483 {
11484 use std::iter::Iterator;
11485 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11486 self
11487 }
11488
11489 /// Sets the value of [annotations][crate::model::Service::annotations].
11490 ///
11491 /// # Example
11492 /// ```ignore,no_run
11493 /// # use google_cloud_run_v2::model::Service;
11494 /// let x = Service::new().set_annotations([
11495 /// ("key0", "abc"),
11496 /// ("key1", "xyz"),
11497 /// ]);
11498 /// ```
11499 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
11500 where
11501 T: std::iter::IntoIterator<Item = (K, V)>,
11502 K: std::convert::Into<std::string::String>,
11503 V: std::convert::Into<std::string::String>,
11504 {
11505 use std::iter::Iterator;
11506 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11507 self
11508 }
11509
11510 /// Sets the value of [create_time][crate::model::Service::create_time].
11511 ///
11512 /// # Example
11513 /// ```ignore,no_run
11514 /// # use google_cloud_run_v2::model::Service;
11515 /// use wkt::Timestamp;
11516 /// let x = Service::new().set_create_time(Timestamp::default()/* use setters */);
11517 /// ```
11518 pub fn set_create_time<T>(mut self, v: T) -> Self
11519 where
11520 T: std::convert::Into<wkt::Timestamp>,
11521 {
11522 self.create_time = std::option::Option::Some(v.into());
11523 self
11524 }
11525
11526 /// Sets or clears the value of [create_time][crate::model::Service::create_time].
11527 ///
11528 /// # Example
11529 /// ```ignore,no_run
11530 /// # use google_cloud_run_v2::model::Service;
11531 /// use wkt::Timestamp;
11532 /// let x = Service::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11533 /// let x = Service::new().set_or_clear_create_time(None::<Timestamp>);
11534 /// ```
11535 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11536 where
11537 T: std::convert::Into<wkt::Timestamp>,
11538 {
11539 self.create_time = v.map(|x| x.into());
11540 self
11541 }
11542
11543 /// Sets the value of [update_time][crate::model::Service::update_time].
11544 ///
11545 /// # Example
11546 /// ```ignore,no_run
11547 /// # use google_cloud_run_v2::model::Service;
11548 /// use wkt::Timestamp;
11549 /// let x = Service::new().set_update_time(Timestamp::default()/* use setters */);
11550 /// ```
11551 pub fn set_update_time<T>(mut self, v: T) -> Self
11552 where
11553 T: std::convert::Into<wkt::Timestamp>,
11554 {
11555 self.update_time = std::option::Option::Some(v.into());
11556 self
11557 }
11558
11559 /// Sets or clears the value of [update_time][crate::model::Service::update_time].
11560 ///
11561 /// # Example
11562 /// ```ignore,no_run
11563 /// # use google_cloud_run_v2::model::Service;
11564 /// use wkt::Timestamp;
11565 /// let x = Service::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11566 /// let x = Service::new().set_or_clear_update_time(None::<Timestamp>);
11567 /// ```
11568 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11569 where
11570 T: std::convert::Into<wkt::Timestamp>,
11571 {
11572 self.update_time = v.map(|x| x.into());
11573 self
11574 }
11575
11576 /// Sets the value of [delete_time][crate::model::Service::delete_time].
11577 ///
11578 /// # Example
11579 /// ```ignore,no_run
11580 /// # use google_cloud_run_v2::model::Service;
11581 /// use wkt::Timestamp;
11582 /// let x = Service::new().set_delete_time(Timestamp::default()/* use setters */);
11583 /// ```
11584 pub fn set_delete_time<T>(mut self, v: T) -> Self
11585 where
11586 T: std::convert::Into<wkt::Timestamp>,
11587 {
11588 self.delete_time = std::option::Option::Some(v.into());
11589 self
11590 }
11591
11592 /// Sets or clears the value of [delete_time][crate::model::Service::delete_time].
11593 ///
11594 /// # Example
11595 /// ```ignore,no_run
11596 /// # use google_cloud_run_v2::model::Service;
11597 /// use wkt::Timestamp;
11598 /// let x = Service::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
11599 /// let x = Service::new().set_or_clear_delete_time(None::<Timestamp>);
11600 /// ```
11601 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
11602 where
11603 T: std::convert::Into<wkt::Timestamp>,
11604 {
11605 self.delete_time = v.map(|x| x.into());
11606 self
11607 }
11608
11609 /// Sets the value of [expire_time][crate::model::Service::expire_time].
11610 ///
11611 /// # Example
11612 /// ```ignore,no_run
11613 /// # use google_cloud_run_v2::model::Service;
11614 /// use wkt::Timestamp;
11615 /// let x = Service::new().set_expire_time(Timestamp::default()/* use setters */);
11616 /// ```
11617 pub fn set_expire_time<T>(mut self, v: T) -> Self
11618 where
11619 T: std::convert::Into<wkt::Timestamp>,
11620 {
11621 self.expire_time = std::option::Option::Some(v.into());
11622 self
11623 }
11624
11625 /// Sets or clears the value of [expire_time][crate::model::Service::expire_time].
11626 ///
11627 /// # Example
11628 /// ```ignore,no_run
11629 /// # use google_cloud_run_v2::model::Service;
11630 /// use wkt::Timestamp;
11631 /// let x = Service::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
11632 /// let x = Service::new().set_or_clear_expire_time(None::<Timestamp>);
11633 /// ```
11634 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
11635 where
11636 T: std::convert::Into<wkt::Timestamp>,
11637 {
11638 self.expire_time = v.map(|x| x.into());
11639 self
11640 }
11641
11642 /// Sets the value of [creator][crate::model::Service::creator].
11643 ///
11644 /// # Example
11645 /// ```ignore,no_run
11646 /// # use google_cloud_run_v2::model::Service;
11647 /// let x = Service::new().set_creator("example");
11648 /// ```
11649 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11650 self.creator = v.into();
11651 self
11652 }
11653
11654 /// Sets the value of [last_modifier][crate::model::Service::last_modifier].
11655 ///
11656 /// # Example
11657 /// ```ignore,no_run
11658 /// # use google_cloud_run_v2::model::Service;
11659 /// let x = Service::new().set_last_modifier("example");
11660 /// ```
11661 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11662 self.last_modifier = v.into();
11663 self
11664 }
11665
11666 /// Sets the value of [client][crate::model::Service::client].
11667 ///
11668 /// # Example
11669 /// ```ignore,no_run
11670 /// # use google_cloud_run_v2::model::Service;
11671 /// let x = Service::new().set_client("example");
11672 /// ```
11673 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11674 self.client = v.into();
11675 self
11676 }
11677
11678 /// Sets the value of [client_version][crate::model::Service::client_version].
11679 ///
11680 /// # Example
11681 /// ```ignore,no_run
11682 /// # use google_cloud_run_v2::model::Service;
11683 /// let x = Service::new().set_client_version("example");
11684 /// ```
11685 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11686 self.client_version = v.into();
11687 self
11688 }
11689
11690 /// Sets the value of [ingress][crate::model::Service::ingress].
11691 ///
11692 /// # Example
11693 /// ```ignore,no_run
11694 /// # use google_cloud_run_v2::model::Service;
11695 /// use google_cloud_run_v2::model::IngressTraffic;
11696 /// let x0 = Service::new().set_ingress(IngressTraffic::All);
11697 /// let x1 = Service::new().set_ingress(IngressTraffic::InternalOnly);
11698 /// let x2 = Service::new().set_ingress(IngressTraffic::InternalLoadBalancer);
11699 /// ```
11700 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
11701 mut self,
11702 v: T,
11703 ) -> Self {
11704 self.ingress = v.into();
11705 self
11706 }
11707
11708 /// Sets the value of [launch_stage][crate::model::Service::launch_stage].
11709 ///
11710 /// # Example
11711 /// ```ignore,no_run
11712 /// # use google_cloud_run_v2::model::Service;
11713 /// use google_cloud_api::model::LaunchStage;
11714 /// let x0 = Service::new().set_launch_stage(LaunchStage::Unimplemented);
11715 /// let x1 = Service::new().set_launch_stage(LaunchStage::Prelaunch);
11716 /// let x2 = Service::new().set_launch_stage(LaunchStage::EarlyAccess);
11717 /// ```
11718 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
11719 mut self,
11720 v: T,
11721 ) -> Self {
11722 self.launch_stage = v.into();
11723 self
11724 }
11725
11726 /// Sets the value of [binary_authorization][crate::model::Service::binary_authorization].
11727 ///
11728 /// # Example
11729 /// ```ignore,no_run
11730 /// # use google_cloud_run_v2::model::Service;
11731 /// use google_cloud_run_v2::model::BinaryAuthorization;
11732 /// let x = Service::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
11733 /// ```
11734 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
11735 where
11736 T: std::convert::Into<crate::model::BinaryAuthorization>,
11737 {
11738 self.binary_authorization = std::option::Option::Some(v.into());
11739 self
11740 }
11741
11742 /// Sets or clears the value of [binary_authorization][crate::model::Service::binary_authorization].
11743 ///
11744 /// # Example
11745 /// ```ignore,no_run
11746 /// # use google_cloud_run_v2::model::Service;
11747 /// use google_cloud_run_v2::model::BinaryAuthorization;
11748 /// let x = Service::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
11749 /// let x = Service::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
11750 /// ```
11751 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
11752 where
11753 T: std::convert::Into<crate::model::BinaryAuthorization>,
11754 {
11755 self.binary_authorization = v.map(|x| x.into());
11756 self
11757 }
11758
11759 /// Sets the value of [template][crate::model::Service::template].
11760 ///
11761 /// # Example
11762 /// ```ignore,no_run
11763 /// # use google_cloud_run_v2::model::Service;
11764 /// use google_cloud_run_v2::model::RevisionTemplate;
11765 /// let x = Service::new().set_template(RevisionTemplate::default()/* use setters */);
11766 /// ```
11767 pub fn set_template<T>(mut self, v: T) -> Self
11768 where
11769 T: std::convert::Into<crate::model::RevisionTemplate>,
11770 {
11771 self.template = std::option::Option::Some(v.into());
11772 self
11773 }
11774
11775 /// Sets or clears the value of [template][crate::model::Service::template].
11776 ///
11777 /// # Example
11778 /// ```ignore,no_run
11779 /// # use google_cloud_run_v2::model::Service;
11780 /// use google_cloud_run_v2::model::RevisionTemplate;
11781 /// let x = Service::new().set_or_clear_template(Some(RevisionTemplate::default()/* use setters */));
11782 /// let x = Service::new().set_or_clear_template(None::<RevisionTemplate>);
11783 /// ```
11784 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
11785 where
11786 T: std::convert::Into<crate::model::RevisionTemplate>,
11787 {
11788 self.template = v.map(|x| x.into());
11789 self
11790 }
11791
11792 /// Sets the value of [traffic][crate::model::Service::traffic].
11793 ///
11794 /// # Example
11795 /// ```ignore,no_run
11796 /// # use google_cloud_run_v2::model::Service;
11797 /// use google_cloud_run_v2::model::TrafficTarget;
11798 /// let x = Service::new()
11799 /// .set_traffic([
11800 /// TrafficTarget::default()/* use setters */,
11801 /// TrafficTarget::default()/* use (different) setters */,
11802 /// ]);
11803 /// ```
11804 pub fn set_traffic<T, V>(mut self, v: T) -> Self
11805 where
11806 T: std::iter::IntoIterator<Item = V>,
11807 V: std::convert::Into<crate::model::TrafficTarget>,
11808 {
11809 use std::iter::Iterator;
11810 self.traffic = v.into_iter().map(|i| i.into()).collect();
11811 self
11812 }
11813
11814 /// Sets the value of [scaling][crate::model::Service::scaling].
11815 ///
11816 /// # Example
11817 /// ```ignore,no_run
11818 /// # use google_cloud_run_v2::model::Service;
11819 /// use google_cloud_run_v2::model::ServiceScaling;
11820 /// let x = Service::new().set_scaling(ServiceScaling::default()/* use setters */);
11821 /// ```
11822 pub fn set_scaling<T>(mut self, v: T) -> Self
11823 where
11824 T: std::convert::Into<crate::model::ServiceScaling>,
11825 {
11826 self.scaling = std::option::Option::Some(v.into());
11827 self
11828 }
11829
11830 /// Sets or clears the value of [scaling][crate::model::Service::scaling].
11831 ///
11832 /// # Example
11833 /// ```ignore,no_run
11834 /// # use google_cloud_run_v2::model::Service;
11835 /// use google_cloud_run_v2::model::ServiceScaling;
11836 /// let x = Service::new().set_or_clear_scaling(Some(ServiceScaling::default()/* use setters */));
11837 /// let x = Service::new().set_or_clear_scaling(None::<ServiceScaling>);
11838 /// ```
11839 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
11840 where
11841 T: std::convert::Into<crate::model::ServiceScaling>,
11842 {
11843 self.scaling = v.map(|x| x.into());
11844 self
11845 }
11846
11847 /// Sets the value of [invoker_iam_disabled][crate::model::Service::invoker_iam_disabled].
11848 ///
11849 /// # Example
11850 /// ```ignore,no_run
11851 /// # use google_cloud_run_v2::model::Service;
11852 /// let x = Service::new().set_invoker_iam_disabled(true);
11853 /// ```
11854 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11855 self.invoker_iam_disabled = v.into();
11856 self
11857 }
11858
11859 /// Sets the value of [default_uri_disabled][crate::model::Service::default_uri_disabled].
11860 ///
11861 /// # Example
11862 /// ```ignore,no_run
11863 /// # use google_cloud_run_v2::model::Service;
11864 /// let x = Service::new().set_default_uri_disabled(true);
11865 /// ```
11866 pub fn set_default_uri_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11867 self.default_uri_disabled = v.into();
11868 self
11869 }
11870
11871 /// Sets the value of [urls][crate::model::Service::urls].
11872 ///
11873 /// # Example
11874 /// ```ignore,no_run
11875 /// # use google_cloud_run_v2::model::Service;
11876 /// let x = Service::new().set_urls(["a", "b", "c"]);
11877 /// ```
11878 pub fn set_urls<T, V>(mut self, v: T) -> Self
11879 where
11880 T: std::iter::IntoIterator<Item = V>,
11881 V: std::convert::Into<std::string::String>,
11882 {
11883 use std::iter::Iterator;
11884 self.urls = v.into_iter().map(|i| i.into()).collect();
11885 self
11886 }
11887
11888 /// Sets the value of [iap_enabled][crate::model::Service::iap_enabled].
11889 ///
11890 /// # Example
11891 /// ```ignore,no_run
11892 /// # use google_cloud_run_v2::model::Service;
11893 /// let x = Service::new().set_iap_enabled(true);
11894 /// ```
11895 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11896 self.iap_enabled = v.into();
11897 self
11898 }
11899
11900 /// Sets the value of [multi_region_settings][crate::model::Service::multi_region_settings].
11901 ///
11902 /// # Example
11903 /// ```ignore,no_run
11904 /// # use google_cloud_run_v2::model::Service;
11905 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
11906 /// let x = Service::new().set_multi_region_settings(MultiRegionSettings::default()/* use setters */);
11907 /// ```
11908 pub fn set_multi_region_settings<T>(mut self, v: T) -> Self
11909 where
11910 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
11911 {
11912 self.multi_region_settings = std::option::Option::Some(v.into());
11913 self
11914 }
11915
11916 /// Sets or clears the value of [multi_region_settings][crate::model::Service::multi_region_settings].
11917 ///
11918 /// # Example
11919 /// ```ignore,no_run
11920 /// # use google_cloud_run_v2::model::Service;
11921 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
11922 /// let x = Service::new().set_or_clear_multi_region_settings(Some(MultiRegionSettings::default()/* use setters */));
11923 /// let x = Service::new().set_or_clear_multi_region_settings(None::<MultiRegionSettings>);
11924 /// ```
11925 pub fn set_or_clear_multi_region_settings<T>(mut self, v: std::option::Option<T>) -> Self
11926 where
11927 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
11928 {
11929 self.multi_region_settings = v.map(|x| x.into());
11930 self
11931 }
11932
11933 /// Sets the value of [custom_audiences][crate::model::Service::custom_audiences].
11934 ///
11935 /// # Example
11936 /// ```ignore,no_run
11937 /// # use google_cloud_run_v2::model::Service;
11938 /// let x = Service::new().set_custom_audiences(["a", "b", "c"]);
11939 /// ```
11940 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
11941 where
11942 T: std::iter::IntoIterator<Item = V>,
11943 V: std::convert::Into<std::string::String>,
11944 {
11945 use std::iter::Iterator;
11946 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
11947 self
11948 }
11949
11950 /// Sets the value of [observed_generation][crate::model::Service::observed_generation].
11951 ///
11952 /// # Example
11953 /// ```ignore,no_run
11954 /// # use google_cloud_run_v2::model::Service;
11955 /// let x = Service::new().set_observed_generation(42);
11956 /// ```
11957 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11958 self.observed_generation = v.into();
11959 self
11960 }
11961
11962 /// Sets the value of [terminal_condition][crate::model::Service::terminal_condition].
11963 ///
11964 /// # Example
11965 /// ```ignore,no_run
11966 /// # use google_cloud_run_v2::model::Service;
11967 /// use google_cloud_run_v2::model::Condition;
11968 /// let x = Service::new().set_terminal_condition(Condition::default()/* use setters */);
11969 /// ```
11970 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
11971 where
11972 T: std::convert::Into<crate::model::Condition>,
11973 {
11974 self.terminal_condition = std::option::Option::Some(v.into());
11975 self
11976 }
11977
11978 /// Sets or clears the value of [terminal_condition][crate::model::Service::terminal_condition].
11979 ///
11980 /// # Example
11981 /// ```ignore,no_run
11982 /// # use google_cloud_run_v2::model::Service;
11983 /// use google_cloud_run_v2::model::Condition;
11984 /// let x = Service::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
11985 /// let x = Service::new().set_or_clear_terminal_condition(None::<Condition>);
11986 /// ```
11987 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
11988 where
11989 T: std::convert::Into<crate::model::Condition>,
11990 {
11991 self.terminal_condition = v.map(|x| x.into());
11992 self
11993 }
11994
11995 /// Sets the value of [conditions][crate::model::Service::conditions].
11996 ///
11997 /// # Example
11998 /// ```ignore,no_run
11999 /// # use google_cloud_run_v2::model::Service;
12000 /// use google_cloud_run_v2::model::Condition;
12001 /// let x = Service::new()
12002 /// .set_conditions([
12003 /// Condition::default()/* use setters */,
12004 /// Condition::default()/* use (different) setters */,
12005 /// ]);
12006 /// ```
12007 pub fn set_conditions<T, V>(mut self, v: T) -> Self
12008 where
12009 T: std::iter::IntoIterator<Item = V>,
12010 V: std::convert::Into<crate::model::Condition>,
12011 {
12012 use std::iter::Iterator;
12013 self.conditions = v.into_iter().map(|i| i.into()).collect();
12014 self
12015 }
12016
12017 /// Sets the value of [latest_ready_revision][crate::model::Service::latest_ready_revision].
12018 ///
12019 /// # Example
12020 /// ```ignore,no_run
12021 /// # use google_cloud_run_v2::model::Service;
12022 /// let x = Service::new().set_latest_ready_revision("example");
12023 /// ```
12024 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
12025 mut self,
12026 v: T,
12027 ) -> Self {
12028 self.latest_ready_revision = v.into();
12029 self
12030 }
12031
12032 /// Sets the value of [latest_created_revision][crate::model::Service::latest_created_revision].
12033 ///
12034 /// # Example
12035 /// ```ignore,no_run
12036 /// # use google_cloud_run_v2::model::Service;
12037 /// let x = Service::new().set_latest_created_revision("example");
12038 /// ```
12039 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
12040 mut self,
12041 v: T,
12042 ) -> Self {
12043 self.latest_created_revision = v.into();
12044 self
12045 }
12046
12047 /// Sets the value of [traffic_statuses][crate::model::Service::traffic_statuses].
12048 ///
12049 /// # Example
12050 /// ```ignore,no_run
12051 /// # use google_cloud_run_v2::model::Service;
12052 /// use google_cloud_run_v2::model::TrafficTargetStatus;
12053 /// let x = Service::new()
12054 /// .set_traffic_statuses([
12055 /// TrafficTargetStatus::default()/* use setters */,
12056 /// TrafficTargetStatus::default()/* use (different) setters */,
12057 /// ]);
12058 /// ```
12059 pub fn set_traffic_statuses<T, V>(mut self, v: T) -> Self
12060 where
12061 T: std::iter::IntoIterator<Item = V>,
12062 V: std::convert::Into<crate::model::TrafficTargetStatus>,
12063 {
12064 use std::iter::Iterator;
12065 self.traffic_statuses = v.into_iter().map(|i| i.into()).collect();
12066 self
12067 }
12068
12069 /// Sets the value of [uri][crate::model::Service::uri].
12070 ///
12071 /// # Example
12072 /// ```ignore,no_run
12073 /// # use google_cloud_run_v2::model::Service;
12074 /// let x = Service::new().set_uri("example");
12075 /// ```
12076 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12077 self.uri = v.into();
12078 self
12079 }
12080
12081 /// Sets the value of [satisfies_pzs][crate::model::Service::satisfies_pzs].
12082 ///
12083 /// # Example
12084 /// ```ignore,no_run
12085 /// # use google_cloud_run_v2::model::Service;
12086 /// let x = Service::new().set_satisfies_pzs(true);
12087 /// ```
12088 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12089 self.satisfies_pzs = v.into();
12090 self
12091 }
12092
12093 /// Sets the value of [threat_detection_enabled][crate::model::Service::threat_detection_enabled].
12094 ///
12095 /// # Example
12096 /// ```ignore,no_run
12097 /// # use google_cloud_run_v2::model::Service;
12098 /// let x = Service::new().set_threat_detection_enabled(true);
12099 /// ```
12100 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12101 self.threat_detection_enabled = v.into();
12102 self
12103 }
12104
12105 /// Sets the value of [build_config][crate::model::Service::build_config].
12106 ///
12107 /// # Example
12108 /// ```ignore,no_run
12109 /// # use google_cloud_run_v2::model::Service;
12110 /// use google_cloud_run_v2::model::BuildConfig;
12111 /// let x = Service::new().set_build_config(BuildConfig::default()/* use setters */);
12112 /// ```
12113 pub fn set_build_config<T>(mut self, v: T) -> Self
12114 where
12115 T: std::convert::Into<crate::model::BuildConfig>,
12116 {
12117 self.build_config = std::option::Option::Some(v.into());
12118 self
12119 }
12120
12121 /// Sets or clears the value of [build_config][crate::model::Service::build_config].
12122 ///
12123 /// # Example
12124 /// ```ignore,no_run
12125 /// # use google_cloud_run_v2::model::Service;
12126 /// use google_cloud_run_v2::model::BuildConfig;
12127 /// let x = Service::new().set_or_clear_build_config(Some(BuildConfig::default()/* use setters */));
12128 /// let x = Service::new().set_or_clear_build_config(None::<BuildConfig>);
12129 /// ```
12130 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
12131 where
12132 T: std::convert::Into<crate::model::BuildConfig>,
12133 {
12134 self.build_config = v.map(|x| x.into());
12135 self
12136 }
12137
12138 /// Sets the value of [reconciling][crate::model::Service::reconciling].
12139 ///
12140 /// # Example
12141 /// ```ignore,no_run
12142 /// # use google_cloud_run_v2::model::Service;
12143 /// let x = Service::new().set_reconciling(true);
12144 /// ```
12145 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12146 self.reconciling = v.into();
12147 self
12148 }
12149
12150 /// Sets the value of [etag][crate::model::Service::etag].
12151 ///
12152 /// # Example
12153 /// ```ignore,no_run
12154 /// # use google_cloud_run_v2::model::Service;
12155 /// let x = Service::new().set_etag("example");
12156 /// ```
12157 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12158 self.etag = v.into();
12159 self
12160 }
12161}
12162
12163impl wkt::message::Message for Service {
12164 fn typename() -> &'static str {
12165 "type.googleapis.com/google.cloud.run.v2.Service"
12166 }
12167}
12168
12169/// Defines additional types related to [Service].
12170pub mod service {
12171 #[allow(unused_imports)]
12172 use super::*;
12173
12174 /// Settings for multi-region deployment.
12175 #[derive(Clone, Default, PartialEq)]
12176 #[non_exhaustive]
12177 pub struct MultiRegionSettings {
12178 /// Required. List of regions to deploy to, including primary region.
12179 pub regions: std::vec::Vec<std::string::String>,
12180
12181 /// Optional. System-generated unique id for the multi-region Service.
12182 pub multi_region_id: std::string::String,
12183
12184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12185 }
12186
12187 impl MultiRegionSettings {
12188 /// Creates a new default instance.
12189 pub fn new() -> Self {
12190 std::default::Default::default()
12191 }
12192
12193 /// Sets the value of [regions][crate::model::service::MultiRegionSettings::regions].
12194 ///
12195 /// # Example
12196 /// ```ignore,no_run
12197 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12198 /// let x = MultiRegionSettings::new().set_regions(["a", "b", "c"]);
12199 /// ```
12200 pub fn set_regions<T, V>(mut self, v: T) -> Self
12201 where
12202 T: std::iter::IntoIterator<Item = V>,
12203 V: std::convert::Into<std::string::String>,
12204 {
12205 use std::iter::Iterator;
12206 self.regions = v.into_iter().map(|i| i.into()).collect();
12207 self
12208 }
12209
12210 /// Sets the value of [multi_region_id][crate::model::service::MultiRegionSettings::multi_region_id].
12211 ///
12212 /// # Example
12213 /// ```ignore,no_run
12214 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12215 /// let x = MultiRegionSettings::new().set_multi_region_id("example");
12216 /// ```
12217 pub fn set_multi_region_id<T: std::convert::Into<std::string::String>>(
12218 mut self,
12219 v: T,
12220 ) -> Self {
12221 self.multi_region_id = v.into();
12222 self
12223 }
12224 }
12225
12226 impl wkt::message::Message for MultiRegionSettings {
12227 fn typename() -> &'static str {
12228 "type.googleapis.com/google.cloud.run.v2.Service.MultiRegionSettings"
12229 }
12230 }
12231}
12232
12233/// Effective settings for the current revision
12234#[derive(Clone, Default, PartialEq)]
12235#[non_exhaustive]
12236pub struct RevisionScalingStatus {
12237 /// The current number of min instances provisioned for this revision.
12238 pub desired_min_instance_count: i32,
12239
12240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12241}
12242
12243impl RevisionScalingStatus {
12244 /// Creates a new default instance.
12245 pub fn new() -> Self {
12246 std::default::Default::default()
12247 }
12248
12249 /// Sets the value of [desired_min_instance_count][crate::model::RevisionScalingStatus::desired_min_instance_count].
12250 ///
12251 /// # Example
12252 /// ```ignore,no_run
12253 /// # use google_cloud_run_v2::model::RevisionScalingStatus;
12254 /// let x = RevisionScalingStatus::new().set_desired_min_instance_count(42);
12255 /// ```
12256 pub fn set_desired_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12257 self.desired_min_instance_count = v.into();
12258 self
12259 }
12260}
12261
12262impl wkt::message::Message for RevisionScalingStatus {
12263 fn typename() -> &'static str {
12264 "type.googleapis.com/google.cloud.run.v2.RevisionScalingStatus"
12265 }
12266}
12267
12268/// Request message for obtaining a Task by its full name.
12269#[derive(Clone, Default, PartialEq)]
12270#[non_exhaustive]
12271pub struct GetTaskRequest {
12272 /// Required. The full name of the Task.
12273 /// Format:
12274 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
12275 pub name: std::string::String,
12276
12277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12278}
12279
12280impl GetTaskRequest {
12281 /// Creates a new default instance.
12282 pub fn new() -> Self {
12283 std::default::Default::default()
12284 }
12285
12286 /// Sets the value of [name][crate::model::GetTaskRequest::name].
12287 ///
12288 /// # Example
12289 /// ```ignore,no_run
12290 /// # use google_cloud_run_v2::model::GetTaskRequest;
12291 /// let x = GetTaskRequest::new().set_name("example");
12292 /// ```
12293 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12294 self.name = v.into();
12295 self
12296 }
12297}
12298
12299impl wkt::message::Message for GetTaskRequest {
12300 fn typename() -> &'static str {
12301 "type.googleapis.com/google.cloud.run.v2.GetTaskRequest"
12302 }
12303}
12304
12305/// Request message for retrieving a list of Tasks.
12306#[derive(Clone, Default, PartialEq)]
12307#[non_exhaustive]
12308pub struct ListTasksRequest {
12309 /// Required. The Execution from which the Tasks should be listed.
12310 /// To list all Tasks across Executions of a Job, use "-" instead of Execution
12311 /// name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
12312 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
12313 pub parent: std::string::String,
12314
12315 /// Maximum number of Tasks to return in this call.
12316 pub page_size: i32,
12317
12318 /// A page token received from a previous call to ListTasks.
12319 /// All other parameters must match.
12320 pub page_token: std::string::String,
12321
12322 /// If true, returns deleted (but unexpired) resources along with active ones.
12323 pub show_deleted: bool,
12324
12325 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12326}
12327
12328impl ListTasksRequest {
12329 /// Creates a new default instance.
12330 pub fn new() -> Self {
12331 std::default::Default::default()
12332 }
12333
12334 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
12335 ///
12336 /// # Example
12337 /// ```ignore,no_run
12338 /// # use google_cloud_run_v2::model::ListTasksRequest;
12339 /// let x = ListTasksRequest::new().set_parent("example");
12340 /// ```
12341 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12342 self.parent = v.into();
12343 self
12344 }
12345
12346 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
12347 ///
12348 /// # Example
12349 /// ```ignore,no_run
12350 /// # use google_cloud_run_v2::model::ListTasksRequest;
12351 /// let x = ListTasksRequest::new().set_page_size(42);
12352 /// ```
12353 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12354 self.page_size = v.into();
12355 self
12356 }
12357
12358 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
12359 ///
12360 /// # Example
12361 /// ```ignore,no_run
12362 /// # use google_cloud_run_v2::model::ListTasksRequest;
12363 /// let x = ListTasksRequest::new().set_page_token("example");
12364 /// ```
12365 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12366 self.page_token = v.into();
12367 self
12368 }
12369
12370 /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
12371 ///
12372 /// # Example
12373 /// ```ignore,no_run
12374 /// # use google_cloud_run_v2::model::ListTasksRequest;
12375 /// let x = ListTasksRequest::new().set_show_deleted(true);
12376 /// ```
12377 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12378 self.show_deleted = v.into();
12379 self
12380 }
12381}
12382
12383impl wkt::message::Message for ListTasksRequest {
12384 fn typename() -> &'static str {
12385 "type.googleapis.com/google.cloud.run.v2.ListTasksRequest"
12386 }
12387}
12388
12389/// Response message containing a list of Tasks.
12390#[derive(Clone, Default, PartialEq)]
12391#[non_exhaustive]
12392pub struct ListTasksResponse {
12393 /// The resulting list of Tasks.
12394 pub tasks: std::vec::Vec<crate::model::Task>,
12395
12396 /// A token indicating there are more items than page_size. Use it in the next
12397 /// ListTasks request to continue.
12398 pub next_page_token: std::string::String,
12399
12400 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12401}
12402
12403impl ListTasksResponse {
12404 /// Creates a new default instance.
12405 pub fn new() -> Self {
12406 std::default::Default::default()
12407 }
12408
12409 /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
12410 ///
12411 /// # Example
12412 /// ```ignore,no_run
12413 /// # use google_cloud_run_v2::model::ListTasksResponse;
12414 /// use google_cloud_run_v2::model::Task;
12415 /// let x = ListTasksResponse::new()
12416 /// .set_tasks([
12417 /// Task::default()/* use setters */,
12418 /// Task::default()/* use (different) setters */,
12419 /// ]);
12420 /// ```
12421 pub fn set_tasks<T, V>(mut self, v: T) -> Self
12422 where
12423 T: std::iter::IntoIterator<Item = V>,
12424 V: std::convert::Into<crate::model::Task>,
12425 {
12426 use std::iter::Iterator;
12427 self.tasks = v.into_iter().map(|i| i.into()).collect();
12428 self
12429 }
12430
12431 /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
12432 ///
12433 /// # Example
12434 /// ```ignore,no_run
12435 /// # use google_cloud_run_v2::model::ListTasksResponse;
12436 /// let x = ListTasksResponse::new().set_next_page_token("example");
12437 /// ```
12438 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12439 self.next_page_token = v.into();
12440 self
12441 }
12442}
12443
12444impl wkt::message::Message for ListTasksResponse {
12445 fn typename() -> &'static str {
12446 "type.googleapis.com/google.cloud.run.v2.ListTasksResponse"
12447 }
12448}
12449
12450#[doc(hidden)]
12451impl google_cloud_gax::paginator::internal::PageableResponse for ListTasksResponse {
12452 type PageItem = crate::model::Task;
12453
12454 fn items(self) -> std::vec::Vec<Self::PageItem> {
12455 self.tasks
12456 }
12457
12458 fn next_page_token(&self) -> std::string::String {
12459 use std::clone::Clone;
12460 self.next_page_token.clone()
12461 }
12462}
12463
12464/// Task represents a single run of a container to completion.
12465#[derive(Clone, Default, PartialEq)]
12466#[non_exhaustive]
12467pub struct Task {
12468 /// Output only. The unique name of this Task.
12469 pub name: std::string::String,
12470
12471 /// Output only. Server assigned unique identifier for the Task. The value is a
12472 /// UUID4 string and guaranteed to remain unchanged until the resource is
12473 /// deleted.
12474 pub uid: std::string::String,
12475
12476 /// Output only. A number that monotonically increases every time the user
12477 /// modifies the desired state.
12478 pub generation: i64,
12479
12480 /// Output only. Unstructured key value map that can be used to organize and
12481 /// categorize objects. User-provided labels are shared with Google's billing
12482 /// system, so they can be used to filter, or break down billing charges by
12483 /// team, component, environment, state, etc. For more information, visit
12484 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
12485 /// <https://cloud.google.com/run/docs/configuring/labels>
12486 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12487
12488 /// Output only. Unstructured key value map that may
12489 /// be set by external tools to store and arbitrary metadata.
12490 /// They are not queryable and should be preserved
12491 /// when modifying objects.
12492 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12493
12494 /// Output only. Represents time when the task was created by the system.
12495 /// It is not guaranteed to be set in happens-before order across separate
12496 /// operations.
12497 pub create_time: std::option::Option<wkt::Timestamp>,
12498
12499 /// Output only. Represents time when the task was scheduled to run by the
12500 /// system. It is not guaranteed to be set in happens-before order across
12501 /// separate operations.
12502 pub scheduled_time: std::option::Option<wkt::Timestamp>,
12503
12504 /// Output only. Represents time when the task started to run.
12505 /// It is not guaranteed to be set in happens-before order across separate
12506 /// operations.
12507 pub start_time: std::option::Option<wkt::Timestamp>,
12508
12509 /// Output only. Represents time when the Task was completed. It is not
12510 /// guaranteed to be set in happens-before order across separate operations.
12511 pub completion_time: std::option::Option<wkt::Timestamp>,
12512
12513 /// Output only. The last-modified time.
12514 pub update_time: std::option::Option<wkt::Timestamp>,
12515
12516 /// Output only. For a deleted resource, the deletion time. It is only
12517 /// populated as a response to a Delete request.
12518 pub delete_time: std::option::Option<wkt::Timestamp>,
12519
12520 /// Output only. For a deleted resource, the time after which it will be
12521 /// permamently deleted. It is only populated as a response to a Delete
12522 /// request.
12523 pub expire_time: std::option::Option<wkt::Timestamp>,
12524
12525 /// Output only. The name of the parent Job.
12526 pub job: std::string::String,
12527
12528 /// Output only. The name of the parent Execution.
12529 pub execution: std::string::String,
12530
12531 /// Holds the single container that defines the unit of execution for this
12532 /// task.
12533 pub containers: std::vec::Vec<crate::model::Container>,
12534
12535 /// A list of Volumes to make available to containers.
12536 pub volumes: std::vec::Vec<crate::model::Volume>,
12537
12538 /// Number of retries allowed per Task, before marking this Task failed.
12539 pub max_retries: i32,
12540
12541 /// Max allowed time duration the Task may be active before the system will
12542 /// actively try to mark it failed and kill associated containers. This applies
12543 /// per attempt of a task, meaning each retry can run for the full timeout.
12544 pub timeout: std::option::Option<wkt::Duration>,
12545
12546 /// Email address of the IAM service account associated with the Task of a
12547 /// Job. The service account represents the identity of the
12548 /// running task, and determines what permissions the task has. If
12549 /// not provided, the task will use the project's default service account.
12550 pub service_account: std::string::String,
12551
12552 /// The execution environment being used to host this Task.
12553 pub execution_environment: crate::model::ExecutionEnvironment,
12554
12555 /// Output only. Indicates whether the resource's reconciliation is still in
12556 /// progress. See comments in `Job.reconciling` for additional information on
12557 /// reconciliation process in Cloud Run.
12558 pub reconciling: bool,
12559
12560 /// Output only. The Condition of this Task, containing its readiness status,
12561 /// and detailed error information in case it did not reach the desired state.
12562 pub conditions: std::vec::Vec<crate::model::Condition>,
12563
12564 /// Output only. The generation of this Task. See comments in `Job.reconciling`
12565 /// for additional information on reconciliation process in Cloud Run.
12566 pub observed_generation: i64,
12567
12568 /// Output only. Index of the Task, unique per execution, and beginning at 0.
12569 pub index: i32,
12570
12571 /// Output only. The number of times this Task was retried.
12572 /// Tasks are retried when they fail up to the maxRetries limit.
12573 pub retried: i32,
12574
12575 /// Output only. Result of the last attempt of this Task.
12576 pub last_attempt_result: std::option::Option<crate::model::TaskAttemptResult>,
12577
12578 /// Output only. A reference to a customer managed encryption key (CMEK) to use
12579 /// to encrypt this container image. For more information, go to
12580 /// <https://cloud.google.com/run/docs/securing/using-cmek>
12581 pub encryption_key: std::string::String,
12582
12583 /// Output only. VPC Access configuration to use for this Task. For more
12584 /// information, visit
12585 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
12586 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
12587
12588 /// Output only. URI where logs for this execution can be found in Cloud
12589 /// Console.
12590 pub log_uri: std::string::String,
12591
12592 /// Output only. Reserved for future use.
12593 pub satisfies_pzs: bool,
12594
12595 /// Output only. The node selector for the task.
12596 pub node_selector: std::option::Option<crate::model::NodeSelector>,
12597
12598 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
12599 /// task.
12600 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
12601
12602 /// Output only. A system-generated fingerprint for this version of the
12603 /// resource. May be used to detect modification conflict during updates.
12604 pub etag: std::string::String,
12605
12606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12607}
12608
12609impl Task {
12610 /// Creates a new default instance.
12611 pub fn new() -> Self {
12612 std::default::Default::default()
12613 }
12614
12615 /// Sets the value of [name][crate::model::Task::name].
12616 ///
12617 /// # Example
12618 /// ```ignore,no_run
12619 /// # use google_cloud_run_v2::model::Task;
12620 /// let x = Task::new().set_name("example");
12621 /// ```
12622 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12623 self.name = v.into();
12624 self
12625 }
12626
12627 /// Sets the value of [uid][crate::model::Task::uid].
12628 ///
12629 /// # Example
12630 /// ```ignore,no_run
12631 /// # use google_cloud_run_v2::model::Task;
12632 /// let x = Task::new().set_uid("example");
12633 /// ```
12634 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12635 self.uid = v.into();
12636 self
12637 }
12638
12639 /// Sets the value of [generation][crate::model::Task::generation].
12640 ///
12641 /// # Example
12642 /// ```ignore,no_run
12643 /// # use google_cloud_run_v2::model::Task;
12644 /// let x = Task::new().set_generation(42);
12645 /// ```
12646 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12647 self.generation = v.into();
12648 self
12649 }
12650
12651 /// Sets the value of [labels][crate::model::Task::labels].
12652 ///
12653 /// # Example
12654 /// ```ignore,no_run
12655 /// # use google_cloud_run_v2::model::Task;
12656 /// let x = Task::new().set_labels([
12657 /// ("key0", "abc"),
12658 /// ("key1", "xyz"),
12659 /// ]);
12660 /// ```
12661 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12662 where
12663 T: std::iter::IntoIterator<Item = (K, V)>,
12664 K: std::convert::Into<std::string::String>,
12665 V: std::convert::Into<std::string::String>,
12666 {
12667 use std::iter::Iterator;
12668 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12669 self
12670 }
12671
12672 /// Sets the value of [annotations][crate::model::Task::annotations].
12673 ///
12674 /// # Example
12675 /// ```ignore,no_run
12676 /// # use google_cloud_run_v2::model::Task;
12677 /// let x = Task::new().set_annotations([
12678 /// ("key0", "abc"),
12679 /// ("key1", "xyz"),
12680 /// ]);
12681 /// ```
12682 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12683 where
12684 T: std::iter::IntoIterator<Item = (K, V)>,
12685 K: std::convert::Into<std::string::String>,
12686 V: std::convert::Into<std::string::String>,
12687 {
12688 use std::iter::Iterator;
12689 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12690 self
12691 }
12692
12693 /// Sets the value of [create_time][crate::model::Task::create_time].
12694 ///
12695 /// # Example
12696 /// ```ignore,no_run
12697 /// # use google_cloud_run_v2::model::Task;
12698 /// use wkt::Timestamp;
12699 /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
12700 /// ```
12701 pub fn set_create_time<T>(mut self, v: T) -> Self
12702 where
12703 T: std::convert::Into<wkt::Timestamp>,
12704 {
12705 self.create_time = std::option::Option::Some(v.into());
12706 self
12707 }
12708
12709 /// Sets or clears the value of [create_time][crate::model::Task::create_time].
12710 ///
12711 /// # Example
12712 /// ```ignore,no_run
12713 /// # use google_cloud_run_v2::model::Task;
12714 /// use wkt::Timestamp;
12715 /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12716 /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
12717 /// ```
12718 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12719 where
12720 T: std::convert::Into<wkt::Timestamp>,
12721 {
12722 self.create_time = v.map(|x| x.into());
12723 self
12724 }
12725
12726 /// Sets the value of [scheduled_time][crate::model::Task::scheduled_time].
12727 ///
12728 /// # Example
12729 /// ```ignore,no_run
12730 /// # use google_cloud_run_v2::model::Task;
12731 /// use wkt::Timestamp;
12732 /// let x = Task::new().set_scheduled_time(Timestamp::default()/* use setters */);
12733 /// ```
12734 pub fn set_scheduled_time<T>(mut self, v: T) -> Self
12735 where
12736 T: std::convert::Into<wkt::Timestamp>,
12737 {
12738 self.scheduled_time = std::option::Option::Some(v.into());
12739 self
12740 }
12741
12742 /// Sets or clears the value of [scheduled_time][crate::model::Task::scheduled_time].
12743 ///
12744 /// # Example
12745 /// ```ignore,no_run
12746 /// # use google_cloud_run_v2::model::Task;
12747 /// use wkt::Timestamp;
12748 /// let x = Task::new().set_or_clear_scheduled_time(Some(Timestamp::default()/* use setters */));
12749 /// let x = Task::new().set_or_clear_scheduled_time(None::<Timestamp>);
12750 /// ```
12751 pub fn set_or_clear_scheduled_time<T>(mut self, v: std::option::Option<T>) -> Self
12752 where
12753 T: std::convert::Into<wkt::Timestamp>,
12754 {
12755 self.scheduled_time = v.map(|x| x.into());
12756 self
12757 }
12758
12759 /// Sets the value of [start_time][crate::model::Task::start_time].
12760 ///
12761 /// # Example
12762 /// ```ignore,no_run
12763 /// # use google_cloud_run_v2::model::Task;
12764 /// use wkt::Timestamp;
12765 /// let x = Task::new().set_start_time(Timestamp::default()/* use setters */);
12766 /// ```
12767 pub fn set_start_time<T>(mut self, v: T) -> Self
12768 where
12769 T: std::convert::Into<wkt::Timestamp>,
12770 {
12771 self.start_time = std::option::Option::Some(v.into());
12772 self
12773 }
12774
12775 /// Sets or clears the value of [start_time][crate::model::Task::start_time].
12776 ///
12777 /// # Example
12778 /// ```ignore,no_run
12779 /// # use google_cloud_run_v2::model::Task;
12780 /// use wkt::Timestamp;
12781 /// let x = Task::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
12782 /// let x = Task::new().set_or_clear_start_time(None::<Timestamp>);
12783 /// ```
12784 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
12785 where
12786 T: std::convert::Into<wkt::Timestamp>,
12787 {
12788 self.start_time = v.map(|x| x.into());
12789 self
12790 }
12791
12792 /// Sets the value of [completion_time][crate::model::Task::completion_time].
12793 ///
12794 /// # Example
12795 /// ```ignore,no_run
12796 /// # use google_cloud_run_v2::model::Task;
12797 /// use wkt::Timestamp;
12798 /// let x = Task::new().set_completion_time(Timestamp::default()/* use setters */);
12799 /// ```
12800 pub fn set_completion_time<T>(mut self, v: T) -> Self
12801 where
12802 T: std::convert::Into<wkt::Timestamp>,
12803 {
12804 self.completion_time = std::option::Option::Some(v.into());
12805 self
12806 }
12807
12808 /// Sets or clears the value of [completion_time][crate::model::Task::completion_time].
12809 ///
12810 /// # Example
12811 /// ```ignore,no_run
12812 /// # use google_cloud_run_v2::model::Task;
12813 /// use wkt::Timestamp;
12814 /// let x = Task::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
12815 /// let x = Task::new().set_or_clear_completion_time(None::<Timestamp>);
12816 /// ```
12817 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
12818 where
12819 T: std::convert::Into<wkt::Timestamp>,
12820 {
12821 self.completion_time = v.map(|x| x.into());
12822 self
12823 }
12824
12825 /// Sets the value of [update_time][crate::model::Task::update_time].
12826 ///
12827 /// # Example
12828 /// ```ignore,no_run
12829 /// # use google_cloud_run_v2::model::Task;
12830 /// use wkt::Timestamp;
12831 /// let x = Task::new().set_update_time(Timestamp::default()/* use setters */);
12832 /// ```
12833 pub fn set_update_time<T>(mut self, v: T) -> Self
12834 where
12835 T: std::convert::Into<wkt::Timestamp>,
12836 {
12837 self.update_time = std::option::Option::Some(v.into());
12838 self
12839 }
12840
12841 /// Sets or clears the value of [update_time][crate::model::Task::update_time].
12842 ///
12843 /// # Example
12844 /// ```ignore,no_run
12845 /// # use google_cloud_run_v2::model::Task;
12846 /// use wkt::Timestamp;
12847 /// let x = Task::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12848 /// let x = Task::new().set_or_clear_update_time(None::<Timestamp>);
12849 /// ```
12850 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12851 where
12852 T: std::convert::Into<wkt::Timestamp>,
12853 {
12854 self.update_time = v.map(|x| x.into());
12855 self
12856 }
12857
12858 /// Sets the value of [delete_time][crate::model::Task::delete_time].
12859 ///
12860 /// # Example
12861 /// ```ignore,no_run
12862 /// # use google_cloud_run_v2::model::Task;
12863 /// use wkt::Timestamp;
12864 /// let x = Task::new().set_delete_time(Timestamp::default()/* use setters */);
12865 /// ```
12866 pub fn set_delete_time<T>(mut self, v: T) -> Self
12867 where
12868 T: std::convert::Into<wkt::Timestamp>,
12869 {
12870 self.delete_time = std::option::Option::Some(v.into());
12871 self
12872 }
12873
12874 /// Sets or clears the value of [delete_time][crate::model::Task::delete_time].
12875 ///
12876 /// # Example
12877 /// ```ignore,no_run
12878 /// # use google_cloud_run_v2::model::Task;
12879 /// use wkt::Timestamp;
12880 /// let x = Task::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12881 /// let x = Task::new().set_or_clear_delete_time(None::<Timestamp>);
12882 /// ```
12883 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12884 where
12885 T: std::convert::Into<wkt::Timestamp>,
12886 {
12887 self.delete_time = v.map(|x| x.into());
12888 self
12889 }
12890
12891 /// Sets the value of [expire_time][crate::model::Task::expire_time].
12892 ///
12893 /// # Example
12894 /// ```ignore,no_run
12895 /// # use google_cloud_run_v2::model::Task;
12896 /// use wkt::Timestamp;
12897 /// let x = Task::new().set_expire_time(Timestamp::default()/* use setters */);
12898 /// ```
12899 pub fn set_expire_time<T>(mut self, v: T) -> Self
12900 where
12901 T: std::convert::Into<wkt::Timestamp>,
12902 {
12903 self.expire_time = std::option::Option::Some(v.into());
12904 self
12905 }
12906
12907 /// Sets or clears the value of [expire_time][crate::model::Task::expire_time].
12908 ///
12909 /// # Example
12910 /// ```ignore,no_run
12911 /// # use google_cloud_run_v2::model::Task;
12912 /// use wkt::Timestamp;
12913 /// let x = Task::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
12914 /// let x = Task::new().set_or_clear_expire_time(None::<Timestamp>);
12915 /// ```
12916 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
12917 where
12918 T: std::convert::Into<wkt::Timestamp>,
12919 {
12920 self.expire_time = v.map(|x| x.into());
12921 self
12922 }
12923
12924 /// Sets the value of [job][crate::model::Task::job].
12925 ///
12926 /// # Example
12927 /// ```ignore,no_run
12928 /// # use google_cloud_run_v2::model::Task;
12929 /// let x = Task::new().set_job("example");
12930 /// ```
12931 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12932 self.job = v.into();
12933 self
12934 }
12935
12936 /// Sets the value of [execution][crate::model::Task::execution].
12937 ///
12938 /// # Example
12939 /// ```ignore,no_run
12940 /// # use google_cloud_run_v2::model::Task;
12941 /// let x = Task::new().set_execution("example");
12942 /// ```
12943 pub fn set_execution<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12944 self.execution = v.into();
12945 self
12946 }
12947
12948 /// Sets the value of [containers][crate::model::Task::containers].
12949 ///
12950 /// # Example
12951 /// ```ignore,no_run
12952 /// # use google_cloud_run_v2::model::Task;
12953 /// use google_cloud_run_v2::model::Container;
12954 /// let x = Task::new()
12955 /// .set_containers([
12956 /// Container::default()/* use setters */,
12957 /// Container::default()/* use (different) setters */,
12958 /// ]);
12959 /// ```
12960 pub fn set_containers<T, V>(mut self, v: T) -> Self
12961 where
12962 T: std::iter::IntoIterator<Item = V>,
12963 V: std::convert::Into<crate::model::Container>,
12964 {
12965 use std::iter::Iterator;
12966 self.containers = v.into_iter().map(|i| i.into()).collect();
12967 self
12968 }
12969
12970 /// Sets the value of [volumes][crate::model::Task::volumes].
12971 ///
12972 /// # Example
12973 /// ```ignore,no_run
12974 /// # use google_cloud_run_v2::model::Task;
12975 /// use google_cloud_run_v2::model::Volume;
12976 /// let x = Task::new()
12977 /// .set_volumes([
12978 /// Volume::default()/* use setters */,
12979 /// Volume::default()/* use (different) setters */,
12980 /// ]);
12981 /// ```
12982 pub fn set_volumes<T, V>(mut self, v: T) -> Self
12983 where
12984 T: std::iter::IntoIterator<Item = V>,
12985 V: std::convert::Into<crate::model::Volume>,
12986 {
12987 use std::iter::Iterator;
12988 self.volumes = v.into_iter().map(|i| i.into()).collect();
12989 self
12990 }
12991
12992 /// Sets the value of [max_retries][crate::model::Task::max_retries].
12993 ///
12994 /// # Example
12995 /// ```ignore,no_run
12996 /// # use google_cloud_run_v2::model::Task;
12997 /// let x = Task::new().set_max_retries(42);
12998 /// ```
12999 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13000 self.max_retries = v.into();
13001 self
13002 }
13003
13004 /// Sets the value of [timeout][crate::model::Task::timeout].
13005 ///
13006 /// # Example
13007 /// ```ignore,no_run
13008 /// # use google_cloud_run_v2::model::Task;
13009 /// use wkt::Duration;
13010 /// let x = Task::new().set_timeout(Duration::default()/* use setters */);
13011 /// ```
13012 pub fn set_timeout<T>(mut self, v: T) -> Self
13013 where
13014 T: std::convert::Into<wkt::Duration>,
13015 {
13016 self.timeout = std::option::Option::Some(v.into());
13017 self
13018 }
13019
13020 /// Sets or clears the value of [timeout][crate::model::Task::timeout].
13021 ///
13022 /// # Example
13023 /// ```ignore,no_run
13024 /// # use google_cloud_run_v2::model::Task;
13025 /// use wkt::Duration;
13026 /// let x = Task::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13027 /// let x = Task::new().set_or_clear_timeout(None::<Duration>);
13028 /// ```
13029 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13030 where
13031 T: std::convert::Into<wkt::Duration>,
13032 {
13033 self.timeout = v.map(|x| x.into());
13034 self
13035 }
13036
13037 /// Sets the value of [service_account][crate::model::Task::service_account].
13038 ///
13039 /// # Example
13040 /// ```ignore,no_run
13041 /// # use google_cloud_run_v2::model::Task;
13042 /// let x = Task::new().set_service_account("example");
13043 /// ```
13044 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13045 self.service_account = v.into();
13046 self
13047 }
13048
13049 /// Sets the value of [execution_environment][crate::model::Task::execution_environment].
13050 ///
13051 /// # Example
13052 /// ```ignore,no_run
13053 /// # use google_cloud_run_v2::model::Task;
13054 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13055 /// let x0 = Task::new().set_execution_environment(ExecutionEnvironment::Gen1);
13056 /// let x1 = Task::new().set_execution_environment(ExecutionEnvironment::Gen2);
13057 /// ```
13058 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13059 mut self,
13060 v: T,
13061 ) -> Self {
13062 self.execution_environment = v.into();
13063 self
13064 }
13065
13066 /// Sets the value of [reconciling][crate::model::Task::reconciling].
13067 ///
13068 /// # Example
13069 /// ```ignore,no_run
13070 /// # use google_cloud_run_v2::model::Task;
13071 /// let x = Task::new().set_reconciling(true);
13072 /// ```
13073 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13074 self.reconciling = v.into();
13075 self
13076 }
13077
13078 /// Sets the value of [conditions][crate::model::Task::conditions].
13079 ///
13080 /// # Example
13081 /// ```ignore,no_run
13082 /// # use google_cloud_run_v2::model::Task;
13083 /// use google_cloud_run_v2::model::Condition;
13084 /// let x = Task::new()
13085 /// .set_conditions([
13086 /// Condition::default()/* use setters */,
13087 /// Condition::default()/* use (different) setters */,
13088 /// ]);
13089 /// ```
13090 pub fn set_conditions<T, V>(mut self, v: T) -> Self
13091 where
13092 T: std::iter::IntoIterator<Item = V>,
13093 V: std::convert::Into<crate::model::Condition>,
13094 {
13095 use std::iter::Iterator;
13096 self.conditions = v.into_iter().map(|i| i.into()).collect();
13097 self
13098 }
13099
13100 /// Sets the value of [observed_generation][crate::model::Task::observed_generation].
13101 ///
13102 /// # Example
13103 /// ```ignore,no_run
13104 /// # use google_cloud_run_v2::model::Task;
13105 /// let x = Task::new().set_observed_generation(42);
13106 /// ```
13107 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13108 self.observed_generation = v.into();
13109 self
13110 }
13111
13112 /// Sets the value of [index][crate::model::Task::index].
13113 ///
13114 /// # Example
13115 /// ```ignore,no_run
13116 /// # use google_cloud_run_v2::model::Task;
13117 /// let x = Task::new().set_index(42);
13118 /// ```
13119 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13120 self.index = v.into();
13121 self
13122 }
13123
13124 /// Sets the value of [retried][crate::model::Task::retried].
13125 ///
13126 /// # Example
13127 /// ```ignore,no_run
13128 /// # use google_cloud_run_v2::model::Task;
13129 /// let x = Task::new().set_retried(42);
13130 /// ```
13131 pub fn set_retried<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13132 self.retried = v.into();
13133 self
13134 }
13135
13136 /// Sets the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13137 ///
13138 /// # Example
13139 /// ```ignore,no_run
13140 /// # use google_cloud_run_v2::model::Task;
13141 /// use google_cloud_run_v2::model::TaskAttemptResult;
13142 /// let x = Task::new().set_last_attempt_result(TaskAttemptResult::default()/* use setters */);
13143 /// ```
13144 pub fn set_last_attempt_result<T>(mut self, v: T) -> Self
13145 where
13146 T: std::convert::Into<crate::model::TaskAttemptResult>,
13147 {
13148 self.last_attempt_result = std::option::Option::Some(v.into());
13149 self
13150 }
13151
13152 /// Sets or clears the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13153 ///
13154 /// # Example
13155 /// ```ignore,no_run
13156 /// # use google_cloud_run_v2::model::Task;
13157 /// use google_cloud_run_v2::model::TaskAttemptResult;
13158 /// let x = Task::new().set_or_clear_last_attempt_result(Some(TaskAttemptResult::default()/* use setters */));
13159 /// let x = Task::new().set_or_clear_last_attempt_result(None::<TaskAttemptResult>);
13160 /// ```
13161 pub fn set_or_clear_last_attempt_result<T>(mut self, v: std::option::Option<T>) -> Self
13162 where
13163 T: std::convert::Into<crate::model::TaskAttemptResult>,
13164 {
13165 self.last_attempt_result = v.map(|x| x.into());
13166 self
13167 }
13168
13169 /// Sets the value of [encryption_key][crate::model::Task::encryption_key].
13170 ///
13171 /// # Example
13172 /// ```ignore,no_run
13173 /// # use google_cloud_run_v2::model::Task;
13174 /// let x = Task::new().set_encryption_key("example");
13175 /// ```
13176 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13177 self.encryption_key = v.into();
13178 self
13179 }
13180
13181 /// Sets the value of [vpc_access][crate::model::Task::vpc_access].
13182 ///
13183 /// # Example
13184 /// ```ignore,no_run
13185 /// # use google_cloud_run_v2::model::Task;
13186 /// use google_cloud_run_v2::model::VpcAccess;
13187 /// let x = Task::new().set_vpc_access(VpcAccess::default()/* use setters */);
13188 /// ```
13189 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13190 where
13191 T: std::convert::Into<crate::model::VpcAccess>,
13192 {
13193 self.vpc_access = std::option::Option::Some(v.into());
13194 self
13195 }
13196
13197 /// Sets or clears the value of [vpc_access][crate::model::Task::vpc_access].
13198 ///
13199 /// # Example
13200 /// ```ignore,no_run
13201 /// # use google_cloud_run_v2::model::Task;
13202 /// use google_cloud_run_v2::model::VpcAccess;
13203 /// let x = Task::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13204 /// let x = Task::new().set_or_clear_vpc_access(None::<VpcAccess>);
13205 /// ```
13206 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13207 where
13208 T: std::convert::Into<crate::model::VpcAccess>,
13209 {
13210 self.vpc_access = v.map(|x| x.into());
13211 self
13212 }
13213
13214 /// Sets the value of [log_uri][crate::model::Task::log_uri].
13215 ///
13216 /// # Example
13217 /// ```ignore,no_run
13218 /// # use google_cloud_run_v2::model::Task;
13219 /// let x = Task::new().set_log_uri("example");
13220 /// ```
13221 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13222 self.log_uri = v.into();
13223 self
13224 }
13225
13226 /// Sets the value of [satisfies_pzs][crate::model::Task::satisfies_pzs].
13227 ///
13228 /// # Example
13229 /// ```ignore,no_run
13230 /// # use google_cloud_run_v2::model::Task;
13231 /// let x = Task::new().set_satisfies_pzs(true);
13232 /// ```
13233 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13234 self.satisfies_pzs = v.into();
13235 self
13236 }
13237
13238 /// Sets the value of [node_selector][crate::model::Task::node_selector].
13239 ///
13240 /// # Example
13241 /// ```ignore,no_run
13242 /// # use google_cloud_run_v2::model::Task;
13243 /// use google_cloud_run_v2::model::NodeSelector;
13244 /// let x = Task::new().set_node_selector(NodeSelector::default()/* use setters */);
13245 /// ```
13246 pub fn set_node_selector<T>(mut self, v: T) -> Self
13247 where
13248 T: std::convert::Into<crate::model::NodeSelector>,
13249 {
13250 self.node_selector = std::option::Option::Some(v.into());
13251 self
13252 }
13253
13254 /// Sets or clears the value of [node_selector][crate::model::Task::node_selector].
13255 ///
13256 /// # Example
13257 /// ```ignore,no_run
13258 /// # use google_cloud_run_v2::model::Task;
13259 /// use google_cloud_run_v2::model::NodeSelector;
13260 /// let x = Task::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13261 /// let x = Task::new().set_or_clear_node_selector(None::<NodeSelector>);
13262 /// ```
13263 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13264 where
13265 T: std::convert::Into<crate::model::NodeSelector>,
13266 {
13267 self.node_selector = v.map(|x| x.into());
13268 self
13269 }
13270
13271 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13272 ///
13273 /// # Example
13274 /// ```ignore,no_run
13275 /// # use google_cloud_run_v2::model::Task;
13276 /// let x = Task::new().set_gpu_zonal_redundancy_disabled(true);
13277 /// ```
13278 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13279 where
13280 T: std::convert::Into<bool>,
13281 {
13282 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13283 self
13284 }
13285
13286 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13287 ///
13288 /// # Example
13289 /// ```ignore,no_run
13290 /// # use google_cloud_run_v2::model::Task;
13291 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13292 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13293 /// ```
13294 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13295 mut self,
13296 v: std::option::Option<T>,
13297 ) -> Self
13298 where
13299 T: std::convert::Into<bool>,
13300 {
13301 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13302 self
13303 }
13304
13305 /// Sets the value of [etag][crate::model::Task::etag].
13306 ///
13307 /// # Example
13308 /// ```ignore,no_run
13309 /// # use google_cloud_run_v2::model::Task;
13310 /// let x = Task::new().set_etag("example");
13311 /// ```
13312 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13313 self.etag = v.into();
13314 self
13315 }
13316}
13317
13318impl wkt::message::Message for Task {
13319 fn typename() -> &'static str {
13320 "type.googleapis.com/google.cloud.run.v2.Task"
13321 }
13322}
13323
13324/// Result of a task attempt.
13325#[derive(Clone, Default, PartialEq)]
13326#[non_exhaustive]
13327pub struct TaskAttemptResult {
13328 /// Output only. The status of this attempt.
13329 /// If the status code is OK, then the attempt succeeded.
13330 pub status: std::option::Option<google_cloud_rpc::model::Status>,
13331
13332 /// Output only. The exit code of this attempt.
13333 /// This may be unset if the container was unable to exit cleanly with a code
13334 /// due to some other failure.
13335 /// See status field for possible failure details.
13336 ///
13337 /// At most one of exit_code or term_signal will be set.
13338 pub exit_code: i32,
13339
13340 /// Output only. Termination signal of the container. This is set to non-zero
13341 /// if the container is terminated by the system.
13342 ///
13343 /// At most one of exit_code or term_signal will be set.
13344 pub term_signal: i32,
13345
13346 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13347}
13348
13349impl TaskAttemptResult {
13350 /// Creates a new default instance.
13351 pub fn new() -> Self {
13352 std::default::Default::default()
13353 }
13354
13355 /// Sets the value of [status][crate::model::TaskAttemptResult::status].
13356 ///
13357 /// # Example
13358 /// ```ignore,no_run
13359 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13360 /// use google_cloud_rpc::model::Status;
13361 /// let x = TaskAttemptResult::new().set_status(Status::default()/* use setters */);
13362 /// ```
13363 pub fn set_status<T>(mut self, v: T) -> Self
13364 where
13365 T: std::convert::Into<google_cloud_rpc::model::Status>,
13366 {
13367 self.status = std::option::Option::Some(v.into());
13368 self
13369 }
13370
13371 /// Sets or clears the value of [status][crate::model::TaskAttemptResult::status].
13372 ///
13373 /// # Example
13374 /// ```ignore,no_run
13375 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13376 /// use google_cloud_rpc::model::Status;
13377 /// let x = TaskAttemptResult::new().set_or_clear_status(Some(Status::default()/* use setters */));
13378 /// let x = TaskAttemptResult::new().set_or_clear_status(None::<Status>);
13379 /// ```
13380 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
13381 where
13382 T: std::convert::Into<google_cloud_rpc::model::Status>,
13383 {
13384 self.status = v.map(|x| x.into());
13385 self
13386 }
13387
13388 /// Sets the value of [exit_code][crate::model::TaskAttemptResult::exit_code].
13389 ///
13390 /// # Example
13391 /// ```ignore,no_run
13392 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13393 /// let x = TaskAttemptResult::new().set_exit_code(42);
13394 /// ```
13395 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13396 self.exit_code = v.into();
13397 self
13398 }
13399
13400 /// Sets the value of [term_signal][crate::model::TaskAttemptResult::term_signal].
13401 ///
13402 /// # Example
13403 /// ```ignore,no_run
13404 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13405 /// let x = TaskAttemptResult::new().set_term_signal(42);
13406 /// ```
13407 pub fn set_term_signal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13408 self.term_signal = v.into();
13409 self
13410 }
13411}
13412
13413impl wkt::message::Message for TaskAttemptResult {
13414 fn typename() -> &'static str {
13415 "type.googleapis.com/google.cloud.run.v2.TaskAttemptResult"
13416 }
13417}
13418
13419/// TaskTemplate describes the data a task should have when created
13420/// from a template.
13421#[derive(Clone, Default, PartialEq)]
13422#[non_exhaustive]
13423pub struct TaskTemplate {
13424 /// Holds the single container that defines the unit of execution for this
13425 /// task.
13426 pub containers: std::vec::Vec<crate::model::Container>,
13427
13428 /// Optional. A list of Volumes to make available to containers.
13429 pub volumes: std::vec::Vec<crate::model::Volume>,
13430
13431 /// Optional. Max allowed time duration the Task may be active before the
13432 /// system will actively try to mark it failed and kill associated containers.
13433 /// This applies per attempt of a task, meaning each retry can run for the full
13434 /// timeout. Defaults to 600 seconds.
13435 pub timeout: std::option::Option<wkt::Duration>,
13436
13437 /// Optional. Email address of the IAM service account associated with the Task
13438 /// of a Job. The service account represents the identity of the running task,
13439 /// and determines what permissions the task has. If not provided, the task
13440 /// will use the project's default service account.
13441 pub service_account: std::string::String,
13442
13443 /// Optional. The execution environment being used to host this Task.
13444 pub execution_environment: crate::model::ExecutionEnvironment,
13445
13446 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
13447 /// this container image. For more information, go to
13448 /// <https://cloud.google.com/run/docs/securing/using-cmek>
13449 pub encryption_key: std::string::String,
13450
13451 /// Optional. VPC Access configuration to use for this Task. For more
13452 /// information, visit
13453 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13454 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
13455
13456 /// Optional. The node selector for the task template.
13457 pub node_selector: std::option::Option<crate::model::NodeSelector>,
13458
13459 /// Optional. True if GPU zonal redundancy is disabled on this task template.
13460 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
13461
13462 #[allow(missing_docs)]
13463 pub retries: std::option::Option<crate::model::task_template::Retries>,
13464
13465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13466}
13467
13468impl TaskTemplate {
13469 /// Creates a new default instance.
13470 pub fn new() -> Self {
13471 std::default::Default::default()
13472 }
13473
13474 /// Sets the value of [containers][crate::model::TaskTemplate::containers].
13475 ///
13476 /// # Example
13477 /// ```ignore,no_run
13478 /// # use google_cloud_run_v2::model::TaskTemplate;
13479 /// use google_cloud_run_v2::model::Container;
13480 /// let x = TaskTemplate::new()
13481 /// .set_containers([
13482 /// Container::default()/* use setters */,
13483 /// Container::default()/* use (different) setters */,
13484 /// ]);
13485 /// ```
13486 pub fn set_containers<T, V>(mut self, v: T) -> Self
13487 where
13488 T: std::iter::IntoIterator<Item = V>,
13489 V: std::convert::Into<crate::model::Container>,
13490 {
13491 use std::iter::Iterator;
13492 self.containers = v.into_iter().map(|i| i.into()).collect();
13493 self
13494 }
13495
13496 /// Sets the value of [volumes][crate::model::TaskTemplate::volumes].
13497 ///
13498 /// # Example
13499 /// ```ignore,no_run
13500 /// # use google_cloud_run_v2::model::TaskTemplate;
13501 /// use google_cloud_run_v2::model::Volume;
13502 /// let x = TaskTemplate::new()
13503 /// .set_volumes([
13504 /// Volume::default()/* use setters */,
13505 /// Volume::default()/* use (different) setters */,
13506 /// ]);
13507 /// ```
13508 pub fn set_volumes<T, V>(mut self, v: T) -> Self
13509 where
13510 T: std::iter::IntoIterator<Item = V>,
13511 V: std::convert::Into<crate::model::Volume>,
13512 {
13513 use std::iter::Iterator;
13514 self.volumes = v.into_iter().map(|i| i.into()).collect();
13515 self
13516 }
13517
13518 /// Sets the value of [timeout][crate::model::TaskTemplate::timeout].
13519 ///
13520 /// # Example
13521 /// ```ignore,no_run
13522 /// # use google_cloud_run_v2::model::TaskTemplate;
13523 /// use wkt::Duration;
13524 /// let x = TaskTemplate::new().set_timeout(Duration::default()/* use setters */);
13525 /// ```
13526 pub fn set_timeout<T>(mut self, v: T) -> Self
13527 where
13528 T: std::convert::Into<wkt::Duration>,
13529 {
13530 self.timeout = std::option::Option::Some(v.into());
13531 self
13532 }
13533
13534 /// Sets or clears the value of [timeout][crate::model::TaskTemplate::timeout].
13535 ///
13536 /// # Example
13537 /// ```ignore,no_run
13538 /// # use google_cloud_run_v2::model::TaskTemplate;
13539 /// use wkt::Duration;
13540 /// let x = TaskTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13541 /// let x = TaskTemplate::new().set_or_clear_timeout(None::<Duration>);
13542 /// ```
13543 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13544 where
13545 T: std::convert::Into<wkt::Duration>,
13546 {
13547 self.timeout = v.map(|x| x.into());
13548 self
13549 }
13550
13551 /// Sets the value of [service_account][crate::model::TaskTemplate::service_account].
13552 ///
13553 /// # Example
13554 /// ```ignore,no_run
13555 /// # use google_cloud_run_v2::model::TaskTemplate;
13556 /// let x = TaskTemplate::new().set_service_account("example");
13557 /// ```
13558 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13559 self.service_account = v.into();
13560 self
13561 }
13562
13563 /// Sets the value of [execution_environment][crate::model::TaskTemplate::execution_environment].
13564 ///
13565 /// # Example
13566 /// ```ignore,no_run
13567 /// # use google_cloud_run_v2::model::TaskTemplate;
13568 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13569 /// let x0 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
13570 /// let x1 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
13571 /// ```
13572 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13573 mut self,
13574 v: T,
13575 ) -> Self {
13576 self.execution_environment = v.into();
13577 self
13578 }
13579
13580 /// Sets the value of [encryption_key][crate::model::TaskTemplate::encryption_key].
13581 ///
13582 /// # Example
13583 /// ```ignore,no_run
13584 /// # use google_cloud_run_v2::model::TaskTemplate;
13585 /// let x = TaskTemplate::new().set_encryption_key("example");
13586 /// ```
13587 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13588 self.encryption_key = v.into();
13589 self
13590 }
13591
13592 /// Sets the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13593 ///
13594 /// # Example
13595 /// ```ignore,no_run
13596 /// # use google_cloud_run_v2::model::TaskTemplate;
13597 /// use google_cloud_run_v2::model::VpcAccess;
13598 /// let x = TaskTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
13599 /// ```
13600 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13601 where
13602 T: std::convert::Into<crate::model::VpcAccess>,
13603 {
13604 self.vpc_access = std::option::Option::Some(v.into());
13605 self
13606 }
13607
13608 /// Sets or clears the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13609 ///
13610 /// # Example
13611 /// ```ignore,no_run
13612 /// # use google_cloud_run_v2::model::TaskTemplate;
13613 /// use google_cloud_run_v2::model::VpcAccess;
13614 /// let x = TaskTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13615 /// let x = TaskTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
13616 /// ```
13617 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13618 where
13619 T: std::convert::Into<crate::model::VpcAccess>,
13620 {
13621 self.vpc_access = v.map(|x| x.into());
13622 self
13623 }
13624
13625 /// Sets the value of [node_selector][crate::model::TaskTemplate::node_selector].
13626 ///
13627 /// # Example
13628 /// ```ignore,no_run
13629 /// # use google_cloud_run_v2::model::TaskTemplate;
13630 /// use google_cloud_run_v2::model::NodeSelector;
13631 /// let x = TaskTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
13632 /// ```
13633 pub fn set_node_selector<T>(mut self, v: T) -> Self
13634 where
13635 T: std::convert::Into<crate::model::NodeSelector>,
13636 {
13637 self.node_selector = std::option::Option::Some(v.into());
13638 self
13639 }
13640
13641 /// Sets or clears the value of [node_selector][crate::model::TaskTemplate::node_selector].
13642 ///
13643 /// # Example
13644 /// ```ignore,no_run
13645 /// # use google_cloud_run_v2::model::TaskTemplate;
13646 /// use google_cloud_run_v2::model::NodeSelector;
13647 /// let x = TaskTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13648 /// let x = TaskTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
13649 /// ```
13650 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13651 where
13652 T: std::convert::Into<crate::model::NodeSelector>,
13653 {
13654 self.node_selector = v.map(|x| x.into());
13655 self
13656 }
13657
13658 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13659 ///
13660 /// # Example
13661 /// ```ignore,no_run
13662 /// # use google_cloud_run_v2::model::TaskTemplate;
13663 /// let x = TaskTemplate::new().set_gpu_zonal_redundancy_disabled(true);
13664 /// ```
13665 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13666 where
13667 T: std::convert::Into<bool>,
13668 {
13669 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13670 self
13671 }
13672
13673 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13674 ///
13675 /// # Example
13676 /// ```ignore,no_run
13677 /// # use google_cloud_run_v2::model::TaskTemplate;
13678 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13679 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13680 /// ```
13681 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13682 mut self,
13683 v: std::option::Option<T>,
13684 ) -> Self
13685 where
13686 T: std::convert::Into<bool>,
13687 {
13688 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13689 self
13690 }
13691
13692 /// Sets the value of [retries][crate::model::TaskTemplate::retries].
13693 ///
13694 /// Note that all the setters affecting `retries` are mutually
13695 /// exclusive.
13696 ///
13697 /// # Example
13698 /// ```ignore,no_run
13699 /// # use google_cloud_run_v2::model::TaskTemplate;
13700 /// use google_cloud_run_v2::model::task_template::Retries;
13701 /// let x = TaskTemplate::new().set_retries(Some(Retries::MaxRetries(42)));
13702 /// ```
13703 pub fn set_retries<
13704 T: std::convert::Into<std::option::Option<crate::model::task_template::Retries>>,
13705 >(
13706 mut self,
13707 v: T,
13708 ) -> Self {
13709 self.retries = v.into();
13710 self
13711 }
13712
13713 /// The value of [retries][crate::model::TaskTemplate::retries]
13714 /// if it holds a `MaxRetries`, `None` if the field is not set or
13715 /// holds a different branch.
13716 pub fn max_retries(&self) -> std::option::Option<&i32> {
13717 #[allow(unreachable_patterns)]
13718 self.retries.as_ref().and_then(|v| match v {
13719 crate::model::task_template::Retries::MaxRetries(v) => std::option::Option::Some(v),
13720 _ => std::option::Option::None,
13721 })
13722 }
13723
13724 /// Sets the value of [retries][crate::model::TaskTemplate::retries]
13725 /// to hold a `MaxRetries`.
13726 ///
13727 /// Note that all the setters affecting `retries` are
13728 /// mutually exclusive.
13729 ///
13730 /// # Example
13731 /// ```ignore,no_run
13732 /// # use google_cloud_run_v2::model::TaskTemplate;
13733 /// let x = TaskTemplate::new().set_max_retries(42);
13734 /// assert!(x.max_retries().is_some());
13735 /// ```
13736 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13737 self.retries =
13738 std::option::Option::Some(crate::model::task_template::Retries::MaxRetries(v.into()));
13739 self
13740 }
13741}
13742
13743impl wkt::message::Message for TaskTemplate {
13744 fn typename() -> &'static str {
13745 "type.googleapis.com/google.cloud.run.v2.TaskTemplate"
13746 }
13747}
13748
13749/// Defines additional types related to [TaskTemplate].
13750pub mod task_template {
13751 #[allow(unused_imports)]
13752 use super::*;
13753
13754 #[allow(missing_docs)]
13755 #[derive(Clone, Debug, PartialEq)]
13756 #[non_exhaustive]
13757 pub enum Retries {
13758 /// Number of retries allowed per Task, before marking this Task failed.
13759 /// Defaults to 3.
13760 MaxRetries(i32),
13761 }
13762}
13763
13764/// Holds a single traffic routing entry for the Service. Allocations can be done
13765/// to a specific Revision name, or pointing to the latest Ready Revision.
13766#[derive(Clone, Default, PartialEq)]
13767#[non_exhaustive]
13768pub struct TrafficTarget {
13769 /// The allocation type for this traffic target.
13770 pub r#type: crate::model::TrafficTargetAllocationType,
13771
13772 /// Revision to which to send this portion of traffic, if traffic allocation is
13773 /// by revision.
13774 pub revision: std::string::String,
13775
13776 /// Specifies percent of the traffic to this Revision.
13777 /// This defaults to zero if unspecified.
13778 pub percent: i32,
13779
13780 /// Indicates a string to be part of the URI to exclusively reference this
13781 /// target.
13782 pub tag: std::string::String,
13783
13784 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13785}
13786
13787impl TrafficTarget {
13788 /// Creates a new default instance.
13789 pub fn new() -> Self {
13790 std::default::Default::default()
13791 }
13792
13793 /// Sets the value of [r#type][crate::model::TrafficTarget::type].
13794 ///
13795 /// # Example
13796 /// ```ignore,no_run
13797 /// # use google_cloud_run_v2::model::TrafficTarget;
13798 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13799 /// let x0 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Latest);
13800 /// let x1 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Revision);
13801 /// ```
13802 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13803 mut self,
13804 v: T,
13805 ) -> Self {
13806 self.r#type = v.into();
13807 self
13808 }
13809
13810 /// Sets the value of [revision][crate::model::TrafficTarget::revision].
13811 ///
13812 /// # Example
13813 /// ```ignore,no_run
13814 /// # use google_cloud_run_v2::model::TrafficTarget;
13815 /// let x = TrafficTarget::new().set_revision("example");
13816 /// ```
13817 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13818 self.revision = v.into();
13819 self
13820 }
13821
13822 /// Sets the value of [percent][crate::model::TrafficTarget::percent].
13823 ///
13824 /// # Example
13825 /// ```ignore,no_run
13826 /// # use google_cloud_run_v2::model::TrafficTarget;
13827 /// let x = TrafficTarget::new().set_percent(42);
13828 /// ```
13829 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13830 self.percent = v.into();
13831 self
13832 }
13833
13834 /// Sets the value of [tag][crate::model::TrafficTarget::tag].
13835 ///
13836 /// # Example
13837 /// ```ignore,no_run
13838 /// # use google_cloud_run_v2::model::TrafficTarget;
13839 /// let x = TrafficTarget::new().set_tag("example");
13840 /// ```
13841 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13842 self.tag = v.into();
13843 self
13844 }
13845}
13846
13847impl wkt::message::Message for TrafficTarget {
13848 fn typename() -> &'static str {
13849 "type.googleapis.com/google.cloud.run.v2.TrafficTarget"
13850 }
13851}
13852
13853/// Represents the observed state of a single `TrafficTarget` entry.
13854#[derive(Clone, Default, PartialEq)]
13855#[non_exhaustive]
13856pub struct TrafficTargetStatus {
13857 /// The allocation type for this traffic target.
13858 pub r#type: crate::model::TrafficTargetAllocationType,
13859
13860 /// Revision to which this traffic is sent.
13861 pub revision: std::string::String,
13862
13863 /// Specifies percent of the traffic to this Revision.
13864 pub percent: i32,
13865
13866 /// Indicates the string used in the URI to exclusively reference this target.
13867 pub tag: std::string::String,
13868
13869 /// Displays the target URI.
13870 pub uri: std::string::String,
13871
13872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13873}
13874
13875impl TrafficTargetStatus {
13876 /// Creates a new default instance.
13877 pub fn new() -> Self {
13878 std::default::Default::default()
13879 }
13880
13881 /// Sets the value of [r#type][crate::model::TrafficTargetStatus::type].
13882 ///
13883 /// # Example
13884 /// ```ignore,no_run
13885 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13886 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13887 /// let x0 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Latest);
13888 /// let x1 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Revision);
13889 /// ```
13890 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13891 mut self,
13892 v: T,
13893 ) -> Self {
13894 self.r#type = v.into();
13895 self
13896 }
13897
13898 /// Sets the value of [revision][crate::model::TrafficTargetStatus::revision].
13899 ///
13900 /// # Example
13901 /// ```ignore,no_run
13902 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13903 /// let x = TrafficTargetStatus::new().set_revision("example");
13904 /// ```
13905 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13906 self.revision = v.into();
13907 self
13908 }
13909
13910 /// Sets the value of [percent][crate::model::TrafficTargetStatus::percent].
13911 ///
13912 /// # Example
13913 /// ```ignore,no_run
13914 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13915 /// let x = TrafficTargetStatus::new().set_percent(42);
13916 /// ```
13917 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13918 self.percent = v.into();
13919 self
13920 }
13921
13922 /// Sets the value of [tag][crate::model::TrafficTargetStatus::tag].
13923 ///
13924 /// # Example
13925 /// ```ignore,no_run
13926 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13927 /// let x = TrafficTargetStatus::new().set_tag("example");
13928 /// ```
13929 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13930 self.tag = v.into();
13931 self
13932 }
13933
13934 /// Sets the value of [uri][crate::model::TrafficTargetStatus::uri].
13935 ///
13936 /// # Example
13937 /// ```ignore,no_run
13938 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13939 /// let x = TrafficTargetStatus::new().set_uri("example");
13940 /// ```
13941 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13942 self.uri = v.into();
13943 self
13944 }
13945}
13946
13947impl wkt::message::Message for TrafficTargetStatus {
13948 fn typename() -> &'static str {
13949 "type.googleapis.com/google.cloud.run.v2.TrafficTargetStatus"
13950 }
13951}
13952
13953/// VPC Access settings. For more information on sending traffic to a VPC
13954/// network, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13955#[derive(Clone, Default, PartialEq)]
13956#[non_exhaustive]
13957pub struct VpcAccess {
13958 /// VPC Access connector name.
13959 /// Format: `projects/{project}/locations/{location}/connectors/{connector}`,
13960 /// where `{project}` can be project id or number.
13961 /// For more information on sending traffic to a VPC network via a connector,
13962 /// visit <https://cloud.google.com/run/docs/configuring/vpc-connectors>.
13963 pub connector: std::string::String,
13964
13965 /// Optional. Traffic VPC egress settings. If not provided, it defaults to
13966 /// PRIVATE_RANGES_ONLY.
13967 pub egress: crate::model::vpc_access::VpcEgress,
13968
13969 /// Optional. Direct VPC egress settings. Currently only single network
13970 /// interface is supported.
13971 pub network_interfaces: std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
13972
13973 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13974}
13975
13976impl VpcAccess {
13977 /// Creates a new default instance.
13978 pub fn new() -> Self {
13979 std::default::Default::default()
13980 }
13981
13982 /// Sets the value of [connector][crate::model::VpcAccess::connector].
13983 ///
13984 /// # Example
13985 /// ```ignore,no_run
13986 /// # use google_cloud_run_v2::model::VpcAccess;
13987 /// let x = VpcAccess::new().set_connector("example");
13988 /// ```
13989 pub fn set_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13990 self.connector = v.into();
13991 self
13992 }
13993
13994 /// Sets the value of [egress][crate::model::VpcAccess::egress].
13995 ///
13996 /// # Example
13997 /// ```ignore,no_run
13998 /// # use google_cloud_run_v2::model::VpcAccess;
13999 /// use google_cloud_run_v2::model::vpc_access::VpcEgress;
14000 /// let x0 = VpcAccess::new().set_egress(VpcEgress::AllTraffic);
14001 /// let x1 = VpcAccess::new().set_egress(VpcEgress::PrivateRangesOnly);
14002 /// ```
14003 pub fn set_egress<T: std::convert::Into<crate::model::vpc_access::VpcEgress>>(
14004 mut self,
14005 v: T,
14006 ) -> Self {
14007 self.egress = v.into();
14008 self
14009 }
14010
14011 /// Sets the value of [network_interfaces][crate::model::VpcAccess::network_interfaces].
14012 ///
14013 /// # Example
14014 /// ```ignore,no_run
14015 /// # use google_cloud_run_v2::model::VpcAccess;
14016 /// use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14017 /// let x = VpcAccess::new()
14018 /// .set_network_interfaces([
14019 /// NetworkInterface::default()/* use setters */,
14020 /// NetworkInterface::default()/* use (different) setters */,
14021 /// ]);
14022 /// ```
14023 pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
14024 where
14025 T: std::iter::IntoIterator<Item = V>,
14026 V: std::convert::Into<crate::model::vpc_access::NetworkInterface>,
14027 {
14028 use std::iter::Iterator;
14029 self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
14030 self
14031 }
14032}
14033
14034impl wkt::message::Message for VpcAccess {
14035 fn typename() -> &'static str {
14036 "type.googleapis.com/google.cloud.run.v2.VpcAccess"
14037 }
14038}
14039
14040/// Defines additional types related to [VpcAccess].
14041pub mod vpc_access {
14042 #[allow(unused_imports)]
14043 use super::*;
14044
14045 /// Direct VPC egress settings.
14046 #[derive(Clone, Default, PartialEq)]
14047 #[non_exhaustive]
14048 pub struct NetworkInterface {
14049 /// Optional. The VPC network that the Cloud Run resource will be able to
14050 /// send traffic to. At least one of network or subnetwork must be specified.
14051 /// If both network and subnetwork are specified, the given VPC subnetwork
14052 /// must belong to the given VPC network. If network is not specified, it
14053 /// will be looked up from the subnetwork.
14054 pub network: std::string::String,
14055
14056 /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs
14057 /// from. At least one of network or subnetwork must be specified. If both
14058 /// network and subnetwork are specified, the given VPC subnetwork must
14059 /// belong to the given VPC network. If subnetwork is not specified, the
14060 /// subnetwork with the same name with the network will be used.
14061 pub subnetwork: std::string::String,
14062
14063 /// Optional. Network tags applied to this Cloud Run resource.
14064 pub tags: std::vec::Vec<std::string::String>,
14065
14066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14067 }
14068
14069 impl NetworkInterface {
14070 /// Creates a new default instance.
14071 pub fn new() -> Self {
14072 std::default::Default::default()
14073 }
14074
14075 /// Sets the value of [network][crate::model::vpc_access::NetworkInterface::network].
14076 ///
14077 /// # Example
14078 /// ```ignore,no_run
14079 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14080 /// let x = NetworkInterface::new().set_network("example");
14081 /// ```
14082 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14083 self.network = v.into();
14084 self
14085 }
14086
14087 /// Sets the value of [subnetwork][crate::model::vpc_access::NetworkInterface::subnetwork].
14088 ///
14089 /// # Example
14090 /// ```ignore,no_run
14091 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14092 /// let x = NetworkInterface::new().set_subnetwork("example");
14093 /// ```
14094 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14095 self.subnetwork = v.into();
14096 self
14097 }
14098
14099 /// Sets the value of [tags][crate::model::vpc_access::NetworkInterface::tags].
14100 ///
14101 /// # Example
14102 /// ```ignore,no_run
14103 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14104 /// let x = NetworkInterface::new().set_tags(["a", "b", "c"]);
14105 /// ```
14106 pub fn set_tags<T, V>(mut self, v: T) -> Self
14107 where
14108 T: std::iter::IntoIterator<Item = V>,
14109 V: std::convert::Into<std::string::String>,
14110 {
14111 use std::iter::Iterator;
14112 self.tags = v.into_iter().map(|i| i.into()).collect();
14113 self
14114 }
14115 }
14116
14117 impl wkt::message::Message for NetworkInterface {
14118 fn typename() -> &'static str {
14119 "type.googleapis.com/google.cloud.run.v2.VpcAccess.NetworkInterface"
14120 }
14121 }
14122
14123 /// Egress options for VPC access.
14124 ///
14125 /// # Working with unknown values
14126 ///
14127 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14128 /// additional enum variants at any time. Adding new variants is not considered
14129 /// a breaking change. Applications should write their code in anticipation of:
14130 ///
14131 /// - New values appearing in future releases of the client library, **and**
14132 /// - New values received dynamically, without application changes.
14133 ///
14134 /// Please consult the [Working with enums] section in the user guide for some
14135 /// guidelines.
14136 ///
14137 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14138 #[derive(Clone, Debug, PartialEq)]
14139 #[non_exhaustive]
14140 pub enum VpcEgress {
14141 /// Unspecified
14142 Unspecified,
14143 /// All outbound traffic is routed through the VPC connector.
14144 AllTraffic,
14145 /// Only private IP ranges are routed through the VPC connector.
14146 PrivateRangesOnly,
14147 /// If set, the enum was initialized with an unknown value.
14148 ///
14149 /// Applications can examine the value using [VpcEgress::value] or
14150 /// [VpcEgress::name].
14151 UnknownValue(vpc_egress::UnknownValue),
14152 }
14153
14154 #[doc(hidden)]
14155 pub mod vpc_egress {
14156 #[allow(unused_imports)]
14157 use super::*;
14158 #[derive(Clone, Debug, PartialEq)]
14159 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14160 }
14161
14162 impl VpcEgress {
14163 /// Gets the enum value.
14164 ///
14165 /// Returns `None` if the enum contains an unknown value deserialized from
14166 /// the string representation of enums.
14167 pub fn value(&self) -> std::option::Option<i32> {
14168 match self {
14169 Self::Unspecified => std::option::Option::Some(0),
14170 Self::AllTraffic => std::option::Option::Some(1),
14171 Self::PrivateRangesOnly => std::option::Option::Some(2),
14172 Self::UnknownValue(u) => u.0.value(),
14173 }
14174 }
14175
14176 /// Gets the enum value as a string.
14177 ///
14178 /// Returns `None` if the enum contains an unknown value deserialized from
14179 /// the integer representation of enums.
14180 pub fn name(&self) -> std::option::Option<&str> {
14181 match self {
14182 Self::Unspecified => std::option::Option::Some("VPC_EGRESS_UNSPECIFIED"),
14183 Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
14184 Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
14185 Self::UnknownValue(u) => u.0.name(),
14186 }
14187 }
14188 }
14189
14190 impl std::default::Default for VpcEgress {
14191 fn default() -> Self {
14192 use std::convert::From;
14193 Self::from(0)
14194 }
14195 }
14196
14197 impl std::fmt::Display for VpcEgress {
14198 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14199 wkt::internal::display_enum(f, self.name(), self.value())
14200 }
14201 }
14202
14203 impl std::convert::From<i32> for VpcEgress {
14204 fn from(value: i32) -> Self {
14205 match value {
14206 0 => Self::Unspecified,
14207 1 => Self::AllTraffic,
14208 2 => Self::PrivateRangesOnly,
14209 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14210 wkt::internal::UnknownEnumValue::Integer(value),
14211 )),
14212 }
14213 }
14214 }
14215
14216 impl std::convert::From<&str> for VpcEgress {
14217 fn from(value: &str) -> Self {
14218 use std::string::ToString;
14219 match value {
14220 "VPC_EGRESS_UNSPECIFIED" => Self::Unspecified,
14221 "ALL_TRAFFIC" => Self::AllTraffic,
14222 "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
14223 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14224 wkt::internal::UnknownEnumValue::String(value.to_string()),
14225 )),
14226 }
14227 }
14228 }
14229
14230 impl serde::ser::Serialize for VpcEgress {
14231 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14232 where
14233 S: serde::Serializer,
14234 {
14235 match self {
14236 Self::Unspecified => serializer.serialize_i32(0),
14237 Self::AllTraffic => serializer.serialize_i32(1),
14238 Self::PrivateRangesOnly => serializer.serialize_i32(2),
14239 Self::UnknownValue(u) => u.0.serialize(serializer),
14240 }
14241 }
14242 }
14243
14244 impl<'de> serde::de::Deserialize<'de> for VpcEgress {
14245 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14246 where
14247 D: serde::Deserializer<'de>,
14248 {
14249 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VpcEgress>::new(
14250 ".google.cloud.run.v2.VpcAccess.VpcEgress",
14251 ))
14252 }
14253 }
14254}
14255
14256/// Settings for Binary Authorization feature.
14257#[derive(Clone, Default, PartialEq)]
14258#[non_exhaustive]
14259pub struct BinaryAuthorization {
14260 /// Optional. If present, indicates to use Breakglass using this justification.
14261 /// If use_default is False, then it must be empty.
14262 /// For more information on breakglass, see
14263 /// <https://cloud.google.com/binary-authorization/docs/using-breakglass>
14264 pub breakglass_justification: std::string::String,
14265
14266 #[allow(missing_docs)]
14267 pub binauthz_method: std::option::Option<crate::model::binary_authorization::BinauthzMethod>,
14268
14269 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14270}
14271
14272impl BinaryAuthorization {
14273 /// Creates a new default instance.
14274 pub fn new() -> Self {
14275 std::default::Default::default()
14276 }
14277
14278 /// Sets the value of [breakglass_justification][crate::model::BinaryAuthorization::breakglass_justification].
14279 ///
14280 /// # Example
14281 /// ```ignore,no_run
14282 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14283 /// let x = BinaryAuthorization::new().set_breakglass_justification("example");
14284 /// ```
14285 pub fn set_breakglass_justification<T: std::convert::Into<std::string::String>>(
14286 mut self,
14287 v: T,
14288 ) -> Self {
14289 self.breakglass_justification = v.into();
14290 self
14291 }
14292
14293 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method].
14294 ///
14295 /// Note that all the setters affecting `binauthz_method` are mutually
14296 /// exclusive.
14297 ///
14298 /// # Example
14299 /// ```ignore,no_run
14300 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14301 /// use google_cloud_run_v2::model::binary_authorization::BinauthzMethod;
14302 /// let x = BinaryAuthorization::new().set_binauthz_method(Some(BinauthzMethod::UseDefault(true)));
14303 /// ```
14304 pub fn set_binauthz_method<
14305 T: std::convert::Into<std::option::Option<crate::model::binary_authorization::BinauthzMethod>>,
14306 >(
14307 mut self,
14308 v: T,
14309 ) -> Self {
14310 self.binauthz_method = v.into();
14311 self
14312 }
14313
14314 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14315 /// if it holds a `UseDefault`, `None` if the field is not set or
14316 /// holds a different branch.
14317 pub fn use_default(&self) -> std::option::Option<&bool> {
14318 #[allow(unreachable_patterns)]
14319 self.binauthz_method.as_ref().and_then(|v| match v {
14320 crate::model::binary_authorization::BinauthzMethod::UseDefault(v) => {
14321 std::option::Option::Some(v)
14322 }
14323 _ => std::option::Option::None,
14324 })
14325 }
14326
14327 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14328 /// to hold a `UseDefault`.
14329 ///
14330 /// Note that all the setters affecting `binauthz_method` are
14331 /// mutually exclusive.
14332 ///
14333 /// # Example
14334 /// ```ignore,no_run
14335 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14336 /// let x = BinaryAuthorization::new().set_use_default(true);
14337 /// assert!(x.use_default().is_some());
14338 /// assert!(x.policy().is_none());
14339 /// ```
14340 pub fn set_use_default<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14341 self.binauthz_method = std::option::Option::Some(
14342 crate::model::binary_authorization::BinauthzMethod::UseDefault(v.into()),
14343 );
14344 self
14345 }
14346
14347 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14348 /// if it holds a `Policy`, `None` if the field is not set or
14349 /// holds a different branch.
14350 pub fn policy(&self) -> std::option::Option<&std::string::String> {
14351 #[allow(unreachable_patterns)]
14352 self.binauthz_method.as_ref().and_then(|v| match v {
14353 crate::model::binary_authorization::BinauthzMethod::Policy(v) => {
14354 std::option::Option::Some(v)
14355 }
14356 _ => std::option::Option::None,
14357 })
14358 }
14359
14360 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14361 /// to hold a `Policy`.
14362 ///
14363 /// Note that all the setters affecting `binauthz_method` are
14364 /// mutually exclusive.
14365 ///
14366 /// # Example
14367 /// ```ignore,no_run
14368 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14369 /// let x = BinaryAuthorization::new().set_policy("example");
14370 /// assert!(x.policy().is_some());
14371 /// assert!(x.use_default().is_none());
14372 /// ```
14373 pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14374 self.binauthz_method = std::option::Option::Some(
14375 crate::model::binary_authorization::BinauthzMethod::Policy(v.into()),
14376 );
14377 self
14378 }
14379}
14380
14381impl wkt::message::Message for BinaryAuthorization {
14382 fn typename() -> &'static str {
14383 "type.googleapis.com/google.cloud.run.v2.BinaryAuthorization"
14384 }
14385}
14386
14387/// Defines additional types related to [BinaryAuthorization].
14388pub mod binary_authorization {
14389 #[allow(unused_imports)]
14390 use super::*;
14391
14392 #[allow(missing_docs)]
14393 #[derive(Clone, Debug, PartialEq)]
14394 #[non_exhaustive]
14395 pub enum BinauthzMethod {
14396 /// Optional. If True, indicates to use the default project's binary
14397 /// authorization policy. If False, binary authorization will be disabled.
14398 UseDefault(bool),
14399 /// Optional. The path to a binary authorization policy.
14400 /// Format: `projects/{project}/platforms/cloudRun/{policy-name}`
14401 Policy(std::string::String),
14402 }
14403}
14404
14405/// Settings for revision-level scaling settings.
14406#[derive(Clone, Default, PartialEq)]
14407#[non_exhaustive]
14408pub struct RevisionScaling {
14409 /// Optional. Minimum number of serving instances that this resource should
14410 /// have.
14411 pub min_instance_count: i32,
14412
14413 /// Optional. Maximum number of serving instances that this resource should
14414 /// have. When unspecified, the field is set to the server default value of
14415 /// 100. For more information see
14416 /// <https://cloud.google.com/run/docs/configuring/max-instances>
14417 pub max_instance_count: i32,
14418
14419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14420}
14421
14422impl RevisionScaling {
14423 /// Creates a new default instance.
14424 pub fn new() -> Self {
14425 std::default::Default::default()
14426 }
14427
14428 /// Sets the value of [min_instance_count][crate::model::RevisionScaling::min_instance_count].
14429 ///
14430 /// # Example
14431 /// ```ignore,no_run
14432 /// # use google_cloud_run_v2::model::RevisionScaling;
14433 /// let x = RevisionScaling::new().set_min_instance_count(42);
14434 /// ```
14435 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14436 self.min_instance_count = v.into();
14437 self
14438 }
14439
14440 /// Sets the value of [max_instance_count][crate::model::RevisionScaling::max_instance_count].
14441 ///
14442 /// # Example
14443 /// ```ignore,no_run
14444 /// # use google_cloud_run_v2::model::RevisionScaling;
14445 /// let x = RevisionScaling::new().set_max_instance_count(42);
14446 /// ```
14447 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14448 self.max_instance_count = v.into();
14449 self
14450 }
14451}
14452
14453impl wkt::message::Message for RevisionScaling {
14454 fn typename() -> &'static str {
14455 "type.googleapis.com/google.cloud.run.v2.RevisionScaling"
14456 }
14457}
14458
14459/// Settings for Cloud Service Mesh. For more information see
14460/// <https://cloud.google.com/service-mesh/docs/overview>.
14461#[derive(Clone, Default, PartialEq)]
14462#[non_exhaustive]
14463pub struct ServiceMesh {
14464 /// The Mesh resource name. Format:
14465 /// `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can
14466 /// be project id or number.
14467 pub mesh: std::string::String,
14468
14469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14470}
14471
14472impl ServiceMesh {
14473 /// Creates a new default instance.
14474 pub fn new() -> Self {
14475 std::default::Default::default()
14476 }
14477
14478 /// Sets the value of [mesh][crate::model::ServiceMesh::mesh].
14479 ///
14480 /// # Example
14481 /// ```ignore,no_run
14482 /// # use google_cloud_run_v2::model::ServiceMesh;
14483 /// let x = ServiceMesh::new().set_mesh("example");
14484 /// ```
14485 pub fn set_mesh<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14486 self.mesh = v.into();
14487 self
14488 }
14489}
14490
14491impl wkt::message::Message for ServiceMesh {
14492 fn typename() -> &'static str {
14493 "type.googleapis.com/google.cloud.run.v2.ServiceMesh"
14494 }
14495}
14496
14497/// Scaling settings applied at the service level rather than
14498/// at the revision level.
14499#[derive(Clone, Default, PartialEq)]
14500#[non_exhaustive]
14501pub struct ServiceScaling {
14502 /// Optional. total min instances for the service. This number of instances is
14503 /// divided among all revisions with specified traffic based on the percent
14504 /// of traffic they are receiving.
14505 pub min_instance_count: i32,
14506
14507 /// Optional. The scaling mode for the service.
14508 pub scaling_mode: crate::model::service_scaling::ScalingMode,
14509
14510 /// Optional. total max instances for the service. This number of instances is
14511 /// divided among all revisions with specified traffic based on the percent
14512 /// of traffic they are receiving.
14513 pub max_instance_count: i32,
14514
14515 /// Optional. total instance count for the service in manual scaling mode. This
14516 /// number of instances is divided among all revisions with specified traffic
14517 /// based on the percent of traffic they are receiving.
14518 pub manual_instance_count: std::option::Option<i32>,
14519
14520 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14521}
14522
14523impl ServiceScaling {
14524 /// Creates a new default instance.
14525 pub fn new() -> Self {
14526 std::default::Default::default()
14527 }
14528
14529 /// Sets the value of [min_instance_count][crate::model::ServiceScaling::min_instance_count].
14530 ///
14531 /// # Example
14532 /// ```ignore,no_run
14533 /// # use google_cloud_run_v2::model::ServiceScaling;
14534 /// let x = ServiceScaling::new().set_min_instance_count(42);
14535 /// ```
14536 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14537 self.min_instance_count = v.into();
14538 self
14539 }
14540
14541 /// Sets the value of [scaling_mode][crate::model::ServiceScaling::scaling_mode].
14542 ///
14543 /// # Example
14544 /// ```ignore,no_run
14545 /// # use google_cloud_run_v2::model::ServiceScaling;
14546 /// use google_cloud_run_v2::model::service_scaling::ScalingMode;
14547 /// let x0 = ServiceScaling::new().set_scaling_mode(ScalingMode::Automatic);
14548 /// let x1 = ServiceScaling::new().set_scaling_mode(ScalingMode::Manual);
14549 /// ```
14550 pub fn set_scaling_mode<T: std::convert::Into<crate::model::service_scaling::ScalingMode>>(
14551 mut self,
14552 v: T,
14553 ) -> Self {
14554 self.scaling_mode = v.into();
14555 self
14556 }
14557
14558 /// Sets the value of [max_instance_count][crate::model::ServiceScaling::max_instance_count].
14559 ///
14560 /// # Example
14561 /// ```ignore,no_run
14562 /// # use google_cloud_run_v2::model::ServiceScaling;
14563 /// let x = ServiceScaling::new().set_max_instance_count(42);
14564 /// ```
14565 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14566 self.max_instance_count = v.into();
14567 self
14568 }
14569
14570 /// Sets the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14571 ///
14572 /// # Example
14573 /// ```ignore,no_run
14574 /// # use google_cloud_run_v2::model::ServiceScaling;
14575 /// let x = ServiceScaling::new().set_manual_instance_count(42);
14576 /// ```
14577 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14578 where
14579 T: std::convert::Into<i32>,
14580 {
14581 self.manual_instance_count = std::option::Option::Some(v.into());
14582 self
14583 }
14584
14585 /// Sets or clears the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14586 ///
14587 /// # Example
14588 /// ```ignore,no_run
14589 /// # use google_cloud_run_v2::model::ServiceScaling;
14590 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(Some(42));
14591 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14592 /// ```
14593 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14594 where
14595 T: std::convert::Into<i32>,
14596 {
14597 self.manual_instance_count = v.map(|x| x.into());
14598 self
14599 }
14600}
14601
14602impl wkt::message::Message for ServiceScaling {
14603 fn typename() -> &'static str {
14604 "type.googleapis.com/google.cloud.run.v2.ServiceScaling"
14605 }
14606}
14607
14608/// Defines additional types related to [ServiceScaling].
14609pub mod service_scaling {
14610 #[allow(unused_imports)]
14611 use super::*;
14612
14613 /// The scaling mode for the service. If not provided, it defaults to
14614 /// AUTOMATIC.
14615 ///
14616 /// # Working with unknown values
14617 ///
14618 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14619 /// additional enum variants at any time. Adding new variants is not considered
14620 /// a breaking change. Applications should write their code in anticipation of:
14621 ///
14622 /// - New values appearing in future releases of the client library, **and**
14623 /// - New values received dynamically, without application changes.
14624 ///
14625 /// Please consult the [Working with enums] section in the user guide for some
14626 /// guidelines.
14627 ///
14628 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14629 #[derive(Clone, Debug, PartialEq)]
14630 #[non_exhaustive]
14631 pub enum ScalingMode {
14632 /// Unspecified.
14633 Unspecified,
14634 /// Scale based on traffic between min and max instances.
14635 Automatic,
14636 /// Scale to exactly min instances and ignore max instances.
14637 Manual,
14638 /// If set, the enum was initialized with an unknown value.
14639 ///
14640 /// Applications can examine the value using [ScalingMode::value] or
14641 /// [ScalingMode::name].
14642 UnknownValue(scaling_mode::UnknownValue),
14643 }
14644
14645 #[doc(hidden)]
14646 pub mod scaling_mode {
14647 #[allow(unused_imports)]
14648 use super::*;
14649 #[derive(Clone, Debug, PartialEq)]
14650 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14651 }
14652
14653 impl ScalingMode {
14654 /// Gets the enum value.
14655 ///
14656 /// Returns `None` if the enum contains an unknown value deserialized from
14657 /// the string representation of enums.
14658 pub fn value(&self) -> std::option::Option<i32> {
14659 match self {
14660 Self::Unspecified => std::option::Option::Some(0),
14661 Self::Automatic => std::option::Option::Some(1),
14662 Self::Manual => std::option::Option::Some(2),
14663 Self::UnknownValue(u) => u.0.value(),
14664 }
14665 }
14666
14667 /// Gets the enum value as a string.
14668 ///
14669 /// Returns `None` if the enum contains an unknown value deserialized from
14670 /// the integer representation of enums.
14671 pub fn name(&self) -> std::option::Option<&str> {
14672 match self {
14673 Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
14674 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
14675 Self::Manual => std::option::Option::Some("MANUAL"),
14676 Self::UnknownValue(u) => u.0.name(),
14677 }
14678 }
14679 }
14680
14681 impl std::default::Default for ScalingMode {
14682 fn default() -> Self {
14683 use std::convert::From;
14684 Self::from(0)
14685 }
14686 }
14687
14688 impl std::fmt::Display for ScalingMode {
14689 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14690 wkt::internal::display_enum(f, self.name(), self.value())
14691 }
14692 }
14693
14694 impl std::convert::From<i32> for ScalingMode {
14695 fn from(value: i32) -> Self {
14696 match value {
14697 0 => Self::Unspecified,
14698 1 => Self::Automatic,
14699 2 => Self::Manual,
14700 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14701 wkt::internal::UnknownEnumValue::Integer(value),
14702 )),
14703 }
14704 }
14705 }
14706
14707 impl std::convert::From<&str> for ScalingMode {
14708 fn from(value: &str) -> Self {
14709 use std::string::ToString;
14710 match value {
14711 "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
14712 "AUTOMATIC" => Self::Automatic,
14713 "MANUAL" => Self::Manual,
14714 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14715 wkt::internal::UnknownEnumValue::String(value.to_string()),
14716 )),
14717 }
14718 }
14719 }
14720
14721 impl serde::ser::Serialize for ScalingMode {
14722 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14723 where
14724 S: serde::Serializer,
14725 {
14726 match self {
14727 Self::Unspecified => serializer.serialize_i32(0),
14728 Self::Automatic => serializer.serialize_i32(1),
14729 Self::Manual => serializer.serialize_i32(2),
14730 Self::UnknownValue(u) => u.0.serialize(serializer),
14731 }
14732 }
14733 }
14734
14735 impl<'de> serde::de::Deserialize<'de> for ScalingMode {
14736 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14737 where
14738 D: serde::Deserializer<'de>,
14739 {
14740 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
14741 ".google.cloud.run.v2.ServiceScaling.ScalingMode",
14742 ))
14743 }
14744 }
14745}
14746
14747/// Worker pool scaling settings.
14748#[derive(Clone, Default, PartialEq)]
14749#[non_exhaustive]
14750pub struct WorkerPoolScaling {
14751 /// Optional. The total number of instances in manual scaling mode.
14752 pub manual_instance_count: std::option::Option<i32>,
14753
14754 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14755}
14756
14757impl WorkerPoolScaling {
14758 /// Creates a new default instance.
14759 pub fn new() -> Self {
14760 std::default::Default::default()
14761 }
14762
14763 /// Sets the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14764 ///
14765 /// # Example
14766 /// ```ignore,no_run
14767 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14768 /// let x = WorkerPoolScaling::new().set_manual_instance_count(42);
14769 /// ```
14770 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14771 where
14772 T: std::convert::Into<i32>,
14773 {
14774 self.manual_instance_count = std::option::Option::Some(v.into());
14775 self
14776 }
14777
14778 /// Sets or clears the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14779 ///
14780 /// # Example
14781 /// ```ignore,no_run
14782 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14783 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(Some(42));
14784 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14785 /// ```
14786 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14787 where
14788 T: std::convert::Into<i32>,
14789 {
14790 self.manual_instance_count = v.map(|x| x.into());
14791 self
14792 }
14793}
14794
14795impl wkt::message::Message for WorkerPoolScaling {
14796 fn typename() -> &'static str {
14797 "type.googleapis.com/google.cloud.run.v2.WorkerPoolScaling"
14798 }
14799}
14800
14801/// Hardware constraints configuration.
14802#[derive(Clone, Default, PartialEq)]
14803#[non_exhaustive]
14804pub struct NodeSelector {
14805 /// Required. GPU accelerator type to attach to an instance.
14806 pub accelerator: std::string::String,
14807
14808 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14809}
14810
14811impl NodeSelector {
14812 /// Creates a new default instance.
14813 pub fn new() -> Self {
14814 std::default::Default::default()
14815 }
14816
14817 /// Sets the value of [accelerator][crate::model::NodeSelector::accelerator].
14818 ///
14819 /// # Example
14820 /// ```ignore,no_run
14821 /// # use google_cloud_run_v2::model::NodeSelector;
14822 /// let x = NodeSelector::new().set_accelerator("example");
14823 /// ```
14824 pub fn set_accelerator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14825 self.accelerator = v.into();
14826 self
14827 }
14828}
14829
14830impl wkt::message::Message for NodeSelector {
14831 fn typename() -> &'static str {
14832 "type.googleapis.com/google.cloud.run.v2.NodeSelector"
14833 }
14834}
14835
14836/// Describes the Build step of the function that builds a container from the
14837/// given source.
14838#[derive(Clone, Default, PartialEq)]
14839#[non_exhaustive]
14840pub struct BuildConfig {
14841 /// Output only. The Cloud Build name of the latest successful deployment of
14842 /// the function.
14843 pub name: std::string::String,
14844
14845 /// The Cloud Storage bucket URI where the function source code is located.
14846 pub source_location: std::string::String,
14847
14848 /// Optional. The name of the function (as defined in source code) that will be
14849 /// executed. Defaults to the resource name suffix, if not specified. For
14850 /// backward compatibility, if function with given name is not found, then the
14851 /// system will try to use function named "function".
14852 pub function_target: std::string::String,
14853
14854 /// Optional. Artifact Registry URI to store the built image.
14855 pub image_uri: std::string::String,
14856
14857 /// Optional. The base image used to build the function.
14858 pub base_image: std::string::String,
14859
14860 /// Optional. Sets whether the function will receive automatic base image
14861 /// updates.
14862 pub enable_automatic_updates: bool,
14863
14864 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
14865 /// build the Cloud Run function. The format of this field is
14866 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
14867 /// `{project}` and `{region}` are the project id and region respectively where
14868 /// the worker pool is defined and `{workerPool}` is the short name of the
14869 /// worker pool.
14870 pub worker_pool: std::string::String,
14871
14872 /// Optional. User-provided build-time environment variables for the function
14873 pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
14874
14875 /// Optional. Service account to be used for building the container. The format
14876 /// of this field is
14877 /// `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
14878 pub service_account: std::string::String,
14879
14880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14881}
14882
14883impl BuildConfig {
14884 /// Creates a new default instance.
14885 pub fn new() -> Self {
14886 std::default::Default::default()
14887 }
14888
14889 /// Sets the value of [name][crate::model::BuildConfig::name].
14890 ///
14891 /// # Example
14892 /// ```ignore,no_run
14893 /// # use google_cloud_run_v2::model::BuildConfig;
14894 /// let x = BuildConfig::new().set_name("example");
14895 /// ```
14896 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14897 self.name = v.into();
14898 self
14899 }
14900
14901 /// Sets the value of [source_location][crate::model::BuildConfig::source_location].
14902 ///
14903 /// # Example
14904 /// ```ignore,no_run
14905 /// # use google_cloud_run_v2::model::BuildConfig;
14906 /// let x = BuildConfig::new().set_source_location("example");
14907 /// ```
14908 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14909 self.source_location = v.into();
14910 self
14911 }
14912
14913 /// Sets the value of [function_target][crate::model::BuildConfig::function_target].
14914 ///
14915 /// # Example
14916 /// ```ignore,no_run
14917 /// # use google_cloud_run_v2::model::BuildConfig;
14918 /// let x = BuildConfig::new().set_function_target("example");
14919 /// ```
14920 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14921 self.function_target = v.into();
14922 self
14923 }
14924
14925 /// Sets the value of [image_uri][crate::model::BuildConfig::image_uri].
14926 ///
14927 /// # Example
14928 /// ```ignore,no_run
14929 /// # use google_cloud_run_v2::model::BuildConfig;
14930 /// let x = BuildConfig::new().set_image_uri("example");
14931 /// ```
14932 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14933 self.image_uri = v.into();
14934 self
14935 }
14936
14937 /// Sets the value of [base_image][crate::model::BuildConfig::base_image].
14938 ///
14939 /// # Example
14940 /// ```ignore,no_run
14941 /// # use google_cloud_run_v2::model::BuildConfig;
14942 /// let x = BuildConfig::new().set_base_image("example");
14943 /// ```
14944 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14945 self.base_image = v.into();
14946 self
14947 }
14948
14949 /// Sets the value of [enable_automatic_updates][crate::model::BuildConfig::enable_automatic_updates].
14950 ///
14951 /// # Example
14952 /// ```ignore,no_run
14953 /// # use google_cloud_run_v2::model::BuildConfig;
14954 /// let x = BuildConfig::new().set_enable_automatic_updates(true);
14955 /// ```
14956 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14957 self.enable_automatic_updates = v.into();
14958 self
14959 }
14960
14961 /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
14962 ///
14963 /// # Example
14964 /// ```ignore,no_run
14965 /// # use google_cloud_run_v2::model::BuildConfig;
14966 /// let x = BuildConfig::new().set_worker_pool("example");
14967 /// ```
14968 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14969 self.worker_pool = v.into();
14970 self
14971 }
14972
14973 /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
14974 ///
14975 /// # Example
14976 /// ```ignore,no_run
14977 /// # use google_cloud_run_v2::model::BuildConfig;
14978 /// let x = BuildConfig::new().set_environment_variables([
14979 /// ("key0", "abc"),
14980 /// ("key1", "xyz"),
14981 /// ]);
14982 /// ```
14983 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
14984 where
14985 T: std::iter::IntoIterator<Item = (K, V)>,
14986 K: std::convert::Into<std::string::String>,
14987 V: std::convert::Into<std::string::String>,
14988 {
14989 use std::iter::Iterator;
14990 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14991 self
14992 }
14993
14994 /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
14995 ///
14996 /// # Example
14997 /// ```ignore,no_run
14998 /// # use google_cloud_run_v2::model::BuildConfig;
14999 /// let x = BuildConfig::new().set_service_account("example");
15000 /// ```
15001 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15002 self.service_account = v.into();
15003 self
15004 }
15005}
15006
15007impl wkt::message::Message for BuildConfig {
15008 fn typename() -> &'static str {
15009 "type.googleapis.com/google.cloud.run.v2.BuildConfig"
15010 }
15011}
15012
15013/// Request message for creating a WorkerPool.
15014#[derive(Clone, Default, PartialEq)]
15015#[non_exhaustive]
15016pub struct CreateWorkerPoolRequest {
15017 /// Required. The location and project in which this worker pool should be
15018 /// created. Format: `projects/{project}/locations/{location}`, where
15019 /// `{project}` can be project id or number. Only lowercase characters, digits,
15020 /// and hyphens.
15021 pub parent: std::string::String,
15022
15023 /// Required. The WorkerPool instance to create.
15024 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15025
15026 /// Required. The unique identifier for the WorkerPool. It must begin with
15027 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
15028 /// The name of the worker pool becomes
15029 /// `{parent}/workerPools/{worker_pool_id}`.
15030 pub worker_pool_id: std::string::String,
15031
15032 /// Optional. Indicates that the request should be validated and default values
15033 /// populated, without persisting the request or creating any resources.
15034 pub validate_only: bool,
15035
15036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15037}
15038
15039impl CreateWorkerPoolRequest {
15040 /// Creates a new default instance.
15041 pub fn new() -> Self {
15042 std::default::Default::default()
15043 }
15044
15045 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
15046 ///
15047 /// # Example
15048 /// ```ignore,no_run
15049 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15050 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
15051 /// ```
15052 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15053 self.parent = v.into();
15054 self
15055 }
15056
15057 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
15058 ///
15059 /// # Example
15060 /// ```ignore,no_run
15061 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15062 /// use google_cloud_run_v2::model::WorkerPool;
15063 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15064 /// ```
15065 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15066 where
15067 T: std::convert::Into<crate::model::WorkerPool>,
15068 {
15069 self.worker_pool = std::option::Option::Some(v.into());
15070 self
15071 }
15072
15073 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
15074 ///
15075 /// # Example
15076 /// ```ignore,no_run
15077 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15078 /// use google_cloud_run_v2::model::WorkerPool;
15079 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15080 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15081 /// ```
15082 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15083 where
15084 T: std::convert::Into<crate::model::WorkerPool>,
15085 {
15086 self.worker_pool = v.map(|x| x.into());
15087 self
15088 }
15089
15090 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
15091 ///
15092 /// # Example
15093 /// ```ignore,no_run
15094 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15095 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
15096 /// ```
15097 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15098 self.worker_pool_id = v.into();
15099 self
15100 }
15101
15102 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
15103 ///
15104 /// # Example
15105 /// ```ignore,no_run
15106 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15107 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
15108 /// ```
15109 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15110 self.validate_only = v.into();
15111 self
15112 }
15113}
15114
15115impl wkt::message::Message for CreateWorkerPoolRequest {
15116 fn typename() -> &'static str {
15117 "type.googleapis.com/google.cloud.run.v2.CreateWorkerPoolRequest"
15118 }
15119}
15120
15121/// Request message for updating a worker pool.
15122#[derive(Clone, Default, PartialEq)]
15123#[non_exhaustive]
15124pub struct UpdateWorkerPoolRequest {
15125 /// Optional. The list of fields to be updated.
15126 pub update_mask: std::option::Option<wkt::FieldMask>,
15127
15128 /// Required. The WorkerPool to be updated.
15129 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15130
15131 /// Optional. Indicates that the request should be validated and default values
15132 /// populated, without persisting the request or updating any resources.
15133 pub validate_only: bool,
15134
15135 /// Optional. If set to true, and if the WorkerPool does not exist, it will
15136 /// create a new one. The caller must have 'run.workerpools.create' permissions
15137 /// if this is set to true and the WorkerPool does not exist.
15138 pub allow_missing: bool,
15139
15140 /// Optional. If set to true, a new revision will be created from the template
15141 /// even if the system doesn't detect any changes from the previously deployed
15142 /// revision.
15143 ///
15144 /// This may be useful for cases where the underlying resources need to be
15145 /// recreated or reinitialized. For example if the image is specified by label,
15146 /// but the underlying image digest has changed) or if the container performs
15147 /// deployment initialization work that needs to be performed again.
15148 pub force_new_revision: bool,
15149
15150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15151}
15152
15153impl UpdateWorkerPoolRequest {
15154 /// Creates a new default instance.
15155 pub fn new() -> Self {
15156 std::default::Default::default()
15157 }
15158
15159 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15160 ///
15161 /// # Example
15162 /// ```ignore,no_run
15163 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15164 /// use wkt::FieldMask;
15165 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15166 /// ```
15167 pub fn set_update_mask<T>(mut self, v: T) -> Self
15168 where
15169 T: std::convert::Into<wkt::FieldMask>,
15170 {
15171 self.update_mask = std::option::Option::Some(v.into());
15172 self
15173 }
15174
15175 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15176 ///
15177 /// # Example
15178 /// ```ignore,no_run
15179 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15180 /// use wkt::FieldMask;
15181 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15182 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15183 /// ```
15184 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15185 where
15186 T: std::convert::Into<wkt::FieldMask>,
15187 {
15188 self.update_mask = v.map(|x| x.into());
15189 self
15190 }
15191
15192 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15193 ///
15194 /// # Example
15195 /// ```ignore,no_run
15196 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15197 /// use google_cloud_run_v2::model::WorkerPool;
15198 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15199 /// ```
15200 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15201 where
15202 T: std::convert::Into<crate::model::WorkerPool>,
15203 {
15204 self.worker_pool = std::option::Option::Some(v.into());
15205 self
15206 }
15207
15208 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15209 ///
15210 /// # Example
15211 /// ```ignore,no_run
15212 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15213 /// use google_cloud_run_v2::model::WorkerPool;
15214 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15215 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15216 /// ```
15217 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15218 where
15219 T: std::convert::Into<crate::model::WorkerPool>,
15220 {
15221 self.worker_pool = v.map(|x| x.into());
15222 self
15223 }
15224
15225 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
15226 ///
15227 /// # Example
15228 /// ```ignore,no_run
15229 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15230 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
15231 /// ```
15232 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15233 self.validate_only = v.into();
15234 self
15235 }
15236
15237 /// Sets the value of [allow_missing][crate::model::UpdateWorkerPoolRequest::allow_missing].
15238 ///
15239 /// # Example
15240 /// ```ignore,no_run
15241 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15242 /// let x = UpdateWorkerPoolRequest::new().set_allow_missing(true);
15243 /// ```
15244 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15245 self.allow_missing = v.into();
15246 self
15247 }
15248
15249 /// Sets the value of [force_new_revision][crate::model::UpdateWorkerPoolRequest::force_new_revision].
15250 ///
15251 /// # Example
15252 /// ```ignore,no_run
15253 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15254 /// let x = UpdateWorkerPoolRequest::new().set_force_new_revision(true);
15255 /// ```
15256 pub fn set_force_new_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15257 self.force_new_revision = v.into();
15258 self
15259 }
15260}
15261
15262impl wkt::message::Message for UpdateWorkerPoolRequest {
15263 fn typename() -> &'static str {
15264 "type.googleapis.com/google.cloud.run.v2.UpdateWorkerPoolRequest"
15265 }
15266}
15267
15268/// Request message for retrieving a list of WorkerPools.
15269#[derive(Clone, Default, PartialEq)]
15270#[non_exhaustive]
15271pub struct ListWorkerPoolsRequest {
15272 /// Required. The location and project to list resources on.
15273 /// Location must be a valid Google Cloud region, and cannot be the "-"
15274 /// wildcard. Format: `projects/{project}/locations/{location}`, where
15275 /// `{project}` can be project id or number.
15276 pub parent: std::string::String,
15277
15278 /// Maximum number of WorkerPools to return in this call.
15279 pub page_size: i32,
15280
15281 /// A page token received from a previous call to ListWorkerPools.
15282 /// All other parameters must match.
15283 pub page_token: std::string::String,
15284
15285 /// If true, returns deleted (but unexpired) resources along with active ones.
15286 pub show_deleted: bool,
15287
15288 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15289}
15290
15291impl ListWorkerPoolsRequest {
15292 /// Creates a new default instance.
15293 pub fn new() -> Self {
15294 std::default::Default::default()
15295 }
15296
15297 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
15298 ///
15299 /// # Example
15300 /// ```ignore,no_run
15301 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15302 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
15303 /// ```
15304 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15305 self.parent = v.into();
15306 self
15307 }
15308
15309 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
15310 ///
15311 /// # Example
15312 /// ```ignore,no_run
15313 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15314 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
15315 /// ```
15316 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15317 self.page_size = v.into();
15318 self
15319 }
15320
15321 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
15322 ///
15323 /// # Example
15324 /// ```ignore,no_run
15325 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15326 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
15327 /// ```
15328 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15329 self.page_token = v.into();
15330 self
15331 }
15332
15333 /// Sets the value of [show_deleted][crate::model::ListWorkerPoolsRequest::show_deleted].
15334 ///
15335 /// # Example
15336 /// ```ignore,no_run
15337 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15338 /// let x = ListWorkerPoolsRequest::new().set_show_deleted(true);
15339 /// ```
15340 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15341 self.show_deleted = v.into();
15342 self
15343 }
15344}
15345
15346impl wkt::message::Message for ListWorkerPoolsRequest {
15347 fn typename() -> &'static str {
15348 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsRequest"
15349 }
15350}
15351
15352/// Response message containing a list of WorkerPools.
15353#[derive(Clone, Default, PartialEq)]
15354#[non_exhaustive]
15355pub struct ListWorkerPoolsResponse {
15356 /// The resulting list of WorkerPools.
15357 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
15358
15359 /// A token indicating there are more items than page_size. Use it in the next
15360 /// ListWorkerPools request to continue.
15361 pub next_page_token: std::string::String,
15362
15363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15364}
15365
15366impl ListWorkerPoolsResponse {
15367 /// Creates a new default instance.
15368 pub fn new() -> Self {
15369 std::default::Default::default()
15370 }
15371
15372 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
15373 ///
15374 /// # Example
15375 /// ```ignore,no_run
15376 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15377 /// use google_cloud_run_v2::model::WorkerPool;
15378 /// let x = ListWorkerPoolsResponse::new()
15379 /// .set_worker_pools([
15380 /// WorkerPool::default()/* use setters */,
15381 /// WorkerPool::default()/* use (different) setters */,
15382 /// ]);
15383 /// ```
15384 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
15385 where
15386 T: std::iter::IntoIterator<Item = V>,
15387 V: std::convert::Into<crate::model::WorkerPool>,
15388 {
15389 use std::iter::Iterator;
15390 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
15391 self
15392 }
15393
15394 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
15395 ///
15396 /// # Example
15397 /// ```ignore,no_run
15398 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15399 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
15400 /// ```
15401 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15402 self.next_page_token = v.into();
15403 self
15404 }
15405}
15406
15407impl wkt::message::Message for ListWorkerPoolsResponse {
15408 fn typename() -> &'static str {
15409 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsResponse"
15410 }
15411}
15412
15413#[doc(hidden)]
15414impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
15415 type PageItem = crate::model::WorkerPool;
15416
15417 fn items(self) -> std::vec::Vec<Self::PageItem> {
15418 self.worker_pools
15419 }
15420
15421 fn next_page_token(&self) -> std::string::String {
15422 use std::clone::Clone;
15423 self.next_page_token.clone()
15424 }
15425}
15426
15427/// Request message for obtaining a WorkerPool by its full name.
15428#[derive(Clone, Default, PartialEq)]
15429#[non_exhaustive]
15430pub struct GetWorkerPoolRequest {
15431 /// Required. The full name of the WorkerPool.
15432 /// Format:
15433 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15434 /// `{project}` can be project id or number.
15435 pub name: std::string::String,
15436
15437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15438}
15439
15440impl GetWorkerPoolRequest {
15441 /// Creates a new default instance.
15442 pub fn new() -> Self {
15443 std::default::Default::default()
15444 }
15445
15446 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
15447 ///
15448 /// # Example
15449 /// ```ignore,no_run
15450 /// # use google_cloud_run_v2::model::GetWorkerPoolRequest;
15451 /// let x = GetWorkerPoolRequest::new().set_name("example");
15452 /// ```
15453 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15454 self.name = v.into();
15455 self
15456 }
15457}
15458
15459impl wkt::message::Message for GetWorkerPoolRequest {
15460 fn typename() -> &'static str {
15461 "type.googleapis.com/google.cloud.run.v2.GetWorkerPoolRequest"
15462 }
15463}
15464
15465/// Request message to delete a WorkerPool by its full name.
15466#[derive(Clone, Default, PartialEq)]
15467#[non_exhaustive]
15468pub struct DeleteWorkerPoolRequest {
15469 /// Required. The full name of the WorkerPool.
15470 /// Format:
15471 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15472 /// `{project}` can be project id or number.
15473 pub name: std::string::String,
15474
15475 /// Optional. Indicates that the request should be validated without actually
15476 /// deleting any resources.
15477 pub validate_only: bool,
15478
15479 /// A system-generated fingerprint for this version of the
15480 /// resource. May be used to detect modification conflict during updates.
15481 pub etag: std::string::String,
15482
15483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15484}
15485
15486impl DeleteWorkerPoolRequest {
15487 /// Creates a new default instance.
15488 pub fn new() -> Self {
15489 std::default::Default::default()
15490 }
15491
15492 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
15493 ///
15494 /// # Example
15495 /// ```ignore,no_run
15496 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15497 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
15498 /// ```
15499 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15500 self.name = v.into();
15501 self
15502 }
15503
15504 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
15505 ///
15506 /// # Example
15507 /// ```ignore,no_run
15508 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15509 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
15510 /// ```
15511 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15512 self.validate_only = v.into();
15513 self
15514 }
15515
15516 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
15517 ///
15518 /// # Example
15519 /// ```ignore,no_run
15520 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15521 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
15522 /// ```
15523 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15524 self.etag = v.into();
15525 self
15526 }
15527}
15528
15529impl wkt::message::Message for DeleteWorkerPoolRequest {
15530 fn typename() -> &'static str {
15531 "type.googleapis.com/google.cloud.run.v2.DeleteWorkerPoolRequest"
15532 }
15533}
15534
15535/// WorkerPool acts as a top-level container that manages a set of
15536/// configurations and revision templates which implement a pull-based workload.
15537/// WorkerPool exists to provide a singular abstraction which can be access
15538/// controlled, reasoned about, and which encapsulates software lifecycle
15539/// decisions such as rollout policy and team resource ownership.
15540#[derive(Clone, Default, PartialEq)]
15541#[non_exhaustive]
15542pub struct WorkerPool {
15543 /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest,
15544 /// this field is ignored, and instead composed from
15545 /// CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id.
15546 ///
15547 /// Format:
15548 /// `projects/{project}/locations/{location}/workerPools/{worker_id}`
15549 pub name: std::string::String,
15550
15551 /// User-provided description of the WorkerPool. This field currently has a
15552 /// 512-character limit.
15553 pub description: std::string::String,
15554
15555 /// Output only. Server assigned unique identifier for the trigger. The value
15556 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
15557 /// deleted.
15558 pub uid: std::string::String,
15559
15560 /// Output only. A number that monotonically increases every time the user
15561 /// modifies the desired state.
15562 /// Please note that unlike v1, this is an int64 value. As with most Google
15563 /// APIs, its JSON representation will be a `string` instead of an `integer`.
15564 pub generation: i64,
15565
15566 /// Optional. Unstructured key value map that can be used to organize and
15567 /// categorize objects. User-provided labels are shared with Google's billing
15568 /// system, so they can be used to filter, or break down billing charges by
15569 /// team, component, environment, state, etc. For more information, visit
15570 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
15571 /// <https://cloud.google.com/run/docs/configuring/labels>.
15572 ///
15573 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
15574 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15575 /// namespaces, and they will be rejected. All system labels in v1 now have a
15576 /// corresponding field in v2 WorkerPool.
15577 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15578
15579 /// Optional. Unstructured key value map that may be set by external tools to
15580 /// store and arbitrary metadata. They are not queryable and should be
15581 /// preserved when modifying objects.
15582 ///
15583 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
15584 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15585 /// namespaces, and they will be rejected in new resources. All system
15586 /// annotations in v1 now have a corresponding field in v2 WorkerPool.
15587 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
15588
15589 /// Output only. The creation time.
15590 pub create_time: std::option::Option<wkt::Timestamp>,
15591
15592 /// Output only. The last-modified time.
15593 pub update_time: std::option::Option<wkt::Timestamp>,
15594
15595 /// Output only. The deletion time. It is only populated as a response to a
15596 /// Delete request.
15597 pub delete_time: std::option::Option<wkt::Timestamp>,
15598
15599 /// Output only. For a deleted resource, the time after which it will be
15600 /// permamently deleted.
15601 pub expire_time: std::option::Option<wkt::Timestamp>,
15602
15603 /// Output only. Email address of the authenticated creator.
15604 pub creator: std::string::String,
15605
15606 /// Output only. Email address of the last authenticated modifier.
15607 pub last_modifier: std::string::String,
15608
15609 /// Arbitrary identifier for the API client.
15610 pub client: std::string::String,
15611
15612 /// Arbitrary version identifier for the API client.
15613 pub client_version: std::string::String,
15614
15615 /// Optional. The launch stage as defined by [Google Cloud Platform
15616 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
15617 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
15618 /// is assumed.
15619 /// Set the launch stage to a preview stage on input to allow use of preview
15620 /// features in that stage. On read (or output), describes whether the
15621 /// resource uses preview features.
15622 ///
15623 /// For example, if ALPHA is provided as input, but only BETA and GA-level
15624 /// features are used, this field will be BETA on output.
15625 pub launch_stage: google_cloud_api::model::LaunchStage,
15626
15627 /// Optional. Settings for the Binary Authorization feature.
15628 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
15629
15630 /// Required. The template used to create revisions for this WorkerPool.
15631 pub template: std::option::Option<crate::model::WorkerPoolRevisionTemplate>,
15632
15633 /// Optional. Specifies how to distribute instances over a collection of
15634 /// Revisions belonging to the WorkerPool. If instance split is empty or not
15635 /// provided, defaults to 100% instances assigned to the latest `Ready`
15636 /// Revision.
15637 pub instance_splits: std::vec::Vec<crate::model::InstanceSplit>,
15638
15639 /// Optional. Specifies worker-pool-level scaling settings
15640 pub scaling: std::option::Option<crate::model::WorkerPoolScaling>,
15641
15642 /// Output only. The generation of this WorkerPool currently serving workloads.
15643 /// See comments in `reconciling` for additional information on reconciliation
15644 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
15645 /// As with most Google APIs, its JSON representation will be a `string`
15646 /// instead of an `integer`.
15647 pub observed_generation: i64,
15648
15649 /// Output only. The Condition of this WorkerPool, containing its readiness
15650 /// status, and detailed error information in case it did not reach a serving
15651 /// state. See comments in `reconciling` for additional information on
15652 /// reconciliation process in Cloud Run.
15653 pub terminal_condition: std::option::Option<crate::model::Condition>,
15654
15655 /// Output only. The Conditions of all other associated sub-resources. They
15656 /// contain additional diagnostics information in case the WorkerPool does not
15657 /// reach its Serving state. See comments in `reconciling` for additional
15658 /// information on reconciliation process in Cloud Run.
15659 pub conditions: std::vec::Vec<crate::model::Condition>,
15660
15661 /// Output only. Name of the latest revision that is serving workloads. See
15662 /// comments in `reconciling` for additional information on reconciliation
15663 /// process in Cloud Run.
15664 pub latest_ready_revision: std::string::String,
15665
15666 /// Output only. Name of the last created revision. See comments in
15667 /// `reconciling` for additional information on reconciliation process in Cloud
15668 /// Run.
15669 pub latest_created_revision: std::string::String,
15670
15671 /// Output only. Detailed status information for corresponding instance splits.
15672 /// See comments in `reconciling` for additional information on reconciliation
15673 /// process in Cloud Run.
15674 pub instance_split_statuses: std::vec::Vec<crate::model::InstanceSplitStatus>,
15675
15676 /// Output only. Indicates whether Cloud Run Threat Detection monitoring is
15677 /// enabled for the parent project of this worker pool.
15678 pub threat_detection_enabled: bool,
15679
15680 /// Deprecated: Not supported, and ignored by Cloud Run.
15681 #[deprecated]
15682 pub custom_audiences: std::vec::Vec<std::string::String>,
15683
15684 /// Output only. Reserved for future use.
15685 pub satisfies_pzs: bool,
15686
15687 /// Output only. Returns true if the WorkerPool is currently being acted upon
15688 /// by the system to bring it into the desired state.
15689 ///
15690 /// When a new WorkerPool is created, or an existing one is updated, Cloud Run
15691 /// will asynchronously perform all necessary steps to bring the WorkerPool to
15692 /// the desired serving state. This process is called reconciliation. While
15693 /// reconciliation is in process, `observed_generation`,
15694 /// `latest_ready_revison`, `instance_split_statuses`, and `uri` will have
15695 /// transient values that might mismatch the intended state: Once
15696 /// reconciliation is over (and this field is false), there are two possible
15697 /// outcomes: reconciliation succeeded and the serving state matches the
15698 /// WorkerPool, or there was an error, and reconciliation failed. This state
15699 /// can be found in `terminal_condition.state`.
15700 ///
15701 /// If reconciliation succeeded, the following fields will match:
15702 /// `instance_splits` and `instance_split_statuses`, `observed_generation` and
15703 /// `generation`, `latest_ready_revision` and `latest_created_revision`.
15704 ///
15705 /// If reconciliation failed, `instance_split_statuses`, `observed_generation`,
15706 /// and `latest_ready_revision` will have the state of the last serving
15707 /// revision, or empty for newly created WorkerPools. Additional information on
15708 /// the failure can be found in `terminal_condition` and `conditions`.
15709 pub reconciling: bool,
15710
15711 /// Optional. A system-generated fingerprint for this version of the
15712 /// resource. May be used to detect modification conflict during updates.
15713 pub etag: std::string::String,
15714
15715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15716}
15717
15718impl WorkerPool {
15719 /// Creates a new default instance.
15720 pub fn new() -> Self {
15721 std::default::Default::default()
15722 }
15723
15724 /// Sets the value of [name][crate::model::WorkerPool::name].
15725 ///
15726 /// # Example
15727 /// ```ignore,no_run
15728 /// # use google_cloud_run_v2::model::WorkerPool;
15729 /// let x = WorkerPool::new().set_name("example");
15730 /// ```
15731 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15732 self.name = v.into();
15733 self
15734 }
15735
15736 /// Sets the value of [description][crate::model::WorkerPool::description].
15737 ///
15738 /// # Example
15739 /// ```ignore,no_run
15740 /// # use google_cloud_run_v2::model::WorkerPool;
15741 /// let x = WorkerPool::new().set_description("example");
15742 /// ```
15743 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15744 self.description = v.into();
15745 self
15746 }
15747
15748 /// Sets the value of [uid][crate::model::WorkerPool::uid].
15749 ///
15750 /// # Example
15751 /// ```ignore,no_run
15752 /// # use google_cloud_run_v2::model::WorkerPool;
15753 /// let x = WorkerPool::new().set_uid("example");
15754 /// ```
15755 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15756 self.uid = v.into();
15757 self
15758 }
15759
15760 /// Sets the value of [generation][crate::model::WorkerPool::generation].
15761 ///
15762 /// # Example
15763 /// ```ignore,no_run
15764 /// # use google_cloud_run_v2::model::WorkerPool;
15765 /// let x = WorkerPool::new().set_generation(42);
15766 /// ```
15767 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15768 self.generation = v.into();
15769 self
15770 }
15771
15772 /// Sets the value of [labels][crate::model::WorkerPool::labels].
15773 ///
15774 /// # Example
15775 /// ```ignore,no_run
15776 /// # use google_cloud_run_v2::model::WorkerPool;
15777 /// let x = WorkerPool::new().set_labels([
15778 /// ("key0", "abc"),
15779 /// ("key1", "xyz"),
15780 /// ]);
15781 /// ```
15782 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15783 where
15784 T: std::iter::IntoIterator<Item = (K, V)>,
15785 K: std::convert::Into<std::string::String>,
15786 V: std::convert::Into<std::string::String>,
15787 {
15788 use std::iter::Iterator;
15789 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15790 self
15791 }
15792
15793 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
15794 ///
15795 /// # Example
15796 /// ```ignore,no_run
15797 /// # use google_cloud_run_v2::model::WorkerPool;
15798 /// let x = WorkerPool::new().set_annotations([
15799 /// ("key0", "abc"),
15800 /// ("key1", "xyz"),
15801 /// ]);
15802 /// ```
15803 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
15804 where
15805 T: std::iter::IntoIterator<Item = (K, V)>,
15806 K: std::convert::Into<std::string::String>,
15807 V: std::convert::Into<std::string::String>,
15808 {
15809 use std::iter::Iterator;
15810 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15811 self
15812 }
15813
15814 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
15815 ///
15816 /// # Example
15817 /// ```ignore,no_run
15818 /// # use google_cloud_run_v2::model::WorkerPool;
15819 /// use wkt::Timestamp;
15820 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
15821 /// ```
15822 pub fn set_create_time<T>(mut self, v: T) -> Self
15823 where
15824 T: std::convert::Into<wkt::Timestamp>,
15825 {
15826 self.create_time = std::option::Option::Some(v.into());
15827 self
15828 }
15829
15830 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
15831 ///
15832 /// # Example
15833 /// ```ignore,no_run
15834 /// # use google_cloud_run_v2::model::WorkerPool;
15835 /// use wkt::Timestamp;
15836 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15837 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
15838 /// ```
15839 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15840 where
15841 T: std::convert::Into<wkt::Timestamp>,
15842 {
15843 self.create_time = v.map(|x| x.into());
15844 self
15845 }
15846
15847 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
15848 ///
15849 /// # Example
15850 /// ```ignore,no_run
15851 /// # use google_cloud_run_v2::model::WorkerPool;
15852 /// use wkt::Timestamp;
15853 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
15854 /// ```
15855 pub fn set_update_time<T>(mut self, v: T) -> Self
15856 where
15857 T: std::convert::Into<wkt::Timestamp>,
15858 {
15859 self.update_time = std::option::Option::Some(v.into());
15860 self
15861 }
15862
15863 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
15864 ///
15865 /// # Example
15866 /// ```ignore,no_run
15867 /// # use google_cloud_run_v2::model::WorkerPool;
15868 /// use wkt::Timestamp;
15869 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15870 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
15871 /// ```
15872 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15873 where
15874 T: std::convert::Into<wkt::Timestamp>,
15875 {
15876 self.update_time = v.map(|x| x.into());
15877 self
15878 }
15879
15880 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
15881 ///
15882 /// # Example
15883 /// ```ignore,no_run
15884 /// # use google_cloud_run_v2::model::WorkerPool;
15885 /// use wkt::Timestamp;
15886 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
15887 /// ```
15888 pub fn set_delete_time<T>(mut self, v: T) -> Self
15889 where
15890 T: std::convert::Into<wkt::Timestamp>,
15891 {
15892 self.delete_time = std::option::Option::Some(v.into());
15893 self
15894 }
15895
15896 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
15897 ///
15898 /// # Example
15899 /// ```ignore,no_run
15900 /// # use google_cloud_run_v2::model::WorkerPool;
15901 /// use wkt::Timestamp;
15902 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
15903 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
15904 /// ```
15905 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
15906 where
15907 T: std::convert::Into<wkt::Timestamp>,
15908 {
15909 self.delete_time = v.map(|x| x.into());
15910 self
15911 }
15912
15913 /// Sets the value of [expire_time][crate::model::WorkerPool::expire_time].
15914 ///
15915 /// # Example
15916 /// ```ignore,no_run
15917 /// # use google_cloud_run_v2::model::WorkerPool;
15918 /// use wkt::Timestamp;
15919 /// let x = WorkerPool::new().set_expire_time(Timestamp::default()/* use setters */);
15920 /// ```
15921 pub fn set_expire_time<T>(mut self, v: T) -> Self
15922 where
15923 T: std::convert::Into<wkt::Timestamp>,
15924 {
15925 self.expire_time = std::option::Option::Some(v.into());
15926 self
15927 }
15928
15929 /// Sets or clears the value of [expire_time][crate::model::WorkerPool::expire_time].
15930 ///
15931 /// # Example
15932 /// ```ignore,no_run
15933 /// # use google_cloud_run_v2::model::WorkerPool;
15934 /// use wkt::Timestamp;
15935 /// let x = WorkerPool::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
15936 /// let x = WorkerPool::new().set_or_clear_expire_time(None::<Timestamp>);
15937 /// ```
15938 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
15939 where
15940 T: std::convert::Into<wkt::Timestamp>,
15941 {
15942 self.expire_time = v.map(|x| x.into());
15943 self
15944 }
15945
15946 /// Sets the value of [creator][crate::model::WorkerPool::creator].
15947 ///
15948 /// # Example
15949 /// ```ignore,no_run
15950 /// # use google_cloud_run_v2::model::WorkerPool;
15951 /// let x = WorkerPool::new().set_creator("example");
15952 /// ```
15953 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15954 self.creator = v.into();
15955 self
15956 }
15957
15958 /// Sets the value of [last_modifier][crate::model::WorkerPool::last_modifier].
15959 ///
15960 /// # Example
15961 /// ```ignore,no_run
15962 /// # use google_cloud_run_v2::model::WorkerPool;
15963 /// let x = WorkerPool::new().set_last_modifier("example");
15964 /// ```
15965 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15966 self.last_modifier = v.into();
15967 self
15968 }
15969
15970 /// Sets the value of [client][crate::model::WorkerPool::client].
15971 ///
15972 /// # Example
15973 /// ```ignore,no_run
15974 /// # use google_cloud_run_v2::model::WorkerPool;
15975 /// let x = WorkerPool::new().set_client("example");
15976 /// ```
15977 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15978 self.client = v.into();
15979 self
15980 }
15981
15982 /// Sets the value of [client_version][crate::model::WorkerPool::client_version].
15983 ///
15984 /// # Example
15985 /// ```ignore,no_run
15986 /// # use google_cloud_run_v2::model::WorkerPool;
15987 /// let x = WorkerPool::new().set_client_version("example");
15988 /// ```
15989 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15990 self.client_version = v.into();
15991 self
15992 }
15993
15994 /// Sets the value of [launch_stage][crate::model::WorkerPool::launch_stage].
15995 ///
15996 /// # Example
15997 /// ```ignore,no_run
15998 /// # use google_cloud_run_v2::model::WorkerPool;
15999 /// use google_cloud_api::model::LaunchStage;
16000 /// let x0 = WorkerPool::new().set_launch_stage(LaunchStage::Unimplemented);
16001 /// let x1 = WorkerPool::new().set_launch_stage(LaunchStage::Prelaunch);
16002 /// let x2 = WorkerPool::new().set_launch_stage(LaunchStage::EarlyAccess);
16003 /// ```
16004 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
16005 mut self,
16006 v: T,
16007 ) -> Self {
16008 self.launch_stage = v.into();
16009 self
16010 }
16011
16012 /// Sets the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
16013 ///
16014 /// # Example
16015 /// ```ignore,no_run
16016 /// # use google_cloud_run_v2::model::WorkerPool;
16017 /// use google_cloud_run_v2::model::BinaryAuthorization;
16018 /// let x = WorkerPool::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
16019 /// ```
16020 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
16021 where
16022 T: std::convert::Into<crate::model::BinaryAuthorization>,
16023 {
16024 self.binary_authorization = std::option::Option::Some(v.into());
16025 self
16026 }
16027
16028 /// Sets or clears the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
16029 ///
16030 /// # Example
16031 /// ```ignore,no_run
16032 /// # use google_cloud_run_v2::model::WorkerPool;
16033 /// use google_cloud_run_v2::model::BinaryAuthorization;
16034 /// let x = WorkerPool::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
16035 /// let x = WorkerPool::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
16036 /// ```
16037 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
16038 where
16039 T: std::convert::Into<crate::model::BinaryAuthorization>,
16040 {
16041 self.binary_authorization = v.map(|x| x.into());
16042 self
16043 }
16044
16045 /// Sets the value of [template][crate::model::WorkerPool::template].
16046 ///
16047 /// # Example
16048 /// ```ignore,no_run
16049 /// # use google_cloud_run_v2::model::WorkerPool;
16050 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16051 /// let x = WorkerPool::new().set_template(WorkerPoolRevisionTemplate::default()/* use setters */);
16052 /// ```
16053 pub fn set_template<T>(mut self, v: T) -> Self
16054 where
16055 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
16056 {
16057 self.template = std::option::Option::Some(v.into());
16058 self
16059 }
16060
16061 /// Sets or clears the value of [template][crate::model::WorkerPool::template].
16062 ///
16063 /// # Example
16064 /// ```ignore,no_run
16065 /// # use google_cloud_run_v2::model::WorkerPool;
16066 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16067 /// let x = WorkerPool::new().set_or_clear_template(Some(WorkerPoolRevisionTemplate::default()/* use setters */));
16068 /// let x = WorkerPool::new().set_or_clear_template(None::<WorkerPoolRevisionTemplate>);
16069 /// ```
16070 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
16071 where
16072 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
16073 {
16074 self.template = v.map(|x| x.into());
16075 self
16076 }
16077
16078 /// Sets the value of [instance_splits][crate::model::WorkerPool::instance_splits].
16079 ///
16080 /// # Example
16081 /// ```ignore,no_run
16082 /// # use google_cloud_run_v2::model::WorkerPool;
16083 /// use google_cloud_run_v2::model::InstanceSplit;
16084 /// let x = WorkerPool::new()
16085 /// .set_instance_splits([
16086 /// InstanceSplit::default()/* use setters */,
16087 /// InstanceSplit::default()/* use (different) setters */,
16088 /// ]);
16089 /// ```
16090 pub fn set_instance_splits<T, V>(mut self, v: T) -> Self
16091 where
16092 T: std::iter::IntoIterator<Item = V>,
16093 V: std::convert::Into<crate::model::InstanceSplit>,
16094 {
16095 use std::iter::Iterator;
16096 self.instance_splits = v.into_iter().map(|i| i.into()).collect();
16097 self
16098 }
16099
16100 /// Sets the value of [scaling][crate::model::WorkerPool::scaling].
16101 ///
16102 /// # Example
16103 /// ```ignore,no_run
16104 /// # use google_cloud_run_v2::model::WorkerPool;
16105 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16106 /// let x = WorkerPool::new().set_scaling(WorkerPoolScaling::default()/* use setters */);
16107 /// ```
16108 pub fn set_scaling<T>(mut self, v: T) -> Self
16109 where
16110 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16111 {
16112 self.scaling = std::option::Option::Some(v.into());
16113 self
16114 }
16115
16116 /// Sets or clears the value of [scaling][crate::model::WorkerPool::scaling].
16117 ///
16118 /// # Example
16119 /// ```ignore,no_run
16120 /// # use google_cloud_run_v2::model::WorkerPool;
16121 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16122 /// let x = WorkerPool::new().set_or_clear_scaling(Some(WorkerPoolScaling::default()/* use setters */));
16123 /// let x = WorkerPool::new().set_or_clear_scaling(None::<WorkerPoolScaling>);
16124 /// ```
16125 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
16126 where
16127 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16128 {
16129 self.scaling = v.map(|x| x.into());
16130 self
16131 }
16132
16133 /// Sets the value of [observed_generation][crate::model::WorkerPool::observed_generation].
16134 ///
16135 /// # Example
16136 /// ```ignore,no_run
16137 /// # use google_cloud_run_v2::model::WorkerPool;
16138 /// let x = WorkerPool::new().set_observed_generation(42);
16139 /// ```
16140 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16141 self.observed_generation = v.into();
16142 self
16143 }
16144
16145 /// Sets the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16146 ///
16147 /// # Example
16148 /// ```ignore,no_run
16149 /// # use google_cloud_run_v2::model::WorkerPool;
16150 /// use google_cloud_run_v2::model::Condition;
16151 /// let x = WorkerPool::new().set_terminal_condition(Condition::default()/* use setters */);
16152 /// ```
16153 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
16154 where
16155 T: std::convert::Into<crate::model::Condition>,
16156 {
16157 self.terminal_condition = std::option::Option::Some(v.into());
16158 self
16159 }
16160
16161 /// Sets or clears the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16162 ///
16163 /// # Example
16164 /// ```ignore,no_run
16165 /// # use google_cloud_run_v2::model::WorkerPool;
16166 /// use google_cloud_run_v2::model::Condition;
16167 /// let x = WorkerPool::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
16168 /// let x = WorkerPool::new().set_or_clear_terminal_condition(None::<Condition>);
16169 /// ```
16170 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
16171 where
16172 T: std::convert::Into<crate::model::Condition>,
16173 {
16174 self.terminal_condition = v.map(|x| x.into());
16175 self
16176 }
16177
16178 /// Sets the value of [conditions][crate::model::WorkerPool::conditions].
16179 ///
16180 /// # Example
16181 /// ```ignore,no_run
16182 /// # use google_cloud_run_v2::model::WorkerPool;
16183 /// use google_cloud_run_v2::model::Condition;
16184 /// let x = WorkerPool::new()
16185 /// .set_conditions([
16186 /// Condition::default()/* use setters */,
16187 /// Condition::default()/* use (different) setters */,
16188 /// ]);
16189 /// ```
16190 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16191 where
16192 T: std::iter::IntoIterator<Item = V>,
16193 V: std::convert::Into<crate::model::Condition>,
16194 {
16195 use std::iter::Iterator;
16196 self.conditions = v.into_iter().map(|i| i.into()).collect();
16197 self
16198 }
16199
16200 /// Sets the value of [latest_ready_revision][crate::model::WorkerPool::latest_ready_revision].
16201 ///
16202 /// # Example
16203 /// ```ignore,no_run
16204 /// # use google_cloud_run_v2::model::WorkerPool;
16205 /// let x = WorkerPool::new().set_latest_ready_revision("example");
16206 /// ```
16207 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
16208 mut self,
16209 v: T,
16210 ) -> Self {
16211 self.latest_ready_revision = v.into();
16212 self
16213 }
16214
16215 /// Sets the value of [latest_created_revision][crate::model::WorkerPool::latest_created_revision].
16216 ///
16217 /// # Example
16218 /// ```ignore,no_run
16219 /// # use google_cloud_run_v2::model::WorkerPool;
16220 /// let x = WorkerPool::new().set_latest_created_revision("example");
16221 /// ```
16222 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
16223 mut self,
16224 v: T,
16225 ) -> Self {
16226 self.latest_created_revision = v.into();
16227 self
16228 }
16229
16230 /// Sets the value of [instance_split_statuses][crate::model::WorkerPool::instance_split_statuses].
16231 ///
16232 /// # Example
16233 /// ```ignore,no_run
16234 /// # use google_cloud_run_v2::model::WorkerPool;
16235 /// use google_cloud_run_v2::model::InstanceSplitStatus;
16236 /// let x = WorkerPool::new()
16237 /// .set_instance_split_statuses([
16238 /// InstanceSplitStatus::default()/* use setters */,
16239 /// InstanceSplitStatus::default()/* use (different) setters */,
16240 /// ]);
16241 /// ```
16242 pub fn set_instance_split_statuses<T, V>(mut self, v: T) -> Self
16243 where
16244 T: std::iter::IntoIterator<Item = V>,
16245 V: std::convert::Into<crate::model::InstanceSplitStatus>,
16246 {
16247 use std::iter::Iterator;
16248 self.instance_split_statuses = v.into_iter().map(|i| i.into()).collect();
16249 self
16250 }
16251
16252 /// Sets the value of [threat_detection_enabled][crate::model::WorkerPool::threat_detection_enabled].
16253 ///
16254 /// # Example
16255 /// ```ignore,no_run
16256 /// # use google_cloud_run_v2::model::WorkerPool;
16257 /// let x = WorkerPool::new().set_threat_detection_enabled(true);
16258 /// ```
16259 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16260 self.threat_detection_enabled = v.into();
16261 self
16262 }
16263
16264 /// Sets the value of [custom_audiences][crate::model::WorkerPool::custom_audiences].
16265 ///
16266 /// # Example
16267 /// ```ignore,no_run
16268 /// # use google_cloud_run_v2::model::WorkerPool;
16269 /// let x = WorkerPool::new().set_custom_audiences(["a", "b", "c"]);
16270 /// ```
16271 #[deprecated]
16272 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
16273 where
16274 T: std::iter::IntoIterator<Item = V>,
16275 V: std::convert::Into<std::string::String>,
16276 {
16277 use std::iter::Iterator;
16278 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
16279 self
16280 }
16281
16282 /// Sets the value of [satisfies_pzs][crate::model::WorkerPool::satisfies_pzs].
16283 ///
16284 /// # Example
16285 /// ```ignore,no_run
16286 /// # use google_cloud_run_v2::model::WorkerPool;
16287 /// let x = WorkerPool::new().set_satisfies_pzs(true);
16288 /// ```
16289 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16290 self.satisfies_pzs = v.into();
16291 self
16292 }
16293
16294 /// Sets the value of [reconciling][crate::model::WorkerPool::reconciling].
16295 ///
16296 /// # Example
16297 /// ```ignore,no_run
16298 /// # use google_cloud_run_v2::model::WorkerPool;
16299 /// let x = WorkerPool::new().set_reconciling(true);
16300 /// ```
16301 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16302 self.reconciling = v.into();
16303 self
16304 }
16305
16306 /// Sets the value of [etag][crate::model::WorkerPool::etag].
16307 ///
16308 /// # Example
16309 /// ```ignore,no_run
16310 /// # use google_cloud_run_v2::model::WorkerPool;
16311 /// let x = WorkerPool::new().set_etag("example");
16312 /// ```
16313 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16314 self.etag = v.into();
16315 self
16316 }
16317}
16318
16319impl wkt::message::Message for WorkerPool {
16320 fn typename() -> &'static str {
16321 "type.googleapis.com/google.cloud.run.v2.WorkerPool"
16322 }
16323}
16324
16325/// WorkerPoolRevisionTemplate describes the data a worker pool revision should
16326/// have when created from a template.
16327#[derive(Clone, Default, PartialEq)]
16328#[non_exhaustive]
16329pub struct WorkerPoolRevisionTemplate {
16330 /// Optional. The unique name for the revision. If this field is omitted, it
16331 /// will be automatically generated based on the WorkerPool name.
16332 pub revision: std::string::String,
16333
16334 /// Optional. Unstructured key value map that can be used to organize and
16335 /// categorize objects. User-provided labels are shared with Google's billing
16336 /// system, so they can be used to filter, or break down billing charges by
16337 /// team, component, environment, state, etc. For more information, visit
16338 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
16339 /// <https://cloud.google.com/run/docs/configuring/labels>.
16340 ///
16341 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
16342 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16343 /// namespaces, and they will be rejected. All system labels in v1 now have a
16344 /// corresponding field in v2 WorkerPoolRevisionTemplate.
16345 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16346
16347 /// Optional. Unstructured key value map that may be set by external tools to
16348 /// store and arbitrary metadata. They are not queryable and should be
16349 /// preserved when modifying objects.
16350 ///
16351 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
16352 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16353 /// namespaces, and they will be rejected. All system annotations in v1 now
16354 /// have a corresponding field in v2 WorkerPoolRevisionTemplate.
16355 ///
16356 /// This field follows Kubernetes annotations' namespacing, limits, and
16357 /// rules.
16358 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
16359
16360 /// Optional. VPC Access configuration to use for this Revision. For more
16361 /// information, visit
16362 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
16363 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
16364
16365 /// Optional. Email address of the IAM service account associated with the
16366 /// revision of the service. The service account represents the identity of the
16367 /// running revision, and determines what permissions the revision has. If not
16368 /// provided, the revision will use the project's default service account.
16369 pub service_account: std::string::String,
16370
16371 /// Holds list of the containers that defines the unit of execution for this
16372 /// Revision.
16373 pub containers: std::vec::Vec<crate::model::Container>,
16374
16375 /// Optional. A list of Volumes to make available to containers.
16376 pub volumes: std::vec::Vec<crate::model::Volume>,
16377
16378 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
16379 /// this container image. For more information, go to
16380 /// <https://cloud.google.com/run/docs/securing/using-cmek>
16381 pub encryption_key: std::string::String,
16382
16383 /// Optional. Enables service mesh connectivity.
16384 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
16385
16386 /// Optional. The action to take if the encryption key is revoked.
16387 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
16388
16389 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
16390 /// before shutting down all instances. The minimum increment is 1 hour.
16391 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
16392
16393 /// Optional. The node selector for the revision template.
16394 pub node_selector: std::option::Option<crate::model::NodeSelector>,
16395
16396 /// Optional. True if GPU zonal redundancy is disabled on this worker pool.
16397 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
16398
16399 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16400}
16401
16402impl WorkerPoolRevisionTemplate {
16403 /// Creates a new default instance.
16404 pub fn new() -> Self {
16405 std::default::Default::default()
16406 }
16407
16408 /// Sets the value of [revision][crate::model::WorkerPoolRevisionTemplate::revision].
16409 ///
16410 /// # Example
16411 /// ```ignore,no_run
16412 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16413 /// let x = WorkerPoolRevisionTemplate::new().set_revision("example");
16414 /// ```
16415 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16416 self.revision = v.into();
16417 self
16418 }
16419
16420 /// Sets the value of [labels][crate::model::WorkerPoolRevisionTemplate::labels].
16421 ///
16422 /// # Example
16423 /// ```ignore,no_run
16424 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16425 /// let x = WorkerPoolRevisionTemplate::new().set_labels([
16426 /// ("key0", "abc"),
16427 /// ("key1", "xyz"),
16428 /// ]);
16429 /// ```
16430 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16431 where
16432 T: std::iter::IntoIterator<Item = (K, V)>,
16433 K: std::convert::Into<std::string::String>,
16434 V: std::convert::Into<std::string::String>,
16435 {
16436 use std::iter::Iterator;
16437 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16438 self
16439 }
16440
16441 /// Sets the value of [annotations][crate::model::WorkerPoolRevisionTemplate::annotations].
16442 ///
16443 /// # Example
16444 /// ```ignore,no_run
16445 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16446 /// let x = WorkerPoolRevisionTemplate::new().set_annotations([
16447 /// ("key0", "abc"),
16448 /// ("key1", "xyz"),
16449 /// ]);
16450 /// ```
16451 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
16452 where
16453 T: std::iter::IntoIterator<Item = (K, V)>,
16454 K: std::convert::Into<std::string::String>,
16455 V: std::convert::Into<std::string::String>,
16456 {
16457 use std::iter::Iterator;
16458 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16459 self
16460 }
16461
16462 /// Sets the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16463 ///
16464 /// # Example
16465 /// ```ignore,no_run
16466 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16467 /// use google_cloud_run_v2::model::VpcAccess;
16468 /// let x = WorkerPoolRevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
16469 /// ```
16470 pub fn set_vpc_access<T>(mut self, v: T) -> Self
16471 where
16472 T: std::convert::Into<crate::model::VpcAccess>,
16473 {
16474 self.vpc_access = std::option::Option::Some(v.into());
16475 self
16476 }
16477
16478 /// Sets or clears the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16479 ///
16480 /// # Example
16481 /// ```ignore,no_run
16482 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16483 /// use google_cloud_run_v2::model::VpcAccess;
16484 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
16485 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
16486 /// ```
16487 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
16488 where
16489 T: std::convert::Into<crate::model::VpcAccess>,
16490 {
16491 self.vpc_access = v.map(|x| x.into());
16492 self
16493 }
16494
16495 /// Sets the value of [service_account][crate::model::WorkerPoolRevisionTemplate::service_account].
16496 ///
16497 /// # Example
16498 /// ```ignore,no_run
16499 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16500 /// let x = WorkerPoolRevisionTemplate::new().set_service_account("example");
16501 /// ```
16502 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16503 self.service_account = v.into();
16504 self
16505 }
16506
16507 /// Sets the value of [containers][crate::model::WorkerPoolRevisionTemplate::containers].
16508 ///
16509 /// # Example
16510 /// ```ignore,no_run
16511 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16512 /// use google_cloud_run_v2::model::Container;
16513 /// let x = WorkerPoolRevisionTemplate::new()
16514 /// .set_containers([
16515 /// Container::default()/* use setters */,
16516 /// Container::default()/* use (different) setters */,
16517 /// ]);
16518 /// ```
16519 pub fn set_containers<T, V>(mut self, v: T) -> Self
16520 where
16521 T: std::iter::IntoIterator<Item = V>,
16522 V: std::convert::Into<crate::model::Container>,
16523 {
16524 use std::iter::Iterator;
16525 self.containers = v.into_iter().map(|i| i.into()).collect();
16526 self
16527 }
16528
16529 /// Sets the value of [volumes][crate::model::WorkerPoolRevisionTemplate::volumes].
16530 ///
16531 /// # Example
16532 /// ```ignore,no_run
16533 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16534 /// use google_cloud_run_v2::model::Volume;
16535 /// let x = WorkerPoolRevisionTemplate::new()
16536 /// .set_volumes([
16537 /// Volume::default()/* use setters */,
16538 /// Volume::default()/* use (different) setters */,
16539 /// ]);
16540 /// ```
16541 pub fn set_volumes<T, V>(mut self, v: T) -> Self
16542 where
16543 T: std::iter::IntoIterator<Item = V>,
16544 V: std::convert::Into<crate::model::Volume>,
16545 {
16546 use std::iter::Iterator;
16547 self.volumes = v.into_iter().map(|i| i.into()).collect();
16548 self
16549 }
16550
16551 /// Sets the value of [encryption_key][crate::model::WorkerPoolRevisionTemplate::encryption_key].
16552 ///
16553 /// # Example
16554 /// ```ignore,no_run
16555 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16556 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key("example");
16557 /// ```
16558 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16559 self.encryption_key = v.into();
16560 self
16561 }
16562
16563 /// Sets the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16564 ///
16565 /// # Example
16566 /// ```ignore,no_run
16567 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16568 /// use google_cloud_run_v2::model::ServiceMesh;
16569 /// let x = WorkerPoolRevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
16570 /// ```
16571 pub fn set_service_mesh<T>(mut self, v: T) -> Self
16572 where
16573 T: std::convert::Into<crate::model::ServiceMesh>,
16574 {
16575 self.service_mesh = std::option::Option::Some(v.into());
16576 self
16577 }
16578
16579 /// Sets or clears the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16580 ///
16581 /// # Example
16582 /// ```ignore,no_run
16583 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16584 /// use google_cloud_run_v2::model::ServiceMesh;
16585 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
16586 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
16587 /// ```
16588 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
16589 where
16590 T: std::convert::Into<crate::model::ServiceMesh>,
16591 {
16592 self.service_mesh = v.map(|x| x.into());
16593 self
16594 }
16595
16596 /// Sets the value of [encryption_key_revocation_action][crate::model::WorkerPoolRevisionTemplate::encryption_key_revocation_action].
16597 ///
16598 /// # Example
16599 /// ```ignore,no_run
16600 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16601 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
16602 /// let x0 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
16603 /// let x1 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
16604 /// ```
16605 pub fn set_encryption_key_revocation_action<
16606 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
16607 >(
16608 mut self,
16609 v: T,
16610 ) -> Self {
16611 self.encryption_key_revocation_action = v.into();
16612 self
16613 }
16614
16615 /// Sets the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16616 ///
16617 /// # Example
16618 /// ```ignore,no_run
16619 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16620 /// use wkt::Duration;
16621 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
16622 /// ```
16623 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
16624 where
16625 T: std::convert::Into<wkt::Duration>,
16626 {
16627 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
16628 self
16629 }
16630
16631 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16632 ///
16633 /// # Example
16634 /// ```ignore,no_run
16635 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16636 /// use wkt::Duration;
16637 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
16638 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
16639 /// ```
16640 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
16641 mut self,
16642 v: std::option::Option<T>,
16643 ) -> Self
16644 where
16645 T: std::convert::Into<wkt::Duration>,
16646 {
16647 self.encryption_key_shutdown_duration = v.map(|x| x.into());
16648 self
16649 }
16650
16651 /// Sets the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16652 ///
16653 /// # Example
16654 /// ```ignore,no_run
16655 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16656 /// use google_cloud_run_v2::model::NodeSelector;
16657 /// let x = WorkerPoolRevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
16658 /// ```
16659 pub fn set_node_selector<T>(mut self, v: T) -> Self
16660 where
16661 T: std::convert::Into<crate::model::NodeSelector>,
16662 {
16663 self.node_selector = std::option::Option::Some(v.into());
16664 self
16665 }
16666
16667 /// Sets or clears the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16668 ///
16669 /// # Example
16670 /// ```ignore,no_run
16671 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16672 /// use google_cloud_run_v2::model::NodeSelector;
16673 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
16674 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
16675 /// ```
16676 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
16677 where
16678 T: std::convert::Into<crate::model::NodeSelector>,
16679 {
16680 self.node_selector = v.map(|x| x.into());
16681 self
16682 }
16683
16684 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16685 ///
16686 /// # Example
16687 /// ```ignore,no_run
16688 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16689 /// let x = WorkerPoolRevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
16690 /// ```
16691 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
16692 where
16693 T: std::convert::Into<bool>,
16694 {
16695 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
16696 self
16697 }
16698
16699 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16700 ///
16701 /// # Example
16702 /// ```ignore,no_run
16703 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16704 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
16705 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
16706 /// ```
16707 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
16708 mut self,
16709 v: std::option::Option<T>,
16710 ) -> Self
16711 where
16712 T: std::convert::Into<bool>,
16713 {
16714 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
16715 self
16716 }
16717}
16718
16719impl wkt::message::Message for WorkerPoolRevisionTemplate {
16720 fn typename() -> &'static str {
16721 "type.googleapis.com/google.cloud.run.v2.WorkerPoolRevisionTemplate"
16722 }
16723}
16724
16725/// The type of instance split allocation.
16726///
16727/// # Working with unknown values
16728///
16729/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16730/// additional enum variants at any time. Adding new variants is not considered
16731/// a breaking change. Applications should write their code in anticipation of:
16732///
16733/// - New values appearing in future releases of the client library, **and**
16734/// - New values received dynamically, without application changes.
16735///
16736/// Please consult the [Working with enums] section in the user guide for some
16737/// guidelines.
16738///
16739/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16740#[derive(Clone, Debug, PartialEq)]
16741#[non_exhaustive]
16742pub enum InstanceSplitAllocationType {
16743 /// Unspecified instance allocation type.
16744 Unspecified,
16745 /// Allocates instances to the Service's latest ready Revision.
16746 Latest,
16747 /// Allocates instances to a Revision by name.
16748 Revision,
16749 /// If set, the enum was initialized with an unknown value.
16750 ///
16751 /// Applications can examine the value using [InstanceSplitAllocationType::value] or
16752 /// [InstanceSplitAllocationType::name].
16753 UnknownValue(instance_split_allocation_type::UnknownValue),
16754}
16755
16756#[doc(hidden)]
16757pub mod instance_split_allocation_type {
16758 #[allow(unused_imports)]
16759 use super::*;
16760 #[derive(Clone, Debug, PartialEq)]
16761 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16762}
16763
16764impl InstanceSplitAllocationType {
16765 /// Gets the enum value.
16766 ///
16767 /// Returns `None` if the enum contains an unknown value deserialized from
16768 /// the string representation of enums.
16769 pub fn value(&self) -> std::option::Option<i32> {
16770 match self {
16771 Self::Unspecified => std::option::Option::Some(0),
16772 Self::Latest => std::option::Option::Some(1),
16773 Self::Revision => std::option::Option::Some(2),
16774 Self::UnknownValue(u) => u.0.value(),
16775 }
16776 }
16777
16778 /// Gets the enum value as a string.
16779 ///
16780 /// Returns `None` if the enum contains an unknown value deserialized from
16781 /// the integer representation of enums.
16782 pub fn name(&self) -> std::option::Option<&str> {
16783 match self {
16784 Self::Unspecified => {
16785 std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED")
16786 }
16787 Self::Latest => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST"),
16788 Self::Revision => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION"),
16789 Self::UnknownValue(u) => u.0.name(),
16790 }
16791 }
16792}
16793
16794impl std::default::Default for InstanceSplitAllocationType {
16795 fn default() -> Self {
16796 use std::convert::From;
16797 Self::from(0)
16798 }
16799}
16800
16801impl std::fmt::Display for InstanceSplitAllocationType {
16802 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16803 wkt::internal::display_enum(f, self.name(), self.value())
16804 }
16805}
16806
16807impl std::convert::From<i32> for InstanceSplitAllocationType {
16808 fn from(value: i32) -> Self {
16809 match value {
16810 0 => Self::Unspecified,
16811 1 => Self::Latest,
16812 2 => Self::Revision,
16813 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16814 wkt::internal::UnknownEnumValue::Integer(value),
16815 )),
16816 }
16817 }
16818}
16819
16820impl std::convert::From<&str> for InstanceSplitAllocationType {
16821 fn from(value: &str) -> Self {
16822 use std::string::ToString;
16823 match value {
16824 "INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16825 "INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST" => Self::Latest,
16826 "INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION" => Self::Revision,
16827 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16828 wkt::internal::UnknownEnumValue::String(value.to_string()),
16829 )),
16830 }
16831 }
16832}
16833
16834impl serde::ser::Serialize for InstanceSplitAllocationType {
16835 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16836 where
16837 S: serde::Serializer,
16838 {
16839 match self {
16840 Self::Unspecified => serializer.serialize_i32(0),
16841 Self::Latest => serializer.serialize_i32(1),
16842 Self::Revision => serializer.serialize_i32(2),
16843 Self::UnknownValue(u) => u.0.serialize(serializer),
16844 }
16845 }
16846}
16847
16848impl<'de> serde::de::Deserialize<'de> for InstanceSplitAllocationType {
16849 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16850 where
16851 D: serde::Deserializer<'de>,
16852 {
16853 deserializer.deserialize_any(
16854 wkt::internal::EnumVisitor::<InstanceSplitAllocationType>::new(
16855 ".google.cloud.run.v2.InstanceSplitAllocationType",
16856 ),
16857 )
16858 }
16859}
16860
16861/// The type of instance allocation.
16862///
16863/// # Working with unknown values
16864///
16865/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16866/// additional enum variants at any time. Adding new variants is not considered
16867/// a breaking change. Applications should write their code in anticipation of:
16868///
16869/// - New values appearing in future releases of the client library, **and**
16870/// - New values received dynamically, without application changes.
16871///
16872/// Please consult the [Working with enums] section in the user guide for some
16873/// guidelines.
16874///
16875/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16876#[derive(Clone, Debug, PartialEq)]
16877#[non_exhaustive]
16878pub enum TrafficTargetAllocationType {
16879 /// Unspecified instance allocation type.
16880 Unspecified,
16881 /// Allocates instances to the Service's latest ready Revision.
16882 Latest,
16883 /// Allocates instances to a Revision by name.
16884 Revision,
16885 /// If set, the enum was initialized with an unknown value.
16886 ///
16887 /// Applications can examine the value using [TrafficTargetAllocationType::value] or
16888 /// [TrafficTargetAllocationType::name].
16889 UnknownValue(traffic_target_allocation_type::UnknownValue),
16890}
16891
16892#[doc(hidden)]
16893pub mod traffic_target_allocation_type {
16894 #[allow(unused_imports)]
16895 use super::*;
16896 #[derive(Clone, Debug, PartialEq)]
16897 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16898}
16899
16900impl TrafficTargetAllocationType {
16901 /// Gets the enum value.
16902 ///
16903 /// Returns `None` if the enum contains an unknown value deserialized from
16904 /// the string representation of enums.
16905 pub fn value(&self) -> std::option::Option<i32> {
16906 match self {
16907 Self::Unspecified => std::option::Option::Some(0),
16908 Self::Latest => std::option::Option::Some(1),
16909 Self::Revision => std::option::Option::Some(2),
16910 Self::UnknownValue(u) => u.0.value(),
16911 }
16912 }
16913
16914 /// Gets the enum value as a string.
16915 ///
16916 /// Returns `None` if the enum contains an unknown value deserialized from
16917 /// the integer representation of enums.
16918 pub fn name(&self) -> std::option::Option<&str> {
16919 match self {
16920 Self::Unspecified => {
16921 std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED")
16922 }
16923 Self::Latest => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
16924 Self::Revision => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"),
16925 Self::UnknownValue(u) => u.0.name(),
16926 }
16927 }
16928}
16929
16930impl std::default::Default for TrafficTargetAllocationType {
16931 fn default() -> Self {
16932 use std::convert::From;
16933 Self::from(0)
16934 }
16935}
16936
16937impl std::fmt::Display for TrafficTargetAllocationType {
16938 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16939 wkt::internal::display_enum(f, self.name(), self.value())
16940 }
16941}
16942
16943impl std::convert::From<i32> for TrafficTargetAllocationType {
16944 fn from(value: i32) -> Self {
16945 match value {
16946 0 => Self::Unspecified,
16947 1 => Self::Latest,
16948 2 => Self::Revision,
16949 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
16950 wkt::internal::UnknownEnumValue::Integer(value),
16951 )),
16952 }
16953 }
16954}
16955
16956impl std::convert::From<&str> for TrafficTargetAllocationType {
16957 fn from(value: &str) -> Self {
16958 use std::string::ToString;
16959 match value {
16960 "TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16961 "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST" => Self::Latest,
16962 "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION" => Self::Revision,
16963 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
16964 wkt::internal::UnknownEnumValue::String(value.to_string()),
16965 )),
16966 }
16967 }
16968}
16969
16970impl serde::ser::Serialize for TrafficTargetAllocationType {
16971 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16972 where
16973 S: serde::Serializer,
16974 {
16975 match self {
16976 Self::Unspecified => serializer.serialize_i32(0),
16977 Self::Latest => serializer.serialize_i32(1),
16978 Self::Revision => serializer.serialize_i32(2),
16979 Self::UnknownValue(u) => u.0.serialize(serializer),
16980 }
16981 }
16982}
16983
16984impl<'de> serde::de::Deserialize<'de> for TrafficTargetAllocationType {
16985 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16986 where
16987 D: serde::Deserializer<'de>,
16988 {
16989 deserializer.deserialize_any(
16990 wkt::internal::EnumVisitor::<TrafficTargetAllocationType>::new(
16991 ".google.cloud.run.v2.TrafficTargetAllocationType",
16992 ),
16993 )
16994 }
16995}
16996
16997/// Allowed ingress traffic for the Container.
16998///
16999/// # Working with unknown values
17000///
17001/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17002/// additional enum variants at any time. Adding new variants is not considered
17003/// a breaking change. Applications should write their code in anticipation of:
17004///
17005/// - New values appearing in future releases of the client library, **and**
17006/// - New values received dynamically, without application changes.
17007///
17008/// Please consult the [Working with enums] section in the user guide for some
17009/// guidelines.
17010///
17011/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17012#[derive(Clone, Debug, PartialEq)]
17013#[non_exhaustive]
17014pub enum IngressTraffic {
17015 /// Unspecified
17016 Unspecified,
17017 /// All inbound traffic is allowed.
17018 All,
17019 /// Only internal traffic is allowed.
17020 InternalOnly,
17021 /// Both internal and Google Cloud Load Balancer traffic is allowed.
17022 InternalLoadBalancer,
17023 /// No ingress traffic is allowed.
17024 None,
17025 /// If set, the enum was initialized with an unknown value.
17026 ///
17027 /// Applications can examine the value using [IngressTraffic::value] or
17028 /// [IngressTraffic::name].
17029 UnknownValue(ingress_traffic::UnknownValue),
17030}
17031
17032#[doc(hidden)]
17033pub mod ingress_traffic {
17034 #[allow(unused_imports)]
17035 use super::*;
17036 #[derive(Clone, Debug, PartialEq)]
17037 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17038}
17039
17040impl IngressTraffic {
17041 /// Gets the enum value.
17042 ///
17043 /// Returns `None` if the enum contains an unknown value deserialized from
17044 /// the string representation of enums.
17045 pub fn value(&self) -> std::option::Option<i32> {
17046 match self {
17047 Self::Unspecified => std::option::Option::Some(0),
17048 Self::All => std::option::Option::Some(1),
17049 Self::InternalOnly => std::option::Option::Some(2),
17050 Self::InternalLoadBalancer => std::option::Option::Some(3),
17051 Self::None => std::option::Option::Some(4),
17052 Self::UnknownValue(u) => u.0.value(),
17053 }
17054 }
17055
17056 /// Gets the enum value as a string.
17057 ///
17058 /// Returns `None` if the enum contains an unknown value deserialized from
17059 /// the integer representation of enums.
17060 pub fn name(&self) -> std::option::Option<&str> {
17061 match self {
17062 Self::Unspecified => std::option::Option::Some("INGRESS_TRAFFIC_UNSPECIFIED"),
17063 Self::All => std::option::Option::Some("INGRESS_TRAFFIC_ALL"),
17064 Self::InternalOnly => std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_ONLY"),
17065 Self::InternalLoadBalancer => {
17066 std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER")
17067 }
17068 Self::None => std::option::Option::Some("INGRESS_TRAFFIC_NONE"),
17069 Self::UnknownValue(u) => u.0.name(),
17070 }
17071 }
17072}
17073
17074impl std::default::Default for IngressTraffic {
17075 fn default() -> Self {
17076 use std::convert::From;
17077 Self::from(0)
17078 }
17079}
17080
17081impl std::fmt::Display for IngressTraffic {
17082 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17083 wkt::internal::display_enum(f, self.name(), self.value())
17084 }
17085}
17086
17087impl std::convert::From<i32> for IngressTraffic {
17088 fn from(value: i32) -> Self {
17089 match value {
17090 0 => Self::Unspecified,
17091 1 => Self::All,
17092 2 => Self::InternalOnly,
17093 3 => Self::InternalLoadBalancer,
17094 4 => Self::None,
17095 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
17096 wkt::internal::UnknownEnumValue::Integer(value),
17097 )),
17098 }
17099 }
17100}
17101
17102impl std::convert::From<&str> for IngressTraffic {
17103 fn from(value: &str) -> Self {
17104 use std::string::ToString;
17105 match value {
17106 "INGRESS_TRAFFIC_UNSPECIFIED" => Self::Unspecified,
17107 "INGRESS_TRAFFIC_ALL" => Self::All,
17108 "INGRESS_TRAFFIC_INTERNAL_ONLY" => Self::InternalOnly,
17109 "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER" => Self::InternalLoadBalancer,
17110 "INGRESS_TRAFFIC_NONE" => Self::None,
17111 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
17112 wkt::internal::UnknownEnumValue::String(value.to_string()),
17113 )),
17114 }
17115 }
17116}
17117
17118impl serde::ser::Serialize for IngressTraffic {
17119 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17120 where
17121 S: serde::Serializer,
17122 {
17123 match self {
17124 Self::Unspecified => serializer.serialize_i32(0),
17125 Self::All => serializer.serialize_i32(1),
17126 Self::InternalOnly => serializer.serialize_i32(2),
17127 Self::InternalLoadBalancer => serializer.serialize_i32(3),
17128 Self::None => serializer.serialize_i32(4),
17129 Self::UnknownValue(u) => u.0.serialize(serializer),
17130 }
17131 }
17132}
17133
17134impl<'de> serde::de::Deserialize<'de> for IngressTraffic {
17135 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17136 where
17137 D: serde::Deserializer<'de>,
17138 {
17139 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressTraffic>::new(
17140 ".google.cloud.run.v2.IngressTraffic",
17141 ))
17142 }
17143}
17144
17145/// Alternatives for execution environments.
17146///
17147/// # Working with unknown values
17148///
17149/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17150/// additional enum variants at any time. Adding new variants is not considered
17151/// a breaking change. Applications should write their code in anticipation of:
17152///
17153/// - New values appearing in future releases of the client library, **and**
17154/// - New values received dynamically, without application changes.
17155///
17156/// Please consult the [Working with enums] section in the user guide for some
17157/// guidelines.
17158///
17159/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17160#[derive(Clone, Debug, PartialEq)]
17161#[non_exhaustive]
17162pub enum ExecutionEnvironment {
17163 /// Unspecified
17164 Unspecified,
17165 /// Uses the First Generation environment.
17166 Gen1,
17167 /// Uses Second Generation environment.
17168 Gen2,
17169 /// If set, the enum was initialized with an unknown value.
17170 ///
17171 /// Applications can examine the value using [ExecutionEnvironment::value] or
17172 /// [ExecutionEnvironment::name].
17173 UnknownValue(execution_environment::UnknownValue),
17174}
17175
17176#[doc(hidden)]
17177pub mod execution_environment {
17178 #[allow(unused_imports)]
17179 use super::*;
17180 #[derive(Clone, Debug, PartialEq)]
17181 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17182}
17183
17184impl ExecutionEnvironment {
17185 /// Gets the enum value.
17186 ///
17187 /// Returns `None` if the enum contains an unknown value deserialized from
17188 /// the string representation of enums.
17189 pub fn value(&self) -> std::option::Option<i32> {
17190 match self {
17191 Self::Unspecified => std::option::Option::Some(0),
17192 Self::Gen1 => std::option::Option::Some(1),
17193 Self::Gen2 => std::option::Option::Some(2),
17194 Self::UnknownValue(u) => u.0.value(),
17195 }
17196 }
17197
17198 /// Gets the enum value as a string.
17199 ///
17200 /// Returns `None` if the enum contains an unknown value deserialized from
17201 /// the integer representation of enums.
17202 pub fn name(&self) -> std::option::Option<&str> {
17203 match self {
17204 Self::Unspecified => std::option::Option::Some("EXECUTION_ENVIRONMENT_UNSPECIFIED"),
17205 Self::Gen1 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN1"),
17206 Self::Gen2 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN2"),
17207 Self::UnknownValue(u) => u.0.name(),
17208 }
17209 }
17210}
17211
17212impl std::default::Default for ExecutionEnvironment {
17213 fn default() -> Self {
17214 use std::convert::From;
17215 Self::from(0)
17216 }
17217}
17218
17219impl std::fmt::Display for ExecutionEnvironment {
17220 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17221 wkt::internal::display_enum(f, self.name(), self.value())
17222 }
17223}
17224
17225impl std::convert::From<i32> for ExecutionEnvironment {
17226 fn from(value: i32) -> Self {
17227 match value {
17228 0 => Self::Unspecified,
17229 1 => Self::Gen1,
17230 2 => Self::Gen2,
17231 _ => Self::UnknownValue(execution_environment::UnknownValue(
17232 wkt::internal::UnknownEnumValue::Integer(value),
17233 )),
17234 }
17235 }
17236}
17237
17238impl std::convert::From<&str> for ExecutionEnvironment {
17239 fn from(value: &str) -> Self {
17240 use std::string::ToString;
17241 match value {
17242 "EXECUTION_ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
17243 "EXECUTION_ENVIRONMENT_GEN1" => Self::Gen1,
17244 "EXECUTION_ENVIRONMENT_GEN2" => Self::Gen2,
17245 _ => Self::UnknownValue(execution_environment::UnknownValue(
17246 wkt::internal::UnknownEnumValue::String(value.to_string()),
17247 )),
17248 }
17249 }
17250}
17251
17252impl serde::ser::Serialize for ExecutionEnvironment {
17253 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17254 where
17255 S: serde::Serializer,
17256 {
17257 match self {
17258 Self::Unspecified => serializer.serialize_i32(0),
17259 Self::Gen1 => serializer.serialize_i32(1),
17260 Self::Gen2 => serializer.serialize_i32(2),
17261 Self::UnknownValue(u) => u.0.serialize(serializer),
17262 }
17263 }
17264}
17265
17266impl<'de> serde::de::Deserialize<'de> for ExecutionEnvironment {
17267 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17268 where
17269 D: serde::Deserializer<'de>,
17270 {
17271 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionEnvironment>::new(
17272 ".google.cloud.run.v2.ExecutionEnvironment",
17273 ))
17274 }
17275}
17276
17277/// Specifies behavior if an encryption key used by a resource is revoked.
17278///
17279/// # Working with unknown values
17280///
17281/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17282/// additional enum variants at any time. Adding new variants is not considered
17283/// a breaking change. Applications should write their code in anticipation of:
17284///
17285/// - New values appearing in future releases of the client library, **and**
17286/// - New values received dynamically, without application changes.
17287///
17288/// Please consult the [Working with enums] section in the user guide for some
17289/// guidelines.
17290///
17291/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17292#[derive(Clone, Debug, PartialEq)]
17293#[non_exhaustive]
17294pub enum EncryptionKeyRevocationAction {
17295 /// Unspecified
17296 Unspecified,
17297 /// Prevents the creation of new instances.
17298 PreventNew,
17299 /// Shuts down existing instances, and prevents creation of new ones.
17300 Shutdown,
17301 /// If set, the enum was initialized with an unknown value.
17302 ///
17303 /// Applications can examine the value using [EncryptionKeyRevocationAction::value] or
17304 /// [EncryptionKeyRevocationAction::name].
17305 UnknownValue(encryption_key_revocation_action::UnknownValue),
17306}
17307
17308#[doc(hidden)]
17309pub mod encryption_key_revocation_action {
17310 #[allow(unused_imports)]
17311 use super::*;
17312 #[derive(Clone, Debug, PartialEq)]
17313 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17314}
17315
17316impl EncryptionKeyRevocationAction {
17317 /// Gets the enum value.
17318 ///
17319 /// Returns `None` if the enum contains an unknown value deserialized from
17320 /// the string representation of enums.
17321 pub fn value(&self) -> std::option::Option<i32> {
17322 match self {
17323 Self::Unspecified => std::option::Option::Some(0),
17324 Self::PreventNew => std::option::Option::Some(1),
17325 Self::Shutdown => std::option::Option::Some(2),
17326 Self::UnknownValue(u) => u.0.value(),
17327 }
17328 }
17329
17330 /// Gets the enum value as a string.
17331 ///
17332 /// Returns `None` if the enum contains an unknown value deserialized from
17333 /// the integer representation of enums.
17334 pub fn name(&self) -> std::option::Option<&str> {
17335 match self {
17336 Self::Unspecified => {
17337 std::option::Option::Some("ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED")
17338 }
17339 Self::PreventNew => std::option::Option::Some("PREVENT_NEW"),
17340 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
17341 Self::UnknownValue(u) => u.0.name(),
17342 }
17343 }
17344}
17345
17346impl std::default::Default for EncryptionKeyRevocationAction {
17347 fn default() -> Self {
17348 use std::convert::From;
17349 Self::from(0)
17350 }
17351}
17352
17353impl std::fmt::Display for EncryptionKeyRevocationAction {
17354 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17355 wkt::internal::display_enum(f, self.name(), self.value())
17356 }
17357}
17358
17359impl std::convert::From<i32> for EncryptionKeyRevocationAction {
17360 fn from(value: i32) -> Self {
17361 match value {
17362 0 => Self::Unspecified,
17363 1 => Self::PreventNew,
17364 2 => Self::Shutdown,
17365 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17366 wkt::internal::UnknownEnumValue::Integer(value),
17367 )),
17368 }
17369 }
17370}
17371
17372impl std::convert::From<&str> for EncryptionKeyRevocationAction {
17373 fn from(value: &str) -> Self {
17374 use std::string::ToString;
17375 match value {
17376 "ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED" => Self::Unspecified,
17377 "PREVENT_NEW" => Self::PreventNew,
17378 "SHUTDOWN" => Self::Shutdown,
17379 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17380 wkt::internal::UnknownEnumValue::String(value.to_string()),
17381 )),
17382 }
17383 }
17384}
17385
17386impl serde::ser::Serialize for EncryptionKeyRevocationAction {
17387 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17388 where
17389 S: serde::Serializer,
17390 {
17391 match self {
17392 Self::Unspecified => serializer.serialize_i32(0),
17393 Self::PreventNew => serializer.serialize_i32(1),
17394 Self::Shutdown => serializer.serialize_i32(2),
17395 Self::UnknownValue(u) => u.0.serialize(serializer),
17396 }
17397 }
17398}
17399
17400impl<'de> serde::de::Deserialize<'de> for EncryptionKeyRevocationAction {
17401 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17402 where
17403 D: serde::Deserializer<'de>,
17404 {
17405 deserializer.deserialize_any(
17406 wkt::internal::EnumVisitor::<EncryptionKeyRevocationAction>::new(
17407 ".google.cloud.run.v2.EncryptionKeyRevocationAction",
17408 ),
17409 )
17410 }
17411}