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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_api;
26extern crate google_cloud_gax;
27extern crate google_cloud_iam_v1;
28extern crate google_cloud_longrunning;
29extern crate google_cloud_lro;
30extern crate google_cloud_rpc;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38mod debug;
39mod deserialize;
40mod serialize;
41
42/// Request message for submitting a Build.
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct SubmitBuildRequest {
46 /// Required. The project and location to build in. Location must be a region,
47 /// e.g., 'us-central1' or 'global' if the global builder is to be used.
48 /// Format:
49 /// `projects/{project}/locations/{location}`
50 pub parent: std::string::String,
51
52 /// Required. Artifact Registry URI to store the built image.
53 pub image_uri: std::string::String,
54
55 /// Optional. The service account to use for the build. If not set, the default
56 /// Cloud Build service account for the project will be used.
57 pub service_account: std::string::String,
58
59 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
60 /// build the function. The format of this field is
61 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
62 /// `{project}` and `{region}` are the project id and region respectively where
63 /// the worker pool is defined and `{workerPool}` is the short name of the
64 /// worker pool.
65 pub worker_pool: std::string::String,
66
67 /// Optional. Additional tags to annotate the build.
68 pub tags: std::vec::Vec<std::string::String>,
69
70 /// Optional. The machine type from default pool to use for the build. If left
71 /// blank, cloudbuild will use a sensible default. Currently only E2_HIGHCPU_8
72 /// is supported. If worker_pool is set, this field will be ignored.
73 pub machine_type: std::string::String,
74
75 /// Optional. The release track of the client that initiated the build request.
76 pub release_track: google_cloud_api::model::LaunchStage,
77
78 /// Optional. The client that initiated the build request.
79 pub client: std::string::String,
80
81 /// Location of source.
82 pub source: std::option::Option<crate::model::submit_build_request::Source>,
83
84 /// Build type must be one of the following.
85 pub build_type: std::option::Option<crate::model::submit_build_request::BuildType>,
86
87 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
88}
89
90impl SubmitBuildRequest {
91 /// Creates a new default instance.
92 pub fn new() -> Self {
93 std::default::Default::default()
94 }
95
96 /// Sets the value of [parent][crate::model::SubmitBuildRequest::parent].
97 ///
98 /// # Example
99 /// ```ignore,no_run
100 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
101 /// let x = SubmitBuildRequest::new().set_parent("example");
102 /// ```
103 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
104 self.parent = v.into();
105 self
106 }
107
108 /// Sets the value of [image_uri][crate::model::SubmitBuildRequest::image_uri].
109 ///
110 /// # Example
111 /// ```ignore,no_run
112 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
113 /// let x = SubmitBuildRequest::new().set_image_uri("example");
114 /// ```
115 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
116 self.image_uri = v.into();
117 self
118 }
119
120 /// Sets the value of [service_account][crate::model::SubmitBuildRequest::service_account].
121 ///
122 /// # Example
123 /// ```ignore,no_run
124 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
125 /// let x = SubmitBuildRequest::new().set_service_account("example");
126 /// ```
127 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
128 self.service_account = v.into();
129 self
130 }
131
132 /// Sets the value of [worker_pool][crate::model::SubmitBuildRequest::worker_pool].
133 ///
134 /// # Example
135 /// ```ignore,no_run
136 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
137 /// let x = SubmitBuildRequest::new().set_worker_pool("example");
138 /// ```
139 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
140 self.worker_pool = v.into();
141 self
142 }
143
144 /// Sets the value of [tags][crate::model::SubmitBuildRequest::tags].
145 ///
146 /// # Example
147 /// ```ignore,no_run
148 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
149 /// let x = SubmitBuildRequest::new().set_tags(["a", "b", "c"]);
150 /// ```
151 pub fn set_tags<T, V>(mut self, v: T) -> Self
152 where
153 T: std::iter::IntoIterator<Item = V>,
154 V: std::convert::Into<std::string::String>,
155 {
156 use std::iter::Iterator;
157 self.tags = v.into_iter().map(|i| i.into()).collect();
158 self
159 }
160
161 /// Sets the value of [machine_type][crate::model::SubmitBuildRequest::machine_type].
162 ///
163 /// # Example
164 /// ```ignore,no_run
165 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
166 /// let x = SubmitBuildRequest::new().set_machine_type("example");
167 /// ```
168 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
169 self.machine_type = v.into();
170 self
171 }
172
173 /// Sets the value of [release_track][crate::model::SubmitBuildRequest::release_track].
174 ///
175 /// # Example
176 /// ```ignore,no_run
177 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
178 /// use google_cloud_api::model::LaunchStage;
179 /// let x0 = SubmitBuildRequest::new().set_release_track(LaunchStage::Unimplemented);
180 /// let x1 = SubmitBuildRequest::new().set_release_track(LaunchStage::Prelaunch);
181 /// let x2 = SubmitBuildRequest::new().set_release_track(LaunchStage::EarlyAccess);
182 /// ```
183 pub fn set_release_track<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
184 mut self,
185 v: T,
186 ) -> Self {
187 self.release_track = v.into();
188 self
189 }
190
191 /// Sets the value of [client][crate::model::SubmitBuildRequest::client].
192 ///
193 /// # Example
194 /// ```ignore,no_run
195 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
196 /// let x = SubmitBuildRequest::new().set_client("example");
197 /// ```
198 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
199 self.client = v.into();
200 self
201 }
202
203 /// Sets the value of [source][crate::model::SubmitBuildRequest::source].
204 ///
205 /// Note that all the setters affecting `source` are mutually
206 /// exclusive.
207 ///
208 /// # Example
209 /// ```ignore,no_run
210 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
211 /// use google_cloud_run_v2::model::StorageSource;
212 /// let x = SubmitBuildRequest::new().set_source(Some(
213 /// google_cloud_run_v2::model::submit_build_request::Source::StorageSource(StorageSource::default().into())));
214 /// ```
215 pub fn set_source<
216 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::Source>>,
217 >(
218 mut self,
219 v: T,
220 ) -> Self {
221 self.source = v.into();
222 self
223 }
224
225 /// The value of [source][crate::model::SubmitBuildRequest::source]
226 /// if it holds a `StorageSource`, `None` if the field is not set or
227 /// holds a different branch.
228 pub fn storage_source(
229 &self,
230 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
231 #[allow(unreachable_patterns)]
232 self.source.as_ref().and_then(|v| match v {
233 crate::model::submit_build_request::Source::StorageSource(v) => {
234 std::option::Option::Some(v)
235 }
236 _ => std::option::Option::None,
237 })
238 }
239
240 /// Sets the value of [source][crate::model::SubmitBuildRequest::source]
241 /// to hold a `StorageSource`.
242 ///
243 /// Note that all the setters affecting `source` are
244 /// mutually exclusive.
245 ///
246 /// # Example
247 /// ```ignore,no_run
248 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
249 /// use google_cloud_run_v2::model::StorageSource;
250 /// let x = SubmitBuildRequest::new().set_storage_source(StorageSource::default()/* use setters */);
251 /// assert!(x.storage_source().is_some());
252 /// ```
253 pub fn set_storage_source<
254 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
255 >(
256 mut self,
257 v: T,
258 ) -> Self {
259 self.source = std::option::Option::Some(
260 crate::model::submit_build_request::Source::StorageSource(v.into()),
261 );
262 self
263 }
264
265 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type].
266 ///
267 /// Note that all the setters affecting `build_type` are mutually
268 /// exclusive.
269 ///
270 /// # Example
271 /// ```ignore,no_run
272 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
273 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
274 /// let x = SubmitBuildRequest::new().set_build_type(Some(
275 /// google_cloud_run_v2::model::submit_build_request::BuildType::BuildpackBuild(BuildpacksBuild::default().into())));
276 /// ```
277 pub fn set_build_type<
278 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::BuildType>>,
279 >(
280 mut self,
281 v: T,
282 ) -> Self {
283 self.build_type = v.into();
284 self
285 }
286
287 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
288 /// if it holds a `BuildpackBuild`, `None` if the field is not set or
289 /// holds a different branch.
290 pub fn buildpack_build(
291 &self,
292 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>
293 {
294 #[allow(unreachable_patterns)]
295 self.build_type.as_ref().and_then(|v| match v {
296 crate::model::submit_build_request::BuildType::BuildpackBuild(v) => {
297 std::option::Option::Some(v)
298 }
299 _ => std::option::Option::None,
300 })
301 }
302
303 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
304 /// to hold a `BuildpackBuild`.
305 ///
306 /// Note that all the setters affecting `build_type` are
307 /// mutually exclusive.
308 ///
309 /// # Example
310 /// ```ignore,no_run
311 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
312 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
313 /// let x = SubmitBuildRequest::new().set_buildpack_build(BuildpacksBuild::default()/* use setters */);
314 /// assert!(x.buildpack_build().is_some());
315 /// assert!(x.docker_build().is_none());
316 /// ```
317 pub fn set_buildpack_build<
318 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>,
319 >(
320 mut self,
321 v: T,
322 ) -> Self {
323 self.build_type = std::option::Option::Some(
324 crate::model::submit_build_request::BuildType::BuildpackBuild(v.into()),
325 );
326 self
327 }
328
329 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
330 /// if it holds a `DockerBuild`, `None` if the field is not set or
331 /// holds a different branch.
332 pub fn docker_build(
333 &self,
334 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::DockerBuild>>
335 {
336 #[allow(unreachable_patterns)]
337 self.build_type.as_ref().and_then(|v| match v {
338 crate::model::submit_build_request::BuildType::DockerBuild(v) => {
339 std::option::Option::Some(v)
340 }
341 _ => std::option::Option::None,
342 })
343 }
344
345 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
346 /// to hold a `DockerBuild`.
347 ///
348 /// Note that all the setters affecting `build_type` are
349 /// mutually exclusive.
350 ///
351 /// # Example
352 /// ```ignore,no_run
353 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
354 /// use google_cloud_run_v2::model::submit_build_request::DockerBuild;
355 /// let x = SubmitBuildRequest::new().set_docker_build(DockerBuild::default()/* use setters */);
356 /// assert!(x.docker_build().is_some());
357 /// assert!(x.buildpack_build().is_none());
358 /// ```
359 pub fn set_docker_build<
360 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
361 >(
362 mut self,
363 v: T,
364 ) -> Self {
365 self.build_type = std::option::Option::Some(
366 crate::model::submit_build_request::BuildType::DockerBuild(v.into()),
367 );
368 self
369 }
370}
371
372impl wkt::message::Message for SubmitBuildRequest {
373 fn typename() -> &'static str {
374 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest"
375 }
376}
377
378/// Defines additional types related to [SubmitBuildRequest].
379pub mod submit_build_request {
380 #[allow(unused_imports)]
381 use super::*;
382
383 /// Build the source using Docker. This means the source has a Dockerfile.
384 #[derive(Clone, Default, PartialEq)]
385 #[non_exhaustive]
386 pub struct DockerBuild {
387 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
388 }
389
390 impl DockerBuild {
391 /// Creates a new default instance.
392 pub fn new() -> Self {
393 std::default::Default::default()
394 }
395 }
396
397 impl wkt::message::Message for DockerBuild {
398 fn typename() -> &'static str {
399 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.DockerBuild"
400 }
401 }
402
403 /// Build the source using Buildpacks.
404 #[derive(Clone, Default, PartialEq)]
405 #[non_exhaustive]
406 pub struct BuildpacksBuild {
407 /// The runtime name, e.g. 'go113'. Leave blank for generic builds.
408 #[deprecated]
409 pub runtime: std::string::String,
410
411 /// Optional. Name of the function target if the source is a function source.
412 /// Required for function builds.
413 pub function_target: std::string::String,
414
415 /// Optional. cache_image_uri is the GCR/AR URL where the cache image will be
416 /// stored. cache_image_uri is optional and omitting it will disable caching.
417 /// This URL must be stable across builds. It is used to derive a
418 /// build-specific temporary URL by substituting the tag with the build ID.
419 /// The build will clean up the temporary image on a best-effort basis.
420 pub cache_image_uri: std::string::String,
421
422 /// Optional. The base image to use for the build.
423 pub base_image: std::string::String,
424
425 /// Optional. User-provided build-time environment variables.
426 pub environment_variables:
427 std::collections::HashMap<std::string::String, std::string::String>,
428
429 /// Optional. Whether or not the application container will be enrolled in
430 /// automatic base image updates. When true, the application will be built on
431 /// a scratch base image, so the base layers can be appended at run time.
432 pub enable_automatic_updates: bool,
433
434 /// Optional. project_descriptor stores the path to the project descriptor
435 /// file. When empty, it means that there is no project descriptor file in
436 /// the source.
437 pub project_descriptor: std::string::String,
438
439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
440 }
441
442 impl BuildpacksBuild {
443 /// Creates a new default instance.
444 pub fn new() -> Self {
445 std::default::Default::default()
446 }
447
448 /// Sets the value of [runtime][crate::model::submit_build_request::BuildpacksBuild::runtime].
449 ///
450 /// # Example
451 /// ```ignore,no_run
452 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
453 /// let x = BuildpacksBuild::new().set_runtime("example");
454 /// ```
455 #[deprecated]
456 pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
457 self.runtime = v.into();
458 self
459 }
460
461 /// Sets the value of [function_target][crate::model::submit_build_request::BuildpacksBuild::function_target].
462 ///
463 /// # Example
464 /// ```ignore,no_run
465 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
466 /// let x = BuildpacksBuild::new().set_function_target("example");
467 /// ```
468 pub fn set_function_target<T: std::convert::Into<std::string::String>>(
469 mut self,
470 v: T,
471 ) -> Self {
472 self.function_target = v.into();
473 self
474 }
475
476 /// Sets the value of [cache_image_uri][crate::model::submit_build_request::BuildpacksBuild::cache_image_uri].
477 ///
478 /// # Example
479 /// ```ignore,no_run
480 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
481 /// let x = BuildpacksBuild::new().set_cache_image_uri("example");
482 /// ```
483 pub fn set_cache_image_uri<T: std::convert::Into<std::string::String>>(
484 mut self,
485 v: T,
486 ) -> Self {
487 self.cache_image_uri = v.into();
488 self
489 }
490
491 /// Sets the value of [base_image][crate::model::submit_build_request::BuildpacksBuild::base_image].
492 ///
493 /// # Example
494 /// ```ignore,no_run
495 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
496 /// let x = BuildpacksBuild::new().set_base_image("example");
497 /// ```
498 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
499 self.base_image = v.into();
500 self
501 }
502
503 /// Sets the value of [environment_variables][crate::model::submit_build_request::BuildpacksBuild::environment_variables].
504 ///
505 /// # Example
506 /// ```ignore,no_run
507 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
508 /// let x = BuildpacksBuild::new().set_environment_variables([
509 /// ("key0", "abc"),
510 /// ("key1", "xyz"),
511 /// ]);
512 /// ```
513 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
514 where
515 T: std::iter::IntoIterator<Item = (K, V)>,
516 K: std::convert::Into<std::string::String>,
517 V: std::convert::Into<std::string::String>,
518 {
519 use std::iter::Iterator;
520 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
521 self
522 }
523
524 /// Sets the value of [enable_automatic_updates][crate::model::submit_build_request::BuildpacksBuild::enable_automatic_updates].
525 ///
526 /// # Example
527 /// ```ignore,no_run
528 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
529 /// let x = BuildpacksBuild::new().set_enable_automatic_updates(true);
530 /// ```
531 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
532 self.enable_automatic_updates = v.into();
533 self
534 }
535
536 /// Sets the value of [project_descriptor][crate::model::submit_build_request::BuildpacksBuild::project_descriptor].
537 ///
538 /// # Example
539 /// ```ignore,no_run
540 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
541 /// let x = BuildpacksBuild::new().set_project_descriptor("example");
542 /// ```
543 pub fn set_project_descriptor<T: std::convert::Into<std::string::String>>(
544 mut self,
545 v: T,
546 ) -> Self {
547 self.project_descriptor = v.into();
548 self
549 }
550 }
551
552 impl wkt::message::Message for BuildpacksBuild {
553 fn typename() -> &'static str {
554 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuild"
555 }
556 }
557
558 /// Location of source.
559 #[derive(Clone, Debug, PartialEq)]
560 #[non_exhaustive]
561 pub enum Source {
562 /// Required. Source for the build.
563 StorageSource(std::boxed::Box<crate::model::StorageSource>),
564 }
565
566 /// Build type must be one of the following.
567 #[derive(Clone, Debug, PartialEq)]
568 #[non_exhaustive]
569 pub enum BuildType {
570 /// Build the source using Buildpacks.
571 BuildpackBuild(std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>),
572 /// Build the source using Docker. This means the source has a Dockerfile.
573 DockerBuild(std::boxed::Box<crate::model::submit_build_request::DockerBuild>),
574 }
575}
576
577/// Response message for submitting a Build.
578#[derive(Clone, Default, PartialEq)]
579#[non_exhaustive]
580pub struct SubmitBuildResponse {
581 /// Cloud Build operation to be polled via CloudBuild API.
582 pub build_operation: std::option::Option<google_cloud_longrunning::model::Operation>,
583
584 /// URI of the base builder image in Artifact Registry being used in the build.
585 /// Used to opt into automatic base image updates.
586 pub base_image_uri: std::string::String,
587
588 /// Warning message for the base image.
589 pub base_image_warning: std::string::String,
590
591 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
592}
593
594impl SubmitBuildResponse {
595 /// Creates a new default instance.
596 pub fn new() -> Self {
597 std::default::Default::default()
598 }
599
600 /// Sets the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
601 ///
602 /// # Example
603 /// ```ignore,no_run
604 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
605 /// use google_cloud_longrunning::model::Operation;
606 /// let x = SubmitBuildResponse::new().set_build_operation(Operation::default()/* use setters */);
607 /// ```
608 pub fn set_build_operation<T>(mut self, v: T) -> Self
609 where
610 T: std::convert::Into<google_cloud_longrunning::model::Operation>,
611 {
612 self.build_operation = std::option::Option::Some(v.into());
613 self
614 }
615
616 /// Sets or clears the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
617 ///
618 /// # Example
619 /// ```ignore,no_run
620 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
621 /// use google_cloud_longrunning::model::Operation;
622 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(Some(Operation::default()/* use setters */));
623 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(None::<Operation>);
624 /// ```
625 pub fn set_or_clear_build_operation<T>(mut self, v: std::option::Option<T>) -> Self
626 where
627 T: std::convert::Into<google_cloud_longrunning::model::Operation>,
628 {
629 self.build_operation = v.map(|x| x.into());
630 self
631 }
632
633 /// Sets the value of [base_image_uri][crate::model::SubmitBuildResponse::base_image_uri].
634 ///
635 /// # Example
636 /// ```ignore,no_run
637 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
638 /// let x = SubmitBuildResponse::new().set_base_image_uri("example");
639 /// ```
640 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
641 self.base_image_uri = v.into();
642 self
643 }
644
645 /// Sets the value of [base_image_warning][crate::model::SubmitBuildResponse::base_image_warning].
646 ///
647 /// # Example
648 /// ```ignore,no_run
649 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
650 /// let x = SubmitBuildResponse::new().set_base_image_warning("example");
651 /// ```
652 pub fn set_base_image_warning<T: std::convert::Into<std::string::String>>(
653 mut self,
654 v: T,
655 ) -> Self {
656 self.base_image_warning = v.into();
657 self
658 }
659}
660
661impl wkt::message::Message for SubmitBuildResponse {
662 fn typename() -> &'static str {
663 "type.googleapis.com/google.cloud.run.v2.SubmitBuildResponse"
664 }
665}
666
667/// Location of the source in an archive file in Google Cloud Storage.
668#[derive(Clone, Default, PartialEq)]
669#[non_exhaustive]
670pub struct StorageSource {
671 /// Required. Google Cloud Storage bucket containing the source (see
672 /// [Bucket Name
673 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
674 pub bucket: std::string::String,
675
676 /// Required. Google Cloud Storage object containing the source.
677 ///
678 /// This object must be a gzipped archive file (`.tar.gz`) containing source to
679 /// build.
680 pub object: std::string::String,
681
682 /// Optional. Google Cloud Storage generation for the object. If the generation
683 /// is omitted, the latest generation will be used.
684 pub generation: i64,
685
686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
687}
688
689impl StorageSource {
690 /// Creates a new default instance.
691 pub fn new() -> Self {
692 std::default::Default::default()
693 }
694
695 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
696 ///
697 /// # Example
698 /// ```ignore,no_run
699 /// # use google_cloud_run_v2::model::StorageSource;
700 /// let x = StorageSource::new().set_bucket("example");
701 /// ```
702 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
703 self.bucket = v.into();
704 self
705 }
706
707 /// Sets the value of [object][crate::model::StorageSource::object].
708 ///
709 /// # Example
710 /// ```ignore,no_run
711 /// # use google_cloud_run_v2::model::StorageSource;
712 /// let x = StorageSource::new().set_object("example");
713 /// ```
714 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
715 self.object = v.into();
716 self
717 }
718
719 /// Sets the value of [generation][crate::model::StorageSource::generation].
720 ///
721 /// # Example
722 /// ```ignore,no_run
723 /// # use google_cloud_run_v2::model::StorageSource;
724 /// let x = StorageSource::new().set_generation(42);
725 /// ```
726 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
727 self.generation = v.into();
728 self
729 }
730}
731
732impl wkt::message::Message for StorageSource {
733 fn typename() -> &'static str {
734 "type.googleapis.com/google.cloud.run.v2.StorageSource"
735 }
736}
737
738/// Defines a status condition for a resource.
739#[derive(Clone, Default, PartialEq)]
740#[non_exhaustive]
741pub struct Condition {
742 /// type is used to communicate the status of the reconciliation process.
743 /// See also:
744 /// <https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting>
745 /// Types common to all resources include:
746 ///
747 /// * "Ready": True when the Resource is ready.
748 pub r#type: std::string::String,
749
750 /// State of the condition.
751 pub state: crate::model::condition::State,
752
753 /// Human readable message indicating details about the current status.
754 pub message: std::string::String,
755
756 /// Last time the condition transitioned from one status to another.
757 pub last_transition_time: std::option::Option<wkt::Timestamp>,
758
759 /// How to interpret failures of this condition, one of Error, Warning, Info
760 pub severity: crate::model::condition::Severity,
761
762 /// The reason for this condition. Depending on the condition type,
763 /// it will populate one of these fields.
764 /// Successful conditions cannot have a reason.
765 pub reasons: std::option::Option<crate::model::condition::Reasons>,
766
767 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
768}
769
770impl Condition {
771 /// Creates a new default instance.
772 pub fn new() -> Self {
773 std::default::Default::default()
774 }
775
776 /// Sets the value of [r#type][crate::model::Condition::type].
777 ///
778 /// # Example
779 /// ```ignore,no_run
780 /// # use google_cloud_run_v2::model::Condition;
781 /// let x = Condition::new().set_type("example");
782 /// ```
783 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
784 self.r#type = v.into();
785 self
786 }
787
788 /// Sets the value of [state][crate::model::Condition::state].
789 ///
790 /// # Example
791 /// ```ignore,no_run
792 /// # use google_cloud_run_v2::model::Condition;
793 /// use google_cloud_run_v2::model::condition::State;
794 /// let x0 = Condition::new().set_state(State::ConditionPending);
795 /// let x1 = Condition::new().set_state(State::ConditionReconciling);
796 /// let x2 = Condition::new().set_state(State::ConditionFailed);
797 /// ```
798 pub fn set_state<T: std::convert::Into<crate::model::condition::State>>(
799 mut self,
800 v: T,
801 ) -> Self {
802 self.state = v.into();
803 self
804 }
805
806 /// Sets the value of [message][crate::model::Condition::message].
807 ///
808 /// # Example
809 /// ```ignore,no_run
810 /// # use google_cloud_run_v2::model::Condition;
811 /// let x = Condition::new().set_message("example");
812 /// ```
813 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
814 self.message = v.into();
815 self
816 }
817
818 /// Sets the value of [last_transition_time][crate::model::Condition::last_transition_time].
819 ///
820 /// # Example
821 /// ```ignore,no_run
822 /// # use google_cloud_run_v2::model::Condition;
823 /// use wkt::Timestamp;
824 /// let x = Condition::new().set_last_transition_time(Timestamp::default()/* use setters */);
825 /// ```
826 pub fn set_last_transition_time<T>(mut self, v: T) -> Self
827 where
828 T: std::convert::Into<wkt::Timestamp>,
829 {
830 self.last_transition_time = std::option::Option::Some(v.into());
831 self
832 }
833
834 /// Sets or clears the value of [last_transition_time][crate::model::Condition::last_transition_time].
835 ///
836 /// # Example
837 /// ```ignore,no_run
838 /// # use google_cloud_run_v2::model::Condition;
839 /// use wkt::Timestamp;
840 /// let x = Condition::new().set_or_clear_last_transition_time(Some(Timestamp::default()/* use setters */));
841 /// let x = Condition::new().set_or_clear_last_transition_time(None::<Timestamp>);
842 /// ```
843 pub fn set_or_clear_last_transition_time<T>(mut self, v: std::option::Option<T>) -> Self
844 where
845 T: std::convert::Into<wkt::Timestamp>,
846 {
847 self.last_transition_time = v.map(|x| x.into());
848 self
849 }
850
851 /// Sets the value of [severity][crate::model::Condition::severity].
852 ///
853 /// # Example
854 /// ```ignore,no_run
855 /// # use google_cloud_run_v2::model::Condition;
856 /// use google_cloud_run_v2::model::condition::Severity;
857 /// let x0 = Condition::new().set_severity(Severity::Error);
858 /// let x1 = Condition::new().set_severity(Severity::Warning);
859 /// let x2 = Condition::new().set_severity(Severity::Info);
860 /// ```
861 pub fn set_severity<T: std::convert::Into<crate::model::condition::Severity>>(
862 mut self,
863 v: T,
864 ) -> Self {
865 self.severity = v.into();
866 self
867 }
868
869 /// Sets the value of [reasons][crate::model::Condition::reasons].
870 ///
871 /// Note that all the setters affecting `reasons` are mutually
872 /// exclusive.
873 ///
874 /// # Example
875 /// ```ignore,no_run
876 /// # use google_cloud_run_v2::model::Condition;
877 /// use google_cloud_run_v2::model::condition::CommonReason;
878 /// let x0 = Condition::new().set_reasons(Some(
879 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::Unknown)));
880 /// let x1 = Condition::new().set_reasons(Some(
881 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::RevisionFailed)));
882 /// let x2 = Condition::new().set_reasons(Some(
883 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::ProgressDeadlineExceeded)));
884 /// ```
885 pub fn set_reasons<
886 T: std::convert::Into<std::option::Option<crate::model::condition::Reasons>>,
887 >(
888 mut self,
889 v: T,
890 ) -> Self {
891 self.reasons = v.into();
892 self
893 }
894
895 /// The value of [reasons][crate::model::Condition::reasons]
896 /// if it holds a `Reason`, `None` if the field is not set or
897 /// holds a different branch.
898 pub fn reason(&self) -> std::option::Option<&crate::model::condition::CommonReason> {
899 #[allow(unreachable_patterns)]
900 self.reasons.as_ref().and_then(|v| match v {
901 crate::model::condition::Reasons::Reason(v) => std::option::Option::Some(v),
902 _ => std::option::Option::None,
903 })
904 }
905
906 /// Sets the value of [reasons][crate::model::Condition::reasons]
907 /// to hold a `Reason`.
908 ///
909 /// Note that all the setters affecting `reasons` are
910 /// mutually exclusive.
911 ///
912 /// # Example
913 /// ```ignore,no_run
914 /// # use google_cloud_run_v2::model::Condition;
915 /// use google_cloud_run_v2::model::condition::CommonReason;
916 /// let x0 = Condition::new().set_reason(CommonReason::Unknown);
917 /// let x1 = Condition::new().set_reason(CommonReason::RevisionFailed);
918 /// let x2 = Condition::new().set_reason(CommonReason::ProgressDeadlineExceeded);
919 /// assert!(x0.reason().is_some());
920 /// assert!(x0.revision_reason().is_none());
921 /// assert!(x0.execution_reason().is_none());
922 /// assert!(x1.reason().is_some());
923 /// assert!(x1.revision_reason().is_none());
924 /// assert!(x1.execution_reason().is_none());
925 /// assert!(x2.reason().is_some());
926 /// assert!(x2.revision_reason().is_none());
927 /// assert!(x2.execution_reason().is_none());
928 /// ```
929 pub fn set_reason<T: std::convert::Into<crate::model::condition::CommonReason>>(
930 mut self,
931 v: T,
932 ) -> Self {
933 self.reasons =
934 std::option::Option::Some(crate::model::condition::Reasons::Reason(v.into()));
935 self
936 }
937
938 /// The value of [reasons][crate::model::Condition::reasons]
939 /// if it holds a `RevisionReason`, `None` if the field is not set or
940 /// holds a different branch.
941 pub fn revision_reason(&self) -> std::option::Option<&crate::model::condition::RevisionReason> {
942 #[allow(unreachable_patterns)]
943 self.reasons.as_ref().and_then(|v| match v {
944 crate::model::condition::Reasons::RevisionReason(v) => std::option::Option::Some(v),
945 _ => std::option::Option::None,
946 })
947 }
948
949 /// Sets the value of [reasons][crate::model::Condition::reasons]
950 /// to hold a `RevisionReason`.
951 ///
952 /// Note that all the setters affecting `reasons` are
953 /// mutually exclusive.
954 ///
955 /// # Example
956 /// ```ignore,no_run
957 /// # use google_cloud_run_v2::model::Condition;
958 /// use google_cloud_run_v2::model::condition::RevisionReason;
959 /// let x0 = Condition::new().set_revision_reason(RevisionReason::Pending);
960 /// let x1 = Condition::new().set_revision_reason(RevisionReason::Reserve);
961 /// let x2 = Condition::new().set_revision_reason(RevisionReason::Retired);
962 /// assert!(x0.revision_reason().is_some());
963 /// assert!(x0.reason().is_none());
964 /// assert!(x0.execution_reason().is_none());
965 /// assert!(x1.revision_reason().is_some());
966 /// assert!(x1.reason().is_none());
967 /// assert!(x1.execution_reason().is_none());
968 /// assert!(x2.revision_reason().is_some());
969 /// assert!(x2.reason().is_none());
970 /// assert!(x2.execution_reason().is_none());
971 /// ```
972 pub fn set_revision_reason<T: std::convert::Into<crate::model::condition::RevisionReason>>(
973 mut self,
974 v: T,
975 ) -> Self {
976 self.reasons =
977 std::option::Option::Some(crate::model::condition::Reasons::RevisionReason(v.into()));
978 self
979 }
980
981 /// The value of [reasons][crate::model::Condition::reasons]
982 /// if it holds a `ExecutionReason`, `None` if the field is not set or
983 /// holds a different branch.
984 pub fn execution_reason(
985 &self,
986 ) -> std::option::Option<&crate::model::condition::ExecutionReason> {
987 #[allow(unreachable_patterns)]
988 self.reasons.as_ref().and_then(|v| match v {
989 crate::model::condition::Reasons::ExecutionReason(v) => std::option::Option::Some(v),
990 _ => std::option::Option::None,
991 })
992 }
993
994 /// Sets the value of [reasons][crate::model::Condition::reasons]
995 /// to hold a `ExecutionReason`.
996 ///
997 /// Note that all the setters affecting `reasons` are
998 /// mutually exclusive.
999 ///
1000 /// # Example
1001 /// ```ignore,no_run
1002 /// # use google_cloud_run_v2::model::Condition;
1003 /// use google_cloud_run_v2::model::condition::ExecutionReason;
1004 /// let x0 = Condition::new().set_execution_reason(ExecutionReason::JobStatusServicePollingError);
1005 /// let x1 = Condition::new().set_execution_reason(ExecutionReason::NonZeroExitCode);
1006 /// let x2 = Condition::new().set_execution_reason(ExecutionReason::Cancelled);
1007 /// assert!(x0.execution_reason().is_some());
1008 /// assert!(x0.reason().is_none());
1009 /// assert!(x0.revision_reason().is_none());
1010 /// assert!(x1.execution_reason().is_some());
1011 /// assert!(x1.reason().is_none());
1012 /// assert!(x1.revision_reason().is_none());
1013 /// assert!(x2.execution_reason().is_some());
1014 /// assert!(x2.reason().is_none());
1015 /// assert!(x2.revision_reason().is_none());
1016 /// ```
1017 pub fn set_execution_reason<T: std::convert::Into<crate::model::condition::ExecutionReason>>(
1018 mut self,
1019 v: T,
1020 ) -> Self {
1021 self.reasons =
1022 std::option::Option::Some(crate::model::condition::Reasons::ExecutionReason(v.into()));
1023 self
1024 }
1025}
1026
1027impl wkt::message::Message for Condition {
1028 fn typename() -> &'static str {
1029 "type.googleapis.com/google.cloud.run.v2.Condition"
1030 }
1031}
1032
1033/// Defines additional types related to [Condition].
1034pub mod condition {
1035 #[allow(unused_imports)]
1036 use super::*;
1037
1038 /// Represents the possible Condition states.
1039 ///
1040 /// # Working with unknown values
1041 ///
1042 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1043 /// additional enum variants at any time. Adding new variants is not considered
1044 /// a breaking change. Applications should write their code in anticipation of:
1045 ///
1046 /// - New values appearing in future releases of the client library, **and**
1047 /// - New values received dynamically, without application changes.
1048 ///
1049 /// Please consult the [Working with enums] section in the user guide for some
1050 /// guidelines.
1051 ///
1052 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1053 #[derive(Clone, Debug, PartialEq)]
1054 #[non_exhaustive]
1055 pub enum State {
1056 /// The default value. This value is used if the state is omitted.
1057 Unspecified,
1058 /// Transient state: Reconciliation has not started yet.
1059 ConditionPending,
1060 /// Transient state: reconciliation is still in progress.
1061 ConditionReconciling,
1062 /// Terminal state: Reconciliation did not succeed.
1063 ConditionFailed,
1064 /// Terminal state: Reconciliation completed successfully.
1065 ConditionSucceeded,
1066 /// If set, the enum was initialized with an unknown value.
1067 ///
1068 /// Applications can examine the value using [State::value] or
1069 /// [State::name].
1070 UnknownValue(state::UnknownValue),
1071 }
1072
1073 #[doc(hidden)]
1074 pub mod state {
1075 #[allow(unused_imports)]
1076 use super::*;
1077 #[derive(Clone, Debug, PartialEq)]
1078 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1079 }
1080
1081 impl State {
1082 /// Gets the enum value.
1083 ///
1084 /// Returns `None` if the enum contains an unknown value deserialized from
1085 /// the string representation of enums.
1086 pub fn value(&self) -> std::option::Option<i32> {
1087 match self {
1088 Self::Unspecified => std::option::Option::Some(0),
1089 Self::ConditionPending => std::option::Option::Some(1),
1090 Self::ConditionReconciling => std::option::Option::Some(2),
1091 Self::ConditionFailed => std::option::Option::Some(3),
1092 Self::ConditionSucceeded => std::option::Option::Some(4),
1093 Self::UnknownValue(u) => u.0.value(),
1094 }
1095 }
1096
1097 /// Gets the enum value as a string.
1098 ///
1099 /// Returns `None` if the enum contains an unknown value deserialized from
1100 /// the integer representation of enums.
1101 pub fn name(&self) -> std::option::Option<&str> {
1102 match self {
1103 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1104 Self::ConditionPending => std::option::Option::Some("CONDITION_PENDING"),
1105 Self::ConditionReconciling => std::option::Option::Some("CONDITION_RECONCILING"),
1106 Self::ConditionFailed => std::option::Option::Some("CONDITION_FAILED"),
1107 Self::ConditionSucceeded => std::option::Option::Some("CONDITION_SUCCEEDED"),
1108 Self::UnknownValue(u) => u.0.name(),
1109 }
1110 }
1111 }
1112
1113 impl std::default::Default for State {
1114 fn default() -> Self {
1115 use std::convert::From;
1116 Self::from(0)
1117 }
1118 }
1119
1120 impl std::fmt::Display for State {
1121 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1122 wkt::internal::display_enum(f, self.name(), self.value())
1123 }
1124 }
1125
1126 impl std::convert::From<i32> for State {
1127 fn from(value: i32) -> Self {
1128 match value {
1129 0 => Self::Unspecified,
1130 1 => Self::ConditionPending,
1131 2 => Self::ConditionReconciling,
1132 3 => Self::ConditionFailed,
1133 4 => Self::ConditionSucceeded,
1134 _ => Self::UnknownValue(state::UnknownValue(
1135 wkt::internal::UnknownEnumValue::Integer(value),
1136 )),
1137 }
1138 }
1139 }
1140
1141 impl std::convert::From<&str> for State {
1142 fn from(value: &str) -> Self {
1143 use std::string::ToString;
1144 match value {
1145 "STATE_UNSPECIFIED" => Self::Unspecified,
1146 "CONDITION_PENDING" => Self::ConditionPending,
1147 "CONDITION_RECONCILING" => Self::ConditionReconciling,
1148 "CONDITION_FAILED" => Self::ConditionFailed,
1149 "CONDITION_SUCCEEDED" => Self::ConditionSucceeded,
1150 _ => Self::UnknownValue(state::UnknownValue(
1151 wkt::internal::UnknownEnumValue::String(value.to_string()),
1152 )),
1153 }
1154 }
1155 }
1156
1157 impl serde::ser::Serialize for State {
1158 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1159 where
1160 S: serde::Serializer,
1161 {
1162 match self {
1163 Self::Unspecified => serializer.serialize_i32(0),
1164 Self::ConditionPending => serializer.serialize_i32(1),
1165 Self::ConditionReconciling => serializer.serialize_i32(2),
1166 Self::ConditionFailed => serializer.serialize_i32(3),
1167 Self::ConditionSucceeded => serializer.serialize_i32(4),
1168 Self::UnknownValue(u) => u.0.serialize(serializer),
1169 }
1170 }
1171 }
1172
1173 impl<'de> serde::de::Deserialize<'de> for State {
1174 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1175 where
1176 D: serde::Deserializer<'de>,
1177 {
1178 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1179 ".google.cloud.run.v2.Condition.State",
1180 ))
1181 }
1182 }
1183
1184 /// Represents the severity of the condition failures.
1185 ///
1186 /// # Working with unknown values
1187 ///
1188 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1189 /// additional enum variants at any time. Adding new variants is not considered
1190 /// a breaking change. Applications should write their code in anticipation of:
1191 ///
1192 /// - New values appearing in future releases of the client library, **and**
1193 /// - New values received dynamically, without application changes.
1194 ///
1195 /// Please consult the [Working with enums] section in the user guide for some
1196 /// guidelines.
1197 ///
1198 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1199 #[derive(Clone, Debug, PartialEq)]
1200 #[non_exhaustive]
1201 pub enum Severity {
1202 /// Unspecified severity
1203 Unspecified,
1204 /// Error severity.
1205 Error,
1206 /// Warning severity.
1207 Warning,
1208 /// Info severity.
1209 Info,
1210 /// If set, the enum was initialized with an unknown value.
1211 ///
1212 /// Applications can examine the value using [Severity::value] or
1213 /// [Severity::name].
1214 UnknownValue(severity::UnknownValue),
1215 }
1216
1217 #[doc(hidden)]
1218 pub mod severity {
1219 #[allow(unused_imports)]
1220 use super::*;
1221 #[derive(Clone, Debug, PartialEq)]
1222 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1223 }
1224
1225 impl Severity {
1226 /// Gets the enum value.
1227 ///
1228 /// Returns `None` if the enum contains an unknown value deserialized from
1229 /// the string representation of enums.
1230 pub fn value(&self) -> std::option::Option<i32> {
1231 match self {
1232 Self::Unspecified => std::option::Option::Some(0),
1233 Self::Error => std::option::Option::Some(1),
1234 Self::Warning => std::option::Option::Some(2),
1235 Self::Info => std::option::Option::Some(3),
1236 Self::UnknownValue(u) => u.0.value(),
1237 }
1238 }
1239
1240 /// Gets the enum value as a string.
1241 ///
1242 /// Returns `None` if the enum contains an unknown value deserialized from
1243 /// the integer representation of enums.
1244 pub fn name(&self) -> std::option::Option<&str> {
1245 match self {
1246 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
1247 Self::Error => std::option::Option::Some("ERROR"),
1248 Self::Warning => std::option::Option::Some("WARNING"),
1249 Self::Info => std::option::Option::Some("INFO"),
1250 Self::UnknownValue(u) => u.0.name(),
1251 }
1252 }
1253 }
1254
1255 impl std::default::Default for Severity {
1256 fn default() -> Self {
1257 use std::convert::From;
1258 Self::from(0)
1259 }
1260 }
1261
1262 impl std::fmt::Display for Severity {
1263 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1264 wkt::internal::display_enum(f, self.name(), self.value())
1265 }
1266 }
1267
1268 impl std::convert::From<i32> for Severity {
1269 fn from(value: i32) -> Self {
1270 match value {
1271 0 => Self::Unspecified,
1272 1 => Self::Error,
1273 2 => Self::Warning,
1274 3 => Self::Info,
1275 _ => Self::UnknownValue(severity::UnknownValue(
1276 wkt::internal::UnknownEnumValue::Integer(value),
1277 )),
1278 }
1279 }
1280 }
1281
1282 impl std::convert::From<&str> for Severity {
1283 fn from(value: &str) -> Self {
1284 use std::string::ToString;
1285 match value {
1286 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
1287 "ERROR" => Self::Error,
1288 "WARNING" => Self::Warning,
1289 "INFO" => Self::Info,
1290 _ => Self::UnknownValue(severity::UnknownValue(
1291 wkt::internal::UnknownEnumValue::String(value.to_string()),
1292 )),
1293 }
1294 }
1295 }
1296
1297 impl serde::ser::Serialize for Severity {
1298 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1299 where
1300 S: serde::Serializer,
1301 {
1302 match self {
1303 Self::Unspecified => serializer.serialize_i32(0),
1304 Self::Error => serializer.serialize_i32(1),
1305 Self::Warning => serializer.serialize_i32(2),
1306 Self::Info => serializer.serialize_i32(3),
1307 Self::UnknownValue(u) => u.0.serialize(serializer),
1308 }
1309 }
1310 }
1311
1312 impl<'de> serde::de::Deserialize<'de> for Severity {
1313 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1314 where
1315 D: serde::Deserializer<'de>,
1316 {
1317 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
1318 ".google.cloud.run.v2.Condition.Severity",
1319 ))
1320 }
1321 }
1322
1323 /// Reasons common to all types of conditions.
1324 ///
1325 /// # Working with unknown values
1326 ///
1327 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1328 /// additional enum variants at any time. Adding new variants is not considered
1329 /// a breaking change. Applications should write their code in anticipation of:
1330 ///
1331 /// - New values appearing in future releases of the client library, **and**
1332 /// - New values received dynamically, without application changes.
1333 ///
1334 /// Please consult the [Working with enums] section in the user guide for some
1335 /// guidelines.
1336 ///
1337 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1338 #[derive(Clone, Debug, PartialEq)]
1339 #[non_exhaustive]
1340 pub enum CommonReason {
1341 /// Default value.
1342 Undefined,
1343 /// Reason unknown. Further details will be in message.
1344 Unknown,
1345 /// Revision creation process failed.
1346 RevisionFailed,
1347 /// Timed out waiting for completion.
1348 ProgressDeadlineExceeded,
1349 /// The container image path is incorrect.
1350 ContainerMissing,
1351 /// Insufficient permissions on the container image.
1352 ContainerPermissionDenied,
1353 /// Container image is not authorized by policy.
1354 ContainerImageUnauthorized,
1355 /// Container image policy authorization check failed.
1356 ContainerImageAuthorizationCheckFailed,
1357 /// Insufficient permissions on encryption key.
1358 EncryptionKeyPermissionDenied,
1359 /// Permission check on encryption key failed.
1360 EncryptionKeyCheckFailed,
1361 /// At least one Access check on secrets failed.
1362 SecretsAccessCheckFailed,
1363 /// Waiting for operation to complete.
1364 WaitingForOperation,
1365 /// System will retry immediately.
1366 ImmediateRetry,
1367 /// System will retry later; current attempt failed.
1368 PostponedRetry,
1369 /// An internal error occurred. Further information may be in the message.
1370 Internal,
1371 /// User-provided VPC network was not found.
1372 VpcNetworkNotFound,
1373 /// If set, the enum was initialized with an unknown value.
1374 ///
1375 /// Applications can examine the value using [CommonReason::value] or
1376 /// [CommonReason::name].
1377 UnknownValue(common_reason::UnknownValue),
1378 }
1379
1380 #[doc(hidden)]
1381 pub mod common_reason {
1382 #[allow(unused_imports)]
1383 use super::*;
1384 #[derive(Clone, Debug, PartialEq)]
1385 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1386 }
1387
1388 impl CommonReason {
1389 /// Gets the enum value.
1390 ///
1391 /// Returns `None` if the enum contains an unknown value deserialized from
1392 /// the string representation of enums.
1393 pub fn value(&self) -> std::option::Option<i32> {
1394 match self {
1395 Self::Undefined => std::option::Option::Some(0),
1396 Self::Unknown => std::option::Option::Some(1),
1397 Self::RevisionFailed => std::option::Option::Some(3),
1398 Self::ProgressDeadlineExceeded => std::option::Option::Some(4),
1399 Self::ContainerMissing => std::option::Option::Some(6),
1400 Self::ContainerPermissionDenied => std::option::Option::Some(7),
1401 Self::ContainerImageUnauthorized => std::option::Option::Some(8),
1402 Self::ContainerImageAuthorizationCheckFailed => std::option::Option::Some(9),
1403 Self::EncryptionKeyPermissionDenied => std::option::Option::Some(10),
1404 Self::EncryptionKeyCheckFailed => std::option::Option::Some(11),
1405 Self::SecretsAccessCheckFailed => std::option::Option::Some(12),
1406 Self::WaitingForOperation => std::option::Option::Some(13),
1407 Self::ImmediateRetry => std::option::Option::Some(14),
1408 Self::PostponedRetry => std::option::Option::Some(15),
1409 Self::Internal => std::option::Option::Some(16),
1410 Self::VpcNetworkNotFound => std::option::Option::Some(17),
1411 Self::UnknownValue(u) => u.0.value(),
1412 }
1413 }
1414
1415 /// Gets the enum value as a string.
1416 ///
1417 /// Returns `None` if the enum contains an unknown value deserialized from
1418 /// the integer representation of enums.
1419 pub fn name(&self) -> std::option::Option<&str> {
1420 match self {
1421 Self::Undefined => std::option::Option::Some("COMMON_REASON_UNDEFINED"),
1422 Self::Unknown => std::option::Option::Some("UNKNOWN"),
1423 Self::RevisionFailed => std::option::Option::Some("REVISION_FAILED"),
1424 Self::ProgressDeadlineExceeded => {
1425 std::option::Option::Some("PROGRESS_DEADLINE_EXCEEDED")
1426 }
1427 Self::ContainerMissing => std::option::Option::Some("CONTAINER_MISSING"),
1428 Self::ContainerPermissionDenied => {
1429 std::option::Option::Some("CONTAINER_PERMISSION_DENIED")
1430 }
1431 Self::ContainerImageUnauthorized => {
1432 std::option::Option::Some("CONTAINER_IMAGE_UNAUTHORIZED")
1433 }
1434 Self::ContainerImageAuthorizationCheckFailed => {
1435 std::option::Option::Some("CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED")
1436 }
1437 Self::EncryptionKeyPermissionDenied => {
1438 std::option::Option::Some("ENCRYPTION_KEY_PERMISSION_DENIED")
1439 }
1440 Self::EncryptionKeyCheckFailed => {
1441 std::option::Option::Some("ENCRYPTION_KEY_CHECK_FAILED")
1442 }
1443 Self::SecretsAccessCheckFailed => {
1444 std::option::Option::Some("SECRETS_ACCESS_CHECK_FAILED")
1445 }
1446 Self::WaitingForOperation => std::option::Option::Some("WAITING_FOR_OPERATION"),
1447 Self::ImmediateRetry => std::option::Option::Some("IMMEDIATE_RETRY"),
1448 Self::PostponedRetry => std::option::Option::Some("POSTPONED_RETRY"),
1449 Self::Internal => std::option::Option::Some("INTERNAL"),
1450 Self::VpcNetworkNotFound => std::option::Option::Some("VPC_NETWORK_NOT_FOUND"),
1451 Self::UnknownValue(u) => u.0.name(),
1452 }
1453 }
1454 }
1455
1456 impl std::default::Default for CommonReason {
1457 fn default() -> Self {
1458 use std::convert::From;
1459 Self::from(0)
1460 }
1461 }
1462
1463 impl std::fmt::Display for CommonReason {
1464 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1465 wkt::internal::display_enum(f, self.name(), self.value())
1466 }
1467 }
1468
1469 impl std::convert::From<i32> for CommonReason {
1470 fn from(value: i32) -> Self {
1471 match value {
1472 0 => Self::Undefined,
1473 1 => Self::Unknown,
1474 3 => Self::RevisionFailed,
1475 4 => Self::ProgressDeadlineExceeded,
1476 6 => Self::ContainerMissing,
1477 7 => Self::ContainerPermissionDenied,
1478 8 => Self::ContainerImageUnauthorized,
1479 9 => Self::ContainerImageAuthorizationCheckFailed,
1480 10 => Self::EncryptionKeyPermissionDenied,
1481 11 => Self::EncryptionKeyCheckFailed,
1482 12 => Self::SecretsAccessCheckFailed,
1483 13 => Self::WaitingForOperation,
1484 14 => Self::ImmediateRetry,
1485 15 => Self::PostponedRetry,
1486 16 => Self::Internal,
1487 17 => Self::VpcNetworkNotFound,
1488 _ => Self::UnknownValue(common_reason::UnknownValue(
1489 wkt::internal::UnknownEnumValue::Integer(value),
1490 )),
1491 }
1492 }
1493 }
1494
1495 impl std::convert::From<&str> for CommonReason {
1496 fn from(value: &str) -> Self {
1497 use std::string::ToString;
1498 match value {
1499 "COMMON_REASON_UNDEFINED" => Self::Undefined,
1500 "UNKNOWN" => Self::Unknown,
1501 "REVISION_FAILED" => Self::RevisionFailed,
1502 "PROGRESS_DEADLINE_EXCEEDED" => Self::ProgressDeadlineExceeded,
1503 "CONTAINER_MISSING" => Self::ContainerMissing,
1504 "CONTAINER_PERMISSION_DENIED" => Self::ContainerPermissionDenied,
1505 "CONTAINER_IMAGE_UNAUTHORIZED" => Self::ContainerImageUnauthorized,
1506 "CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED" => {
1507 Self::ContainerImageAuthorizationCheckFailed
1508 }
1509 "ENCRYPTION_KEY_PERMISSION_DENIED" => Self::EncryptionKeyPermissionDenied,
1510 "ENCRYPTION_KEY_CHECK_FAILED" => Self::EncryptionKeyCheckFailed,
1511 "SECRETS_ACCESS_CHECK_FAILED" => Self::SecretsAccessCheckFailed,
1512 "WAITING_FOR_OPERATION" => Self::WaitingForOperation,
1513 "IMMEDIATE_RETRY" => Self::ImmediateRetry,
1514 "POSTPONED_RETRY" => Self::PostponedRetry,
1515 "INTERNAL" => Self::Internal,
1516 "VPC_NETWORK_NOT_FOUND" => Self::VpcNetworkNotFound,
1517 _ => Self::UnknownValue(common_reason::UnknownValue(
1518 wkt::internal::UnknownEnumValue::String(value.to_string()),
1519 )),
1520 }
1521 }
1522 }
1523
1524 impl serde::ser::Serialize for CommonReason {
1525 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1526 where
1527 S: serde::Serializer,
1528 {
1529 match self {
1530 Self::Undefined => serializer.serialize_i32(0),
1531 Self::Unknown => serializer.serialize_i32(1),
1532 Self::RevisionFailed => serializer.serialize_i32(3),
1533 Self::ProgressDeadlineExceeded => serializer.serialize_i32(4),
1534 Self::ContainerMissing => serializer.serialize_i32(6),
1535 Self::ContainerPermissionDenied => serializer.serialize_i32(7),
1536 Self::ContainerImageUnauthorized => serializer.serialize_i32(8),
1537 Self::ContainerImageAuthorizationCheckFailed => serializer.serialize_i32(9),
1538 Self::EncryptionKeyPermissionDenied => serializer.serialize_i32(10),
1539 Self::EncryptionKeyCheckFailed => serializer.serialize_i32(11),
1540 Self::SecretsAccessCheckFailed => serializer.serialize_i32(12),
1541 Self::WaitingForOperation => serializer.serialize_i32(13),
1542 Self::ImmediateRetry => serializer.serialize_i32(14),
1543 Self::PostponedRetry => serializer.serialize_i32(15),
1544 Self::Internal => serializer.serialize_i32(16),
1545 Self::VpcNetworkNotFound => serializer.serialize_i32(17),
1546 Self::UnknownValue(u) => u.0.serialize(serializer),
1547 }
1548 }
1549 }
1550
1551 impl<'de> serde::de::Deserialize<'de> for CommonReason {
1552 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1553 where
1554 D: serde::Deserializer<'de>,
1555 {
1556 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommonReason>::new(
1557 ".google.cloud.run.v2.Condition.CommonReason",
1558 ))
1559 }
1560 }
1561
1562 /// Reasons specific to Revision resource.
1563 ///
1564 /// # Working with unknown values
1565 ///
1566 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1567 /// additional enum variants at any time. Adding new variants is not considered
1568 /// a breaking change. Applications should write their code in anticipation of:
1569 ///
1570 /// - New values appearing in future releases of the client library, **and**
1571 /// - New values received dynamically, without application changes.
1572 ///
1573 /// Please consult the [Working with enums] section in the user guide for some
1574 /// guidelines.
1575 ///
1576 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1577 #[derive(Clone, Debug, PartialEq)]
1578 #[non_exhaustive]
1579 pub enum RevisionReason {
1580 /// Default value.
1581 Undefined,
1582 /// Revision in Pending state.
1583 Pending,
1584 /// Revision is in Reserve state.
1585 Reserve,
1586 /// Revision is Retired.
1587 Retired,
1588 /// Revision is being retired.
1589 Retiring,
1590 /// Revision is being recreated.
1591 Recreating,
1592 /// There was a health check error.
1593 HealthCheckContainerError,
1594 /// Health check failed due to user error from customized path of the
1595 /// container. System will retry.
1596 CustomizedPathResponsePending,
1597 /// A revision with min_instance_count > 0 was created and is reserved, but
1598 /// it was not configured to serve traffic, so it's not live. This can also
1599 /// happen momentarily during traffic migration.
1600 MinInstancesNotProvisioned,
1601 /// The maximum allowed number of active revisions has been reached.
1602 ActiveRevisionLimitReached,
1603 /// There was no deployment defined.
1604 /// This value is no longer used, but Services created in older versions of
1605 /// the API might contain this value.
1606 NoDeployment,
1607 /// A revision's container has no port specified since the revision is of a
1608 /// manually scaled service with 0 instance count
1609 HealthCheckSkipped,
1610 /// A revision with min_instance_count > 0 was created and is waiting for
1611 /// enough instances to begin a traffic migration.
1612 MinInstancesWarming,
1613 /// If set, the enum was initialized with an unknown value.
1614 ///
1615 /// Applications can examine the value using [RevisionReason::value] or
1616 /// [RevisionReason::name].
1617 UnknownValue(revision_reason::UnknownValue),
1618 }
1619
1620 #[doc(hidden)]
1621 pub mod revision_reason {
1622 #[allow(unused_imports)]
1623 use super::*;
1624 #[derive(Clone, Debug, PartialEq)]
1625 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1626 }
1627
1628 impl RevisionReason {
1629 /// Gets the enum value.
1630 ///
1631 /// Returns `None` if the enum contains an unknown value deserialized from
1632 /// the string representation of enums.
1633 pub fn value(&self) -> std::option::Option<i32> {
1634 match self {
1635 Self::Undefined => std::option::Option::Some(0),
1636 Self::Pending => std::option::Option::Some(1),
1637 Self::Reserve => std::option::Option::Some(2),
1638 Self::Retired => std::option::Option::Some(3),
1639 Self::Retiring => std::option::Option::Some(4),
1640 Self::Recreating => std::option::Option::Some(5),
1641 Self::HealthCheckContainerError => std::option::Option::Some(6),
1642 Self::CustomizedPathResponsePending => std::option::Option::Some(7),
1643 Self::MinInstancesNotProvisioned => std::option::Option::Some(8),
1644 Self::ActiveRevisionLimitReached => std::option::Option::Some(9),
1645 Self::NoDeployment => std::option::Option::Some(10),
1646 Self::HealthCheckSkipped => std::option::Option::Some(11),
1647 Self::MinInstancesWarming => std::option::Option::Some(12),
1648 Self::UnknownValue(u) => u.0.value(),
1649 }
1650 }
1651
1652 /// Gets the enum value as a string.
1653 ///
1654 /// Returns `None` if the enum contains an unknown value deserialized from
1655 /// the integer representation of enums.
1656 pub fn name(&self) -> std::option::Option<&str> {
1657 match self {
1658 Self::Undefined => std::option::Option::Some("REVISION_REASON_UNDEFINED"),
1659 Self::Pending => std::option::Option::Some("PENDING"),
1660 Self::Reserve => std::option::Option::Some("RESERVE"),
1661 Self::Retired => std::option::Option::Some("RETIRED"),
1662 Self::Retiring => std::option::Option::Some("RETIRING"),
1663 Self::Recreating => std::option::Option::Some("RECREATING"),
1664 Self::HealthCheckContainerError => {
1665 std::option::Option::Some("HEALTH_CHECK_CONTAINER_ERROR")
1666 }
1667 Self::CustomizedPathResponsePending => {
1668 std::option::Option::Some("CUSTOMIZED_PATH_RESPONSE_PENDING")
1669 }
1670 Self::MinInstancesNotProvisioned => {
1671 std::option::Option::Some("MIN_INSTANCES_NOT_PROVISIONED")
1672 }
1673 Self::ActiveRevisionLimitReached => {
1674 std::option::Option::Some("ACTIVE_REVISION_LIMIT_REACHED")
1675 }
1676 Self::NoDeployment => std::option::Option::Some("NO_DEPLOYMENT"),
1677 Self::HealthCheckSkipped => std::option::Option::Some("HEALTH_CHECK_SKIPPED"),
1678 Self::MinInstancesWarming => std::option::Option::Some("MIN_INSTANCES_WARMING"),
1679 Self::UnknownValue(u) => u.0.name(),
1680 }
1681 }
1682 }
1683
1684 impl std::default::Default for RevisionReason {
1685 fn default() -> Self {
1686 use std::convert::From;
1687 Self::from(0)
1688 }
1689 }
1690
1691 impl std::fmt::Display for RevisionReason {
1692 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1693 wkt::internal::display_enum(f, self.name(), self.value())
1694 }
1695 }
1696
1697 impl std::convert::From<i32> for RevisionReason {
1698 fn from(value: i32) -> Self {
1699 match value {
1700 0 => Self::Undefined,
1701 1 => Self::Pending,
1702 2 => Self::Reserve,
1703 3 => Self::Retired,
1704 4 => Self::Retiring,
1705 5 => Self::Recreating,
1706 6 => Self::HealthCheckContainerError,
1707 7 => Self::CustomizedPathResponsePending,
1708 8 => Self::MinInstancesNotProvisioned,
1709 9 => Self::ActiveRevisionLimitReached,
1710 10 => Self::NoDeployment,
1711 11 => Self::HealthCheckSkipped,
1712 12 => Self::MinInstancesWarming,
1713 _ => Self::UnknownValue(revision_reason::UnknownValue(
1714 wkt::internal::UnknownEnumValue::Integer(value),
1715 )),
1716 }
1717 }
1718 }
1719
1720 impl std::convert::From<&str> for RevisionReason {
1721 fn from(value: &str) -> Self {
1722 use std::string::ToString;
1723 match value {
1724 "REVISION_REASON_UNDEFINED" => Self::Undefined,
1725 "PENDING" => Self::Pending,
1726 "RESERVE" => Self::Reserve,
1727 "RETIRED" => Self::Retired,
1728 "RETIRING" => Self::Retiring,
1729 "RECREATING" => Self::Recreating,
1730 "HEALTH_CHECK_CONTAINER_ERROR" => Self::HealthCheckContainerError,
1731 "CUSTOMIZED_PATH_RESPONSE_PENDING" => Self::CustomizedPathResponsePending,
1732 "MIN_INSTANCES_NOT_PROVISIONED" => Self::MinInstancesNotProvisioned,
1733 "ACTIVE_REVISION_LIMIT_REACHED" => Self::ActiveRevisionLimitReached,
1734 "NO_DEPLOYMENT" => Self::NoDeployment,
1735 "HEALTH_CHECK_SKIPPED" => Self::HealthCheckSkipped,
1736 "MIN_INSTANCES_WARMING" => Self::MinInstancesWarming,
1737 _ => Self::UnknownValue(revision_reason::UnknownValue(
1738 wkt::internal::UnknownEnumValue::String(value.to_string()),
1739 )),
1740 }
1741 }
1742 }
1743
1744 impl serde::ser::Serialize for RevisionReason {
1745 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1746 where
1747 S: serde::Serializer,
1748 {
1749 match self {
1750 Self::Undefined => serializer.serialize_i32(0),
1751 Self::Pending => serializer.serialize_i32(1),
1752 Self::Reserve => serializer.serialize_i32(2),
1753 Self::Retired => serializer.serialize_i32(3),
1754 Self::Retiring => serializer.serialize_i32(4),
1755 Self::Recreating => serializer.serialize_i32(5),
1756 Self::HealthCheckContainerError => serializer.serialize_i32(6),
1757 Self::CustomizedPathResponsePending => serializer.serialize_i32(7),
1758 Self::MinInstancesNotProvisioned => serializer.serialize_i32(8),
1759 Self::ActiveRevisionLimitReached => serializer.serialize_i32(9),
1760 Self::NoDeployment => serializer.serialize_i32(10),
1761 Self::HealthCheckSkipped => serializer.serialize_i32(11),
1762 Self::MinInstancesWarming => serializer.serialize_i32(12),
1763 Self::UnknownValue(u) => u.0.serialize(serializer),
1764 }
1765 }
1766 }
1767
1768 impl<'de> serde::de::Deserialize<'de> for RevisionReason {
1769 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1770 where
1771 D: serde::Deserializer<'de>,
1772 {
1773 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RevisionReason>::new(
1774 ".google.cloud.run.v2.Condition.RevisionReason",
1775 ))
1776 }
1777 }
1778
1779 /// Reasons specific to Execution resource.
1780 ///
1781 /// # Working with unknown values
1782 ///
1783 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1784 /// additional enum variants at any time. Adding new variants is not considered
1785 /// a breaking change. Applications should write their code in anticipation of:
1786 ///
1787 /// - New values appearing in future releases of the client library, **and**
1788 /// - New values received dynamically, without application changes.
1789 ///
1790 /// Please consult the [Working with enums] section in the user guide for some
1791 /// guidelines.
1792 ///
1793 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1794 #[derive(Clone, Debug, PartialEq)]
1795 #[non_exhaustive]
1796 pub enum ExecutionReason {
1797 /// Default value.
1798 Undefined,
1799 /// Internal system error getting execution status. System will retry.
1800 JobStatusServicePollingError,
1801 /// A task reached its retry limit and the last attempt failed due to the
1802 /// user container exiting with a non-zero exit code.
1803 NonZeroExitCode,
1804 /// The execution was cancelled by users.
1805 Cancelled,
1806 /// The execution is in the process of being cancelled.
1807 Cancelling,
1808 /// The execution was deleted.
1809 Deleted,
1810 /// A delayed execution is waiting for a start time.
1811 DelayedStartPending,
1812 /// If set, the enum was initialized with an unknown value.
1813 ///
1814 /// Applications can examine the value using [ExecutionReason::value] or
1815 /// [ExecutionReason::name].
1816 UnknownValue(execution_reason::UnknownValue),
1817 }
1818
1819 #[doc(hidden)]
1820 pub mod execution_reason {
1821 #[allow(unused_imports)]
1822 use super::*;
1823 #[derive(Clone, Debug, PartialEq)]
1824 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1825 }
1826
1827 impl ExecutionReason {
1828 /// Gets the enum value.
1829 ///
1830 /// Returns `None` if the enum contains an unknown value deserialized from
1831 /// the string representation of enums.
1832 pub fn value(&self) -> std::option::Option<i32> {
1833 match self {
1834 Self::Undefined => std::option::Option::Some(0),
1835 Self::JobStatusServicePollingError => std::option::Option::Some(1),
1836 Self::NonZeroExitCode => std::option::Option::Some(2),
1837 Self::Cancelled => std::option::Option::Some(3),
1838 Self::Cancelling => std::option::Option::Some(4),
1839 Self::Deleted => std::option::Option::Some(5),
1840 Self::DelayedStartPending => std::option::Option::Some(6),
1841 Self::UnknownValue(u) => u.0.value(),
1842 }
1843 }
1844
1845 /// Gets the enum value as a string.
1846 ///
1847 /// Returns `None` if the enum contains an unknown value deserialized from
1848 /// the integer representation of enums.
1849 pub fn name(&self) -> std::option::Option<&str> {
1850 match self {
1851 Self::Undefined => std::option::Option::Some("EXECUTION_REASON_UNDEFINED"),
1852 Self::JobStatusServicePollingError => {
1853 std::option::Option::Some("JOB_STATUS_SERVICE_POLLING_ERROR")
1854 }
1855 Self::NonZeroExitCode => std::option::Option::Some("NON_ZERO_EXIT_CODE"),
1856 Self::Cancelled => std::option::Option::Some("CANCELLED"),
1857 Self::Cancelling => std::option::Option::Some("CANCELLING"),
1858 Self::Deleted => std::option::Option::Some("DELETED"),
1859 Self::DelayedStartPending => std::option::Option::Some("DELAYED_START_PENDING"),
1860 Self::UnknownValue(u) => u.0.name(),
1861 }
1862 }
1863 }
1864
1865 impl std::default::Default for ExecutionReason {
1866 fn default() -> Self {
1867 use std::convert::From;
1868 Self::from(0)
1869 }
1870 }
1871
1872 impl std::fmt::Display for ExecutionReason {
1873 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1874 wkt::internal::display_enum(f, self.name(), self.value())
1875 }
1876 }
1877
1878 impl std::convert::From<i32> for ExecutionReason {
1879 fn from(value: i32) -> Self {
1880 match value {
1881 0 => Self::Undefined,
1882 1 => Self::JobStatusServicePollingError,
1883 2 => Self::NonZeroExitCode,
1884 3 => Self::Cancelled,
1885 4 => Self::Cancelling,
1886 5 => Self::Deleted,
1887 6 => Self::DelayedStartPending,
1888 _ => Self::UnknownValue(execution_reason::UnknownValue(
1889 wkt::internal::UnknownEnumValue::Integer(value),
1890 )),
1891 }
1892 }
1893 }
1894
1895 impl std::convert::From<&str> for ExecutionReason {
1896 fn from(value: &str) -> Self {
1897 use std::string::ToString;
1898 match value {
1899 "EXECUTION_REASON_UNDEFINED" => Self::Undefined,
1900 "JOB_STATUS_SERVICE_POLLING_ERROR" => Self::JobStatusServicePollingError,
1901 "NON_ZERO_EXIT_CODE" => Self::NonZeroExitCode,
1902 "CANCELLED" => Self::Cancelled,
1903 "CANCELLING" => Self::Cancelling,
1904 "DELETED" => Self::Deleted,
1905 "DELAYED_START_PENDING" => Self::DelayedStartPending,
1906 _ => Self::UnknownValue(execution_reason::UnknownValue(
1907 wkt::internal::UnknownEnumValue::String(value.to_string()),
1908 )),
1909 }
1910 }
1911 }
1912
1913 impl serde::ser::Serialize for ExecutionReason {
1914 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1915 where
1916 S: serde::Serializer,
1917 {
1918 match self {
1919 Self::Undefined => serializer.serialize_i32(0),
1920 Self::JobStatusServicePollingError => serializer.serialize_i32(1),
1921 Self::NonZeroExitCode => serializer.serialize_i32(2),
1922 Self::Cancelled => serializer.serialize_i32(3),
1923 Self::Cancelling => serializer.serialize_i32(4),
1924 Self::Deleted => serializer.serialize_i32(5),
1925 Self::DelayedStartPending => serializer.serialize_i32(6),
1926 Self::UnknownValue(u) => u.0.serialize(serializer),
1927 }
1928 }
1929 }
1930
1931 impl<'de> serde::de::Deserialize<'de> for ExecutionReason {
1932 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1933 where
1934 D: serde::Deserializer<'de>,
1935 {
1936 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionReason>::new(
1937 ".google.cloud.run.v2.Condition.ExecutionReason",
1938 ))
1939 }
1940 }
1941
1942 /// The reason for this condition. Depending on the condition type,
1943 /// it will populate one of these fields.
1944 /// Successful conditions cannot have a reason.
1945 #[derive(Clone, Debug, PartialEq)]
1946 #[non_exhaustive]
1947 pub enum Reasons {
1948 /// Output only. A common (service-level) reason for this condition.
1949 Reason(crate::model::condition::CommonReason),
1950 /// Output only. A reason for the revision condition.
1951 RevisionReason(crate::model::condition::RevisionReason),
1952 /// Output only. A reason for the execution condition.
1953 ExecutionReason(crate::model::condition::ExecutionReason),
1954 }
1955}
1956
1957/// ContainerStatus holds the information of container name and image digest
1958/// value.
1959#[derive(Clone, Default, PartialEq)]
1960#[non_exhaustive]
1961pub struct ContainerStatus {
1962 /// The name of the container, if specified.
1963 pub name: std::string::String,
1964
1965 /// ImageDigest holds the resolved digest for the image specified and resolved
1966 /// during the creation of Revision. This field holds the digest value
1967 /// regardless of whether a tag or digest was originally specified in the
1968 /// Container object.
1969 pub image_digest: std::string::String,
1970
1971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1972}
1973
1974impl ContainerStatus {
1975 /// Creates a new default instance.
1976 pub fn new() -> Self {
1977 std::default::Default::default()
1978 }
1979
1980 /// Sets the value of [name][crate::model::ContainerStatus::name].
1981 ///
1982 /// # Example
1983 /// ```ignore,no_run
1984 /// # use google_cloud_run_v2::model::ContainerStatus;
1985 /// let x = ContainerStatus::new().set_name("example");
1986 /// ```
1987 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1988 self.name = v.into();
1989 self
1990 }
1991
1992 /// Sets the value of [image_digest][crate::model::ContainerStatus::image_digest].
1993 ///
1994 /// # Example
1995 /// ```ignore,no_run
1996 /// # use google_cloud_run_v2::model::ContainerStatus;
1997 /// let x = ContainerStatus::new().set_image_digest("example");
1998 /// ```
1999 pub fn set_image_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2000 self.image_digest = v.into();
2001 self
2002 }
2003}
2004
2005impl wkt::message::Message for ContainerStatus {
2006 fn typename() -> &'static str {
2007 "type.googleapis.com/google.cloud.run.v2.ContainerStatus"
2008 }
2009}
2010
2011/// Request message for obtaining a Execution by its full name.
2012#[derive(Clone, Default, PartialEq)]
2013#[non_exhaustive]
2014pub struct GetExecutionRequest {
2015 /// Required. The full name of the Execution.
2016 /// Format:
2017 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2018 /// where `{project}` can be project id or number.
2019 pub name: std::string::String,
2020
2021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2022}
2023
2024impl GetExecutionRequest {
2025 /// Creates a new default instance.
2026 pub fn new() -> Self {
2027 std::default::Default::default()
2028 }
2029
2030 /// Sets the value of [name][crate::model::GetExecutionRequest::name].
2031 ///
2032 /// # Example
2033 /// ```ignore,no_run
2034 /// # use google_cloud_run_v2::model::GetExecutionRequest;
2035 /// # let project_id = "project_id";
2036 /// # let location_id = "location_id";
2037 /// # let job_id = "job_id";
2038 /// # let execution_id = "execution_id";
2039 /// let x = GetExecutionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
2040 /// ```
2041 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2042 self.name = v.into();
2043 self
2044 }
2045}
2046
2047impl wkt::message::Message for GetExecutionRequest {
2048 fn typename() -> &'static str {
2049 "type.googleapis.com/google.cloud.run.v2.GetExecutionRequest"
2050 }
2051}
2052
2053/// Request message for retrieving a list of Executions.
2054#[derive(Clone, Default, PartialEq)]
2055#[non_exhaustive]
2056pub struct ListExecutionsRequest {
2057 /// Required. The Execution from which the Executions should be listed.
2058 /// To list all Executions across Jobs, use "-" instead of Job name.
2059 /// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
2060 /// `{project}` can be project id or number.
2061 pub parent: std::string::String,
2062
2063 /// Maximum number of Executions to return in this call.
2064 pub page_size: i32,
2065
2066 /// A page token received from a previous call to ListExecutions.
2067 /// All other parameters must match.
2068 pub page_token: std::string::String,
2069
2070 /// If true, returns deleted (but unexpired) resources along with active ones.
2071 pub show_deleted: bool,
2072
2073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2074}
2075
2076impl ListExecutionsRequest {
2077 /// Creates a new default instance.
2078 pub fn new() -> Self {
2079 std::default::Default::default()
2080 }
2081
2082 /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
2083 ///
2084 /// # Example
2085 /// ```ignore,no_run
2086 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2087 /// # let project_id = "project_id";
2088 /// # let location_id = "location_id";
2089 /// # let job_id = "job_id";
2090 /// let x = ListExecutionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
2091 /// ```
2092 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2093 self.parent = v.into();
2094 self
2095 }
2096
2097 /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
2098 ///
2099 /// # Example
2100 /// ```ignore,no_run
2101 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2102 /// let x = ListExecutionsRequest::new().set_page_size(42);
2103 /// ```
2104 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2105 self.page_size = v.into();
2106 self
2107 }
2108
2109 /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
2110 ///
2111 /// # Example
2112 /// ```ignore,no_run
2113 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2114 /// let x = ListExecutionsRequest::new().set_page_token("example");
2115 /// ```
2116 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2117 self.page_token = v.into();
2118 self
2119 }
2120
2121 /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
2122 ///
2123 /// # Example
2124 /// ```ignore,no_run
2125 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2126 /// let x = ListExecutionsRequest::new().set_show_deleted(true);
2127 /// ```
2128 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2129 self.show_deleted = v.into();
2130 self
2131 }
2132}
2133
2134impl wkt::message::Message for ListExecutionsRequest {
2135 fn typename() -> &'static str {
2136 "type.googleapis.com/google.cloud.run.v2.ListExecutionsRequest"
2137 }
2138}
2139
2140/// Response message containing a list of Executions.
2141#[derive(Clone, Default, PartialEq)]
2142#[non_exhaustive]
2143pub struct ListExecutionsResponse {
2144 /// The resulting list of Executions.
2145 pub executions: std::vec::Vec<crate::model::Execution>,
2146
2147 /// A token indicating there are more items than page_size. Use it in the next
2148 /// ListExecutions request to continue.
2149 pub next_page_token: std::string::String,
2150
2151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2152}
2153
2154impl ListExecutionsResponse {
2155 /// Creates a new default instance.
2156 pub fn new() -> Self {
2157 std::default::Default::default()
2158 }
2159
2160 /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
2161 ///
2162 /// # Example
2163 /// ```ignore,no_run
2164 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2165 /// use google_cloud_run_v2::model::Execution;
2166 /// let x = ListExecutionsResponse::new()
2167 /// .set_executions([
2168 /// Execution::default()/* use setters */,
2169 /// Execution::default()/* use (different) setters */,
2170 /// ]);
2171 /// ```
2172 pub fn set_executions<T, V>(mut self, v: T) -> Self
2173 where
2174 T: std::iter::IntoIterator<Item = V>,
2175 V: std::convert::Into<crate::model::Execution>,
2176 {
2177 use std::iter::Iterator;
2178 self.executions = v.into_iter().map(|i| i.into()).collect();
2179 self
2180 }
2181
2182 /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
2183 ///
2184 /// # Example
2185 /// ```ignore,no_run
2186 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2187 /// let x = ListExecutionsResponse::new().set_next_page_token("example");
2188 /// ```
2189 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2190 self.next_page_token = v.into();
2191 self
2192 }
2193}
2194
2195impl wkt::message::Message for ListExecutionsResponse {
2196 fn typename() -> &'static str {
2197 "type.googleapis.com/google.cloud.run.v2.ListExecutionsResponse"
2198 }
2199}
2200
2201#[doc(hidden)]
2202impl google_cloud_gax::paginator::internal::PageableResponse for ListExecutionsResponse {
2203 type PageItem = crate::model::Execution;
2204
2205 fn items(self) -> std::vec::Vec<Self::PageItem> {
2206 self.executions
2207 }
2208
2209 fn next_page_token(&self) -> std::string::String {
2210 use std::clone::Clone;
2211 self.next_page_token.clone()
2212 }
2213}
2214
2215/// Request message for deleting an Execution.
2216#[derive(Clone, Default, PartialEq)]
2217#[non_exhaustive]
2218pub struct DeleteExecutionRequest {
2219 /// Required. The name of the Execution to delete.
2220 /// Format:
2221 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2222 /// where `{project}` can be project id or number.
2223 pub name: std::string::String,
2224
2225 /// Indicates that the request should be validated without actually
2226 /// deleting any resources.
2227 pub validate_only: bool,
2228
2229 /// A system-generated fingerprint for this version of the resource.
2230 /// This may be used to detect modification conflict during updates.
2231 pub etag: std::string::String,
2232
2233 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2234}
2235
2236impl DeleteExecutionRequest {
2237 /// Creates a new default instance.
2238 pub fn new() -> Self {
2239 std::default::Default::default()
2240 }
2241
2242 /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
2243 ///
2244 /// # Example
2245 /// ```ignore,no_run
2246 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2247 /// # let project_id = "project_id";
2248 /// # let location_id = "location_id";
2249 /// # let job_id = "job_id";
2250 /// # let execution_id = "execution_id";
2251 /// let x = DeleteExecutionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
2252 /// ```
2253 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2254 self.name = v.into();
2255 self
2256 }
2257
2258 /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
2259 ///
2260 /// # Example
2261 /// ```ignore,no_run
2262 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2263 /// let x = DeleteExecutionRequest::new().set_validate_only(true);
2264 /// ```
2265 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2266 self.validate_only = v.into();
2267 self
2268 }
2269
2270 /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
2271 ///
2272 /// # Example
2273 /// ```ignore,no_run
2274 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2275 /// let x = DeleteExecutionRequest::new().set_etag("example");
2276 /// ```
2277 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2278 self.etag = v.into();
2279 self
2280 }
2281}
2282
2283impl wkt::message::Message for DeleteExecutionRequest {
2284 fn typename() -> &'static str {
2285 "type.googleapis.com/google.cloud.run.v2.DeleteExecutionRequest"
2286 }
2287}
2288
2289/// Request message for deleting an Execution.
2290#[derive(Clone, Default, PartialEq)]
2291#[non_exhaustive]
2292pub struct CancelExecutionRequest {
2293 /// Required. The name of the Execution to cancel.
2294 /// Format:
2295 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2296 /// where `{project}` can be project id or number.
2297 pub name: std::string::String,
2298
2299 /// Indicates that the request should be validated without actually
2300 /// cancelling any resources.
2301 pub validate_only: bool,
2302
2303 /// A system-generated fingerprint for this version of the resource.
2304 /// This may be used to detect modification conflict during updates.
2305 pub etag: std::string::String,
2306
2307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2308}
2309
2310impl CancelExecutionRequest {
2311 /// Creates a new default instance.
2312 pub fn new() -> Self {
2313 std::default::Default::default()
2314 }
2315
2316 /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
2317 ///
2318 /// # Example
2319 /// ```ignore,no_run
2320 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2321 /// # let project_id = "project_id";
2322 /// # let location_id = "location_id";
2323 /// # let job_id = "job_id";
2324 /// # let execution_id = "execution_id";
2325 /// let x = CancelExecutionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
2326 /// ```
2327 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2328 self.name = v.into();
2329 self
2330 }
2331
2332 /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
2333 ///
2334 /// # Example
2335 /// ```ignore,no_run
2336 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2337 /// let x = CancelExecutionRequest::new().set_validate_only(true);
2338 /// ```
2339 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2340 self.validate_only = v.into();
2341 self
2342 }
2343
2344 /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
2345 ///
2346 /// # Example
2347 /// ```ignore,no_run
2348 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2349 /// let x = CancelExecutionRequest::new().set_etag("example");
2350 /// ```
2351 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2352 self.etag = v.into();
2353 self
2354 }
2355}
2356
2357impl wkt::message::Message for CancelExecutionRequest {
2358 fn typename() -> &'static str {
2359 "type.googleapis.com/google.cloud.run.v2.CancelExecutionRequest"
2360 }
2361}
2362
2363/// Execution represents the configuration of a single execution. A execution an
2364/// immutable resource that references a container image which is run to
2365/// completion.
2366#[derive(Clone, Default, PartialEq)]
2367#[non_exhaustive]
2368pub struct Execution {
2369 /// Output only. The unique name of this Execution.
2370 pub name: std::string::String,
2371
2372 /// Output only. Server assigned unique identifier for the Execution. The value
2373 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
2374 /// deleted.
2375 pub uid: std::string::String,
2376
2377 /// Output only. Email address of the authenticated creator.
2378 pub creator: std::string::String,
2379
2380 /// Output only. A number that monotonically increases every time the user
2381 /// modifies the desired state.
2382 pub generation: i64,
2383
2384 /// Output only. Unstructured key value map that can be used to organize and
2385 /// categorize objects. User-provided labels are shared with Google's billing
2386 /// system, so they can be used to filter, or break down billing charges by
2387 /// team, component, environment, state, etc. For more information, visit
2388 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
2389 /// <https://cloud.google.com/run/docs/configuring/labels>
2390 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2391
2392 /// Output only. Unstructured key value map that may
2393 /// be set by external tools to store and arbitrary metadata.
2394 /// They are not queryable and should be preserved
2395 /// when modifying objects.
2396 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2397
2398 /// Output only. Represents time when the execution was acknowledged by the
2399 /// execution controller. It is not guaranteed to be set in happens-before
2400 /// order across separate operations.
2401 pub create_time: std::option::Option<wkt::Timestamp>,
2402
2403 /// Output only. Represents time when the execution started to run.
2404 /// It is not guaranteed to be set in happens-before order across separate
2405 /// operations.
2406 pub start_time: std::option::Option<wkt::Timestamp>,
2407
2408 /// Output only. Represents time when the execution was completed. It is not
2409 /// guaranteed to be set in happens-before order across separate operations.
2410 pub completion_time: std::option::Option<wkt::Timestamp>,
2411
2412 /// Output only. The last-modified time.
2413 pub update_time: std::option::Option<wkt::Timestamp>,
2414
2415 /// Output only. For a deleted resource, the deletion time. It is only
2416 /// populated as a response to a Delete request.
2417 pub delete_time: std::option::Option<wkt::Timestamp>,
2418
2419 /// Output only. For a deleted resource, the time after which it will be
2420 /// permamently deleted. It is only populated as a response to a Delete
2421 /// request.
2422 pub expire_time: std::option::Option<wkt::Timestamp>,
2423
2424 /// The least stable launch stage needed to create this resource, as defined by
2425 /// [Google Cloud Platform Launch
2426 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
2427 /// `ALPHA`, `BETA`, and `GA`.
2428 ///
2429 /// Note that this value might not be what was used
2430 /// as input. For example, if ALPHA was provided as input in the parent
2431 /// resource, but only BETA and GA-level features are were, this field will be
2432 /// BETA.
2433 pub launch_stage: google_cloud_api::model::LaunchStage,
2434
2435 /// Output only. The name of the parent Job.
2436 pub job: std::string::String,
2437
2438 /// Output only. Specifies the maximum desired number of tasks the execution
2439 /// should run at any given time. Must be <= task_count. The actual number of
2440 /// tasks running in steady state will be less than this number when
2441 /// ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
2442 /// the work left to do is less than max parallelism.
2443 pub parallelism: i32,
2444
2445 /// Output only. Specifies the desired number of tasks the execution should
2446 /// run. Setting to 1 means that parallelism is limited to 1 and the success of
2447 /// that task signals the success of the execution.
2448 pub task_count: i32,
2449
2450 /// Output only. The template used to create tasks for this execution.
2451 pub template: std::option::Option<crate::model::TaskTemplate>,
2452
2453 /// Output only. Indicates whether the resource's reconciliation is still in
2454 /// progress. See comments in `Job.reconciling` for additional information on
2455 /// reconciliation process in Cloud Run.
2456 pub reconciling: bool,
2457
2458 /// Output only. The Condition of this Execution, containing its readiness
2459 /// status, and detailed error information in case it did not reach the desired
2460 /// state.
2461 pub conditions: std::vec::Vec<crate::model::Condition>,
2462
2463 /// Output only. The generation of this Execution. See comments in
2464 /// `reconciling` for additional information on reconciliation process in Cloud
2465 /// Run.
2466 pub observed_generation: i64,
2467
2468 /// Output only. The number of actively running tasks.
2469 pub running_count: i32,
2470
2471 /// Output only. The number of tasks which reached phase Succeeded.
2472 pub succeeded_count: i32,
2473
2474 /// Output only. The number of tasks which reached phase Failed.
2475 pub failed_count: i32,
2476
2477 /// Output only. The number of tasks which reached phase Cancelled.
2478 pub cancelled_count: i32,
2479
2480 /// Output only. The number of tasks which have retried at least once.
2481 pub retried_count: i32,
2482
2483 /// Output only. URI where logs for this execution can be found in Cloud
2484 /// Console.
2485 pub log_uri: std::string::String,
2486
2487 /// Output only. Reserved for future use.
2488 pub satisfies_pzs: bool,
2489
2490 /// Output only. A system-generated fingerprint for this version of the
2491 /// resource. May be used to detect modification conflict during updates.
2492 pub etag: std::string::String,
2493
2494 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2495}
2496
2497impl Execution {
2498 /// Creates a new default instance.
2499 pub fn new() -> Self {
2500 std::default::Default::default()
2501 }
2502
2503 /// Sets the value of [name][crate::model::Execution::name].
2504 ///
2505 /// # Example
2506 /// ```ignore,no_run
2507 /// # use google_cloud_run_v2::model::Execution;
2508 /// # let project_id = "project_id";
2509 /// # let location_id = "location_id";
2510 /// # let job_id = "job_id";
2511 /// # let execution_id = "execution_id";
2512 /// let x = Execution::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
2513 /// ```
2514 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2515 self.name = v.into();
2516 self
2517 }
2518
2519 /// Sets the value of [uid][crate::model::Execution::uid].
2520 ///
2521 /// # Example
2522 /// ```ignore,no_run
2523 /// # use google_cloud_run_v2::model::Execution;
2524 /// let x = Execution::new().set_uid("example");
2525 /// ```
2526 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2527 self.uid = v.into();
2528 self
2529 }
2530
2531 /// Sets the value of [creator][crate::model::Execution::creator].
2532 ///
2533 /// # Example
2534 /// ```ignore,no_run
2535 /// # use google_cloud_run_v2::model::Execution;
2536 /// let x = Execution::new().set_creator("example");
2537 /// ```
2538 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2539 self.creator = v.into();
2540 self
2541 }
2542
2543 /// Sets the value of [generation][crate::model::Execution::generation].
2544 ///
2545 /// # Example
2546 /// ```ignore,no_run
2547 /// # use google_cloud_run_v2::model::Execution;
2548 /// let x = Execution::new().set_generation(42);
2549 /// ```
2550 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2551 self.generation = v.into();
2552 self
2553 }
2554
2555 /// Sets the value of [labels][crate::model::Execution::labels].
2556 ///
2557 /// # Example
2558 /// ```ignore,no_run
2559 /// # use google_cloud_run_v2::model::Execution;
2560 /// let x = Execution::new().set_labels([
2561 /// ("key0", "abc"),
2562 /// ("key1", "xyz"),
2563 /// ]);
2564 /// ```
2565 pub fn set_labels<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.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2573 self
2574 }
2575
2576 /// Sets the value of [annotations][crate::model::Execution::annotations].
2577 ///
2578 /// # Example
2579 /// ```ignore,no_run
2580 /// # use google_cloud_run_v2::model::Execution;
2581 /// let x = Execution::new().set_annotations([
2582 /// ("key0", "abc"),
2583 /// ("key1", "xyz"),
2584 /// ]);
2585 /// ```
2586 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2587 where
2588 T: std::iter::IntoIterator<Item = (K, V)>,
2589 K: std::convert::Into<std::string::String>,
2590 V: std::convert::Into<std::string::String>,
2591 {
2592 use std::iter::Iterator;
2593 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2594 self
2595 }
2596
2597 /// Sets the value of [create_time][crate::model::Execution::create_time].
2598 ///
2599 /// # Example
2600 /// ```ignore,no_run
2601 /// # use google_cloud_run_v2::model::Execution;
2602 /// use wkt::Timestamp;
2603 /// let x = Execution::new().set_create_time(Timestamp::default()/* use setters */);
2604 /// ```
2605 pub fn set_create_time<T>(mut self, v: T) -> Self
2606 where
2607 T: std::convert::Into<wkt::Timestamp>,
2608 {
2609 self.create_time = std::option::Option::Some(v.into());
2610 self
2611 }
2612
2613 /// Sets or clears the value of [create_time][crate::model::Execution::create_time].
2614 ///
2615 /// # Example
2616 /// ```ignore,no_run
2617 /// # use google_cloud_run_v2::model::Execution;
2618 /// use wkt::Timestamp;
2619 /// let x = Execution::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2620 /// let x = Execution::new().set_or_clear_create_time(None::<Timestamp>);
2621 /// ```
2622 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2623 where
2624 T: std::convert::Into<wkt::Timestamp>,
2625 {
2626 self.create_time = v.map(|x| x.into());
2627 self
2628 }
2629
2630 /// Sets the value of [start_time][crate::model::Execution::start_time].
2631 ///
2632 /// # Example
2633 /// ```ignore,no_run
2634 /// # use google_cloud_run_v2::model::Execution;
2635 /// use wkt::Timestamp;
2636 /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
2637 /// ```
2638 pub fn set_start_time<T>(mut self, v: T) -> Self
2639 where
2640 T: std::convert::Into<wkt::Timestamp>,
2641 {
2642 self.start_time = std::option::Option::Some(v.into());
2643 self
2644 }
2645
2646 /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
2647 ///
2648 /// # Example
2649 /// ```ignore,no_run
2650 /// # use google_cloud_run_v2::model::Execution;
2651 /// use wkt::Timestamp;
2652 /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2653 /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
2654 /// ```
2655 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2656 where
2657 T: std::convert::Into<wkt::Timestamp>,
2658 {
2659 self.start_time = v.map(|x| x.into());
2660 self
2661 }
2662
2663 /// Sets the value of [completion_time][crate::model::Execution::completion_time].
2664 ///
2665 /// # Example
2666 /// ```ignore,no_run
2667 /// # use google_cloud_run_v2::model::Execution;
2668 /// use wkt::Timestamp;
2669 /// let x = Execution::new().set_completion_time(Timestamp::default()/* use setters */);
2670 /// ```
2671 pub fn set_completion_time<T>(mut self, v: T) -> Self
2672 where
2673 T: std::convert::Into<wkt::Timestamp>,
2674 {
2675 self.completion_time = std::option::Option::Some(v.into());
2676 self
2677 }
2678
2679 /// Sets or clears the value of [completion_time][crate::model::Execution::completion_time].
2680 ///
2681 /// # Example
2682 /// ```ignore,no_run
2683 /// # use google_cloud_run_v2::model::Execution;
2684 /// use wkt::Timestamp;
2685 /// let x = Execution::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
2686 /// let x = Execution::new().set_or_clear_completion_time(None::<Timestamp>);
2687 /// ```
2688 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
2689 where
2690 T: std::convert::Into<wkt::Timestamp>,
2691 {
2692 self.completion_time = v.map(|x| x.into());
2693 self
2694 }
2695
2696 /// Sets the value of [update_time][crate::model::Execution::update_time].
2697 ///
2698 /// # Example
2699 /// ```ignore,no_run
2700 /// # use google_cloud_run_v2::model::Execution;
2701 /// use wkt::Timestamp;
2702 /// let x = Execution::new().set_update_time(Timestamp::default()/* use setters */);
2703 /// ```
2704 pub fn set_update_time<T>(mut self, v: T) -> Self
2705 where
2706 T: std::convert::Into<wkt::Timestamp>,
2707 {
2708 self.update_time = std::option::Option::Some(v.into());
2709 self
2710 }
2711
2712 /// Sets or clears the value of [update_time][crate::model::Execution::update_time].
2713 ///
2714 /// # Example
2715 /// ```ignore,no_run
2716 /// # use google_cloud_run_v2::model::Execution;
2717 /// use wkt::Timestamp;
2718 /// let x = Execution::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2719 /// let x = Execution::new().set_or_clear_update_time(None::<Timestamp>);
2720 /// ```
2721 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2722 where
2723 T: std::convert::Into<wkt::Timestamp>,
2724 {
2725 self.update_time = v.map(|x| x.into());
2726 self
2727 }
2728
2729 /// Sets the value of [delete_time][crate::model::Execution::delete_time].
2730 ///
2731 /// # Example
2732 /// ```ignore,no_run
2733 /// # use google_cloud_run_v2::model::Execution;
2734 /// use wkt::Timestamp;
2735 /// let x = Execution::new().set_delete_time(Timestamp::default()/* use setters */);
2736 /// ```
2737 pub fn set_delete_time<T>(mut self, v: T) -> Self
2738 where
2739 T: std::convert::Into<wkt::Timestamp>,
2740 {
2741 self.delete_time = std::option::Option::Some(v.into());
2742 self
2743 }
2744
2745 /// Sets or clears the value of [delete_time][crate::model::Execution::delete_time].
2746 ///
2747 /// # Example
2748 /// ```ignore,no_run
2749 /// # use google_cloud_run_v2::model::Execution;
2750 /// use wkt::Timestamp;
2751 /// let x = Execution::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2752 /// let x = Execution::new().set_or_clear_delete_time(None::<Timestamp>);
2753 /// ```
2754 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2755 where
2756 T: std::convert::Into<wkt::Timestamp>,
2757 {
2758 self.delete_time = v.map(|x| x.into());
2759 self
2760 }
2761
2762 /// Sets the value of [expire_time][crate::model::Execution::expire_time].
2763 ///
2764 /// # Example
2765 /// ```ignore,no_run
2766 /// # use google_cloud_run_v2::model::Execution;
2767 /// use wkt::Timestamp;
2768 /// let x = Execution::new().set_expire_time(Timestamp::default()/* use setters */);
2769 /// ```
2770 pub fn set_expire_time<T>(mut self, v: T) -> Self
2771 where
2772 T: std::convert::Into<wkt::Timestamp>,
2773 {
2774 self.expire_time = std::option::Option::Some(v.into());
2775 self
2776 }
2777
2778 /// Sets or clears the value of [expire_time][crate::model::Execution::expire_time].
2779 ///
2780 /// # Example
2781 /// ```ignore,no_run
2782 /// # use google_cloud_run_v2::model::Execution;
2783 /// use wkt::Timestamp;
2784 /// let x = Execution::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2785 /// let x = Execution::new().set_or_clear_expire_time(None::<Timestamp>);
2786 /// ```
2787 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2788 where
2789 T: std::convert::Into<wkt::Timestamp>,
2790 {
2791 self.expire_time = v.map(|x| x.into());
2792 self
2793 }
2794
2795 /// Sets the value of [launch_stage][crate::model::Execution::launch_stage].
2796 ///
2797 /// # Example
2798 /// ```ignore,no_run
2799 /// # use google_cloud_run_v2::model::Execution;
2800 /// use google_cloud_api::model::LaunchStage;
2801 /// let x0 = Execution::new().set_launch_stage(LaunchStage::Unimplemented);
2802 /// let x1 = Execution::new().set_launch_stage(LaunchStage::Prelaunch);
2803 /// let x2 = Execution::new().set_launch_stage(LaunchStage::EarlyAccess);
2804 /// ```
2805 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
2806 mut self,
2807 v: T,
2808 ) -> Self {
2809 self.launch_stage = v.into();
2810 self
2811 }
2812
2813 /// Sets the value of [job][crate::model::Execution::job].
2814 ///
2815 /// # Example
2816 /// ```ignore,no_run
2817 /// # use google_cloud_run_v2::model::Execution;
2818 /// # let project_id = "project_id";
2819 /// # let location_id = "location_id";
2820 /// # let job_id = "job_id";
2821 /// let x = Execution::new().set_job(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
2822 /// ```
2823 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2824 self.job = v.into();
2825 self
2826 }
2827
2828 /// Sets the value of [parallelism][crate::model::Execution::parallelism].
2829 ///
2830 /// # Example
2831 /// ```ignore,no_run
2832 /// # use google_cloud_run_v2::model::Execution;
2833 /// let x = Execution::new().set_parallelism(42);
2834 /// ```
2835 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2836 self.parallelism = v.into();
2837 self
2838 }
2839
2840 /// Sets the value of [task_count][crate::model::Execution::task_count].
2841 ///
2842 /// # Example
2843 /// ```ignore,no_run
2844 /// # use google_cloud_run_v2::model::Execution;
2845 /// let x = Execution::new().set_task_count(42);
2846 /// ```
2847 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2848 self.task_count = v.into();
2849 self
2850 }
2851
2852 /// Sets the value of [template][crate::model::Execution::template].
2853 ///
2854 /// # Example
2855 /// ```ignore,no_run
2856 /// # use google_cloud_run_v2::model::Execution;
2857 /// use google_cloud_run_v2::model::TaskTemplate;
2858 /// let x = Execution::new().set_template(TaskTemplate::default()/* use setters */);
2859 /// ```
2860 pub fn set_template<T>(mut self, v: T) -> Self
2861 where
2862 T: std::convert::Into<crate::model::TaskTemplate>,
2863 {
2864 self.template = std::option::Option::Some(v.into());
2865 self
2866 }
2867
2868 /// Sets or clears the value of [template][crate::model::Execution::template].
2869 ///
2870 /// # Example
2871 /// ```ignore,no_run
2872 /// # use google_cloud_run_v2::model::Execution;
2873 /// use google_cloud_run_v2::model::TaskTemplate;
2874 /// let x = Execution::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
2875 /// let x = Execution::new().set_or_clear_template(None::<TaskTemplate>);
2876 /// ```
2877 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
2878 where
2879 T: std::convert::Into<crate::model::TaskTemplate>,
2880 {
2881 self.template = v.map(|x| x.into());
2882 self
2883 }
2884
2885 /// Sets the value of [reconciling][crate::model::Execution::reconciling].
2886 ///
2887 /// # Example
2888 /// ```ignore,no_run
2889 /// # use google_cloud_run_v2::model::Execution;
2890 /// let x = Execution::new().set_reconciling(true);
2891 /// ```
2892 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2893 self.reconciling = v.into();
2894 self
2895 }
2896
2897 /// Sets the value of [conditions][crate::model::Execution::conditions].
2898 ///
2899 /// # Example
2900 /// ```ignore,no_run
2901 /// # use google_cloud_run_v2::model::Execution;
2902 /// use google_cloud_run_v2::model::Condition;
2903 /// let x = Execution::new()
2904 /// .set_conditions([
2905 /// Condition::default()/* use setters */,
2906 /// Condition::default()/* use (different) setters */,
2907 /// ]);
2908 /// ```
2909 pub fn set_conditions<T, V>(mut self, v: T) -> Self
2910 where
2911 T: std::iter::IntoIterator<Item = V>,
2912 V: std::convert::Into<crate::model::Condition>,
2913 {
2914 use std::iter::Iterator;
2915 self.conditions = v.into_iter().map(|i| i.into()).collect();
2916 self
2917 }
2918
2919 /// Sets the value of [observed_generation][crate::model::Execution::observed_generation].
2920 ///
2921 /// # Example
2922 /// ```ignore,no_run
2923 /// # use google_cloud_run_v2::model::Execution;
2924 /// let x = Execution::new().set_observed_generation(42);
2925 /// ```
2926 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2927 self.observed_generation = v.into();
2928 self
2929 }
2930
2931 /// Sets the value of [running_count][crate::model::Execution::running_count].
2932 ///
2933 /// # Example
2934 /// ```ignore,no_run
2935 /// # use google_cloud_run_v2::model::Execution;
2936 /// let x = Execution::new().set_running_count(42);
2937 /// ```
2938 pub fn set_running_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2939 self.running_count = v.into();
2940 self
2941 }
2942
2943 /// Sets the value of [succeeded_count][crate::model::Execution::succeeded_count].
2944 ///
2945 /// # Example
2946 /// ```ignore,no_run
2947 /// # use google_cloud_run_v2::model::Execution;
2948 /// let x = Execution::new().set_succeeded_count(42);
2949 /// ```
2950 pub fn set_succeeded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2951 self.succeeded_count = v.into();
2952 self
2953 }
2954
2955 /// Sets the value of [failed_count][crate::model::Execution::failed_count].
2956 ///
2957 /// # Example
2958 /// ```ignore,no_run
2959 /// # use google_cloud_run_v2::model::Execution;
2960 /// let x = Execution::new().set_failed_count(42);
2961 /// ```
2962 pub fn set_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2963 self.failed_count = v.into();
2964 self
2965 }
2966
2967 /// Sets the value of [cancelled_count][crate::model::Execution::cancelled_count].
2968 ///
2969 /// # Example
2970 /// ```ignore,no_run
2971 /// # use google_cloud_run_v2::model::Execution;
2972 /// let x = Execution::new().set_cancelled_count(42);
2973 /// ```
2974 pub fn set_cancelled_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2975 self.cancelled_count = v.into();
2976 self
2977 }
2978
2979 /// Sets the value of [retried_count][crate::model::Execution::retried_count].
2980 ///
2981 /// # Example
2982 /// ```ignore,no_run
2983 /// # use google_cloud_run_v2::model::Execution;
2984 /// let x = Execution::new().set_retried_count(42);
2985 /// ```
2986 pub fn set_retried_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2987 self.retried_count = v.into();
2988 self
2989 }
2990
2991 /// Sets the value of [log_uri][crate::model::Execution::log_uri].
2992 ///
2993 /// # Example
2994 /// ```ignore,no_run
2995 /// # use google_cloud_run_v2::model::Execution;
2996 /// let x = Execution::new().set_log_uri("example");
2997 /// ```
2998 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2999 self.log_uri = v.into();
3000 self
3001 }
3002
3003 /// Sets the value of [satisfies_pzs][crate::model::Execution::satisfies_pzs].
3004 ///
3005 /// # Example
3006 /// ```ignore,no_run
3007 /// # use google_cloud_run_v2::model::Execution;
3008 /// let x = Execution::new().set_satisfies_pzs(true);
3009 /// ```
3010 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3011 self.satisfies_pzs = v.into();
3012 self
3013 }
3014
3015 /// Sets the value of [etag][crate::model::Execution::etag].
3016 ///
3017 /// # Example
3018 /// ```ignore,no_run
3019 /// # use google_cloud_run_v2::model::Execution;
3020 /// let x = Execution::new().set_etag("example");
3021 /// ```
3022 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3023 self.etag = v.into();
3024 self
3025 }
3026}
3027
3028impl wkt::message::Message for Execution {
3029 fn typename() -> &'static str {
3030 "type.googleapis.com/google.cloud.run.v2.Execution"
3031 }
3032}
3033
3034/// ExecutionTemplate describes the data an execution should have when created
3035/// from a template.
3036#[derive(Clone, Default, PartialEq)]
3037#[non_exhaustive]
3038pub struct ExecutionTemplate {
3039 /// Unstructured key value map that can be used to organize and categorize
3040 /// objects.
3041 /// User-provided labels are shared with Google's billing system, so they can
3042 /// be used to filter, or break down billing charges by team, component,
3043 /// environment, state, etc. For more information, visit
3044 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
3045 /// <https://cloud.google.com/run/docs/configuring/labels>.
3046 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3047
3048 /// Unstructured key value map that may be set by external tools to store and
3049 /// arbitrary metadata. They are not queryable and should be preserved
3050 /// when modifying objects.
3051 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3052
3053 /// Optional. Specifies the maximum desired number of tasks the execution
3054 /// should run at given time. When the job is run, if this field is 0 or unset,
3055 /// the maximum possible value will be used for that execution. The actual
3056 /// number of tasks running in steady state will be less than this number when
3057 /// there are fewer tasks waiting to be completed remaining, i.e. when the work
3058 /// left to do is less than max parallelism.
3059 pub parallelism: i32,
3060
3061 /// Specifies the desired number of tasks the execution should run.
3062 /// Setting to 1 means that parallelism is limited to 1 and the success of
3063 /// that task signals the success of the execution. Defaults to 1.
3064 pub task_count: i32,
3065
3066 /// Required. Describes the task(s) that will be created when executing an
3067 /// execution.
3068 pub template: std::option::Option<crate::model::TaskTemplate>,
3069
3070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3071}
3072
3073impl ExecutionTemplate {
3074 /// Creates a new default instance.
3075 pub fn new() -> Self {
3076 std::default::Default::default()
3077 }
3078
3079 /// Sets the value of [labels][crate::model::ExecutionTemplate::labels].
3080 ///
3081 /// # Example
3082 /// ```ignore,no_run
3083 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3084 /// let x = ExecutionTemplate::new().set_labels([
3085 /// ("key0", "abc"),
3086 /// ("key1", "xyz"),
3087 /// ]);
3088 /// ```
3089 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3090 where
3091 T: std::iter::IntoIterator<Item = (K, V)>,
3092 K: std::convert::Into<std::string::String>,
3093 V: std::convert::Into<std::string::String>,
3094 {
3095 use std::iter::Iterator;
3096 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3097 self
3098 }
3099
3100 /// Sets the value of [annotations][crate::model::ExecutionTemplate::annotations].
3101 ///
3102 /// # Example
3103 /// ```ignore,no_run
3104 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3105 /// let x = ExecutionTemplate::new().set_annotations([
3106 /// ("key0", "abc"),
3107 /// ("key1", "xyz"),
3108 /// ]);
3109 /// ```
3110 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3111 where
3112 T: std::iter::IntoIterator<Item = (K, V)>,
3113 K: std::convert::Into<std::string::String>,
3114 V: std::convert::Into<std::string::String>,
3115 {
3116 use std::iter::Iterator;
3117 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3118 self
3119 }
3120
3121 /// Sets the value of [parallelism][crate::model::ExecutionTemplate::parallelism].
3122 ///
3123 /// # Example
3124 /// ```ignore,no_run
3125 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3126 /// let x = ExecutionTemplate::new().set_parallelism(42);
3127 /// ```
3128 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3129 self.parallelism = v.into();
3130 self
3131 }
3132
3133 /// Sets the value of [task_count][crate::model::ExecutionTemplate::task_count].
3134 ///
3135 /// # Example
3136 /// ```ignore,no_run
3137 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3138 /// let x = ExecutionTemplate::new().set_task_count(42);
3139 /// ```
3140 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3141 self.task_count = v.into();
3142 self
3143 }
3144
3145 /// Sets the value of [template][crate::model::ExecutionTemplate::template].
3146 ///
3147 /// # Example
3148 /// ```ignore,no_run
3149 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3150 /// use google_cloud_run_v2::model::TaskTemplate;
3151 /// let x = ExecutionTemplate::new().set_template(TaskTemplate::default()/* use setters */);
3152 /// ```
3153 pub fn set_template<T>(mut self, v: T) -> Self
3154 where
3155 T: std::convert::Into<crate::model::TaskTemplate>,
3156 {
3157 self.template = std::option::Option::Some(v.into());
3158 self
3159 }
3160
3161 /// Sets or clears the value of [template][crate::model::ExecutionTemplate::template].
3162 ///
3163 /// # Example
3164 /// ```ignore,no_run
3165 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3166 /// use google_cloud_run_v2::model::TaskTemplate;
3167 /// let x = ExecutionTemplate::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
3168 /// let x = ExecutionTemplate::new().set_or_clear_template(None::<TaskTemplate>);
3169 /// ```
3170 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
3171 where
3172 T: std::convert::Into<crate::model::TaskTemplate>,
3173 {
3174 self.template = v.map(|x| x.into());
3175 self
3176 }
3177}
3178
3179impl wkt::message::Message for ExecutionTemplate {
3180 fn typename() -> &'static str {
3181 "type.googleapis.com/google.cloud.run.v2.ExecutionTemplate"
3182 }
3183}
3184
3185#[allow(missing_docs)]
3186#[derive(Clone, Default, PartialEq)]
3187#[non_exhaustive]
3188pub struct CreateInstanceRequest {
3189 #[allow(missing_docs)]
3190 pub parent: std::string::String,
3191
3192 #[allow(missing_docs)]
3193 pub instance: std::option::Option<crate::model::Instance>,
3194
3195 /// Required. The unique identifier for the Instance. It must begin with
3196 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
3197 /// The name of the instance becomes {parent}/instances/{instance_id}.
3198 pub instance_id: std::string::String,
3199
3200 /// Optional. Indicates that the request should be validated and default values
3201 /// populated, without persisting the request or creating any resources.
3202 pub validate_only: bool,
3203
3204 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3205}
3206
3207impl CreateInstanceRequest {
3208 /// Creates a new default instance.
3209 pub fn new() -> Self {
3210 std::default::Default::default()
3211 }
3212
3213 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3214 ///
3215 /// # Example
3216 /// ```ignore,no_run
3217 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3218 /// # let project_id = "project_id";
3219 /// # let location_id = "location_id";
3220 /// let x = CreateInstanceRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
3221 /// ```
3222 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3223 self.parent = v.into();
3224 self
3225 }
3226
3227 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3228 ///
3229 /// # Example
3230 /// ```ignore,no_run
3231 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3232 /// use google_cloud_run_v2::model::Instance;
3233 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
3234 /// ```
3235 pub fn set_instance<T>(mut self, v: T) -> Self
3236 where
3237 T: std::convert::Into<crate::model::Instance>,
3238 {
3239 self.instance = std::option::Option::Some(v.into());
3240 self
3241 }
3242
3243 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3244 ///
3245 /// # Example
3246 /// ```ignore,no_run
3247 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3248 /// use google_cloud_run_v2::model::Instance;
3249 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
3250 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
3251 /// ```
3252 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3253 where
3254 T: std::convert::Into<crate::model::Instance>,
3255 {
3256 self.instance = v.map(|x| x.into());
3257 self
3258 }
3259
3260 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3261 ///
3262 /// # Example
3263 /// ```ignore,no_run
3264 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3265 /// let x = CreateInstanceRequest::new().set_instance_id("example");
3266 /// ```
3267 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3268 self.instance_id = v.into();
3269 self
3270 }
3271
3272 /// Sets the value of [validate_only][crate::model::CreateInstanceRequest::validate_only].
3273 ///
3274 /// # Example
3275 /// ```ignore,no_run
3276 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3277 /// let x = CreateInstanceRequest::new().set_validate_only(true);
3278 /// ```
3279 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3280 self.validate_only = v.into();
3281 self
3282 }
3283}
3284
3285impl wkt::message::Message for CreateInstanceRequest {
3286 fn typename() -> &'static str {
3287 "type.googleapis.com/google.cloud.run.v2.CreateInstanceRequest"
3288 }
3289}
3290
3291#[allow(missing_docs)]
3292#[derive(Clone, Default, PartialEq)]
3293#[non_exhaustive]
3294pub struct GetInstanceRequest {
3295 #[allow(missing_docs)]
3296 pub name: std::string::String,
3297
3298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3299}
3300
3301impl GetInstanceRequest {
3302 /// Creates a new default instance.
3303 pub fn new() -> Self {
3304 std::default::Default::default()
3305 }
3306
3307 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3308 ///
3309 /// # Example
3310 /// ```ignore,no_run
3311 /// # use google_cloud_run_v2::model::GetInstanceRequest;
3312 /// # let project_id = "project_id";
3313 /// # let location_id = "location_id";
3314 /// # let instance_id = "instance_id";
3315 /// let x = GetInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3316 /// ```
3317 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3318 self.name = v.into();
3319 self
3320 }
3321}
3322
3323impl wkt::message::Message for GetInstanceRequest {
3324 fn typename() -> &'static str {
3325 "type.googleapis.com/google.cloud.run.v2.GetInstanceRequest"
3326 }
3327}
3328
3329#[allow(missing_docs)]
3330#[derive(Clone, Default, PartialEq)]
3331#[non_exhaustive]
3332pub struct DeleteInstanceRequest {
3333 #[allow(missing_docs)]
3334 pub name: std::string::String,
3335
3336 /// Optional. Indicates that the request should be validated without actually
3337 /// deleting any resources.
3338 pub validate_only: bool,
3339
3340 /// Optional. A system-generated fingerprint for this version of the
3341 /// resource. May be used to detect modification conflict during updates.
3342 pub etag: std::string::String,
3343
3344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3345}
3346
3347impl DeleteInstanceRequest {
3348 /// Creates a new default instance.
3349 pub fn new() -> Self {
3350 std::default::Default::default()
3351 }
3352
3353 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3354 ///
3355 /// # Example
3356 /// ```ignore,no_run
3357 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3358 /// # let project_id = "project_id";
3359 /// # let location_id = "location_id";
3360 /// # let instance_id = "instance_id";
3361 /// let x = DeleteInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3362 /// ```
3363 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3364 self.name = v.into();
3365 self
3366 }
3367
3368 /// Sets the value of [validate_only][crate::model::DeleteInstanceRequest::validate_only].
3369 ///
3370 /// # Example
3371 /// ```ignore,no_run
3372 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3373 /// let x = DeleteInstanceRequest::new().set_validate_only(true);
3374 /// ```
3375 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3376 self.validate_only = v.into();
3377 self
3378 }
3379
3380 /// Sets the value of [etag][crate::model::DeleteInstanceRequest::etag].
3381 ///
3382 /// # Example
3383 /// ```ignore,no_run
3384 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3385 /// let x = DeleteInstanceRequest::new().set_etag("example");
3386 /// ```
3387 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3388 self.etag = v.into();
3389 self
3390 }
3391}
3392
3393impl wkt::message::Message for DeleteInstanceRequest {
3394 fn typename() -> &'static str {
3395 "type.googleapis.com/google.cloud.run.v2.DeleteInstanceRequest"
3396 }
3397}
3398
3399/// Request message for retrieving a list of Instances.
3400#[derive(Clone, Default, PartialEq)]
3401#[non_exhaustive]
3402pub struct ListInstancesRequest {
3403 /// Required. The location and project to list resources on.
3404 /// Format: projects/{project}/locations/{location}, where {project} can be
3405 /// project id or number.
3406 pub parent: std::string::String,
3407
3408 /// Optional. Maximum number of Instances to return in this call.
3409 pub page_size: i32,
3410
3411 /// Optional. A page token received from a previous call to ListInstances.
3412 /// All other parameters must match.
3413 pub page_token: std::string::String,
3414
3415 /// Optional. If true, returns deleted (but unexpired) resources along with
3416 /// active ones.
3417 pub show_deleted: bool,
3418
3419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3420}
3421
3422impl ListInstancesRequest {
3423 /// Creates a new default instance.
3424 pub fn new() -> Self {
3425 std::default::Default::default()
3426 }
3427
3428 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
3429 ///
3430 /// # Example
3431 /// ```ignore,no_run
3432 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3433 /// # let project_id = "project_id";
3434 /// # let location_id = "location_id";
3435 /// let x = ListInstancesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
3436 /// ```
3437 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3438 self.parent = v.into();
3439 self
3440 }
3441
3442 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
3443 ///
3444 /// # Example
3445 /// ```ignore,no_run
3446 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3447 /// let x = ListInstancesRequest::new().set_page_size(42);
3448 /// ```
3449 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3450 self.page_size = v.into();
3451 self
3452 }
3453
3454 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
3455 ///
3456 /// # Example
3457 /// ```ignore,no_run
3458 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3459 /// let x = ListInstancesRequest::new().set_page_token("example");
3460 /// ```
3461 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3462 self.page_token = v.into();
3463 self
3464 }
3465
3466 /// Sets the value of [show_deleted][crate::model::ListInstancesRequest::show_deleted].
3467 ///
3468 /// # Example
3469 /// ```ignore,no_run
3470 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3471 /// let x = ListInstancesRequest::new().set_show_deleted(true);
3472 /// ```
3473 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3474 self.show_deleted = v.into();
3475 self
3476 }
3477}
3478
3479impl wkt::message::Message for ListInstancesRequest {
3480 fn typename() -> &'static str {
3481 "type.googleapis.com/google.cloud.run.v2.ListInstancesRequest"
3482 }
3483}
3484
3485/// Response message containing a list of Instances.
3486#[derive(Clone, Default, PartialEq)]
3487#[non_exhaustive]
3488pub struct ListInstancesResponse {
3489 /// The resulting list of Instances.
3490 pub instances: std::vec::Vec<crate::model::Instance>,
3491
3492 /// A token indicating there are more items than page_size. Use it in the next
3493 /// ListInstances request to continue.
3494 pub next_page_token: std::string::String,
3495
3496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3497}
3498
3499impl ListInstancesResponse {
3500 /// Creates a new default instance.
3501 pub fn new() -> Self {
3502 std::default::Default::default()
3503 }
3504
3505 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
3506 ///
3507 /// # Example
3508 /// ```ignore,no_run
3509 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3510 /// use google_cloud_run_v2::model::Instance;
3511 /// let x = ListInstancesResponse::new()
3512 /// .set_instances([
3513 /// Instance::default()/* use setters */,
3514 /// Instance::default()/* use (different) setters */,
3515 /// ]);
3516 /// ```
3517 pub fn set_instances<T, V>(mut self, v: T) -> Self
3518 where
3519 T: std::iter::IntoIterator<Item = V>,
3520 V: std::convert::Into<crate::model::Instance>,
3521 {
3522 use std::iter::Iterator;
3523 self.instances = v.into_iter().map(|i| i.into()).collect();
3524 self
3525 }
3526
3527 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
3528 ///
3529 /// # Example
3530 /// ```ignore,no_run
3531 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3532 /// let x = ListInstancesResponse::new().set_next_page_token("example");
3533 /// ```
3534 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3535 self.next_page_token = v.into();
3536 self
3537 }
3538}
3539
3540impl wkt::message::Message for ListInstancesResponse {
3541 fn typename() -> &'static str {
3542 "type.googleapis.com/google.cloud.run.v2.ListInstancesResponse"
3543 }
3544}
3545
3546#[doc(hidden)]
3547impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
3548 type PageItem = crate::model::Instance;
3549
3550 fn items(self) -> std::vec::Vec<Self::PageItem> {
3551 self.instances
3552 }
3553
3554 fn next_page_token(&self) -> std::string::String {
3555 use std::clone::Clone;
3556 self.next_page_token.clone()
3557 }
3558}
3559
3560/// Request message for deleting an Instance.
3561#[derive(Clone, Default, PartialEq)]
3562#[non_exhaustive]
3563pub struct StopInstanceRequest {
3564 /// Required. The name of the Instance to stop.
3565 /// Format:
3566 /// `projects/{project}/locations/{location}/instances/{instance}`,
3567 /// where `{project}` can be project id or number.
3568 pub name: std::string::String,
3569
3570 /// Optional. Indicates that the request should be validated without actually
3571 /// stopping any resources.
3572 pub validate_only: bool,
3573
3574 /// Optional. A system-generated fingerprint for this version of the resource.
3575 /// This may be used to detect modification conflict during updates.
3576 pub etag: std::string::String,
3577
3578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3579}
3580
3581impl StopInstanceRequest {
3582 /// Creates a new default instance.
3583 pub fn new() -> Self {
3584 std::default::Default::default()
3585 }
3586
3587 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
3588 ///
3589 /// # Example
3590 /// ```ignore,no_run
3591 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3592 /// # let project_id = "project_id";
3593 /// # let location_id = "location_id";
3594 /// # let instance_id = "instance_id";
3595 /// let x = StopInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3596 /// ```
3597 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3598 self.name = v.into();
3599 self
3600 }
3601
3602 /// Sets the value of [validate_only][crate::model::StopInstanceRequest::validate_only].
3603 ///
3604 /// # Example
3605 /// ```ignore,no_run
3606 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3607 /// let x = StopInstanceRequest::new().set_validate_only(true);
3608 /// ```
3609 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3610 self.validate_only = v.into();
3611 self
3612 }
3613
3614 /// Sets the value of [etag][crate::model::StopInstanceRequest::etag].
3615 ///
3616 /// # Example
3617 /// ```ignore,no_run
3618 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3619 /// let x = StopInstanceRequest::new().set_etag("example");
3620 /// ```
3621 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3622 self.etag = v.into();
3623 self
3624 }
3625}
3626
3627impl wkt::message::Message for StopInstanceRequest {
3628 fn typename() -> &'static str {
3629 "type.googleapis.com/google.cloud.run.v2.StopInstanceRequest"
3630 }
3631}
3632
3633/// Request message for starting an Instance.
3634#[derive(Clone, Default, PartialEq)]
3635#[non_exhaustive]
3636pub struct StartInstanceRequest {
3637 /// Required. The name of the Instance to stop.
3638 /// Format:
3639 /// `projects/{project}/locations/{location}/instances/{instance}`,
3640 /// where `{project}` can be project id or number.
3641 pub name: std::string::String,
3642
3643 /// Optional. Indicates that the request should be validated without actually
3644 /// stopping any resources.
3645 pub validate_only: bool,
3646
3647 /// Optional. A system-generated fingerprint for this version of the resource.
3648 /// This may be used to detect modification conflict during updates.
3649 pub etag: std::string::String,
3650
3651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3652}
3653
3654impl StartInstanceRequest {
3655 /// Creates a new default instance.
3656 pub fn new() -> Self {
3657 std::default::Default::default()
3658 }
3659
3660 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
3661 ///
3662 /// # Example
3663 /// ```ignore,no_run
3664 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3665 /// # let project_id = "project_id";
3666 /// # let location_id = "location_id";
3667 /// # let instance_id = "instance_id";
3668 /// let x = StartInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3669 /// ```
3670 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3671 self.name = v.into();
3672 self
3673 }
3674
3675 /// Sets the value of [validate_only][crate::model::StartInstanceRequest::validate_only].
3676 ///
3677 /// # Example
3678 /// ```ignore,no_run
3679 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3680 /// let x = StartInstanceRequest::new().set_validate_only(true);
3681 /// ```
3682 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3683 self.validate_only = v.into();
3684 self
3685 }
3686
3687 /// Sets the value of [etag][crate::model::StartInstanceRequest::etag].
3688 ///
3689 /// # Example
3690 /// ```ignore,no_run
3691 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3692 /// let x = StartInstanceRequest::new().set_etag("example");
3693 /// ```
3694 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3695 self.etag = v.into();
3696 self
3697 }
3698}
3699
3700impl wkt::message::Message for StartInstanceRequest {
3701 fn typename() -> &'static str {
3702 "type.googleapis.com/google.cloud.run.v2.StartInstanceRequest"
3703 }
3704}
3705
3706/// A Cloud Run Instance represents a single group of containers running in a
3707/// region.
3708#[derive(Clone, Default, PartialEq)]
3709#[non_exhaustive]
3710pub struct Instance {
3711 /// The fully qualified name of this Instance. In CreateInstanceRequest, this
3712 /// field is ignored, and instead composed from CreateInstanceRequest.parent
3713 /// and CreateInstanceRequest.instance_id.
3714 ///
3715 /// Format:
3716 /// projects/{project}/locations/{location}/instances/{instance_id}
3717 pub name: std::string::String,
3718
3719 /// User-provided description of the Instance. This field currently has a
3720 /// 512-character limit.
3721 pub description: std::string::String,
3722
3723 /// Output only. Server assigned unique identifier for the trigger. The value
3724 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
3725 /// deleted.
3726 pub uid: std::string::String,
3727
3728 /// Output only. A number that monotonically increases every time the user
3729 /// modifies the desired state.
3730 /// Please note that unlike v1, this is an int64 value. As with most Google
3731 /// APIs, its JSON representation will be a `string` instead of an `integer`.
3732 pub generation: i64,
3733
3734 #[allow(missing_docs)]
3735 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3736
3737 #[allow(missing_docs)]
3738 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3739
3740 /// Output only. The creation time.
3741 pub create_time: std::option::Option<wkt::Timestamp>,
3742
3743 /// Output only. The last-modified time.
3744 pub update_time: std::option::Option<wkt::Timestamp>,
3745
3746 /// Output only. The deletion time.
3747 pub delete_time: std::option::Option<wkt::Timestamp>,
3748
3749 /// Output only. For a deleted resource, the time after which it will be
3750 /// permamently deleted.
3751 pub expire_time: std::option::Option<wkt::Timestamp>,
3752
3753 /// Output only. Email address of the authenticated creator.
3754 pub creator: std::string::String,
3755
3756 /// Output only. Email address of the last authenticated modifier.
3757 pub last_modifier: std::string::String,
3758
3759 /// Arbitrary identifier for the API client.
3760 pub client: std::string::String,
3761
3762 /// Arbitrary version identifier for the API client.
3763 pub client_version: std::string::String,
3764
3765 /// The launch stage as defined by [Google Cloud Platform
3766 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
3767 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
3768 /// is assumed.
3769 /// Set the launch stage to a preview stage on input to allow use of preview
3770 /// features in that stage. On read (or output), describes whether the
3771 /// resource uses preview features.
3772 pub launch_stage: google_cloud_api::model::LaunchStage,
3773
3774 /// Settings for the Binary Authorization feature.
3775 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
3776
3777 /// Optional. VPC Access configuration to use for this Revision. For more
3778 /// information, visit
3779 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
3780 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
3781
3782 #[allow(missing_docs)]
3783 pub service_account: std::string::String,
3784
3785 /// Required. Holds the single container that defines the unit of execution for
3786 /// this Instance.
3787 pub containers: std::vec::Vec<crate::model::Container>,
3788
3789 /// A list of Volumes to make available to containers.
3790 pub volumes: std::vec::Vec<crate::model::Volume>,
3791
3792 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
3793 /// this container image. For more information, go to
3794 /// <https://cloud.google.com/run/docs/securing/using-cmek>
3795 pub encryption_key: std::string::String,
3796
3797 /// The action to take if the encryption key is revoked.
3798 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
3799
3800 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
3801 /// shutting down all instances. The minimum increment is 1 hour.
3802 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
3803
3804 /// Optional. The node selector for the instance.
3805 pub node_selector: std::option::Option<crate::model::NodeSelector>,
3806
3807 /// Optional. True if GPU zonal redundancy is disabled on this instance.
3808 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
3809
3810 /// Optional. Provides the ingress settings for this Instance. On output,
3811 /// returns the currently observed ingress settings, or
3812 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
3813 pub ingress: crate::model::IngressTraffic,
3814
3815 /// Optional. Disables IAM permission check for run.routes.invoke for callers
3816 /// of this Instance. For more information, visit
3817 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
3818 pub invoker_iam_disabled: bool,
3819
3820 /// Optional. IAP settings on the Instance.
3821 pub iap_enabled: bool,
3822
3823 /// Output only. The generation of this Instance currently serving traffic. See
3824 /// comments in `reconciling` for additional information on reconciliation
3825 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
3826 /// As with most Google APIs, its JSON representation will be a `string`
3827 /// instead of an `integer`.
3828 pub observed_generation: i64,
3829
3830 /// Output only. The Google Console URI to obtain logs for the Instance.
3831 pub log_uri: std::string::String,
3832
3833 /// Output only. The Condition of this Instance, containing its readiness
3834 /// status, and detailed error information in case it did not reach a serving
3835 /// state. See comments in `reconciling` for additional information on
3836 /// reconciliation process in Cloud Run.
3837 pub terminal_condition: std::option::Option<crate::model::Condition>,
3838
3839 /// Output only. The Conditions of all other associated sub-resources. They
3840 /// contain additional diagnostics information in case the Instance does not
3841 /// reach its Serving state. See comments in `reconciling` for additional
3842 /// information on reconciliation process in Cloud Run.
3843 pub conditions: std::vec::Vec<crate::model::Condition>,
3844
3845 /// Output only. Status information for each of the specified containers. The
3846 /// status includes the resolved digest for specified images.
3847 pub container_statuses: std::vec::Vec<crate::model::ContainerStatus>,
3848
3849 /// Output only. Reserved for future use.
3850 pub satisfies_pzs: bool,
3851
3852 /// Output only. All URLs serving traffic for this Instance.
3853 pub urls: std::vec::Vec<std::string::String>,
3854
3855 /// Output only. Returns true if the Instance is currently being acted upon by
3856 /// the system to bring it into the desired state.
3857 ///
3858 /// When a new Instance is created, or an existing one is updated, Cloud Run
3859 /// will asynchronously perform all necessary steps to bring the Instance to
3860 /// the desired serving state. This process is called reconciliation. While
3861 /// reconciliation is in process, `observed_generation` will have a transient
3862 /// value that might mismatch the intended state.
3863 /// Once reconciliation is over (and this field is false), there are two
3864 /// possible outcomes: reconciliation succeeded and the serving state matches
3865 /// the Instance, or there was an error, and reconciliation failed. This state
3866 /// can be found in `terminal_condition.state`.
3867 pub reconciling: bool,
3868
3869 /// Optional. A system-generated fingerprint for this version of the
3870 /// resource. May be used to detect modification conflict during updates.
3871 pub etag: std::string::String,
3872
3873 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3874}
3875
3876impl Instance {
3877 /// Creates a new default instance.
3878 pub fn new() -> Self {
3879 std::default::Default::default()
3880 }
3881
3882 /// Sets the value of [name][crate::model::Instance::name].
3883 ///
3884 /// # Example
3885 /// ```ignore,no_run
3886 /// # use google_cloud_run_v2::model::Instance;
3887 /// # let project_id = "project_id";
3888 /// # let location_id = "location_id";
3889 /// # let instance_id = "instance_id";
3890 /// let x = Instance::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3891 /// ```
3892 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3893 self.name = v.into();
3894 self
3895 }
3896
3897 /// Sets the value of [description][crate::model::Instance::description].
3898 ///
3899 /// # Example
3900 /// ```ignore,no_run
3901 /// # use google_cloud_run_v2::model::Instance;
3902 /// let x = Instance::new().set_description("example");
3903 /// ```
3904 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3905 self.description = v.into();
3906 self
3907 }
3908
3909 /// Sets the value of [uid][crate::model::Instance::uid].
3910 ///
3911 /// # Example
3912 /// ```ignore,no_run
3913 /// # use google_cloud_run_v2::model::Instance;
3914 /// let x = Instance::new().set_uid("example");
3915 /// ```
3916 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3917 self.uid = v.into();
3918 self
3919 }
3920
3921 /// Sets the value of [generation][crate::model::Instance::generation].
3922 ///
3923 /// # Example
3924 /// ```ignore,no_run
3925 /// # use google_cloud_run_v2::model::Instance;
3926 /// let x = Instance::new().set_generation(42);
3927 /// ```
3928 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3929 self.generation = v.into();
3930 self
3931 }
3932
3933 /// Sets the value of [labels][crate::model::Instance::labels].
3934 ///
3935 /// # Example
3936 /// ```ignore,no_run
3937 /// # use google_cloud_run_v2::model::Instance;
3938 /// let x = Instance::new().set_labels([
3939 /// ("key0", "abc"),
3940 /// ("key1", "xyz"),
3941 /// ]);
3942 /// ```
3943 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3944 where
3945 T: std::iter::IntoIterator<Item = (K, V)>,
3946 K: std::convert::Into<std::string::String>,
3947 V: std::convert::Into<std::string::String>,
3948 {
3949 use std::iter::Iterator;
3950 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3951 self
3952 }
3953
3954 /// Sets the value of [annotations][crate::model::Instance::annotations].
3955 ///
3956 /// # Example
3957 /// ```ignore,no_run
3958 /// # use google_cloud_run_v2::model::Instance;
3959 /// let x = Instance::new().set_annotations([
3960 /// ("key0", "abc"),
3961 /// ("key1", "xyz"),
3962 /// ]);
3963 /// ```
3964 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3965 where
3966 T: std::iter::IntoIterator<Item = (K, V)>,
3967 K: std::convert::Into<std::string::String>,
3968 V: std::convert::Into<std::string::String>,
3969 {
3970 use std::iter::Iterator;
3971 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3972 self
3973 }
3974
3975 /// Sets the value of [create_time][crate::model::Instance::create_time].
3976 ///
3977 /// # Example
3978 /// ```ignore,no_run
3979 /// # use google_cloud_run_v2::model::Instance;
3980 /// use wkt::Timestamp;
3981 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
3982 /// ```
3983 pub fn set_create_time<T>(mut self, v: T) -> Self
3984 where
3985 T: std::convert::Into<wkt::Timestamp>,
3986 {
3987 self.create_time = std::option::Option::Some(v.into());
3988 self
3989 }
3990
3991 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
3992 ///
3993 /// # Example
3994 /// ```ignore,no_run
3995 /// # use google_cloud_run_v2::model::Instance;
3996 /// use wkt::Timestamp;
3997 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3998 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
3999 /// ```
4000 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4001 where
4002 T: std::convert::Into<wkt::Timestamp>,
4003 {
4004 self.create_time = v.map(|x| x.into());
4005 self
4006 }
4007
4008 /// Sets the value of [update_time][crate::model::Instance::update_time].
4009 ///
4010 /// # Example
4011 /// ```ignore,no_run
4012 /// # use google_cloud_run_v2::model::Instance;
4013 /// use wkt::Timestamp;
4014 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
4015 /// ```
4016 pub fn set_update_time<T>(mut self, v: T) -> Self
4017 where
4018 T: std::convert::Into<wkt::Timestamp>,
4019 {
4020 self.update_time = std::option::Option::Some(v.into());
4021 self
4022 }
4023
4024 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
4025 ///
4026 /// # Example
4027 /// ```ignore,no_run
4028 /// # use google_cloud_run_v2::model::Instance;
4029 /// use wkt::Timestamp;
4030 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4031 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
4032 /// ```
4033 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4034 where
4035 T: std::convert::Into<wkt::Timestamp>,
4036 {
4037 self.update_time = v.map(|x| x.into());
4038 self
4039 }
4040
4041 /// Sets the value of [delete_time][crate::model::Instance::delete_time].
4042 ///
4043 /// # Example
4044 /// ```ignore,no_run
4045 /// # use google_cloud_run_v2::model::Instance;
4046 /// use wkt::Timestamp;
4047 /// let x = Instance::new().set_delete_time(Timestamp::default()/* use setters */);
4048 /// ```
4049 pub fn set_delete_time<T>(mut self, v: T) -> Self
4050 where
4051 T: std::convert::Into<wkt::Timestamp>,
4052 {
4053 self.delete_time = std::option::Option::Some(v.into());
4054 self
4055 }
4056
4057 /// Sets or clears the value of [delete_time][crate::model::Instance::delete_time].
4058 ///
4059 /// # Example
4060 /// ```ignore,no_run
4061 /// # use google_cloud_run_v2::model::Instance;
4062 /// use wkt::Timestamp;
4063 /// let x = Instance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
4064 /// let x = Instance::new().set_or_clear_delete_time(None::<Timestamp>);
4065 /// ```
4066 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
4067 where
4068 T: std::convert::Into<wkt::Timestamp>,
4069 {
4070 self.delete_time = v.map(|x| x.into());
4071 self
4072 }
4073
4074 /// Sets the value of [expire_time][crate::model::Instance::expire_time].
4075 ///
4076 /// # Example
4077 /// ```ignore,no_run
4078 /// # use google_cloud_run_v2::model::Instance;
4079 /// use wkt::Timestamp;
4080 /// let x = Instance::new().set_expire_time(Timestamp::default()/* use setters */);
4081 /// ```
4082 pub fn set_expire_time<T>(mut self, v: T) -> Self
4083 where
4084 T: std::convert::Into<wkt::Timestamp>,
4085 {
4086 self.expire_time = std::option::Option::Some(v.into());
4087 self
4088 }
4089
4090 /// Sets or clears the value of [expire_time][crate::model::Instance::expire_time].
4091 ///
4092 /// # Example
4093 /// ```ignore,no_run
4094 /// # use google_cloud_run_v2::model::Instance;
4095 /// use wkt::Timestamp;
4096 /// let x = Instance::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4097 /// let x = Instance::new().set_or_clear_expire_time(None::<Timestamp>);
4098 /// ```
4099 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4100 where
4101 T: std::convert::Into<wkt::Timestamp>,
4102 {
4103 self.expire_time = v.map(|x| x.into());
4104 self
4105 }
4106
4107 /// Sets the value of [creator][crate::model::Instance::creator].
4108 ///
4109 /// # Example
4110 /// ```ignore,no_run
4111 /// # use google_cloud_run_v2::model::Instance;
4112 /// let x = Instance::new().set_creator("example");
4113 /// ```
4114 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4115 self.creator = v.into();
4116 self
4117 }
4118
4119 /// Sets the value of [last_modifier][crate::model::Instance::last_modifier].
4120 ///
4121 /// # Example
4122 /// ```ignore,no_run
4123 /// # use google_cloud_run_v2::model::Instance;
4124 /// let x = Instance::new().set_last_modifier("example");
4125 /// ```
4126 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4127 self.last_modifier = v.into();
4128 self
4129 }
4130
4131 /// Sets the value of [client][crate::model::Instance::client].
4132 ///
4133 /// # Example
4134 /// ```ignore,no_run
4135 /// # use google_cloud_run_v2::model::Instance;
4136 /// let x = Instance::new().set_client("example");
4137 /// ```
4138 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4139 self.client = v.into();
4140 self
4141 }
4142
4143 /// Sets the value of [client_version][crate::model::Instance::client_version].
4144 ///
4145 /// # Example
4146 /// ```ignore,no_run
4147 /// # use google_cloud_run_v2::model::Instance;
4148 /// let x = Instance::new().set_client_version("example");
4149 /// ```
4150 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4151 self.client_version = v.into();
4152 self
4153 }
4154
4155 /// Sets the value of [launch_stage][crate::model::Instance::launch_stage].
4156 ///
4157 /// # Example
4158 /// ```ignore,no_run
4159 /// # use google_cloud_run_v2::model::Instance;
4160 /// use google_cloud_api::model::LaunchStage;
4161 /// let x0 = Instance::new().set_launch_stage(LaunchStage::Unimplemented);
4162 /// let x1 = Instance::new().set_launch_stage(LaunchStage::Prelaunch);
4163 /// let x2 = Instance::new().set_launch_stage(LaunchStage::EarlyAccess);
4164 /// ```
4165 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
4166 mut self,
4167 v: T,
4168 ) -> Self {
4169 self.launch_stage = v.into();
4170 self
4171 }
4172
4173 /// Sets the value of [binary_authorization][crate::model::Instance::binary_authorization].
4174 ///
4175 /// # Example
4176 /// ```ignore,no_run
4177 /// # use google_cloud_run_v2::model::Instance;
4178 /// use google_cloud_run_v2::model::BinaryAuthorization;
4179 /// let x = Instance::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
4180 /// ```
4181 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
4182 where
4183 T: std::convert::Into<crate::model::BinaryAuthorization>,
4184 {
4185 self.binary_authorization = std::option::Option::Some(v.into());
4186 self
4187 }
4188
4189 /// Sets or clears the value of [binary_authorization][crate::model::Instance::binary_authorization].
4190 ///
4191 /// # Example
4192 /// ```ignore,no_run
4193 /// # use google_cloud_run_v2::model::Instance;
4194 /// use google_cloud_run_v2::model::BinaryAuthorization;
4195 /// let x = Instance::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
4196 /// let x = Instance::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
4197 /// ```
4198 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
4199 where
4200 T: std::convert::Into<crate::model::BinaryAuthorization>,
4201 {
4202 self.binary_authorization = v.map(|x| x.into());
4203 self
4204 }
4205
4206 /// Sets the value of [vpc_access][crate::model::Instance::vpc_access].
4207 ///
4208 /// # Example
4209 /// ```ignore,no_run
4210 /// # use google_cloud_run_v2::model::Instance;
4211 /// use google_cloud_run_v2::model::VpcAccess;
4212 /// let x = Instance::new().set_vpc_access(VpcAccess::default()/* use setters */);
4213 /// ```
4214 pub fn set_vpc_access<T>(mut self, v: T) -> Self
4215 where
4216 T: std::convert::Into<crate::model::VpcAccess>,
4217 {
4218 self.vpc_access = std::option::Option::Some(v.into());
4219 self
4220 }
4221
4222 /// Sets or clears the value of [vpc_access][crate::model::Instance::vpc_access].
4223 ///
4224 /// # Example
4225 /// ```ignore,no_run
4226 /// # use google_cloud_run_v2::model::Instance;
4227 /// use google_cloud_run_v2::model::VpcAccess;
4228 /// let x = Instance::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
4229 /// let x = Instance::new().set_or_clear_vpc_access(None::<VpcAccess>);
4230 /// ```
4231 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
4232 where
4233 T: std::convert::Into<crate::model::VpcAccess>,
4234 {
4235 self.vpc_access = v.map(|x| x.into());
4236 self
4237 }
4238
4239 /// Sets the value of [service_account][crate::model::Instance::service_account].
4240 ///
4241 /// # Example
4242 /// ```ignore,no_run
4243 /// # use google_cloud_run_v2::model::Instance;
4244 /// let x = Instance::new().set_service_account("example");
4245 /// ```
4246 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4247 self.service_account = v.into();
4248 self
4249 }
4250
4251 /// Sets the value of [containers][crate::model::Instance::containers].
4252 ///
4253 /// # Example
4254 /// ```ignore,no_run
4255 /// # use google_cloud_run_v2::model::Instance;
4256 /// use google_cloud_run_v2::model::Container;
4257 /// let x = Instance::new()
4258 /// .set_containers([
4259 /// Container::default()/* use setters */,
4260 /// Container::default()/* use (different) setters */,
4261 /// ]);
4262 /// ```
4263 pub fn set_containers<T, V>(mut self, v: T) -> Self
4264 where
4265 T: std::iter::IntoIterator<Item = V>,
4266 V: std::convert::Into<crate::model::Container>,
4267 {
4268 use std::iter::Iterator;
4269 self.containers = v.into_iter().map(|i| i.into()).collect();
4270 self
4271 }
4272
4273 /// Sets the value of [volumes][crate::model::Instance::volumes].
4274 ///
4275 /// # Example
4276 /// ```ignore,no_run
4277 /// # use google_cloud_run_v2::model::Instance;
4278 /// use google_cloud_run_v2::model::Volume;
4279 /// let x = Instance::new()
4280 /// .set_volumes([
4281 /// Volume::default()/* use setters */,
4282 /// Volume::default()/* use (different) setters */,
4283 /// ]);
4284 /// ```
4285 pub fn set_volumes<T, V>(mut self, v: T) -> Self
4286 where
4287 T: std::iter::IntoIterator<Item = V>,
4288 V: std::convert::Into<crate::model::Volume>,
4289 {
4290 use std::iter::Iterator;
4291 self.volumes = v.into_iter().map(|i| i.into()).collect();
4292 self
4293 }
4294
4295 /// Sets the value of [encryption_key][crate::model::Instance::encryption_key].
4296 ///
4297 /// # Example
4298 /// ```ignore,no_run
4299 /// # use google_cloud_run_v2::model::Instance;
4300 /// let x = Instance::new().set_encryption_key("example");
4301 /// ```
4302 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4303 self.encryption_key = v.into();
4304 self
4305 }
4306
4307 /// Sets the value of [encryption_key_revocation_action][crate::model::Instance::encryption_key_revocation_action].
4308 ///
4309 /// # Example
4310 /// ```ignore,no_run
4311 /// # use google_cloud_run_v2::model::Instance;
4312 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
4313 /// let x0 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
4314 /// let x1 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
4315 /// ```
4316 pub fn set_encryption_key_revocation_action<
4317 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
4318 >(
4319 mut self,
4320 v: T,
4321 ) -> Self {
4322 self.encryption_key_revocation_action = v.into();
4323 self
4324 }
4325
4326 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4327 ///
4328 /// # Example
4329 /// ```ignore,no_run
4330 /// # use google_cloud_run_v2::model::Instance;
4331 /// use wkt::Duration;
4332 /// let x = Instance::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
4333 /// ```
4334 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
4335 where
4336 T: std::convert::Into<wkt::Duration>,
4337 {
4338 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
4339 self
4340 }
4341
4342 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4343 ///
4344 /// # Example
4345 /// ```ignore,no_run
4346 /// # use google_cloud_run_v2::model::Instance;
4347 /// use wkt::Duration;
4348 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
4349 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
4350 /// ```
4351 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
4352 mut self,
4353 v: std::option::Option<T>,
4354 ) -> Self
4355 where
4356 T: std::convert::Into<wkt::Duration>,
4357 {
4358 self.encryption_key_shutdown_duration = v.map(|x| x.into());
4359 self
4360 }
4361
4362 /// Sets the value of [node_selector][crate::model::Instance::node_selector].
4363 ///
4364 /// # Example
4365 /// ```ignore,no_run
4366 /// # use google_cloud_run_v2::model::Instance;
4367 /// use google_cloud_run_v2::model::NodeSelector;
4368 /// let x = Instance::new().set_node_selector(NodeSelector::default()/* use setters */);
4369 /// ```
4370 pub fn set_node_selector<T>(mut self, v: T) -> Self
4371 where
4372 T: std::convert::Into<crate::model::NodeSelector>,
4373 {
4374 self.node_selector = std::option::Option::Some(v.into());
4375 self
4376 }
4377
4378 /// Sets or clears the value of [node_selector][crate::model::Instance::node_selector].
4379 ///
4380 /// # Example
4381 /// ```ignore,no_run
4382 /// # use google_cloud_run_v2::model::Instance;
4383 /// use google_cloud_run_v2::model::NodeSelector;
4384 /// let x = Instance::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
4385 /// let x = Instance::new().set_or_clear_node_selector(None::<NodeSelector>);
4386 /// ```
4387 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
4388 where
4389 T: std::convert::Into<crate::model::NodeSelector>,
4390 {
4391 self.node_selector = v.map(|x| x.into());
4392 self
4393 }
4394
4395 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4396 ///
4397 /// # Example
4398 /// ```ignore,no_run
4399 /// # use google_cloud_run_v2::model::Instance;
4400 /// let x = Instance::new().set_gpu_zonal_redundancy_disabled(true);
4401 /// ```
4402 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
4403 where
4404 T: std::convert::Into<bool>,
4405 {
4406 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
4407 self
4408 }
4409
4410 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4411 ///
4412 /// # Example
4413 /// ```ignore,no_run
4414 /// # use google_cloud_run_v2::model::Instance;
4415 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
4416 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
4417 /// ```
4418 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
4419 mut self,
4420 v: std::option::Option<T>,
4421 ) -> Self
4422 where
4423 T: std::convert::Into<bool>,
4424 {
4425 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
4426 self
4427 }
4428
4429 /// Sets the value of [ingress][crate::model::Instance::ingress].
4430 ///
4431 /// # Example
4432 /// ```ignore,no_run
4433 /// # use google_cloud_run_v2::model::Instance;
4434 /// use google_cloud_run_v2::model::IngressTraffic;
4435 /// let x0 = Instance::new().set_ingress(IngressTraffic::All);
4436 /// let x1 = Instance::new().set_ingress(IngressTraffic::InternalOnly);
4437 /// let x2 = Instance::new().set_ingress(IngressTraffic::InternalLoadBalancer);
4438 /// ```
4439 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
4440 mut self,
4441 v: T,
4442 ) -> Self {
4443 self.ingress = v.into();
4444 self
4445 }
4446
4447 /// Sets the value of [invoker_iam_disabled][crate::model::Instance::invoker_iam_disabled].
4448 ///
4449 /// # Example
4450 /// ```ignore,no_run
4451 /// # use google_cloud_run_v2::model::Instance;
4452 /// let x = Instance::new().set_invoker_iam_disabled(true);
4453 /// ```
4454 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4455 self.invoker_iam_disabled = v.into();
4456 self
4457 }
4458
4459 /// Sets the value of [iap_enabled][crate::model::Instance::iap_enabled].
4460 ///
4461 /// # Example
4462 /// ```ignore,no_run
4463 /// # use google_cloud_run_v2::model::Instance;
4464 /// let x = Instance::new().set_iap_enabled(true);
4465 /// ```
4466 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4467 self.iap_enabled = v.into();
4468 self
4469 }
4470
4471 /// Sets the value of [observed_generation][crate::model::Instance::observed_generation].
4472 ///
4473 /// # Example
4474 /// ```ignore,no_run
4475 /// # use google_cloud_run_v2::model::Instance;
4476 /// let x = Instance::new().set_observed_generation(42);
4477 /// ```
4478 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4479 self.observed_generation = v.into();
4480 self
4481 }
4482
4483 /// Sets the value of [log_uri][crate::model::Instance::log_uri].
4484 ///
4485 /// # Example
4486 /// ```ignore,no_run
4487 /// # use google_cloud_run_v2::model::Instance;
4488 /// let x = Instance::new().set_log_uri("example");
4489 /// ```
4490 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4491 self.log_uri = v.into();
4492 self
4493 }
4494
4495 /// Sets the value of [terminal_condition][crate::model::Instance::terminal_condition].
4496 ///
4497 /// # Example
4498 /// ```ignore,no_run
4499 /// # use google_cloud_run_v2::model::Instance;
4500 /// use google_cloud_run_v2::model::Condition;
4501 /// let x = Instance::new().set_terminal_condition(Condition::default()/* use setters */);
4502 /// ```
4503 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
4504 where
4505 T: std::convert::Into<crate::model::Condition>,
4506 {
4507 self.terminal_condition = std::option::Option::Some(v.into());
4508 self
4509 }
4510
4511 /// Sets or clears the value of [terminal_condition][crate::model::Instance::terminal_condition].
4512 ///
4513 /// # Example
4514 /// ```ignore,no_run
4515 /// # use google_cloud_run_v2::model::Instance;
4516 /// use google_cloud_run_v2::model::Condition;
4517 /// let x = Instance::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
4518 /// let x = Instance::new().set_or_clear_terminal_condition(None::<Condition>);
4519 /// ```
4520 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
4521 where
4522 T: std::convert::Into<crate::model::Condition>,
4523 {
4524 self.terminal_condition = v.map(|x| x.into());
4525 self
4526 }
4527
4528 /// Sets the value of [conditions][crate::model::Instance::conditions].
4529 ///
4530 /// # Example
4531 /// ```ignore,no_run
4532 /// # use google_cloud_run_v2::model::Instance;
4533 /// use google_cloud_run_v2::model::Condition;
4534 /// let x = Instance::new()
4535 /// .set_conditions([
4536 /// Condition::default()/* use setters */,
4537 /// Condition::default()/* use (different) setters */,
4538 /// ]);
4539 /// ```
4540 pub fn set_conditions<T, V>(mut self, v: T) -> Self
4541 where
4542 T: std::iter::IntoIterator<Item = V>,
4543 V: std::convert::Into<crate::model::Condition>,
4544 {
4545 use std::iter::Iterator;
4546 self.conditions = v.into_iter().map(|i| i.into()).collect();
4547 self
4548 }
4549
4550 /// Sets the value of [container_statuses][crate::model::Instance::container_statuses].
4551 ///
4552 /// # Example
4553 /// ```ignore,no_run
4554 /// # use google_cloud_run_v2::model::Instance;
4555 /// use google_cloud_run_v2::model::ContainerStatus;
4556 /// let x = Instance::new()
4557 /// .set_container_statuses([
4558 /// ContainerStatus::default()/* use setters */,
4559 /// ContainerStatus::default()/* use (different) setters */,
4560 /// ]);
4561 /// ```
4562 pub fn set_container_statuses<T, V>(mut self, v: T) -> Self
4563 where
4564 T: std::iter::IntoIterator<Item = V>,
4565 V: std::convert::Into<crate::model::ContainerStatus>,
4566 {
4567 use std::iter::Iterator;
4568 self.container_statuses = v.into_iter().map(|i| i.into()).collect();
4569 self
4570 }
4571
4572 /// Sets the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
4573 ///
4574 /// # Example
4575 /// ```ignore,no_run
4576 /// # use google_cloud_run_v2::model::Instance;
4577 /// let x = Instance::new().set_satisfies_pzs(true);
4578 /// ```
4579 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4580 self.satisfies_pzs = v.into();
4581 self
4582 }
4583
4584 /// Sets the value of [urls][crate::model::Instance::urls].
4585 ///
4586 /// # Example
4587 /// ```ignore,no_run
4588 /// # use google_cloud_run_v2::model::Instance;
4589 /// let x = Instance::new().set_urls(["a", "b", "c"]);
4590 /// ```
4591 pub fn set_urls<T, V>(mut self, v: T) -> Self
4592 where
4593 T: std::iter::IntoIterator<Item = V>,
4594 V: std::convert::Into<std::string::String>,
4595 {
4596 use std::iter::Iterator;
4597 self.urls = v.into_iter().map(|i| i.into()).collect();
4598 self
4599 }
4600
4601 /// Sets the value of [reconciling][crate::model::Instance::reconciling].
4602 ///
4603 /// # Example
4604 /// ```ignore,no_run
4605 /// # use google_cloud_run_v2::model::Instance;
4606 /// let x = Instance::new().set_reconciling(true);
4607 /// ```
4608 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4609 self.reconciling = v.into();
4610 self
4611 }
4612
4613 /// Sets the value of [etag][crate::model::Instance::etag].
4614 ///
4615 /// # Example
4616 /// ```ignore,no_run
4617 /// # use google_cloud_run_v2::model::Instance;
4618 /// let x = Instance::new().set_etag("example");
4619 /// ```
4620 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4621 self.etag = v.into();
4622 self
4623 }
4624}
4625
4626impl wkt::message::Message for Instance {
4627 fn typename() -> &'static str {
4628 "type.googleapis.com/google.cloud.run.v2.Instance"
4629 }
4630}
4631
4632/// Holds a single instance split entry for the Worker. Allocations can be done
4633/// to a specific Revision name, or pointing to the latest Ready Revision.
4634#[derive(Clone, Default, PartialEq)]
4635#[non_exhaustive]
4636pub struct InstanceSplit {
4637 /// The allocation type for this instance split.
4638 pub r#type: crate::model::InstanceSplitAllocationType,
4639
4640 /// Revision to which to assign this portion of instances, if split allocation
4641 /// is by revision.
4642 pub revision: std::string::String,
4643
4644 /// Specifies percent of the instance split to this Revision.
4645 /// This defaults to zero if unspecified.
4646 pub percent: i32,
4647
4648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4649}
4650
4651impl InstanceSplit {
4652 /// Creates a new default instance.
4653 pub fn new() -> Self {
4654 std::default::Default::default()
4655 }
4656
4657 /// Sets the value of [r#type][crate::model::InstanceSplit::type].
4658 ///
4659 /// # Example
4660 /// ```ignore,no_run
4661 /// # use google_cloud_run_v2::model::InstanceSplit;
4662 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4663 /// let x0 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Latest);
4664 /// let x1 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Revision);
4665 /// ```
4666 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4667 mut self,
4668 v: T,
4669 ) -> Self {
4670 self.r#type = v.into();
4671 self
4672 }
4673
4674 /// Sets the value of [revision][crate::model::InstanceSplit::revision].
4675 ///
4676 /// # Example
4677 /// ```ignore,no_run
4678 /// # use google_cloud_run_v2::model::InstanceSplit;
4679 /// # let project_id = "project_id";
4680 /// # let location_id = "location_id";
4681 /// # let service_id = "service_id";
4682 /// # let revision_id = "revision_id";
4683 /// let x = InstanceSplit::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
4684 /// ```
4685 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4686 self.revision = v.into();
4687 self
4688 }
4689
4690 /// Sets the value of [percent][crate::model::InstanceSplit::percent].
4691 ///
4692 /// # Example
4693 /// ```ignore,no_run
4694 /// # use google_cloud_run_v2::model::InstanceSplit;
4695 /// let x = InstanceSplit::new().set_percent(42);
4696 /// ```
4697 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4698 self.percent = v.into();
4699 self
4700 }
4701}
4702
4703impl wkt::message::Message for InstanceSplit {
4704 fn typename() -> &'static str {
4705 "type.googleapis.com/google.cloud.run.v2.InstanceSplit"
4706 }
4707}
4708
4709/// Represents the observed state of a single `InstanceSplit` entry.
4710#[derive(Clone, Default, PartialEq)]
4711#[non_exhaustive]
4712pub struct InstanceSplitStatus {
4713 /// The allocation type for this instance split.
4714 pub r#type: crate::model::InstanceSplitAllocationType,
4715
4716 /// Revision to which this instance split is assigned.
4717 pub revision: std::string::String,
4718
4719 /// Specifies percent of the instance split to this Revision.
4720 pub percent: i32,
4721
4722 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4723}
4724
4725impl InstanceSplitStatus {
4726 /// Creates a new default instance.
4727 pub fn new() -> Self {
4728 std::default::Default::default()
4729 }
4730
4731 /// Sets the value of [r#type][crate::model::InstanceSplitStatus::type].
4732 ///
4733 /// # Example
4734 /// ```ignore,no_run
4735 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4736 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4737 /// let x0 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Latest);
4738 /// let x1 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Revision);
4739 /// ```
4740 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4741 mut self,
4742 v: T,
4743 ) -> Self {
4744 self.r#type = v.into();
4745 self
4746 }
4747
4748 /// Sets the value of [revision][crate::model::InstanceSplitStatus::revision].
4749 ///
4750 /// # Example
4751 /// ```ignore,no_run
4752 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4753 /// # let project_id = "project_id";
4754 /// # let location_id = "location_id";
4755 /// # let service_id = "service_id";
4756 /// # let revision_id = "revision_id";
4757 /// let x = InstanceSplitStatus::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
4758 /// ```
4759 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4760 self.revision = v.into();
4761 self
4762 }
4763
4764 /// Sets the value of [percent][crate::model::InstanceSplitStatus::percent].
4765 ///
4766 /// # Example
4767 /// ```ignore,no_run
4768 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4769 /// let x = InstanceSplitStatus::new().set_percent(42);
4770 /// ```
4771 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4772 self.percent = v.into();
4773 self
4774 }
4775}
4776
4777impl wkt::message::Message for InstanceSplitStatus {
4778 fn typename() -> &'static str {
4779 "type.googleapis.com/google.cloud.run.v2.InstanceSplitStatus"
4780 }
4781}
4782
4783/// Request message for creating a Job.
4784#[derive(Clone, Default, PartialEq)]
4785#[non_exhaustive]
4786pub struct CreateJobRequest {
4787 /// Required. The location and project in which this Job should be created.
4788 /// Format: projects/{project}/locations/{location}, where {project} can be
4789 /// project id or number.
4790 pub parent: std::string::String,
4791
4792 /// Required. The Job instance to create.
4793 pub job: std::option::Option<crate::model::Job>,
4794
4795 /// Required. The unique identifier for the Job. The name of the job becomes
4796 /// {parent}/jobs/{job_id}.
4797 pub job_id: std::string::String,
4798
4799 /// Indicates that the request should be validated and default values
4800 /// populated, without persisting the request or creating any resources.
4801 pub validate_only: bool,
4802
4803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4804}
4805
4806impl CreateJobRequest {
4807 /// Creates a new default instance.
4808 pub fn new() -> Self {
4809 std::default::Default::default()
4810 }
4811
4812 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
4813 ///
4814 /// # Example
4815 /// ```ignore,no_run
4816 /// # use google_cloud_run_v2::model::CreateJobRequest;
4817 /// # let project_id = "project_id";
4818 /// # let location_id = "location_id";
4819 /// let x = CreateJobRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
4820 /// ```
4821 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4822 self.parent = v.into();
4823 self
4824 }
4825
4826 /// Sets the value of [job][crate::model::CreateJobRequest::job].
4827 ///
4828 /// # Example
4829 /// ```ignore,no_run
4830 /// # use google_cloud_run_v2::model::CreateJobRequest;
4831 /// use google_cloud_run_v2::model::Job;
4832 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
4833 /// ```
4834 pub fn set_job<T>(mut self, v: T) -> Self
4835 where
4836 T: std::convert::Into<crate::model::Job>,
4837 {
4838 self.job = std::option::Option::Some(v.into());
4839 self
4840 }
4841
4842 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
4843 ///
4844 /// # Example
4845 /// ```ignore,no_run
4846 /// # use google_cloud_run_v2::model::CreateJobRequest;
4847 /// use google_cloud_run_v2::model::Job;
4848 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4849 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
4850 /// ```
4851 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4852 where
4853 T: std::convert::Into<crate::model::Job>,
4854 {
4855 self.job = v.map(|x| x.into());
4856 self
4857 }
4858
4859 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
4860 ///
4861 /// # Example
4862 /// ```ignore,no_run
4863 /// # use google_cloud_run_v2::model::CreateJobRequest;
4864 /// let x = CreateJobRequest::new().set_job_id("example");
4865 /// ```
4866 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4867 self.job_id = v.into();
4868 self
4869 }
4870
4871 /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
4872 ///
4873 /// # Example
4874 /// ```ignore,no_run
4875 /// # use google_cloud_run_v2::model::CreateJobRequest;
4876 /// let x = CreateJobRequest::new().set_validate_only(true);
4877 /// ```
4878 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4879 self.validate_only = v.into();
4880 self
4881 }
4882}
4883
4884impl wkt::message::Message for CreateJobRequest {
4885 fn typename() -> &'static str {
4886 "type.googleapis.com/google.cloud.run.v2.CreateJobRequest"
4887 }
4888}
4889
4890/// Request message for obtaining a Job by its full name.
4891#[derive(Clone, Default, PartialEq)]
4892#[non_exhaustive]
4893pub struct GetJobRequest {
4894 /// Required. The full name of the Job.
4895 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
4896 /// can be project id or number.
4897 pub name: std::string::String,
4898
4899 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4900}
4901
4902impl GetJobRequest {
4903 /// Creates a new default instance.
4904 pub fn new() -> Self {
4905 std::default::Default::default()
4906 }
4907
4908 /// Sets the value of [name][crate::model::GetJobRequest::name].
4909 ///
4910 /// # Example
4911 /// ```ignore,no_run
4912 /// # use google_cloud_run_v2::model::GetJobRequest;
4913 /// # let project_id = "project_id";
4914 /// # let location_id = "location_id";
4915 /// # let job_id = "job_id";
4916 /// let x = GetJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
4917 /// ```
4918 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4919 self.name = v.into();
4920 self
4921 }
4922}
4923
4924impl wkt::message::Message for GetJobRequest {
4925 fn typename() -> &'static str {
4926 "type.googleapis.com/google.cloud.run.v2.GetJobRequest"
4927 }
4928}
4929
4930/// Request message for updating a Job.
4931#[derive(Clone, Default, PartialEq)]
4932#[non_exhaustive]
4933pub struct UpdateJobRequest {
4934 /// Required. The Job to be updated.
4935 pub job: std::option::Option<crate::model::Job>,
4936
4937 /// Indicates that the request should be validated and default values
4938 /// populated, without persisting the request or updating any resources.
4939 pub validate_only: bool,
4940
4941 /// Optional. If set to true, and if the Job does not exist, it will create a
4942 /// new one. Caller must have both create and update permissions for this call
4943 /// if this is set to true.
4944 pub allow_missing: bool,
4945
4946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4947}
4948
4949impl UpdateJobRequest {
4950 /// Creates a new default instance.
4951 pub fn new() -> Self {
4952 std::default::Default::default()
4953 }
4954
4955 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
4956 ///
4957 /// # Example
4958 /// ```ignore,no_run
4959 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4960 /// use google_cloud_run_v2::model::Job;
4961 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
4962 /// ```
4963 pub fn set_job<T>(mut self, v: T) -> Self
4964 where
4965 T: std::convert::Into<crate::model::Job>,
4966 {
4967 self.job = std::option::Option::Some(v.into());
4968 self
4969 }
4970
4971 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
4972 ///
4973 /// # Example
4974 /// ```ignore,no_run
4975 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4976 /// use google_cloud_run_v2::model::Job;
4977 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4978 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
4979 /// ```
4980 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4981 where
4982 T: std::convert::Into<crate::model::Job>,
4983 {
4984 self.job = v.map(|x| x.into());
4985 self
4986 }
4987
4988 /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
4989 ///
4990 /// # Example
4991 /// ```ignore,no_run
4992 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4993 /// let x = UpdateJobRequest::new().set_validate_only(true);
4994 /// ```
4995 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4996 self.validate_only = v.into();
4997 self
4998 }
4999
5000 /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
5001 ///
5002 /// # Example
5003 /// ```ignore,no_run
5004 /// # use google_cloud_run_v2::model::UpdateJobRequest;
5005 /// let x = UpdateJobRequest::new().set_allow_missing(true);
5006 /// ```
5007 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5008 self.allow_missing = v.into();
5009 self
5010 }
5011}
5012
5013impl wkt::message::Message for UpdateJobRequest {
5014 fn typename() -> &'static str {
5015 "type.googleapis.com/google.cloud.run.v2.UpdateJobRequest"
5016 }
5017}
5018
5019/// Request message for retrieving a list of Jobs.
5020#[derive(Clone, Default, PartialEq)]
5021#[non_exhaustive]
5022pub struct ListJobsRequest {
5023 /// Required. The location and project to list resources on.
5024 /// Format: projects/{project}/locations/{location}, where {project} can be
5025 /// project id or number.
5026 pub parent: std::string::String,
5027
5028 /// Maximum number of Jobs to return in this call.
5029 pub page_size: i32,
5030
5031 /// A page token received from a previous call to ListJobs.
5032 /// All other parameters must match.
5033 pub page_token: std::string::String,
5034
5035 /// If true, returns deleted (but unexpired) resources along with active ones.
5036 pub show_deleted: bool,
5037
5038 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5039}
5040
5041impl ListJobsRequest {
5042 /// Creates a new default instance.
5043 pub fn new() -> Self {
5044 std::default::Default::default()
5045 }
5046
5047 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
5048 ///
5049 /// # Example
5050 /// ```ignore,no_run
5051 /// # use google_cloud_run_v2::model::ListJobsRequest;
5052 /// # let project_id = "project_id";
5053 /// # let location_id = "location_id";
5054 /// let x = ListJobsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
5055 /// ```
5056 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5057 self.parent = v.into();
5058 self
5059 }
5060
5061 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
5062 ///
5063 /// # Example
5064 /// ```ignore,no_run
5065 /// # use google_cloud_run_v2::model::ListJobsRequest;
5066 /// let x = ListJobsRequest::new().set_page_size(42);
5067 /// ```
5068 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5069 self.page_size = v.into();
5070 self
5071 }
5072
5073 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
5074 ///
5075 /// # Example
5076 /// ```ignore,no_run
5077 /// # use google_cloud_run_v2::model::ListJobsRequest;
5078 /// let x = ListJobsRequest::new().set_page_token("example");
5079 /// ```
5080 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5081 self.page_token = v.into();
5082 self
5083 }
5084
5085 /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
5086 ///
5087 /// # Example
5088 /// ```ignore,no_run
5089 /// # use google_cloud_run_v2::model::ListJobsRequest;
5090 /// let x = ListJobsRequest::new().set_show_deleted(true);
5091 /// ```
5092 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5093 self.show_deleted = v.into();
5094 self
5095 }
5096}
5097
5098impl wkt::message::Message for ListJobsRequest {
5099 fn typename() -> &'static str {
5100 "type.googleapis.com/google.cloud.run.v2.ListJobsRequest"
5101 }
5102}
5103
5104/// Response message containing a list of Jobs.
5105#[derive(Clone, Default, PartialEq)]
5106#[non_exhaustive]
5107pub struct ListJobsResponse {
5108 /// The resulting list of Jobs.
5109 pub jobs: std::vec::Vec<crate::model::Job>,
5110
5111 /// A token indicating there are more items than page_size. Use it in the next
5112 /// ListJobs request to continue.
5113 pub next_page_token: std::string::String,
5114
5115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5116}
5117
5118impl ListJobsResponse {
5119 /// Creates a new default instance.
5120 pub fn new() -> Self {
5121 std::default::Default::default()
5122 }
5123
5124 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
5125 ///
5126 /// # Example
5127 /// ```ignore,no_run
5128 /// # use google_cloud_run_v2::model::ListJobsResponse;
5129 /// use google_cloud_run_v2::model::Job;
5130 /// let x = ListJobsResponse::new()
5131 /// .set_jobs([
5132 /// Job::default()/* use setters */,
5133 /// Job::default()/* use (different) setters */,
5134 /// ]);
5135 /// ```
5136 pub fn set_jobs<T, V>(mut self, v: T) -> Self
5137 where
5138 T: std::iter::IntoIterator<Item = V>,
5139 V: std::convert::Into<crate::model::Job>,
5140 {
5141 use std::iter::Iterator;
5142 self.jobs = v.into_iter().map(|i| i.into()).collect();
5143 self
5144 }
5145
5146 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
5147 ///
5148 /// # Example
5149 /// ```ignore,no_run
5150 /// # use google_cloud_run_v2::model::ListJobsResponse;
5151 /// let x = ListJobsResponse::new().set_next_page_token("example");
5152 /// ```
5153 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5154 self.next_page_token = v.into();
5155 self
5156 }
5157}
5158
5159impl wkt::message::Message for ListJobsResponse {
5160 fn typename() -> &'static str {
5161 "type.googleapis.com/google.cloud.run.v2.ListJobsResponse"
5162 }
5163}
5164
5165#[doc(hidden)]
5166impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
5167 type PageItem = crate::model::Job;
5168
5169 fn items(self) -> std::vec::Vec<Self::PageItem> {
5170 self.jobs
5171 }
5172
5173 fn next_page_token(&self) -> std::string::String {
5174 use std::clone::Clone;
5175 self.next_page_token.clone()
5176 }
5177}
5178
5179/// Request message to delete a Job by its full name.
5180#[derive(Clone, Default, PartialEq)]
5181#[non_exhaustive]
5182pub struct DeleteJobRequest {
5183 /// Required. The full name of the Job.
5184 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5185 /// can be project id or number.
5186 pub name: std::string::String,
5187
5188 /// Indicates that the request should be validated without actually
5189 /// deleting any resources.
5190 pub validate_only: bool,
5191
5192 /// A system-generated fingerprint for this version of the
5193 /// resource. May be used to detect modification conflict during updates.
5194 pub etag: std::string::String,
5195
5196 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5197}
5198
5199impl DeleteJobRequest {
5200 /// Creates a new default instance.
5201 pub fn new() -> Self {
5202 std::default::Default::default()
5203 }
5204
5205 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
5206 ///
5207 /// # Example
5208 /// ```ignore,no_run
5209 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5210 /// # let project_id = "project_id";
5211 /// # let location_id = "location_id";
5212 /// # let job_id = "job_id";
5213 /// let x = DeleteJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
5214 /// ```
5215 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5216 self.name = v.into();
5217 self
5218 }
5219
5220 /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
5221 ///
5222 /// # Example
5223 /// ```ignore,no_run
5224 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5225 /// let x = DeleteJobRequest::new().set_validate_only(true);
5226 /// ```
5227 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5228 self.validate_only = v.into();
5229 self
5230 }
5231
5232 /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
5233 ///
5234 /// # Example
5235 /// ```ignore,no_run
5236 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5237 /// let x = DeleteJobRequest::new().set_etag("example");
5238 /// ```
5239 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5240 self.etag = v.into();
5241 self
5242 }
5243}
5244
5245impl wkt::message::Message for DeleteJobRequest {
5246 fn typename() -> &'static str {
5247 "type.googleapis.com/google.cloud.run.v2.DeleteJobRequest"
5248 }
5249}
5250
5251/// Request message to create a new Execution of a Job.
5252#[derive(Clone, Default, PartialEq)]
5253#[non_exhaustive]
5254pub struct RunJobRequest {
5255 /// Required. The full name of the Job.
5256 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5257 /// can be project id or number.
5258 pub name: std::string::String,
5259
5260 /// Indicates that the request should be validated without actually
5261 /// deleting any resources.
5262 pub validate_only: bool,
5263
5264 /// A system-generated fingerprint for this version of the
5265 /// resource. May be used to detect modification conflict during updates.
5266 pub etag: std::string::String,
5267
5268 /// Overrides specification for a given execution of a job. If provided,
5269 /// overrides will be applied to update the execution or task spec.
5270 pub overrides: std::option::Option<crate::model::run_job_request::Overrides>,
5271
5272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5273}
5274
5275impl RunJobRequest {
5276 /// Creates a new default instance.
5277 pub fn new() -> Self {
5278 std::default::Default::default()
5279 }
5280
5281 /// Sets the value of [name][crate::model::RunJobRequest::name].
5282 ///
5283 /// # Example
5284 /// ```ignore,no_run
5285 /// # use google_cloud_run_v2::model::RunJobRequest;
5286 /// # let project_id = "project_id";
5287 /// # let location_id = "location_id";
5288 /// # let job_id = "job_id";
5289 /// let x = RunJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
5290 /// ```
5291 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5292 self.name = v.into();
5293 self
5294 }
5295
5296 /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
5297 ///
5298 /// # Example
5299 /// ```ignore,no_run
5300 /// # use google_cloud_run_v2::model::RunJobRequest;
5301 /// let x = RunJobRequest::new().set_validate_only(true);
5302 /// ```
5303 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5304 self.validate_only = v.into();
5305 self
5306 }
5307
5308 /// Sets the value of [etag][crate::model::RunJobRequest::etag].
5309 ///
5310 /// # Example
5311 /// ```ignore,no_run
5312 /// # use google_cloud_run_v2::model::RunJobRequest;
5313 /// let x = RunJobRequest::new().set_etag("example");
5314 /// ```
5315 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5316 self.etag = v.into();
5317 self
5318 }
5319
5320 /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
5321 ///
5322 /// # Example
5323 /// ```ignore,no_run
5324 /// # use google_cloud_run_v2::model::RunJobRequest;
5325 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5326 /// let x = RunJobRequest::new().set_overrides(Overrides::default()/* use setters */);
5327 /// ```
5328 pub fn set_overrides<T>(mut self, v: T) -> Self
5329 where
5330 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5331 {
5332 self.overrides = std::option::Option::Some(v.into());
5333 self
5334 }
5335
5336 /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
5337 ///
5338 /// # Example
5339 /// ```ignore,no_run
5340 /// # use google_cloud_run_v2::model::RunJobRequest;
5341 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5342 /// let x = RunJobRequest::new().set_or_clear_overrides(Some(Overrides::default()/* use setters */));
5343 /// let x = RunJobRequest::new().set_or_clear_overrides(None::<Overrides>);
5344 /// ```
5345 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
5346 where
5347 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5348 {
5349 self.overrides = v.map(|x| x.into());
5350 self
5351 }
5352}
5353
5354impl wkt::message::Message for RunJobRequest {
5355 fn typename() -> &'static str {
5356 "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
5357 }
5358}
5359
5360/// Defines additional types related to [RunJobRequest].
5361pub mod run_job_request {
5362 #[allow(unused_imports)]
5363 use super::*;
5364
5365 /// RunJob Overrides that contains Execution fields to be overridden.
5366 #[derive(Clone, Default, PartialEq)]
5367 #[non_exhaustive]
5368 pub struct Overrides {
5369 /// Per container override specification.
5370 pub container_overrides:
5371 std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>,
5372
5373 /// Optional. The desired number of tasks the execution should run. Will
5374 /// replace existing task_count value.
5375 pub task_count: i32,
5376
5377 /// Duration in seconds the task may be active before the system will
5378 /// actively try to mark it failed and kill associated containers. Will
5379 /// replace existing timeout_seconds value.
5380 pub timeout: std::option::Option<wkt::Duration>,
5381
5382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5383 }
5384
5385 impl Overrides {
5386 /// Creates a new default instance.
5387 pub fn new() -> Self {
5388 std::default::Default::default()
5389 }
5390
5391 /// Sets the value of [container_overrides][crate::model::run_job_request::Overrides::container_overrides].
5392 ///
5393 /// # Example
5394 /// ```ignore,no_run
5395 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5396 /// use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5397 /// let x = Overrides::new()
5398 /// .set_container_overrides([
5399 /// ContainerOverride::default()/* use setters */,
5400 /// ContainerOverride::default()/* use (different) setters */,
5401 /// ]);
5402 /// ```
5403 pub fn set_container_overrides<T, V>(mut self, v: T) -> Self
5404 where
5405 T: std::iter::IntoIterator<Item = V>,
5406 V: std::convert::Into<crate::model::run_job_request::overrides::ContainerOverride>,
5407 {
5408 use std::iter::Iterator;
5409 self.container_overrides = v.into_iter().map(|i| i.into()).collect();
5410 self
5411 }
5412
5413 /// Sets the value of [task_count][crate::model::run_job_request::Overrides::task_count].
5414 ///
5415 /// # Example
5416 /// ```ignore,no_run
5417 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5418 /// let x = Overrides::new().set_task_count(42);
5419 /// ```
5420 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5421 self.task_count = v.into();
5422 self
5423 }
5424
5425 /// Sets the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5426 ///
5427 /// # Example
5428 /// ```ignore,no_run
5429 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5430 /// use wkt::Duration;
5431 /// let x = Overrides::new().set_timeout(Duration::default()/* use setters */);
5432 /// ```
5433 pub fn set_timeout<T>(mut self, v: T) -> Self
5434 where
5435 T: std::convert::Into<wkt::Duration>,
5436 {
5437 self.timeout = std::option::Option::Some(v.into());
5438 self
5439 }
5440
5441 /// Sets or clears the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5442 ///
5443 /// # Example
5444 /// ```ignore,no_run
5445 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5446 /// use wkt::Duration;
5447 /// let x = Overrides::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
5448 /// let x = Overrides::new().set_or_clear_timeout(None::<Duration>);
5449 /// ```
5450 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5451 where
5452 T: std::convert::Into<wkt::Duration>,
5453 {
5454 self.timeout = v.map(|x| x.into());
5455 self
5456 }
5457 }
5458
5459 impl wkt::message::Message for Overrides {
5460 fn typename() -> &'static str {
5461 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
5462 }
5463 }
5464
5465 /// Defines additional types related to [Overrides].
5466 pub mod overrides {
5467 #[allow(unused_imports)]
5468 use super::*;
5469
5470 /// Per-container override specification.
5471 #[derive(Clone, Default, PartialEq)]
5472 #[non_exhaustive]
5473 pub struct ContainerOverride {
5474 /// The name of the container specified as a DNS_LABEL.
5475 pub name: std::string::String,
5476
5477 /// Optional. Arguments to the entrypoint. Will replace existing args for
5478 /// override.
5479 pub args: std::vec::Vec<std::string::String>,
5480
5481 /// List of environment variables to set in the container. Will be merged
5482 /// with existing env for override.
5483 pub env: std::vec::Vec<crate::model::EnvVar>,
5484
5485 /// Optional. True if the intention is to clear out existing args list.
5486 pub clear_args: bool,
5487
5488 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5489 }
5490
5491 impl ContainerOverride {
5492 /// Creates a new default instance.
5493 pub fn new() -> Self {
5494 std::default::Default::default()
5495 }
5496
5497 /// Sets the value of [name][crate::model::run_job_request::overrides::ContainerOverride::name].
5498 ///
5499 /// # Example
5500 /// ```ignore,no_run
5501 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5502 /// let x = ContainerOverride::new().set_name("example");
5503 /// ```
5504 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5505 self.name = v.into();
5506 self
5507 }
5508
5509 /// Sets the value of [args][crate::model::run_job_request::overrides::ContainerOverride::args].
5510 ///
5511 /// # Example
5512 /// ```ignore,no_run
5513 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5514 /// let x = ContainerOverride::new().set_args(["a", "b", "c"]);
5515 /// ```
5516 pub fn set_args<T, V>(mut self, v: T) -> Self
5517 where
5518 T: std::iter::IntoIterator<Item = V>,
5519 V: std::convert::Into<std::string::String>,
5520 {
5521 use std::iter::Iterator;
5522 self.args = v.into_iter().map(|i| i.into()).collect();
5523 self
5524 }
5525
5526 /// Sets the value of [env][crate::model::run_job_request::overrides::ContainerOverride::env].
5527 ///
5528 /// # Example
5529 /// ```ignore,no_run
5530 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5531 /// use google_cloud_run_v2::model::EnvVar;
5532 /// let x = ContainerOverride::new()
5533 /// .set_env([
5534 /// EnvVar::default()/* use setters */,
5535 /// EnvVar::default()/* use (different) setters */,
5536 /// ]);
5537 /// ```
5538 pub fn set_env<T, V>(mut self, v: T) -> Self
5539 where
5540 T: std::iter::IntoIterator<Item = V>,
5541 V: std::convert::Into<crate::model::EnvVar>,
5542 {
5543 use std::iter::Iterator;
5544 self.env = v.into_iter().map(|i| i.into()).collect();
5545 self
5546 }
5547
5548 /// Sets the value of [clear_args][crate::model::run_job_request::overrides::ContainerOverride::clear_args].
5549 ///
5550 /// # Example
5551 /// ```ignore,no_run
5552 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5553 /// let x = ContainerOverride::new().set_clear_args(true);
5554 /// ```
5555 pub fn set_clear_args<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5556 self.clear_args = v.into();
5557 self
5558 }
5559 }
5560
5561 impl wkt::message::Message for ContainerOverride {
5562 fn typename() -> &'static str {
5563 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
5564 }
5565 }
5566 }
5567}
5568
5569/// Job represents the configuration of a single job, which references a
5570/// container image that is run to completion.
5571#[derive(Clone, Default, PartialEq)]
5572#[non_exhaustive]
5573pub struct Job {
5574 /// The fully qualified name of this Job.
5575 ///
5576 /// Format:
5577 /// projects/{project}/locations/{location}/jobs/{job}
5578 pub name: std::string::String,
5579
5580 /// Output only. Server assigned unique identifier for the Execution. The value
5581 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
5582 /// deleted.
5583 pub uid: std::string::String,
5584
5585 /// Output only. A number that monotonically increases every time the user
5586 /// modifies the desired state.
5587 pub generation: i64,
5588
5589 /// Unstructured key value map that can be used to organize and categorize
5590 /// objects.
5591 /// User-provided labels are shared with Google's billing system, so they can
5592 /// be used to filter, or break down billing charges by team, component,
5593 /// environment, state, etc. For more information, visit
5594 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
5595 /// <https://cloud.google.com/run/docs/configuring/labels>.
5596 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5597
5598 /// Unstructured key value map that may
5599 /// be set by external tools to store and arbitrary metadata.
5600 /// They are not queryable and should be preserved
5601 /// when modifying objects.
5602 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
5603
5604 /// Output only. The creation time.
5605 pub create_time: std::option::Option<wkt::Timestamp>,
5606
5607 /// Output only. The last-modified time.
5608 pub update_time: std::option::Option<wkt::Timestamp>,
5609
5610 /// Output only. The deletion time. It is only populated as a response to a
5611 /// Delete request.
5612 pub delete_time: std::option::Option<wkt::Timestamp>,
5613
5614 /// Output only. For a deleted resource, the time after which it will be
5615 /// permamently deleted.
5616 pub expire_time: std::option::Option<wkt::Timestamp>,
5617
5618 /// Output only. Email address of the authenticated creator.
5619 pub creator: std::string::String,
5620
5621 /// Output only. Email address of the last authenticated modifier.
5622 pub last_modifier: std::string::String,
5623
5624 /// Arbitrary identifier for the API client.
5625 pub client: std::string::String,
5626
5627 /// Arbitrary version identifier for the API client.
5628 pub client_version: std::string::String,
5629
5630 /// The launch stage as defined by [Google Cloud Platform
5631 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
5632 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
5633 /// is assumed.
5634 /// Set the launch stage to a preview stage on input to allow use of preview
5635 /// features in that stage. On read (or output), describes whether the resource
5636 /// uses preview features.
5637 ///
5638 /// For example, if ALPHA is provided as input, but only BETA and GA-level
5639 /// features are used, this field will be BETA on output.
5640 pub launch_stage: google_cloud_api::model::LaunchStage,
5641
5642 /// Settings for the Binary Authorization feature.
5643 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
5644
5645 /// Required. The template used to create executions for this Job.
5646 pub template: std::option::Option<crate::model::ExecutionTemplate>,
5647
5648 /// Output only. The generation of this Job. See comments in `reconciling` for
5649 /// additional information on reconciliation process in Cloud Run.
5650 pub observed_generation: i64,
5651
5652 /// Output only. The Condition of this Job, containing its readiness status,
5653 /// and detailed error information in case it did not reach the desired state.
5654 pub terminal_condition: std::option::Option<crate::model::Condition>,
5655
5656 /// Output only. The Conditions of all other associated sub-resources. They
5657 /// contain additional diagnostics information in case the Job does not reach
5658 /// its desired state. See comments in `reconciling` for additional information
5659 /// on reconciliation process in Cloud Run.
5660 pub conditions: std::vec::Vec<crate::model::Condition>,
5661
5662 /// Output only. Number of executions created for this job.
5663 pub execution_count: i32,
5664
5665 /// Output only. Name of the last created execution.
5666 pub latest_created_execution: std::option::Option<crate::model::ExecutionReference>,
5667
5668 /// Output only. Returns true if the Job is currently being acted upon by the
5669 /// system to bring it into the desired state.
5670 ///
5671 /// When a new Job is created, or an existing one is updated, Cloud Run
5672 /// will asynchronously perform all necessary steps to bring the Job to the
5673 /// desired state. This process is called reconciliation.
5674 /// While reconciliation is in process, `observed_generation` and
5675 /// `latest_succeeded_execution`, will have transient values that might
5676 /// mismatch the intended state: Once reconciliation is over (and this field is
5677 /// false), there are two possible outcomes: reconciliation succeeded and the
5678 /// state matches the Job, or there was an error, and reconciliation failed.
5679 /// This state can be found in `terminal_condition.state`.
5680 ///
5681 /// If reconciliation succeeded, the following fields will match:
5682 /// `observed_generation` and `generation`, `latest_succeeded_execution` and
5683 /// `latest_created_execution`.
5684 ///
5685 /// If reconciliation failed, `observed_generation` and
5686 /// `latest_succeeded_execution` will have the state of the last succeeded
5687 /// execution or empty for newly created Job. Additional information on the
5688 /// failure can be found in `terminal_condition` and `conditions`.
5689 pub reconciling: bool,
5690
5691 /// Output only. Reserved for future use.
5692 pub satisfies_pzs: bool,
5693
5694 /// Optional. A system-generated fingerprint for this version of the
5695 /// resource. May be used to detect modification conflict during updates.
5696 pub etag: std::string::String,
5697
5698 #[allow(missing_docs)]
5699 pub create_execution: std::option::Option<crate::model::job::CreateExecution>,
5700
5701 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5702}
5703
5704impl Job {
5705 /// Creates a new default instance.
5706 pub fn new() -> Self {
5707 std::default::Default::default()
5708 }
5709
5710 /// Sets the value of [name][crate::model::Job::name].
5711 ///
5712 /// # Example
5713 /// ```ignore,no_run
5714 /// # use google_cloud_run_v2::model::Job;
5715 /// # let project_id = "project_id";
5716 /// # let location_id = "location_id";
5717 /// # let job_id = "job_id";
5718 /// let x = Job::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
5719 /// ```
5720 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5721 self.name = v.into();
5722 self
5723 }
5724
5725 /// Sets the value of [uid][crate::model::Job::uid].
5726 ///
5727 /// # Example
5728 /// ```ignore,no_run
5729 /// # use google_cloud_run_v2::model::Job;
5730 /// let x = Job::new().set_uid("example");
5731 /// ```
5732 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5733 self.uid = v.into();
5734 self
5735 }
5736
5737 /// Sets the value of [generation][crate::model::Job::generation].
5738 ///
5739 /// # Example
5740 /// ```ignore,no_run
5741 /// # use google_cloud_run_v2::model::Job;
5742 /// let x = Job::new().set_generation(42);
5743 /// ```
5744 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5745 self.generation = v.into();
5746 self
5747 }
5748
5749 /// Sets the value of [labels][crate::model::Job::labels].
5750 ///
5751 /// # Example
5752 /// ```ignore,no_run
5753 /// # use google_cloud_run_v2::model::Job;
5754 /// let x = Job::new().set_labels([
5755 /// ("key0", "abc"),
5756 /// ("key1", "xyz"),
5757 /// ]);
5758 /// ```
5759 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5760 where
5761 T: std::iter::IntoIterator<Item = (K, V)>,
5762 K: std::convert::Into<std::string::String>,
5763 V: std::convert::Into<std::string::String>,
5764 {
5765 use std::iter::Iterator;
5766 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5767 self
5768 }
5769
5770 /// Sets the value of [annotations][crate::model::Job::annotations].
5771 ///
5772 /// # Example
5773 /// ```ignore,no_run
5774 /// # use google_cloud_run_v2::model::Job;
5775 /// let x = Job::new().set_annotations([
5776 /// ("key0", "abc"),
5777 /// ("key1", "xyz"),
5778 /// ]);
5779 /// ```
5780 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5781 where
5782 T: std::iter::IntoIterator<Item = (K, V)>,
5783 K: std::convert::Into<std::string::String>,
5784 V: std::convert::Into<std::string::String>,
5785 {
5786 use std::iter::Iterator;
5787 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5788 self
5789 }
5790
5791 /// Sets the value of [create_time][crate::model::Job::create_time].
5792 ///
5793 /// # Example
5794 /// ```ignore,no_run
5795 /// # use google_cloud_run_v2::model::Job;
5796 /// use wkt::Timestamp;
5797 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
5798 /// ```
5799 pub fn set_create_time<T>(mut self, v: T) -> Self
5800 where
5801 T: std::convert::Into<wkt::Timestamp>,
5802 {
5803 self.create_time = std::option::Option::Some(v.into());
5804 self
5805 }
5806
5807 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
5808 ///
5809 /// # Example
5810 /// ```ignore,no_run
5811 /// # use google_cloud_run_v2::model::Job;
5812 /// use wkt::Timestamp;
5813 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5814 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
5815 /// ```
5816 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5817 where
5818 T: std::convert::Into<wkt::Timestamp>,
5819 {
5820 self.create_time = v.map(|x| x.into());
5821 self
5822 }
5823
5824 /// Sets the value of [update_time][crate::model::Job::update_time].
5825 ///
5826 /// # Example
5827 /// ```ignore,no_run
5828 /// # use google_cloud_run_v2::model::Job;
5829 /// use wkt::Timestamp;
5830 /// let x = Job::new().set_update_time(Timestamp::default()/* use setters */);
5831 /// ```
5832 pub fn set_update_time<T>(mut self, v: T) -> Self
5833 where
5834 T: std::convert::Into<wkt::Timestamp>,
5835 {
5836 self.update_time = std::option::Option::Some(v.into());
5837 self
5838 }
5839
5840 /// Sets or clears the value of [update_time][crate::model::Job::update_time].
5841 ///
5842 /// # Example
5843 /// ```ignore,no_run
5844 /// # use google_cloud_run_v2::model::Job;
5845 /// use wkt::Timestamp;
5846 /// let x = Job::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5847 /// let x = Job::new().set_or_clear_update_time(None::<Timestamp>);
5848 /// ```
5849 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5850 where
5851 T: std::convert::Into<wkt::Timestamp>,
5852 {
5853 self.update_time = v.map(|x| x.into());
5854 self
5855 }
5856
5857 /// Sets the value of [delete_time][crate::model::Job::delete_time].
5858 ///
5859 /// # Example
5860 /// ```ignore,no_run
5861 /// # use google_cloud_run_v2::model::Job;
5862 /// use wkt::Timestamp;
5863 /// let x = Job::new().set_delete_time(Timestamp::default()/* use setters */);
5864 /// ```
5865 pub fn set_delete_time<T>(mut self, v: T) -> Self
5866 where
5867 T: std::convert::Into<wkt::Timestamp>,
5868 {
5869 self.delete_time = std::option::Option::Some(v.into());
5870 self
5871 }
5872
5873 /// Sets or clears the value of [delete_time][crate::model::Job::delete_time].
5874 ///
5875 /// # Example
5876 /// ```ignore,no_run
5877 /// # use google_cloud_run_v2::model::Job;
5878 /// use wkt::Timestamp;
5879 /// let x = Job::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
5880 /// let x = Job::new().set_or_clear_delete_time(None::<Timestamp>);
5881 /// ```
5882 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
5883 where
5884 T: std::convert::Into<wkt::Timestamp>,
5885 {
5886 self.delete_time = v.map(|x| x.into());
5887 self
5888 }
5889
5890 /// Sets the value of [expire_time][crate::model::Job::expire_time].
5891 ///
5892 /// # Example
5893 /// ```ignore,no_run
5894 /// # use google_cloud_run_v2::model::Job;
5895 /// use wkt::Timestamp;
5896 /// let x = Job::new().set_expire_time(Timestamp::default()/* use setters */);
5897 /// ```
5898 pub fn set_expire_time<T>(mut self, v: T) -> Self
5899 where
5900 T: std::convert::Into<wkt::Timestamp>,
5901 {
5902 self.expire_time = std::option::Option::Some(v.into());
5903 self
5904 }
5905
5906 /// Sets or clears the value of [expire_time][crate::model::Job::expire_time].
5907 ///
5908 /// # Example
5909 /// ```ignore,no_run
5910 /// # use google_cloud_run_v2::model::Job;
5911 /// use wkt::Timestamp;
5912 /// let x = Job::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5913 /// let x = Job::new().set_or_clear_expire_time(None::<Timestamp>);
5914 /// ```
5915 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5916 where
5917 T: std::convert::Into<wkt::Timestamp>,
5918 {
5919 self.expire_time = v.map(|x| x.into());
5920 self
5921 }
5922
5923 /// Sets the value of [creator][crate::model::Job::creator].
5924 ///
5925 /// # Example
5926 /// ```ignore,no_run
5927 /// # use google_cloud_run_v2::model::Job;
5928 /// let x = Job::new().set_creator("example");
5929 /// ```
5930 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5931 self.creator = v.into();
5932 self
5933 }
5934
5935 /// Sets the value of [last_modifier][crate::model::Job::last_modifier].
5936 ///
5937 /// # Example
5938 /// ```ignore,no_run
5939 /// # use google_cloud_run_v2::model::Job;
5940 /// let x = Job::new().set_last_modifier("example");
5941 /// ```
5942 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5943 self.last_modifier = v.into();
5944 self
5945 }
5946
5947 /// Sets the value of [client][crate::model::Job::client].
5948 ///
5949 /// # Example
5950 /// ```ignore,no_run
5951 /// # use google_cloud_run_v2::model::Job;
5952 /// let x = Job::new().set_client("example");
5953 /// ```
5954 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5955 self.client = v.into();
5956 self
5957 }
5958
5959 /// Sets the value of [client_version][crate::model::Job::client_version].
5960 ///
5961 /// # Example
5962 /// ```ignore,no_run
5963 /// # use google_cloud_run_v2::model::Job;
5964 /// let x = Job::new().set_client_version("example");
5965 /// ```
5966 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5967 self.client_version = v.into();
5968 self
5969 }
5970
5971 /// Sets the value of [launch_stage][crate::model::Job::launch_stage].
5972 ///
5973 /// # Example
5974 /// ```ignore,no_run
5975 /// # use google_cloud_run_v2::model::Job;
5976 /// use google_cloud_api::model::LaunchStage;
5977 /// let x0 = Job::new().set_launch_stage(LaunchStage::Unimplemented);
5978 /// let x1 = Job::new().set_launch_stage(LaunchStage::Prelaunch);
5979 /// let x2 = Job::new().set_launch_stage(LaunchStage::EarlyAccess);
5980 /// ```
5981 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
5982 mut self,
5983 v: T,
5984 ) -> Self {
5985 self.launch_stage = v.into();
5986 self
5987 }
5988
5989 /// Sets the value of [binary_authorization][crate::model::Job::binary_authorization].
5990 ///
5991 /// # Example
5992 /// ```ignore,no_run
5993 /// # use google_cloud_run_v2::model::Job;
5994 /// use google_cloud_run_v2::model::BinaryAuthorization;
5995 /// let x = Job::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
5996 /// ```
5997 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
5998 where
5999 T: std::convert::Into<crate::model::BinaryAuthorization>,
6000 {
6001 self.binary_authorization = std::option::Option::Some(v.into());
6002 self
6003 }
6004
6005 /// Sets or clears the value of [binary_authorization][crate::model::Job::binary_authorization].
6006 ///
6007 /// # Example
6008 /// ```ignore,no_run
6009 /// # use google_cloud_run_v2::model::Job;
6010 /// use google_cloud_run_v2::model::BinaryAuthorization;
6011 /// let x = Job::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
6012 /// let x = Job::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
6013 /// ```
6014 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
6015 where
6016 T: std::convert::Into<crate::model::BinaryAuthorization>,
6017 {
6018 self.binary_authorization = v.map(|x| x.into());
6019 self
6020 }
6021
6022 /// Sets the value of [template][crate::model::Job::template].
6023 ///
6024 /// # Example
6025 /// ```ignore,no_run
6026 /// # use google_cloud_run_v2::model::Job;
6027 /// use google_cloud_run_v2::model::ExecutionTemplate;
6028 /// let x = Job::new().set_template(ExecutionTemplate::default()/* use setters */);
6029 /// ```
6030 pub fn set_template<T>(mut self, v: T) -> Self
6031 where
6032 T: std::convert::Into<crate::model::ExecutionTemplate>,
6033 {
6034 self.template = std::option::Option::Some(v.into());
6035 self
6036 }
6037
6038 /// Sets or clears the value of [template][crate::model::Job::template].
6039 ///
6040 /// # Example
6041 /// ```ignore,no_run
6042 /// # use google_cloud_run_v2::model::Job;
6043 /// use google_cloud_run_v2::model::ExecutionTemplate;
6044 /// let x = Job::new().set_or_clear_template(Some(ExecutionTemplate::default()/* use setters */));
6045 /// let x = Job::new().set_or_clear_template(None::<ExecutionTemplate>);
6046 /// ```
6047 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
6048 where
6049 T: std::convert::Into<crate::model::ExecutionTemplate>,
6050 {
6051 self.template = v.map(|x| x.into());
6052 self
6053 }
6054
6055 /// Sets the value of [observed_generation][crate::model::Job::observed_generation].
6056 ///
6057 /// # Example
6058 /// ```ignore,no_run
6059 /// # use google_cloud_run_v2::model::Job;
6060 /// let x = Job::new().set_observed_generation(42);
6061 /// ```
6062 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6063 self.observed_generation = v.into();
6064 self
6065 }
6066
6067 /// Sets the value of [terminal_condition][crate::model::Job::terminal_condition].
6068 ///
6069 /// # Example
6070 /// ```ignore,no_run
6071 /// # use google_cloud_run_v2::model::Job;
6072 /// use google_cloud_run_v2::model::Condition;
6073 /// let x = Job::new().set_terminal_condition(Condition::default()/* use setters */);
6074 /// ```
6075 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
6076 where
6077 T: std::convert::Into<crate::model::Condition>,
6078 {
6079 self.terminal_condition = std::option::Option::Some(v.into());
6080 self
6081 }
6082
6083 /// Sets or clears the value of [terminal_condition][crate::model::Job::terminal_condition].
6084 ///
6085 /// # Example
6086 /// ```ignore,no_run
6087 /// # use google_cloud_run_v2::model::Job;
6088 /// use google_cloud_run_v2::model::Condition;
6089 /// let x = Job::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
6090 /// let x = Job::new().set_or_clear_terminal_condition(None::<Condition>);
6091 /// ```
6092 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
6093 where
6094 T: std::convert::Into<crate::model::Condition>,
6095 {
6096 self.terminal_condition = v.map(|x| x.into());
6097 self
6098 }
6099
6100 /// Sets the value of [conditions][crate::model::Job::conditions].
6101 ///
6102 /// # Example
6103 /// ```ignore,no_run
6104 /// # use google_cloud_run_v2::model::Job;
6105 /// use google_cloud_run_v2::model::Condition;
6106 /// let x = Job::new()
6107 /// .set_conditions([
6108 /// Condition::default()/* use setters */,
6109 /// Condition::default()/* use (different) setters */,
6110 /// ]);
6111 /// ```
6112 pub fn set_conditions<T, V>(mut self, v: T) -> Self
6113 where
6114 T: std::iter::IntoIterator<Item = V>,
6115 V: std::convert::Into<crate::model::Condition>,
6116 {
6117 use std::iter::Iterator;
6118 self.conditions = v.into_iter().map(|i| i.into()).collect();
6119 self
6120 }
6121
6122 /// Sets the value of [execution_count][crate::model::Job::execution_count].
6123 ///
6124 /// # Example
6125 /// ```ignore,no_run
6126 /// # use google_cloud_run_v2::model::Job;
6127 /// let x = Job::new().set_execution_count(42);
6128 /// ```
6129 pub fn set_execution_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6130 self.execution_count = v.into();
6131 self
6132 }
6133
6134 /// Sets the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6135 ///
6136 /// # Example
6137 /// ```ignore,no_run
6138 /// # use google_cloud_run_v2::model::Job;
6139 /// use google_cloud_run_v2::model::ExecutionReference;
6140 /// let x = Job::new().set_latest_created_execution(ExecutionReference::default()/* use setters */);
6141 /// ```
6142 pub fn set_latest_created_execution<T>(mut self, v: T) -> Self
6143 where
6144 T: std::convert::Into<crate::model::ExecutionReference>,
6145 {
6146 self.latest_created_execution = std::option::Option::Some(v.into());
6147 self
6148 }
6149
6150 /// Sets or clears the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6151 ///
6152 /// # Example
6153 /// ```ignore,no_run
6154 /// # use google_cloud_run_v2::model::Job;
6155 /// use google_cloud_run_v2::model::ExecutionReference;
6156 /// let x = Job::new().set_or_clear_latest_created_execution(Some(ExecutionReference::default()/* use setters */));
6157 /// let x = Job::new().set_or_clear_latest_created_execution(None::<ExecutionReference>);
6158 /// ```
6159 pub fn set_or_clear_latest_created_execution<T>(mut self, v: std::option::Option<T>) -> Self
6160 where
6161 T: std::convert::Into<crate::model::ExecutionReference>,
6162 {
6163 self.latest_created_execution = v.map(|x| x.into());
6164 self
6165 }
6166
6167 /// Sets the value of [reconciling][crate::model::Job::reconciling].
6168 ///
6169 /// # Example
6170 /// ```ignore,no_run
6171 /// # use google_cloud_run_v2::model::Job;
6172 /// let x = Job::new().set_reconciling(true);
6173 /// ```
6174 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6175 self.reconciling = v.into();
6176 self
6177 }
6178
6179 /// Sets the value of [satisfies_pzs][crate::model::Job::satisfies_pzs].
6180 ///
6181 /// # Example
6182 /// ```ignore,no_run
6183 /// # use google_cloud_run_v2::model::Job;
6184 /// let x = Job::new().set_satisfies_pzs(true);
6185 /// ```
6186 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6187 self.satisfies_pzs = v.into();
6188 self
6189 }
6190
6191 /// Sets the value of [etag][crate::model::Job::etag].
6192 ///
6193 /// # Example
6194 /// ```ignore,no_run
6195 /// # use google_cloud_run_v2::model::Job;
6196 /// let x = Job::new().set_etag("example");
6197 /// ```
6198 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6199 self.etag = v.into();
6200 self
6201 }
6202
6203 /// Sets the value of [create_execution][crate::model::Job::create_execution].
6204 ///
6205 /// Note that all the setters affecting `create_execution` are mutually
6206 /// exclusive.
6207 ///
6208 /// # Example
6209 /// ```ignore,no_run
6210 /// # use google_cloud_run_v2::model::Job;
6211 /// use google_cloud_run_v2::model::job::CreateExecution;
6212 /// let x = Job::new().set_create_execution(Some(CreateExecution::StartExecutionToken("example".to_string())));
6213 /// ```
6214 pub fn set_create_execution<
6215 T: std::convert::Into<std::option::Option<crate::model::job::CreateExecution>>,
6216 >(
6217 mut self,
6218 v: T,
6219 ) -> Self {
6220 self.create_execution = v.into();
6221 self
6222 }
6223
6224 /// The value of [create_execution][crate::model::Job::create_execution]
6225 /// if it holds a `StartExecutionToken`, `None` if the field is not set or
6226 /// holds a different branch.
6227 pub fn start_execution_token(&self) -> std::option::Option<&std::string::String> {
6228 #[allow(unreachable_patterns)]
6229 self.create_execution.as_ref().and_then(|v| match v {
6230 crate::model::job::CreateExecution::StartExecutionToken(v) => {
6231 std::option::Option::Some(v)
6232 }
6233 _ => std::option::Option::None,
6234 })
6235 }
6236
6237 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6238 /// to hold a `StartExecutionToken`.
6239 ///
6240 /// Note that all the setters affecting `create_execution` are
6241 /// mutually exclusive.
6242 ///
6243 /// # Example
6244 /// ```ignore,no_run
6245 /// # use google_cloud_run_v2::model::Job;
6246 /// let x = Job::new().set_start_execution_token("example");
6247 /// assert!(x.start_execution_token().is_some());
6248 /// assert!(x.run_execution_token().is_none());
6249 /// ```
6250 pub fn set_start_execution_token<T: std::convert::Into<std::string::String>>(
6251 mut self,
6252 v: T,
6253 ) -> Self {
6254 self.create_execution = std::option::Option::Some(
6255 crate::model::job::CreateExecution::StartExecutionToken(v.into()),
6256 );
6257 self
6258 }
6259
6260 /// The value of [create_execution][crate::model::Job::create_execution]
6261 /// if it holds a `RunExecutionToken`, `None` if the field is not set or
6262 /// holds a different branch.
6263 pub fn run_execution_token(&self) -> std::option::Option<&std::string::String> {
6264 #[allow(unreachable_patterns)]
6265 self.create_execution.as_ref().and_then(|v| match v {
6266 crate::model::job::CreateExecution::RunExecutionToken(v) => {
6267 std::option::Option::Some(v)
6268 }
6269 _ => std::option::Option::None,
6270 })
6271 }
6272
6273 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6274 /// to hold a `RunExecutionToken`.
6275 ///
6276 /// Note that all the setters affecting `create_execution` are
6277 /// mutually exclusive.
6278 ///
6279 /// # Example
6280 /// ```ignore,no_run
6281 /// # use google_cloud_run_v2::model::Job;
6282 /// let x = Job::new().set_run_execution_token("example");
6283 /// assert!(x.run_execution_token().is_some());
6284 /// assert!(x.start_execution_token().is_none());
6285 /// ```
6286 pub fn set_run_execution_token<T: std::convert::Into<std::string::String>>(
6287 mut self,
6288 v: T,
6289 ) -> Self {
6290 self.create_execution = std::option::Option::Some(
6291 crate::model::job::CreateExecution::RunExecutionToken(v.into()),
6292 );
6293 self
6294 }
6295}
6296
6297impl wkt::message::Message for Job {
6298 fn typename() -> &'static str {
6299 "type.googleapis.com/google.cloud.run.v2.Job"
6300 }
6301}
6302
6303/// Defines additional types related to [Job].
6304pub mod job {
6305 #[allow(unused_imports)]
6306 use super::*;
6307
6308 #[allow(missing_docs)]
6309 #[derive(Clone, Debug, PartialEq)]
6310 #[non_exhaustive]
6311 pub enum CreateExecution {
6312 /// A unique string used as a suffix creating a new execution. The Job will
6313 /// become ready when the execution is successfully started.
6314 /// The sum of job name and token length must be fewer than 63 characters.
6315 StartExecutionToken(std::string::String),
6316 /// A unique string used as a suffix for creating a new execution. The Job
6317 /// will become ready when the execution is successfully completed.
6318 /// The sum of job name and token length must be fewer than 63 characters.
6319 RunExecutionToken(std::string::String),
6320 }
6321}
6322
6323/// Reference to an Execution. Use /Executions.GetExecution with the given name
6324/// to get full execution including the latest status.
6325#[derive(Clone, Default, PartialEq)]
6326#[non_exhaustive]
6327pub struct ExecutionReference {
6328 /// Name of the execution.
6329 pub name: std::string::String,
6330
6331 /// Creation timestamp of the execution.
6332 pub create_time: std::option::Option<wkt::Timestamp>,
6333
6334 /// Creation timestamp of the execution.
6335 pub completion_time: std::option::Option<wkt::Timestamp>,
6336
6337 /// The deletion time of the execution. It is only
6338 /// populated as a response to a Delete request.
6339 pub delete_time: std::option::Option<wkt::Timestamp>,
6340
6341 /// Status for the execution completion.
6342 pub completion_status: crate::model::execution_reference::CompletionStatus,
6343
6344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6345}
6346
6347impl ExecutionReference {
6348 /// Creates a new default instance.
6349 pub fn new() -> Self {
6350 std::default::Default::default()
6351 }
6352
6353 /// Sets the value of [name][crate::model::ExecutionReference::name].
6354 ///
6355 /// # Example
6356 /// ```ignore,no_run
6357 /// # use google_cloud_run_v2::model::ExecutionReference;
6358 /// # let project_id = "project_id";
6359 /// # let location_id = "location_id";
6360 /// # let job_id = "job_id";
6361 /// # let execution_id = "execution_id";
6362 /// let x = ExecutionReference::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
6363 /// ```
6364 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6365 self.name = v.into();
6366 self
6367 }
6368
6369 /// Sets the value of [create_time][crate::model::ExecutionReference::create_time].
6370 ///
6371 /// # Example
6372 /// ```ignore,no_run
6373 /// # use google_cloud_run_v2::model::ExecutionReference;
6374 /// use wkt::Timestamp;
6375 /// let x = ExecutionReference::new().set_create_time(Timestamp::default()/* use setters */);
6376 /// ```
6377 pub fn set_create_time<T>(mut self, v: T) -> Self
6378 where
6379 T: std::convert::Into<wkt::Timestamp>,
6380 {
6381 self.create_time = std::option::Option::Some(v.into());
6382 self
6383 }
6384
6385 /// Sets or clears the value of [create_time][crate::model::ExecutionReference::create_time].
6386 ///
6387 /// # Example
6388 /// ```ignore,no_run
6389 /// # use google_cloud_run_v2::model::ExecutionReference;
6390 /// use wkt::Timestamp;
6391 /// let x = ExecutionReference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6392 /// let x = ExecutionReference::new().set_or_clear_create_time(None::<Timestamp>);
6393 /// ```
6394 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6395 where
6396 T: std::convert::Into<wkt::Timestamp>,
6397 {
6398 self.create_time = v.map(|x| x.into());
6399 self
6400 }
6401
6402 /// Sets the value of [completion_time][crate::model::ExecutionReference::completion_time].
6403 ///
6404 /// # Example
6405 /// ```ignore,no_run
6406 /// # use google_cloud_run_v2::model::ExecutionReference;
6407 /// use wkt::Timestamp;
6408 /// let x = ExecutionReference::new().set_completion_time(Timestamp::default()/* use setters */);
6409 /// ```
6410 pub fn set_completion_time<T>(mut self, v: T) -> Self
6411 where
6412 T: std::convert::Into<wkt::Timestamp>,
6413 {
6414 self.completion_time = std::option::Option::Some(v.into());
6415 self
6416 }
6417
6418 /// Sets or clears the value of [completion_time][crate::model::ExecutionReference::completion_time].
6419 ///
6420 /// # Example
6421 /// ```ignore,no_run
6422 /// # use google_cloud_run_v2::model::ExecutionReference;
6423 /// use wkt::Timestamp;
6424 /// let x = ExecutionReference::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
6425 /// let x = ExecutionReference::new().set_or_clear_completion_time(None::<Timestamp>);
6426 /// ```
6427 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
6428 where
6429 T: std::convert::Into<wkt::Timestamp>,
6430 {
6431 self.completion_time = v.map(|x| x.into());
6432 self
6433 }
6434
6435 /// Sets the value of [delete_time][crate::model::ExecutionReference::delete_time].
6436 ///
6437 /// # Example
6438 /// ```ignore,no_run
6439 /// # use google_cloud_run_v2::model::ExecutionReference;
6440 /// use wkt::Timestamp;
6441 /// let x = ExecutionReference::new().set_delete_time(Timestamp::default()/* use setters */);
6442 /// ```
6443 pub fn set_delete_time<T>(mut self, v: T) -> Self
6444 where
6445 T: std::convert::Into<wkt::Timestamp>,
6446 {
6447 self.delete_time = std::option::Option::Some(v.into());
6448 self
6449 }
6450
6451 /// Sets or clears the value of [delete_time][crate::model::ExecutionReference::delete_time].
6452 ///
6453 /// # Example
6454 /// ```ignore,no_run
6455 /// # use google_cloud_run_v2::model::ExecutionReference;
6456 /// use wkt::Timestamp;
6457 /// let x = ExecutionReference::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
6458 /// let x = ExecutionReference::new().set_or_clear_delete_time(None::<Timestamp>);
6459 /// ```
6460 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
6461 where
6462 T: std::convert::Into<wkt::Timestamp>,
6463 {
6464 self.delete_time = v.map(|x| x.into());
6465 self
6466 }
6467
6468 /// Sets the value of [completion_status][crate::model::ExecutionReference::completion_status].
6469 ///
6470 /// # Example
6471 /// ```ignore,no_run
6472 /// # use google_cloud_run_v2::model::ExecutionReference;
6473 /// use google_cloud_run_v2::model::execution_reference::CompletionStatus;
6474 /// let x0 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionSucceeded);
6475 /// let x1 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionFailed);
6476 /// let x2 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionRunning);
6477 /// ```
6478 pub fn set_completion_status<
6479 T: std::convert::Into<crate::model::execution_reference::CompletionStatus>,
6480 >(
6481 mut self,
6482 v: T,
6483 ) -> Self {
6484 self.completion_status = v.into();
6485 self
6486 }
6487}
6488
6489impl wkt::message::Message for ExecutionReference {
6490 fn typename() -> &'static str {
6491 "type.googleapis.com/google.cloud.run.v2.ExecutionReference"
6492 }
6493}
6494
6495/// Defines additional types related to [ExecutionReference].
6496pub mod execution_reference {
6497 #[allow(unused_imports)]
6498 use super::*;
6499
6500 /// Possible execution completion status.
6501 ///
6502 /// # Working with unknown values
6503 ///
6504 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6505 /// additional enum variants at any time. Adding new variants is not considered
6506 /// a breaking change. Applications should write their code in anticipation of:
6507 ///
6508 /// - New values appearing in future releases of the client library, **and**
6509 /// - New values received dynamically, without application changes.
6510 ///
6511 /// Please consult the [Working with enums] section in the user guide for some
6512 /// guidelines.
6513 ///
6514 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6515 #[derive(Clone, Debug, PartialEq)]
6516 #[non_exhaustive]
6517 pub enum CompletionStatus {
6518 /// The default value. This value is used if the state is omitted.
6519 Unspecified,
6520 /// Job execution has succeeded.
6521 ExecutionSucceeded,
6522 /// Job execution has failed.
6523 ExecutionFailed,
6524 /// Job execution is running normally.
6525 ExecutionRunning,
6526 /// Waiting for backing resources to be provisioned.
6527 ExecutionPending,
6528 /// Job execution has been cancelled by the user.
6529 ExecutionCancelled,
6530 /// If set, the enum was initialized with an unknown value.
6531 ///
6532 /// Applications can examine the value using [CompletionStatus::value] or
6533 /// [CompletionStatus::name].
6534 UnknownValue(completion_status::UnknownValue),
6535 }
6536
6537 #[doc(hidden)]
6538 pub mod completion_status {
6539 #[allow(unused_imports)]
6540 use super::*;
6541 #[derive(Clone, Debug, PartialEq)]
6542 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6543 }
6544
6545 impl CompletionStatus {
6546 /// Gets the enum value.
6547 ///
6548 /// Returns `None` if the enum contains an unknown value deserialized from
6549 /// the string representation of enums.
6550 pub fn value(&self) -> std::option::Option<i32> {
6551 match self {
6552 Self::Unspecified => std::option::Option::Some(0),
6553 Self::ExecutionSucceeded => std::option::Option::Some(1),
6554 Self::ExecutionFailed => std::option::Option::Some(2),
6555 Self::ExecutionRunning => std::option::Option::Some(3),
6556 Self::ExecutionPending => std::option::Option::Some(4),
6557 Self::ExecutionCancelled => std::option::Option::Some(5),
6558 Self::UnknownValue(u) => u.0.value(),
6559 }
6560 }
6561
6562 /// Gets the enum value as a string.
6563 ///
6564 /// Returns `None` if the enum contains an unknown value deserialized from
6565 /// the integer representation of enums.
6566 pub fn name(&self) -> std::option::Option<&str> {
6567 match self {
6568 Self::Unspecified => std::option::Option::Some("COMPLETION_STATUS_UNSPECIFIED"),
6569 Self::ExecutionSucceeded => std::option::Option::Some("EXECUTION_SUCCEEDED"),
6570 Self::ExecutionFailed => std::option::Option::Some("EXECUTION_FAILED"),
6571 Self::ExecutionRunning => std::option::Option::Some("EXECUTION_RUNNING"),
6572 Self::ExecutionPending => std::option::Option::Some("EXECUTION_PENDING"),
6573 Self::ExecutionCancelled => std::option::Option::Some("EXECUTION_CANCELLED"),
6574 Self::UnknownValue(u) => u.0.name(),
6575 }
6576 }
6577 }
6578
6579 impl std::default::Default for CompletionStatus {
6580 fn default() -> Self {
6581 use std::convert::From;
6582 Self::from(0)
6583 }
6584 }
6585
6586 impl std::fmt::Display for CompletionStatus {
6587 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6588 wkt::internal::display_enum(f, self.name(), self.value())
6589 }
6590 }
6591
6592 impl std::convert::From<i32> for CompletionStatus {
6593 fn from(value: i32) -> Self {
6594 match value {
6595 0 => Self::Unspecified,
6596 1 => Self::ExecutionSucceeded,
6597 2 => Self::ExecutionFailed,
6598 3 => Self::ExecutionRunning,
6599 4 => Self::ExecutionPending,
6600 5 => Self::ExecutionCancelled,
6601 _ => Self::UnknownValue(completion_status::UnknownValue(
6602 wkt::internal::UnknownEnumValue::Integer(value),
6603 )),
6604 }
6605 }
6606 }
6607
6608 impl std::convert::From<&str> for CompletionStatus {
6609 fn from(value: &str) -> Self {
6610 use std::string::ToString;
6611 match value {
6612 "COMPLETION_STATUS_UNSPECIFIED" => Self::Unspecified,
6613 "EXECUTION_SUCCEEDED" => Self::ExecutionSucceeded,
6614 "EXECUTION_FAILED" => Self::ExecutionFailed,
6615 "EXECUTION_RUNNING" => Self::ExecutionRunning,
6616 "EXECUTION_PENDING" => Self::ExecutionPending,
6617 "EXECUTION_CANCELLED" => Self::ExecutionCancelled,
6618 _ => Self::UnknownValue(completion_status::UnknownValue(
6619 wkt::internal::UnknownEnumValue::String(value.to_string()),
6620 )),
6621 }
6622 }
6623 }
6624
6625 impl serde::ser::Serialize for CompletionStatus {
6626 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6627 where
6628 S: serde::Serializer,
6629 {
6630 match self {
6631 Self::Unspecified => serializer.serialize_i32(0),
6632 Self::ExecutionSucceeded => serializer.serialize_i32(1),
6633 Self::ExecutionFailed => serializer.serialize_i32(2),
6634 Self::ExecutionRunning => serializer.serialize_i32(3),
6635 Self::ExecutionPending => serializer.serialize_i32(4),
6636 Self::ExecutionCancelled => serializer.serialize_i32(5),
6637 Self::UnknownValue(u) => u.0.serialize(serializer),
6638 }
6639 }
6640 }
6641
6642 impl<'de> serde::de::Deserialize<'de> for CompletionStatus {
6643 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6644 where
6645 D: serde::Deserializer<'de>,
6646 {
6647 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionStatus>::new(
6648 ".google.cloud.run.v2.ExecutionReference.CompletionStatus",
6649 ))
6650 }
6651 }
6652}
6653
6654/// A single application container.
6655/// This specifies both the container to run, the command to run in the container
6656/// and the arguments to supply to it.
6657/// Note that additional arguments can be supplied by the system to the container
6658/// at runtime.
6659#[derive(Clone, Default, PartialEq)]
6660#[non_exhaustive]
6661pub struct Container {
6662 /// Name of the container specified as a DNS_LABEL (RFC 1123).
6663 pub name: std::string::String,
6664
6665 /// Required. Name of the container image in Dockerhub, Google Artifact
6666 /// Registry, or Google Container Registry. If the host is not provided,
6667 /// Dockerhub is assumed.
6668 pub image: std::string::String,
6669
6670 /// Optional. Location of the source.
6671 pub source_code: std::option::Option<crate::model::SourceCode>,
6672
6673 /// Entrypoint array. Not executed within a shell.
6674 /// The docker image's ENTRYPOINT is used if this is not provided.
6675 pub command: std::vec::Vec<std::string::String>,
6676
6677 /// Arguments to the entrypoint.
6678 /// The docker image's CMD is used if this is not provided.
6679 pub args: std::vec::Vec<std::string::String>,
6680
6681 /// List of environment variables to set in the container.
6682 pub env: std::vec::Vec<crate::model::EnvVar>,
6683
6684 /// Compute Resource requirements by this container.
6685 pub resources: std::option::Option<crate::model::ResourceRequirements>,
6686
6687 /// List of ports to expose from the container. Only a single port can be
6688 /// specified. The specified ports must be listening on all interfaces
6689 /// (0.0.0.0) within the container to be accessible.
6690 ///
6691 /// If omitted, a port number will be chosen and passed to the container
6692 /// through the PORT environment variable for the container to listen on.
6693 pub ports: std::vec::Vec<crate::model::ContainerPort>,
6694
6695 /// Volume to mount into the container's filesystem.
6696 pub volume_mounts: std::vec::Vec<crate::model::VolumeMount>,
6697
6698 /// Container's working directory.
6699 /// If not specified, the container runtime's default will be used, which
6700 /// might be configured in the container image.
6701 pub working_dir: std::string::String,
6702
6703 /// Periodic probe of container liveness.
6704 /// Container will be restarted if the probe fails.
6705 pub liveness_probe: std::option::Option<crate::model::Probe>,
6706
6707 /// Startup probe of application within the container.
6708 /// All other probes are disabled if a startup probe is provided, until it
6709 /// succeeds. Container will not be added to service endpoints if the probe
6710 /// fails.
6711 pub startup_probe: std::option::Option<crate::model::Probe>,
6712
6713 /// Readiness probe to be used for health checks.
6714 pub readiness_probe: std::option::Option<crate::model::Probe>,
6715
6716 /// Names of the containers that must start before this container.
6717 pub depends_on: std::vec::Vec<std::string::String>,
6718
6719 /// Base image for this container. Only supported for services. If set, it
6720 /// indicates that the service is enrolled into automatic base image update.
6721 pub base_image_uri: std::string::String,
6722
6723 /// Output only. The build info of the container image.
6724 pub build_info: std::option::Option<crate::model::BuildInfo>,
6725
6726 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6727}
6728
6729impl Container {
6730 /// Creates a new default instance.
6731 pub fn new() -> Self {
6732 std::default::Default::default()
6733 }
6734
6735 /// Sets the value of [name][crate::model::Container::name].
6736 ///
6737 /// # Example
6738 /// ```ignore,no_run
6739 /// # use google_cloud_run_v2::model::Container;
6740 /// let x = Container::new().set_name("example");
6741 /// ```
6742 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6743 self.name = v.into();
6744 self
6745 }
6746
6747 /// Sets the value of [image][crate::model::Container::image].
6748 ///
6749 /// # Example
6750 /// ```ignore,no_run
6751 /// # use google_cloud_run_v2::model::Container;
6752 /// let x = Container::new().set_image("example");
6753 /// ```
6754 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6755 self.image = v.into();
6756 self
6757 }
6758
6759 /// Sets the value of [source_code][crate::model::Container::source_code].
6760 ///
6761 /// # Example
6762 /// ```ignore,no_run
6763 /// # use google_cloud_run_v2::model::Container;
6764 /// use google_cloud_run_v2::model::SourceCode;
6765 /// let x = Container::new().set_source_code(SourceCode::default()/* use setters */);
6766 /// ```
6767 pub fn set_source_code<T>(mut self, v: T) -> Self
6768 where
6769 T: std::convert::Into<crate::model::SourceCode>,
6770 {
6771 self.source_code = std::option::Option::Some(v.into());
6772 self
6773 }
6774
6775 /// Sets or clears the value of [source_code][crate::model::Container::source_code].
6776 ///
6777 /// # Example
6778 /// ```ignore,no_run
6779 /// # use google_cloud_run_v2::model::Container;
6780 /// use google_cloud_run_v2::model::SourceCode;
6781 /// let x = Container::new().set_or_clear_source_code(Some(SourceCode::default()/* use setters */));
6782 /// let x = Container::new().set_or_clear_source_code(None::<SourceCode>);
6783 /// ```
6784 pub fn set_or_clear_source_code<T>(mut self, v: std::option::Option<T>) -> Self
6785 where
6786 T: std::convert::Into<crate::model::SourceCode>,
6787 {
6788 self.source_code = v.map(|x| x.into());
6789 self
6790 }
6791
6792 /// Sets the value of [command][crate::model::Container::command].
6793 ///
6794 /// # Example
6795 /// ```ignore,no_run
6796 /// # use google_cloud_run_v2::model::Container;
6797 /// let x = Container::new().set_command(["a", "b", "c"]);
6798 /// ```
6799 pub fn set_command<T, V>(mut self, v: T) -> Self
6800 where
6801 T: std::iter::IntoIterator<Item = V>,
6802 V: std::convert::Into<std::string::String>,
6803 {
6804 use std::iter::Iterator;
6805 self.command = v.into_iter().map(|i| i.into()).collect();
6806 self
6807 }
6808
6809 /// Sets the value of [args][crate::model::Container::args].
6810 ///
6811 /// # Example
6812 /// ```ignore,no_run
6813 /// # use google_cloud_run_v2::model::Container;
6814 /// let x = Container::new().set_args(["a", "b", "c"]);
6815 /// ```
6816 pub fn set_args<T, V>(mut self, v: T) -> Self
6817 where
6818 T: std::iter::IntoIterator<Item = V>,
6819 V: std::convert::Into<std::string::String>,
6820 {
6821 use std::iter::Iterator;
6822 self.args = v.into_iter().map(|i| i.into()).collect();
6823 self
6824 }
6825
6826 /// Sets the value of [env][crate::model::Container::env].
6827 ///
6828 /// # Example
6829 /// ```ignore,no_run
6830 /// # use google_cloud_run_v2::model::Container;
6831 /// use google_cloud_run_v2::model::EnvVar;
6832 /// let x = Container::new()
6833 /// .set_env([
6834 /// EnvVar::default()/* use setters */,
6835 /// EnvVar::default()/* use (different) setters */,
6836 /// ]);
6837 /// ```
6838 pub fn set_env<T, V>(mut self, v: T) -> Self
6839 where
6840 T: std::iter::IntoIterator<Item = V>,
6841 V: std::convert::Into<crate::model::EnvVar>,
6842 {
6843 use std::iter::Iterator;
6844 self.env = v.into_iter().map(|i| i.into()).collect();
6845 self
6846 }
6847
6848 /// Sets the value of [resources][crate::model::Container::resources].
6849 ///
6850 /// # Example
6851 /// ```ignore,no_run
6852 /// # use google_cloud_run_v2::model::Container;
6853 /// use google_cloud_run_v2::model::ResourceRequirements;
6854 /// let x = Container::new().set_resources(ResourceRequirements::default()/* use setters */);
6855 /// ```
6856 pub fn set_resources<T>(mut self, v: T) -> Self
6857 where
6858 T: std::convert::Into<crate::model::ResourceRequirements>,
6859 {
6860 self.resources = std::option::Option::Some(v.into());
6861 self
6862 }
6863
6864 /// Sets or clears the value of [resources][crate::model::Container::resources].
6865 ///
6866 /// # Example
6867 /// ```ignore,no_run
6868 /// # use google_cloud_run_v2::model::Container;
6869 /// use google_cloud_run_v2::model::ResourceRequirements;
6870 /// let x = Container::new().set_or_clear_resources(Some(ResourceRequirements::default()/* use setters */));
6871 /// let x = Container::new().set_or_clear_resources(None::<ResourceRequirements>);
6872 /// ```
6873 pub fn set_or_clear_resources<T>(mut self, v: std::option::Option<T>) -> Self
6874 where
6875 T: std::convert::Into<crate::model::ResourceRequirements>,
6876 {
6877 self.resources = v.map(|x| x.into());
6878 self
6879 }
6880
6881 /// Sets the value of [ports][crate::model::Container::ports].
6882 ///
6883 /// # Example
6884 /// ```ignore,no_run
6885 /// # use google_cloud_run_v2::model::Container;
6886 /// use google_cloud_run_v2::model::ContainerPort;
6887 /// let x = Container::new()
6888 /// .set_ports([
6889 /// ContainerPort::default()/* use setters */,
6890 /// ContainerPort::default()/* use (different) setters */,
6891 /// ]);
6892 /// ```
6893 pub fn set_ports<T, V>(mut self, v: T) -> Self
6894 where
6895 T: std::iter::IntoIterator<Item = V>,
6896 V: std::convert::Into<crate::model::ContainerPort>,
6897 {
6898 use std::iter::Iterator;
6899 self.ports = v.into_iter().map(|i| i.into()).collect();
6900 self
6901 }
6902
6903 /// Sets the value of [volume_mounts][crate::model::Container::volume_mounts].
6904 ///
6905 /// # Example
6906 /// ```ignore,no_run
6907 /// # use google_cloud_run_v2::model::Container;
6908 /// use google_cloud_run_v2::model::VolumeMount;
6909 /// let x = Container::new()
6910 /// .set_volume_mounts([
6911 /// VolumeMount::default()/* use setters */,
6912 /// VolumeMount::default()/* use (different) setters */,
6913 /// ]);
6914 /// ```
6915 pub fn set_volume_mounts<T, V>(mut self, v: T) -> Self
6916 where
6917 T: std::iter::IntoIterator<Item = V>,
6918 V: std::convert::Into<crate::model::VolumeMount>,
6919 {
6920 use std::iter::Iterator;
6921 self.volume_mounts = v.into_iter().map(|i| i.into()).collect();
6922 self
6923 }
6924
6925 /// Sets the value of [working_dir][crate::model::Container::working_dir].
6926 ///
6927 /// # Example
6928 /// ```ignore,no_run
6929 /// # use google_cloud_run_v2::model::Container;
6930 /// let x = Container::new().set_working_dir("example");
6931 /// ```
6932 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6933 self.working_dir = v.into();
6934 self
6935 }
6936
6937 /// Sets the value of [liveness_probe][crate::model::Container::liveness_probe].
6938 ///
6939 /// # Example
6940 /// ```ignore,no_run
6941 /// # use google_cloud_run_v2::model::Container;
6942 /// use google_cloud_run_v2::model::Probe;
6943 /// let x = Container::new().set_liveness_probe(Probe::default()/* use setters */);
6944 /// ```
6945 pub fn set_liveness_probe<T>(mut self, v: T) -> Self
6946 where
6947 T: std::convert::Into<crate::model::Probe>,
6948 {
6949 self.liveness_probe = std::option::Option::Some(v.into());
6950 self
6951 }
6952
6953 /// Sets or clears the value of [liveness_probe][crate::model::Container::liveness_probe].
6954 ///
6955 /// # Example
6956 /// ```ignore,no_run
6957 /// # use google_cloud_run_v2::model::Container;
6958 /// use google_cloud_run_v2::model::Probe;
6959 /// let x = Container::new().set_or_clear_liveness_probe(Some(Probe::default()/* use setters */));
6960 /// let x = Container::new().set_or_clear_liveness_probe(None::<Probe>);
6961 /// ```
6962 pub fn set_or_clear_liveness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6963 where
6964 T: std::convert::Into<crate::model::Probe>,
6965 {
6966 self.liveness_probe = v.map(|x| x.into());
6967 self
6968 }
6969
6970 /// Sets the value of [startup_probe][crate::model::Container::startup_probe].
6971 ///
6972 /// # Example
6973 /// ```ignore,no_run
6974 /// # use google_cloud_run_v2::model::Container;
6975 /// use google_cloud_run_v2::model::Probe;
6976 /// let x = Container::new().set_startup_probe(Probe::default()/* use setters */);
6977 /// ```
6978 pub fn set_startup_probe<T>(mut self, v: T) -> Self
6979 where
6980 T: std::convert::Into<crate::model::Probe>,
6981 {
6982 self.startup_probe = std::option::Option::Some(v.into());
6983 self
6984 }
6985
6986 /// Sets or clears the value of [startup_probe][crate::model::Container::startup_probe].
6987 ///
6988 /// # Example
6989 /// ```ignore,no_run
6990 /// # use google_cloud_run_v2::model::Container;
6991 /// use google_cloud_run_v2::model::Probe;
6992 /// let x = Container::new().set_or_clear_startup_probe(Some(Probe::default()/* use setters */));
6993 /// let x = Container::new().set_or_clear_startup_probe(None::<Probe>);
6994 /// ```
6995 pub fn set_or_clear_startup_probe<T>(mut self, v: std::option::Option<T>) -> Self
6996 where
6997 T: std::convert::Into<crate::model::Probe>,
6998 {
6999 self.startup_probe = v.map(|x| x.into());
7000 self
7001 }
7002
7003 /// Sets the value of [readiness_probe][crate::model::Container::readiness_probe].
7004 ///
7005 /// # Example
7006 /// ```ignore,no_run
7007 /// # use google_cloud_run_v2::model::Container;
7008 /// use google_cloud_run_v2::model::Probe;
7009 /// let x = Container::new().set_readiness_probe(Probe::default()/* use setters */);
7010 /// ```
7011 pub fn set_readiness_probe<T>(mut self, v: T) -> Self
7012 where
7013 T: std::convert::Into<crate::model::Probe>,
7014 {
7015 self.readiness_probe = std::option::Option::Some(v.into());
7016 self
7017 }
7018
7019 /// Sets or clears the value of [readiness_probe][crate::model::Container::readiness_probe].
7020 ///
7021 /// # Example
7022 /// ```ignore,no_run
7023 /// # use google_cloud_run_v2::model::Container;
7024 /// use google_cloud_run_v2::model::Probe;
7025 /// let x = Container::new().set_or_clear_readiness_probe(Some(Probe::default()/* use setters */));
7026 /// let x = Container::new().set_or_clear_readiness_probe(None::<Probe>);
7027 /// ```
7028 pub fn set_or_clear_readiness_probe<T>(mut self, v: std::option::Option<T>) -> Self
7029 where
7030 T: std::convert::Into<crate::model::Probe>,
7031 {
7032 self.readiness_probe = v.map(|x| x.into());
7033 self
7034 }
7035
7036 /// Sets the value of [depends_on][crate::model::Container::depends_on].
7037 ///
7038 /// # Example
7039 /// ```ignore,no_run
7040 /// # use google_cloud_run_v2::model::Container;
7041 /// let x = Container::new().set_depends_on(["a", "b", "c"]);
7042 /// ```
7043 pub fn set_depends_on<T, V>(mut self, v: T) -> Self
7044 where
7045 T: std::iter::IntoIterator<Item = V>,
7046 V: std::convert::Into<std::string::String>,
7047 {
7048 use std::iter::Iterator;
7049 self.depends_on = v.into_iter().map(|i| i.into()).collect();
7050 self
7051 }
7052
7053 /// Sets the value of [base_image_uri][crate::model::Container::base_image_uri].
7054 ///
7055 /// # Example
7056 /// ```ignore,no_run
7057 /// # use google_cloud_run_v2::model::Container;
7058 /// let x = Container::new().set_base_image_uri("example");
7059 /// ```
7060 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7061 self.base_image_uri = v.into();
7062 self
7063 }
7064
7065 /// Sets the value of [build_info][crate::model::Container::build_info].
7066 ///
7067 /// # Example
7068 /// ```ignore,no_run
7069 /// # use google_cloud_run_v2::model::Container;
7070 /// use google_cloud_run_v2::model::BuildInfo;
7071 /// let x = Container::new().set_build_info(BuildInfo::default()/* use setters */);
7072 /// ```
7073 pub fn set_build_info<T>(mut self, v: T) -> Self
7074 where
7075 T: std::convert::Into<crate::model::BuildInfo>,
7076 {
7077 self.build_info = std::option::Option::Some(v.into());
7078 self
7079 }
7080
7081 /// Sets or clears the value of [build_info][crate::model::Container::build_info].
7082 ///
7083 /// # Example
7084 /// ```ignore,no_run
7085 /// # use google_cloud_run_v2::model::Container;
7086 /// use google_cloud_run_v2::model::BuildInfo;
7087 /// let x = Container::new().set_or_clear_build_info(Some(BuildInfo::default()/* use setters */));
7088 /// let x = Container::new().set_or_clear_build_info(None::<BuildInfo>);
7089 /// ```
7090 pub fn set_or_clear_build_info<T>(mut self, v: std::option::Option<T>) -> Self
7091 where
7092 T: std::convert::Into<crate::model::BuildInfo>,
7093 {
7094 self.build_info = v.map(|x| x.into());
7095 self
7096 }
7097}
7098
7099impl wkt::message::Message for Container {
7100 fn typename() -> &'static str {
7101 "type.googleapis.com/google.cloud.run.v2.Container"
7102 }
7103}
7104
7105/// ResourceRequirements describes the compute resource requirements.
7106#[derive(Clone, Default, PartialEq)]
7107#[non_exhaustive]
7108pub struct ResourceRequirements {
7109 /// Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.
7110 pub limits: std::collections::HashMap<std::string::String, std::string::String>,
7111
7112 /// Determines whether CPU is only allocated during requests (true by default).
7113 /// However, if ResourceRequirements is set, the caller must explicitly
7114 /// set this field to true to preserve the default behavior.
7115 pub cpu_idle: bool,
7116
7117 /// Determines whether CPU should be boosted on startup of a new container
7118 /// instance above the requested CPU threshold, this can help reduce cold-start
7119 /// latency.
7120 pub startup_cpu_boost: bool,
7121
7122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7123}
7124
7125impl ResourceRequirements {
7126 /// Creates a new default instance.
7127 pub fn new() -> Self {
7128 std::default::Default::default()
7129 }
7130
7131 /// Sets the value of [limits][crate::model::ResourceRequirements::limits].
7132 ///
7133 /// # Example
7134 /// ```ignore,no_run
7135 /// # use google_cloud_run_v2::model::ResourceRequirements;
7136 /// let x = ResourceRequirements::new().set_limits([
7137 /// ("key0", "abc"),
7138 /// ("key1", "xyz"),
7139 /// ]);
7140 /// ```
7141 pub fn set_limits<T, K, V>(mut self, v: T) -> Self
7142 where
7143 T: std::iter::IntoIterator<Item = (K, V)>,
7144 K: std::convert::Into<std::string::String>,
7145 V: std::convert::Into<std::string::String>,
7146 {
7147 use std::iter::Iterator;
7148 self.limits = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7149 self
7150 }
7151
7152 /// Sets the value of [cpu_idle][crate::model::ResourceRequirements::cpu_idle].
7153 ///
7154 /// # Example
7155 /// ```ignore,no_run
7156 /// # use google_cloud_run_v2::model::ResourceRequirements;
7157 /// let x = ResourceRequirements::new().set_cpu_idle(true);
7158 /// ```
7159 pub fn set_cpu_idle<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7160 self.cpu_idle = v.into();
7161 self
7162 }
7163
7164 /// Sets the value of [startup_cpu_boost][crate::model::ResourceRequirements::startup_cpu_boost].
7165 ///
7166 /// # Example
7167 /// ```ignore,no_run
7168 /// # use google_cloud_run_v2::model::ResourceRequirements;
7169 /// let x = ResourceRequirements::new().set_startup_cpu_boost(true);
7170 /// ```
7171 pub fn set_startup_cpu_boost<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7172 self.startup_cpu_boost = v.into();
7173 self
7174 }
7175}
7176
7177impl wkt::message::Message for ResourceRequirements {
7178 fn typename() -> &'static str {
7179 "type.googleapis.com/google.cloud.run.v2.ResourceRequirements"
7180 }
7181}
7182
7183/// EnvVar represents an environment variable present in a Container.
7184#[derive(Clone, Default, PartialEq)]
7185#[non_exhaustive]
7186pub struct EnvVar {
7187 /// Required. Name of the environment variable. Must not exceed 32768
7188 /// characters.
7189 pub name: std::string::String,
7190
7191 #[allow(missing_docs)]
7192 pub values: std::option::Option<crate::model::env_var::Values>,
7193
7194 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7195}
7196
7197impl EnvVar {
7198 /// Creates a new default instance.
7199 pub fn new() -> Self {
7200 std::default::Default::default()
7201 }
7202
7203 /// Sets the value of [name][crate::model::EnvVar::name].
7204 ///
7205 /// # Example
7206 /// ```ignore,no_run
7207 /// # use google_cloud_run_v2::model::EnvVar;
7208 /// let x = EnvVar::new().set_name("example");
7209 /// ```
7210 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7211 self.name = v.into();
7212 self
7213 }
7214
7215 /// Sets the value of [values][crate::model::EnvVar::values].
7216 ///
7217 /// Note that all the setters affecting `values` are mutually
7218 /// exclusive.
7219 ///
7220 /// # Example
7221 /// ```ignore,no_run
7222 /// # use google_cloud_run_v2::model::EnvVar;
7223 /// use google_cloud_run_v2::model::env_var::Values;
7224 /// let x = EnvVar::new().set_values(Some(Values::Value("example".to_string())));
7225 /// ```
7226 pub fn set_values<T: std::convert::Into<std::option::Option<crate::model::env_var::Values>>>(
7227 mut self,
7228 v: T,
7229 ) -> Self {
7230 self.values = v.into();
7231 self
7232 }
7233
7234 /// The value of [values][crate::model::EnvVar::values]
7235 /// if it holds a `Value`, `None` if the field is not set or
7236 /// holds a different branch.
7237 pub fn value(&self) -> std::option::Option<&std::string::String> {
7238 #[allow(unreachable_patterns)]
7239 self.values.as_ref().and_then(|v| match v {
7240 crate::model::env_var::Values::Value(v) => std::option::Option::Some(v),
7241 _ => std::option::Option::None,
7242 })
7243 }
7244
7245 /// Sets the value of [values][crate::model::EnvVar::values]
7246 /// to hold a `Value`.
7247 ///
7248 /// Note that all the setters affecting `values` are
7249 /// mutually exclusive.
7250 ///
7251 /// # Example
7252 /// ```ignore,no_run
7253 /// # use google_cloud_run_v2::model::EnvVar;
7254 /// let x = EnvVar::new().set_value("example");
7255 /// assert!(x.value().is_some());
7256 /// assert!(x.value_source().is_none());
7257 /// ```
7258 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7259 self.values = std::option::Option::Some(crate::model::env_var::Values::Value(v.into()));
7260 self
7261 }
7262
7263 /// The value of [values][crate::model::EnvVar::values]
7264 /// if it holds a `ValueSource`, `None` if the field is not set or
7265 /// holds a different branch.
7266 pub fn value_source(
7267 &self,
7268 ) -> std::option::Option<&std::boxed::Box<crate::model::EnvVarSource>> {
7269 #[allow(unreachable_patterns)]
7270 self.values.as_ref().and_then(|v| match v {
7271 crate::model::env_var::Values::ValueSource(v) => std::option::Option::Some(v),
7272 _ => std::option::Option::None,
7273 })
7274 }
7275
7276 /// Sets the value of [values][crate::model::EnvVar::values]
7277 /// to hold a `ValueSource`.
7278 ///
7279 /// Note that all the setters affecting `values` are
7280 /// mutually exclusive.
7281 ///
7282 /// # Example
7283 /// ```ignore,no_run
7284 /// # use google_cloud_run_v2::model::EnvVar;
7285 /// use google_cloud_run_v2::model::EnvVarSource;
7286 /// let x = EnvVar::new().set_value_source(EnvVarSource::default()/* use setters */);
7287 /// assert!(x.value_source().is_some());
7288 /// assert!(x.value().is_none());
7289 /// ```
7290 pub fn set_value_source<T: std::convert::Into<std::boxed::Box<crate::model::EnvVarSource>>>(
7291 mut self,
7292 v: T,
7293 ) -> Self {
7294 self.values =
7295 std::option::Option::Some(crate::model::env_var::Values::ValueSource(v.into()));
7296 self
7297 }
7298}
7299
7300impl wkt::message::Message for EnvVar {
7301 fn typename() -> &'static str {
7302 "type.googleapis.com/google.cloud.run.v2.EnvVar"
7303 }
7304}
7305
7306/// Defines additional types related to [EnvVar].
7307pub mod env_var {
7308 #[allow(unused_imports)]
7309 use super::*;
7310
7311 #[allow(missing_docs)]
7312 #[derive(Clone, Debug, PartialEq)]
7313 #[non_exhaustive]
7314 pub enum Values {
7315 /// Literal value of the environment variable.
7316 /// Defaults to "", and the maximum length is 32768 bytes.
7317 /// Variable references are not supported in Cloud Run.
7318 Value(std::string::String),
7319 /// Source for the environment variable's value.
7320 ValueSource(std::boxed::Box<crate::model::EnvVarSource>),
7321 }
7322}
7323
7324/// EnvVarSource represents a source for the value of an EnvVar.
7325#[derive(Clone, Default, PartialEq)]
7326#[non_exhaustive]
7327pub struct EnvVarSource {
7328 /// Selects a secret and a specific version from Cloud Secret Manager.
7329 pub secret_key_ref: std::option::Option<crate::model::SecretKeySelector>,
7330
7331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7332}
7333
7334impl EnvVarSource {
7335 /// Creates a new default instance.
7336 pub fn new() -> Self {
7337 std::default::Default::default()
7338 }
7339
7340 /// Sets the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7341 ///
7342 /// # Example
7343 /// ```ignore,no_run
7344 /// # use google_cloud_run_v2::model::EnvVarSource;
7345 /// use google_cloud_run_v2::model::SecretKeySelector;
7346 /// let x = EnvVarSource::new().set_secret_key_ref(SecretKeySelector::default()/* use setters */);
7347 /// ```
7348 pub fn set_secret_key_ref<T>(mut self, v: T) -> Self
7349 where
7350 T: std::convert::Into<crate::model::SecretKeySelector>,
7351 {
7352 self.secret_key_ref = std::option::Option::Some(v.into());
7353 self
7354 }
7355
7356 /// Sets or clears the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7357 ///
7358 /// # Example
7359 /// ```ignore,no_run
7360 /// # use google_cloud_run_v2::model::EnvVarSource;
7361 /// use google_cloud_run_v2::model::SecretKeySelector;
7362 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(Some(SecretKeySelector::default()/* use setters */));
7363 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(None::<SecretKeySelector>);
7364 /// ```
7365 pub fn set_or_clear_secret_key_ref<T>(mut self, v: std::option::Option<T>) -> Self
7366 where
7367 T: std::convert::Into<crate::model::SecretKeySelector>,
7368 {
7369 self.secret_key_ref = v.map(|x| x.into());
7370 self
7371 }
7372}
7373
7374impl wkt::message::Message for EnvVarSource {
7375 fn typename() -> &'static str {
7376 "type.googleapis.com/google.cloud.run.v2.EnvVarSource"
7377 }
7378}
7379
7380/// SecretEnvVarSource represents a source for the value of an EnvVar.
7381#[derive(Clone, Default, PartialEq)]
7382#[non_exhaustive]
7383pub struct SecretKeySelector {
7384 /// Required. The name of the secret in Cloud Secret Manager.
7385 /// Format: {secret_name} if the secret is in the same project.
7386 /// projects/{project}/secrets/{secret_name} if the secret is
7387 /// in a different project.
7388 pub secret: std::string::String,
7389
7390 /// The Cloud Secret Manager secret version.
7391 /// Can be 'latest' for the latest version, an integer for a specific version,
7392 /// or a version alias.
7393 pub version: std::string::String,
7394
7395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7396}
7397
7398impl SecretKeySelector {
7399 /// Creates a new default instance.
7400 pub fn new() -> Self {
7401 std::default::Default::default()
7402 }
7403
7404 /// Sets the value of [secret][crate::model::SecretKeySelector::secret].
7405 ///
7406 /// # Example
7407 /// ```ignore,no_run
7408 /// # use google_cloud_run_v2::model::SecretKeySelector;
7409 /// let x = SecretKeySelector::new().set_secret("example");
7410 /// ```
7411 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7412 self.secret = v.into();
7413 self
7414 }
7415
7416 /// Sets the value of [version][crate::model::SecretKeySelector::version].
7417 ///
7418 /// # Example
7419 /// ```ignore,no_run
7420 /// # use google_cloud_run_v2::model::SecretKeySelector;
7421 /// let x = SecretKeySelector::new().set_version("example");
7422 /// ```
7423 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7424 self.version = v.into();
7425 self
7426 }
7427}
7428
7429impl wkt::message::Message for SecretKeySelector {
7430 fn typename() -> &'static str {
7431 "type.googleapis.com/google.cloud.run.v2.SecretKeySelector"
7432 }
7433}
7434
7435/// ContainerPort represents a network port in a single container.
7436#[derive(Clone, Default, PartialEq)]
7437#[non_exhaustive]
7438pub struct ContainerPort {
7439 /// If specified, used to specify which protocol to use.
7440 /// Allowed values are "http1" and "h2c".
7441 pub name: std::string::String,
7442
7443 /// Port number the container listens on.
7444 /// This must be a valid TCP port number, 0 < container_port < 65536.
7445 pub container_port: i32,
7446
7447 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7448}
7449
7450impl ContainerPort {
7451 /// Creates a new default instance.
7452 pub fn new() -> Self {
7453 std::default::Default::default()
7454 }
7455
7456 /// Sets the value of [name][crate::model::ContainerPort::name].
7457 ///
7458 /// # Example
7459 /// ```ignore,no_run
7460 /// # use google_cloud_run_v2::model::ContainerPort;
7461 /// let x = ContainerPort::new().set_name("example");
7462 /// ```
7463 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7464 self.name = v.into();
7465 self
7466 }
7467
7468 /// Sets the value of [container_port][crate::model::ContainerPort::container_port].
7469 ///
7470 /// # Example
7471 /// ```ignore,no_run
7472 /// # use google_cloud_run_v2::model::ContainerPort;
7473 /// let x = ContainerPort::new().set_container_port(42);
7474 /// ```
7475 pub fn set_container_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7476 self.container_port = v.into();
7477 self
7478 }
7479}
7480
7481impl wkt::message::Message for ContainerPort {
7482 fn typename() -> &'static str {
7483 "type.googleapis.com/google.cloud.run.v2.ContainerPort"
7484 }
7485}
7486
7487/// VolumeMount describes a mounting of a Volume within a container.
7488#[derive(Clone, Default, PartialEq)]
7489#[non_exhaustive]
7490pub struct VolumeMount {
7491 /// Required. This must match the Name of a Volume.
7492 pub name: std::string::String,
7493
7494 /// Required. Path within the container at which the volume should be mounted.
7495 /// Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must
7496 /// otherwise be `/cloudsql`. All instances defined in the Volume will be
7497 /// available as `/cloudsql/[instance]`. For more information on Cloud SQL
7498 /// volumes, visit <https://cloud.google.com/sql/docs/mysql/connect-run>
7499 pub mount_path: std::string::String,
7500
7501 /// Optional. Path within the volume from which the container's volume should
7502 /// be mounted. Defaults to "" (volume's root).
7503 pub sub_path: std::string::String,
7504
7505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7506}
7507
7508impl VolumeMount {
7509 /// Creates a new default instance.
7510 pub fn new() -> Self {
7511 std::default::Default::default()
7512 }
7513
7514 /// Sets the value of [name][crate::model::VolumeMount::name].
7515 ///
7516 /// # Example
7517 /// ```ignore,no_run
7518 /// # use google_cloud_run_v2::model::VolumeMount;
7519 /// let x = VolumeMount::new().set_name("example");
7520 /// ```
7521 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7522 self.name = v.into();
7523 self
7524 }
7525
7526 /// Sets the value of [mount_path][crate::model::VolumeMount::mount_path].
7527 ///
7528 /// # Example
7529 /// ```ignore,no_run
7530 /// # use google_cloud_run_v2::model::VolumeMount;
7531 /// let x = VolumeMount::new().set_mount_path("example");
7532 /// ```
7533 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7534 self.mount_path = v.into();
7535 self
7536 }
7537
7538 /// Sets the value of [sub_path][crate::model::VolumeMount::sub_path].
7539 ///
7540 /// # Example
7541 /// ```ignore,no_run
7542 /// # use google_cloud_run_v2::model::VolumeMount;
7543 /// let x = VolumeMount::new().set_sub_path("example");
7544 /// ```
7545 pub fn set_sub_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7546 self.sub_path = v.into();
7547 self
7548 }
7549}
7550
7551impl wkt::message::Message for VolumeMount {
7552 fn typename() -> &'static str {
7553 "type.googleapis.com/google.cloud.run.v2.VolumeMount"
7554 }
7555}
7556
7557/// Volume represents a named volume in a container.
7558#[derive(Clone, Default, PartialEq)]
7559#[non_exhaustive]
7560pub struct Volume {
7561 /// Required. Volume's name.
7562 pub name: std::string::String,
7563
7564 #[allow(missing_docs)]
7565 pub volume_type: std::option::Option<crate::model::volume::VolumeType>,
7566
7567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7568}
7569
7570impl Volume {
7571 /// Creates a new default instance.
7572 pub fn new() -> Self {
7573 std::default::Default::default()
7574 }
7575
7576 /// Sets the value of [name][crate::model::Volume::name].
7577 ///
7578 /// # Example
7579 /// ```ignore,no_run
7580 /// # use google_cloud_run_v2::model::Volume;
7581 /// let x = Volume::new().set_name("example");
7582 /// ```
7583 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7584 self.name = v.into();
7585 self
7586 }
7587
7588 /// Sets the value of [volume_type][crate::model::Volume::volume_type].
7589 ///
7590 /// Note that all the setters affecting `volume_type` are mutually
7591 /// exclusive.
7592 ///
7593 /// # Example
7594 /// ```ignore,no_run
7595 /// # use google_cloud_run_v2::model::Volume;
7596 /// use google_cloud_run_v2::model::SecretVolumeSource;
7597 /// let x = Volume::new().set_volume_type(Some(
7598 /// google_cloud_run_v2::model::volume::VolumeType::Secret(SecretVolumeSource::default().into())));
7599 /// ```
7600 pub fn set_volume_type<
7601 T: std::convert::Into<std::option::Option<crate::model::volume::VolumeType>>,
7602 >(
7603 mut self,
7604 v: T,
7605 ) -> Self {
7606 self.volume_type = v.into();
7607 self
7608 }
7609
7610 /// The value of [volume_type][crate::model::Volume::volume_type]
7611 /// if it holds a `Secret`, `None` if the field is not set or
7612 /// holds a different branch.
7613 pub fn secret(
7614 &self,
7615 ) -> std::option::Option<&std::boxed::Box<crate::model::SecretVolumeSource>> {
7616 #[allow(unreachable_patterns)]
7617 self.volume_type.as_ref().and_then(|v| match v {
7618 crate::model::volume::VolumeType::Secret(v) => std::option::Option::Some(v),
7619 _ => std::option::Option::None,
7620 })
7621 }
7622
7623 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7624 /// to hold a `Secret`.
7625 ///
7626 /// Note that all the setters affecting `volume_type` are
7627 /// mutually exclusive.
7628 ///
7629 /// # Example
7630 /// ```ignore,no_run
7631 /// # use google_cloud_run_v2::model::Volume;
7632 /// use google_cloud_run_v2::model::SecretVolumeSource;
7633 /// let x = Volume::new().set_secret(SecretVolumeSource::default()/* use setters */);
7634 /// assert!(x.secret().is_some());
7635 /// assert!(x.cloud_sql_instance().is_none());
7636 /// assert!(x.empty_dir().is_none());
7637 /// assert!(x.nfs().is_none());
7638 /// assert!(x.gcs().is_none());
7639 /// ```
7640 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretVolumeSource>>>(
7641 mut self,
7642 v: T,
7643 ) -> Self {
7644 self.volume_type =
7645 std::option::Option::Some(crate::model::volume::VolumeType::Secret(v.into()));
7646 self
7647 }
7648
7649 /// The value of [volume_type][crate::model::Volume::volume_type]
7650 /// if it holds a `CloudSqlInstance`, `None` if the field is not set or
7651 /// holds a different branch.
7652 pub fn cloud_sql_instance(
7653 &self,
7654 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSqlInstance>> {
7655 #[allow(unreachable_patterns)]
7656 self.volume_type.as_ref().and_then(|v| match v {
7657 crate::model::volume::VolumeType::CloudSqlInstance(v) => std::option::Option::Some(v),
7658 _ => std::option::Option::None,
7659 })
7660 }
7661
7662 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7663 /// to hold a `CloudSqlInstance`.
7664 ///
7665 /// Note that all the setters affecting `volume_type` are
7666 /// mutually exclusive.
7667 ///
7668 /// # Example
7669 /// ```ignore,no_run
7670 /// # use google_cloud_run_v2::model::Volume;
7671 /// use google_cloud_run_v2::model::CloudSqlInstance;
7672 /// let x = Volume::new().set_cloud_sql_instance(CloudSqlInstance::default()/* use setters */);
7673 /// assert!(x.cloud_sql_instance().is_some());
7674 /// assert!(x.secret().is_none());
7675 /// assert!(x.empty_dir().is_none());
7676 /// assert!(x.nfs().is_none());
7677 /// assert!(x.gcs().is_none());
7678 /// ```
7679 pub fn set_cloud_sql_instance<
7680 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlInstance>>,
7681 >(
7682 mut self,
7683 v: T,
7684 ) -> Self {
7685 self.volume_type =
7686 std::option::Option::Some(crate::model::volume::VolumeType::CloudSqlInstance(v.into()));
7687 self
7688 }
7689
7690 /// The value of [volume_type][crate::model::Volume::volume_type]
7691 /// if it holds a `EmptyDir`, `None` if the field is not set or
7692 /// holds a different branch.
7693 pub fn empty_dir(
7694 &self,
7695 ) -> std::option::Option<&std::boxed::Box<crate::model::EmptyDirVolumeSource>> {
7696 #[allow(unreachable_patterns)]
7697 self.volume_type.as_ref().and_then(|v| match v {
7698 crate::model::volume::VolumeType::EmptyDir(v) => std::option::Option::Some(v),
7699 _ => std::option::Option::None,
7700 })
7701 }
7702
7703 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7704 /// to hold a `EmptyDir`.
7705 ///
7706 /// Note that all the setters affecting `volume_type` are
7707 /// mutually exclusive.
7708 ///
7709 /// # Example
7710 /// ```ignore,no_run
7711 /// # use google_cloud_run_v2::model::Volume;
7712 /// use google_cloud_run_v2::model::EmptyDirVolumeSource;
7713 /// let x = Volume::new().set_empty_dir(EmptyDirVolumeSource::default()/* use setters */);
7714 /// assert!(x.empty_dir().is_some());
7715 /// assert!(x.secret().is_none());
7716 /// assert!(x.cloud_sql_instance().is_none());
7717 /// assert!(x.nfs().is_none());
7718 /// assert!(x.gcs().is_none());
7719 /// ```
7720 pub fn set_empty_dir<
7721 T: std::convert::Into<std::boxed::Box<crate::model::EmptyDirVolumeSource>>,
7722 >(
7723 mut self,
7724 v: T,
7725 ) -> Self {
7726 self.volume_type =
7727 std::option::Option::Some(crate::model::volume::VolumeType::EmptyDir(v.into()));
7728 self
7729 }
7730
7731 /// The value of [volume_type][crate::model::Volume::volume_type]
7732 /// if it holds a `Nfs`, `None` if the field is not set or
7733 /// holds a different branch.
7734 pub fn nfs(&self) -> std::option::Option<&std::boxed::Box<crate::model::NFSVolumeSource>> {
7735 #[allow(unreachable_patterns)]
7736 self.volume_type.as_ref().and_then(|v| match v {
7737 crate::model::volume::VolumeType::Nfs(v) => std::option::Option::Some(v),
7738 _ => std::option::Option::None,
7739 })
7740 }
7741
7742 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7743 /// to hold a `Nfs`.
7744 ///
7745 /// Note that all the setters affecting `volume_type` are
7746 /// mutually exclusive.
7747 ///
7748 /// # Example
7749 /// ```ignore,no_run
7750 /// # use google_cloud_run_v2::model::Volume;
7751 /// use google_cloud_run_v2::model::NFSVolumeSource;
7752 /// let x = Volume::new().set_nfs(NFSVolumeSource::default()/* use setters */);
7753 /// assert!(x.nfs().is_some());
7754 /// assert!(x.secret().is_none());
7755 /// assert!(x.cloud_sql_instance().is_none());
7756 /// assert!(x.empty_dir().is_none());
7757 /// assert!(x.gcs().is_none());
7758 /// ```
7759 pub fn set_nfs<T: std::convert::Into<std::boxed::Box<crate::model::NFSVolumeSource>>>(
7760 mut self,
7761 v: T,
7762 ) -> Self {
7763 self.volume_type =
7764 std::option::Option::Some(crate::model::volume::VolumeType::Nfs(v.into()));
7765 self
7766 }
7767
7768 /// The value of [volume_type][crate::model::Volume::volume_type]
7769 /// if it holds a `Gcs`, `None` if the field is not set or
7770 /// holds a different branch.
7771 pub fn gcs(&self) -> std::option::Option<&std::boxed::Box<crate::model::GCSVolumeSource>> {
7772 #[allow(unreachable_patterns)]
7773 self.volume_type.as_ref().and_then(|v| match v {
7774 crate::model::volume::VolumeType::Gcs(v) => std::option::Option::Some(v),
7775 _ => std::option::Option::None,
7776 })
7777 }
7778
7779 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7780 /// to hold a `Gcs`.
7781 ///
7782 /// Note that all the setters affecting `volume_type` are
7783 /// mutually exclusive.
7784 ///
7785 /// # Example
7786 /// ```ignore,no_run
7787 /// # use google_cloud_run_v2::model::Volume;
7788 /// use google_cloud_run_v2::model::GCSVolumeSource;
7789 /// let x = Volume::new().set_gcs(GCSVolumeSource::default()/* use setters */);
7790 /// assert!(x.gcs().is_some());
7791 /// assert!(x.secret().is_none());
7792 /// assert!(x.cloud_sql_instance().is_none());
7793 /// assert!(x.empty_dir().is_none());
7794 /// assert!(x.nfs().is_none());
7795 /// ```
7796 pub fn set_gcs<T: std::convert::Into<std::boxed::Box<crate::model::GCSVolumeSource>>>(
7797 mut self,
7798 v: T,
7799 ) -> Self {
7800 self.volume_type =
7801 std::option::Option::Some(crate::model::volume::VolumeType::Gcs(v.into()));
7802 self
7803 }
7804}
7805
7806impl wkt::message::Message for Volume {
7807 fn typename() -> &'static str {
7808 "type.googleapis.com/google.cloud.run.v2.Volume"
7809 }
7810}
7811
7812/// Defines additional types related to [Volume].
7813pub mod volume {
7814 #[allow(unused_imports)]
7815 use super::*;
7816
7817 #[allow(missing_docs)]
7818 #[derive(Clone, Debug, PartialEq)]
7819 #[non_exhaustive]
7820 pub enum VolumeType {
7821 /// Secret represents a secret that should populate this volume.
7822 Secret(std::boxed::Box<crate::model::SecretVolumeSource>),
7823 /// For Cloud SQL volumes, contains the specific instances that should be
7824 /// mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
7825 /// more information on how to connect Cloud SQL and Cloud Run.
7826 CloudSqlInstance(std::boxed::Box<crate::model::CloudSqlInstance>),
7827 /// Ephemeral storage used as a shared volume.
7828 EmptyDir(std::boxed::Box<crate::model::EmptyDirVolumeSource>),
7829 /// For NFS Voumes, contains the path to the nfs Volume
7830 Nfs(std::boxed::Box<crate::model::NFSVolumeSource>),
7831 /// Persistent storage backed by a Google Cloud Storage bucket.
7832 Gcs(std::boxed::Box<crate::model::GCSVolumeSource>),
7833 }
7834}
7835
7836/// The secret's value will be presented as the content of a file whose
7837/// name is defined in the item path. If no items are defined, the name of
7838/// the file is the secret.
7839#[derive(Clone, Default, PartialEq)]
7840#[non_exhaustive]
7841pub struct SecretVolumeSource {
7842 /// Required. The name of the secret in Cloud Secret Manager.
7843 /// Format: {secret} if the secret is in the same project.
7844 /// projects/{project}/secrets/{secret} if the secret is
7845 /// in a different project.
7846 pub secret: std::string::String,
7847
7848 /// If unspecified, the volume will expose a file whose name is the
7849 /// secret, relative to VolumeMount.mount_path + VolumeMount.sub_path.
7850 /// If specified, the key will be used as the version to fetch from Cloud
7851 /// Secret Manager and the path will be the name of the file exposed in the
7852 /// volume. When items are defined, they must specify a path and a version.
7853 pub items: std::vec::Vec<crate::model::VersionToPath>,
7854
7855 /// Integer representation of mode bits to use on created files by default.
7856 /// Must be a value between 0000 and 0777 (octal), defaulting to 0444.
7857 /// Directories within the path are not affected by this setting.
7858 ///
7859 /// Notes
7860 ///
7861 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7862 /// * This is an integer representation of the mode bits. So, the octal
7863 /// integer value should look exactly as the chmod numeric notation with a
7864 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7865 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7866 /// 493 (base-10).
7867 /// * This might be in conflict with other options that affect the
7868 /// file mode, like fsGroup, and the result can be other mode bits set.
7869 ///
7870 /// This might be in conflict with other options that affect the
7871 /// file mode, like fsGroup, and as a result, other mode bits could be set.
7872 pub default_mode: i32,
7873
7874 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7875}
7876
7877impl SecretVolumeSource {
7878 /// Creates a new default instance.
7879 pub fn new() -> Self {
7880 std::default::Default::default()
7881 }
7882
7883 /// Sets the value of [secret][crate::model::SecretVolumeSource::secret].
7884 ///
7885 /// # Example
7886 /// ```ignore,no_run
7887 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7888 /// let x = SecretVolumeSource::new().set_secret("example");
7889 /// ```
7890 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7891 self.secret = v.into();
7892 self
7893 }
7894
7895 /// Sets the value of [items][crate::model::SecretVolumeSource::items].
7896 ///
7897 /// # Example
7898 /// ```ignore,no_run
7899 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7900 /// use google_cloud_run_v2::model::VersionToPath;
7901 /// let x = SecretVolumeSource::new()
7902 /// .set_items([
7903 /// VersionToPath::default()/* use setters */,
7904 /// VersionToPath::default()/* use (different) setters */,
7905 /// ]);
7906 /// ```
7907 pub fn set_items<T, V>(mut self, v: T) -> Self
7908 where
7909 T: std::iter::IntoIterator<Item = V>,
7910 V: std::convert::Into<crate::model::VersionToPath>,
7911 {
7912 use std::iter::Iterator;
7913 self.items = v.into_iter().map(|i| i.into()).collect();
7914 self
7915 }
7916
7917 /// Sets the value of [default_mode][crate::model::SecretVolumeSource::default_mode].
7918 ///
7919 /// # Example
7920 /// ```ignore,no_run
7921 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7922 /// let x = SecretVolumeSource::new().set_default_mode(42);
7923 /// ```
7924 pub fn set_default_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7925 self.default_mode = v.into();
7926 self
7927 }
7928}
7929
7930impl wkt::message::Message for SecretVolumeSource {
7931 fn typename() -> &'static str {
7932 "type.googleapis.com/google.cloud.run.v2.SecretVolumeSource"
7933 }
7934}
7935
7936/// VersionToPath maps a specific version of a secret to a relative file to mount
7937/// to, relative to VolumeMount's mount_path.
7938#[derive(Clone, Default, PartialEq)]
7939#[non_exhaustive]
7940pub struct VersionToPath {
7941 /// Required. The relative path of the secret in the container.
7942 pub path: std::string::String,
7943
7944 /// The Cloud Secret Manager secret version.
7945 /// Can be 'latest' for the latest value, or an integer or a secret alias for a
7946 /// specific version.
7947 pub version: std::string::String,
7948
7949 /// Integer octal mode bits to use on this file, must be a value between
7950 /// 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
7951 /// used.
7952 ///
7953 /// Notes
7954 ///
7955 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7956 /// * This is an integer representation of the mode bits. So, the octal
7957 /// integer value should look exactly as the chmod numeric notation with a
7958 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7959 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7960 /// 493 (base-10).
7961 /// * This might be in conflict with other options that affect the
7962 /// file mode, like fsGroup, and the result can be other mode bits set.
7963 pub mode: i32,
7964
7965 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7966}
7967
7968impl VersionToPath {
7969 /// Creates a new default instance.
7970 pub fn new() -> Self {
7971 std::default::Default::default()
7972 }
7973
7974 /// Sets the value of [path][crate::model::VersionToPath::path].
7975 ///
7976 /// # Example
7977 /// ```ignore,no_run
7978 /// # use google_cloud_run_v2::model::VersionToPath;
7979 /// let x = VersionToPath::new().set_path("example");
7980 /// ```
7981 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7982 self.path = v.into();
7983 self
7984 }
7985
7986 /// Sets the value of [version][crate::model::VersionToPath::version].
7987 ///
7988 /// # Example
7989 /// ```ignore,no_run
7990 /// # use google_cloud_run_v2::model::VersionToPath;
7991 /// let x = VersionToPath::new().set_version("example");
7992 /// ```
7993 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7994 self.version = v.into();
7995 self
7996 }
7997
7998 /// Sets the value of [mode][crate::model::VersionToPath::mode].
7999 ///
8000 /// # Example
8001 /// ```ignore,no_run
8002 /// # use google_cloud_run_v2::model::VersionToPath;
8003 /// let x = VersionToPath::new().set_mode(42);
8004 /// ```
8005 pub fn set_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8006 self.mode = v.into();
8007 self
8008 }
8009}
8010
8011impl wkt::message::Message for VersionToPath {
8012 fn typename() -> &'static str {
8013 "type.googleapis.com/google.cloud.run.v2.VersionToPath"
8014 }
8015}
8016
8017/// Represents a set of Cloud SQL instances. Each one will be available under
8018/// /cloudsql/[instance]. Visit
8019/// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
8020/// how to connect Cloud SQL and Cloud Run.
8021#[derive(Clone, Default, PartialEq)]
8022#[non_exhaustive]
8023pub struct CloudSqlInstance {
8024 /// The Cloud SQL instance connection names, as can be found in
8025 /// <https://console.cloud.google.com/sql/instances>. Visit
8026 /// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
8027 /// how to connect Cloud SQL and Cloud Run. Format:
8028 /// {project}:{location}:{instance}
8029 pub instances: std::vec::Vec<std::string::String>,
8030
8031 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8032}
8033
8034impl CloudSqlInstance {
8035 /// Creates a new default instance.
8036 pub fn new() -> Self {
8037 std::default::Default::default()
8038 }
8039
8040 /// Sets the value of [instances][crate::model::CloudSqlInstance::instances].
8041 ///
8042 /// # Example
8043 /// ```ignore,no_run
8044 /// # use google_cloud_run_v2::model::CloudSqlInstance;
8045 /// let x = CloudSqlInstance::new().set_instances(["a", "b", "c"]);
8046 /// ```
8047 pub fn set_instances<T, V>(mut self, v: T) -> Self
8048 where
8049 T: std::iter::IntoIterator<Item = V>,
8050 V: std::convert::Into<std::string::String>,
8051 {
8052 use std::iter::Iterator;
8053 self.instances = v.into_iter().map(|i| i.into()).collect();
8054 self
8055 }
8056}
8057
8058impl wkt::message::Message for CloudSqlInstance {
8059 fn typename() -> &'static str {
8060 "type.googleapis.com/google.cloud.run.v2.CloudSqlInstance"
8061 }
8062}
8063
8064/// In memory (tmpfs) ephemeral storage.
8065/// It is ephemeral in the sense that when the sandbox is taken down, the data is
8066/// destroyed with it (it does not persist across sandbox runs).
8067#[derive(Clone, Default, PartialEq)]
8068#[non_exhaustive]
8069pub struct EmptyDirVolumeSource {
8070 /// The medium on which the data is stored. Acceptable values today is only
8071 /// MEMORY or none. When none, the default will currently be backed by memory
8072 /// but could change over time. +optional
8073 pub medium: crate::model::empty_dir_volume_source::Medium,
8074
8075 /// Limit on the storage usable by this EmptyDir volume.
8076 /// The size limit is also applicable for memory medium.
8077 /// The maximum usage on memory medium EmptyDir would be the minimum value
8078 /// between the SizeLimit specified here and the sum of memory limits of all
8079 /// containers. The default is nil which means that the limit is undefined.
8080 /// More info:
8081 /// <https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume>.
8082 /// Info in Kubernetes:
8083 /// <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir>
8084 pub size_limit: std::string::String,
8085
8086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8087}
8088
8089impl EmptyDirVolumeSource {
8090 /// Creates a new default instance.
8091 pub fn new() -> Self {
8092 std::default::Default::default()
8093 }
8094
8095 /// Sets the value of [medium][crate::model::EmptyDirVolumeSource::medium].
8096 ///
8097 /// # Example
8098 /// ```ignore,no_run
8099 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
8100 /// use google_cloud_run_v2::model::empty_dir_volume_source::Medium;
8101 /// let x0 = EmptyDirVolumeSource::new().set_medium(Medium::Memory);
8102 /// ```
8103 pub fn set_medium<T: std::convert::Into<crate::model::empty_dir_volume_source::Medium>>(
8104 mut self,
8105 v: T,
8106 ) -> Self {
8107 self.medium = v.into();
8108 self
8109 }
8110
8111 /// Sets the value of [size_limit][crate::model::EmptyDirVolumeSource::size_limit].
8112 ///
8113 /// # Example
8114 /// ```ignore,no_run
8115 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
8116 /// let x = EmptyDirVolumeSource::new().set_size_limit("example");
8117 /// ```
8118 pub fn set_size_limit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8119 self.size_limit = v.into();
8120 self
8121 }
8122}
8123
8124impl wkt::message::Message for EmptyDirVolumeSource {
8125 fn typename() -> &'static str {
8126 "type.googleapis.com/google.cloud.run.v2.EmptyDirVolumeSource"
8127 }
8128}
8129
8130/// Defines additional types related to [EmptyDirVolumeSource].
8131pub mod empty_dir_volume_source {
8132 #[allow(unused_imports)]
8133 use super::*;
8134
8135 /// The different types of medium supported for EmptyDir.
8136 ///
8137 /// # Working with unknown values
8138 ///
8139 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8140 /// additional enum variants at any time. Adding new variants is not considered
8141 /// a breaking change. Applications should write their code in anticipation of:
8142 ///
8143 /// - New values appearing in future releases of the client library, **and**
8144 /// - New values received dynamically, without application changes.
8145 ///
8146 /// Please consult the [Working with enums] section in the user guide for some
8147 /// guidelines.
8148 ///
8149 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8150 #[derive(Clone, Debug, PartialEq)]
8151 #[non_exhaustive]
8152 pub enum Medium {
8153 /// When not specified, falls back to the default implementation which
8154 /// is currently in memory (this may change over time).
8155 Unspecified,
8156 /// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
8157 Memory,
8158 /// If set, the enum was initialized with an unknown value.
8159 ///
8160 /// Applications can examine the value using [Medium::value] or
8161 /// [Medium::name].
8162 UnknownValue(medium::UnknownValue),
8163 }
8164
8165 #[doc(hidden)]
8166 pub mod medium {
8167 #[allow(unused_imports)]
8168 use super::*;
8169 #[derive(Clone, Debug, PartialEq)]
8170 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8171 }
8172
8173 impl Medium {
8174 /// Gets the enum value.
8175 ///
8176 /// Returns `None` if the enum contains an unknown value deserialized from
8177 /// the string representation of enums.
8178 pub fn value(&self) -> std::option::Option<i32> {
8179 match self {
8180 Self::Unspecified => std::option::Option::Some(0),
8181 Self::Memory => std::option::Option::Some(1),
8182 Self::UnknownValue(u) => u.0.value(),
8183 }
8184 }
8185
8186 /// Gets the enum value as a string.
8187 ///
8188 /// Returns `None` if the enum contains an unknown value deserialized from
8189 /// the integer representation of enums.
8190 pub fn name(&self) -> std::option::Option<&str> {
8191 match self {
8192 Self::Unspecified => std::option::Option::Some("MEDIUM_UNSPECIFIED"),
8193 Self::Memory => std::option::Option::Some("MEMORY"),
8194 Self::UnknownValue(u) => u.0.name(),
8195 }
8196 }
8197 }
8198
8199 impl std::default::Default for Medium {
8200 fn default() -> Self {
8201 use std::convert::From;
8202 Self::from(0)
8203 }
8204 }
8205
8206 impl std::fmt::Display for Medium {
8207 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8208 wkt::internal::display_enum(f, self.name(), self.value())
8209 }
8210 }
8211
8212 impl std::convert::From<i32> for Medium {
8213 fn from(value: i32) -> Self {
8214 match value {
8215 0 => Self::Unspecified,
8216 1 => Self::Memory,
8217 _ => Self::UnknownValue(medium::UnknownValue(
8218 wkt::internal::UnknownEnumValue::Integer(value),
8219 )),
8220 }
8221 }
8222 }
8223
8224 impl std::convert::From<&str> for Medium {
8225 fn from(value: &str) -> Self {
8226 use std::string::ToString;
8227 match value {
8228 "MEDIUM_UNSPECIFIED" => Self::Unspecified,
8229 "MEMORY" => Self::Memory,
8230 _ => Self::UnknownValue(medium::UnknownValue(
8231 wkt::internal::UnknownEnumValue::String(value.to_string()),
8232 )),
8233 }
8234 }
8235 }
8236
8237 impl serde::ser::Serialize for Medium {
8238 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8239 where
8240 S: serde::Serializer,
8241 {
8242 match self {
8243 Self::Unspecified => serializer.serialize_i32(0),
8244 Self::Memory => serializer.serialize_i32(1),
8245 Self::UnknownValue(u) => u.0.serialize(serializer),
8246 }
8247 }
8248 }
8249
8250 impl<'de> serde::de::Deserialize<'de> for Medium {
8251 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8252 where
8253 D: serde::Deserializer<'de>,
8254 {
8255 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Medium>::new(
8256 ".google.cloud.run.v2.EmptyDirVolumeSource.Medium",
8257 ))
8258 }
8259 }
8260}
8261
8262/// Represents an NFS mount.
8263#[derive(Clone, Default, PartialEq)]
8264#[non_exhaustive]
8265pub struct NFSVolumeSource {
8266 /// Hostname or IP address of the NFS server
8267 pub server: std::string::String,
8268
8269 /// Path that is exported by the NFS server.
8270 pub path: std::string::String,
8271
8272 /// If true, the volume will be mounted as read only for all mounts.
8273 pub read_only: bool,
8274
8275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8276}
8277
8278impl NFSVolumeSource {
8279 /// Creates a new default instance.
8280 pub fn new() -> Self {
8281 std::default::Default::default()
8282 }
8283
8284 /// Sets the value of [server][crate::model::NFSVolumeSource::server].
8285 ///
8286 /// # Example
8287 /// ```ignore,no_run
8288 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8289 /// let x = NFSVolumeSource::new().set_server("example");
8290 /// ```
8291 pub fn set_server<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8292 self.server = v.into();
8293 self
8294 }
8295
8296 /// Sets the value of [path][crate::model::NFSVolumeSource::path].
8297 ///
8298 /// # Example
8299 /// ```ignore,no_run
8300 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8301 /// let x = NFSVolumeSource::new().set_path("example");
8302 /// ```
8303 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8304 self.path = v.into();
8305 self
8306 }
8307
8308 /// Sets the value of [read_only][crate::model::NFSVolumeSource::read_only].
8309 ///
8310 /// # Example
8311 /// ```ignore,no_run
8312 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8313 /// let x = NFSVolumeSource::new().set_read_only(true);
8314 /// ```
8315 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8316 self.read_only = v.into();
8317 self
8318 }
8319}
8320
8321impl wkt::message::Message for NFSVolumeSource {
8322 fn typename() -> &'static str {
8323 "type.googleapis.com/google.cloud.run.v2.NFSVolumeSource"
8324 }
8325}
8326
8327/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage
8328/// FUSE.
8329#[derive(Clone, Default, PartialEq)]
8330#[non_exhaustive]
8331pub struct GCSVolumeSource {
8332 /// Cloud Storage Bucket name.
8333 pub bucket: std::string::String,
8334
8335 /// If true, the volume will be mounted as read only for all mounts.
8336 pub read_only: bool,
8337
8338 /// A list of additional flags to pass to the gcsfuse CLI.
8339 /// Options should be specified without the leading "--".
8340 pub mount_options: std::vec::Vec<std::string::String>,
8341
8342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8343}
8344
8345impl GCSVolumeSource {
8346 /// Creates a new default instance.
8347 pub fn new() -> Self {
8348 std::default::Default::default()
8349 }
8350
8351 /// Sets the value of [bucket][crate::model::GCSVolumeSource::bucket].
8352 ///
8353 /// # Example
8354 /// ```ignore,no_run
8355 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8356 /// let x = GCSVolumeSource::new().set_bucket("example");
8357 /// ```
8358 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8359 self.bucket = v.into();
8360 self
8361 }
8362
8363 /// Sets the value of [read_only][crate::model::GCSVolumeSource::read_only].
8364 ///
8365 /// # Example
8366 /// ```ignore,no_run
8367 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8368 /// let x = GCSVolumeSource::new().set_read_only(true);
8369 /// ```
8370 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8371 self.read_only = v.into();
8372 self
8373 }
8374
8375 /// Sets the value of [mount_options][crate::model::GCSVolumeSource::mount_options].
8376 ///
8377 /// # Example
8378 /// ```ignore,no_run
8379 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8380 /// let x = GCSVolumeSource::new().set_mount_options(["a", "b", "c"]);
8381 /// ```
8382 pub fn set_mount_options<T, V>(mut self, v: T) -> Self
8383 where
8384 T: std::iter::IntoIterator<Item = V>,
8385 V: std::convert::Into<std::string::String>,
8386 {
8387 use std::iter::Iterator;
8388 self.mount_options = v.into_iter().map(|i| i.into()).collect();
8389 self
8390 }
8391}
8392
8393impl wkt::message::Message for GCSVolumeSource {
8394 fn typename() -> &'static str {
8395 "type.googleapis.com/google.cloud.run.v2.GCSVolumeSource"
8396 }
8397}
8398
8399/// Probe describes a health check to be performed against a container to
8400/// determine whether it is alive or ready to receive traffic.
8401#[derive(Clone, Default, PartialEq)]
8402#[non_exhaustive]
8403pub struct Probe {
8404 /// Optional. Number of seconds after the container has started before the
8405 /// probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum
8406 /// value for liveness probe is 3600. Maximum value for startup probe is 240.
8407 pub initial_delay_seconds: i32,
8408
8409 /// Optional. Number of seconds after which the probe times out.
8410 /// Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
8411 /// Must be smaller than period_seconds.
8412 pub timeout_seconds: i32,
8413
8414 /// Optional. How often (in seconds) to perform the probe.
8415 /// Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
8416 /// is 3600. Maximum value for startup probe is 240.
8417 /// Must be greater or equal than timeout_seconds.
8418 pub period_seconds: i32,
8419
8420 /// Optional. Minimum consecutive failures for the probe to be considered
8421 /// failed after having succeeded. Defaults to 3. Minimum value is 1.
8422 pub failure_threshold: i32,
8423
8424 #[allow(missing_docs)]
8425 pub probe_type: std::option::Option<crate::model::probe::ProbeType>,
8426
8427 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8428}
8429
8430impl Probe {
8431 /// Creates a new default instance.
8432 pub fn new() -> Self {
8433 std::default::Default::default()
8434 }
8435
8436 /// Sets the value of [initial_delay_seconds][crate::model::Probe::initial_delay_seconds].
8437 ///
8438 /// # Example
8439 /// ```ignore,no_run
8440 /// # use google_cloud_run_v2::model::Probe;
8441 /// let x = Probe::new().set_initial_delay_seconds(42);
8442 /// ```
8443 pub fn set_initial_delay_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8444 self.initial_delay_seconds = v.into();
8445 self
8446 }
8447
8448 /// Sets the value of [timeout_seconds][crate::model::Probe::timeout_seconds].
8449 ///
8450 /// # Example
8451 /// ```ignore,no_run
8452 /// # use google_cloud_run_v2::model::Probe;
8453 /// let x = Probe::new().set_timeout_seconds(42);
8454 /// ```
8455 pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8456 self.timeout_seconds = v.into();
8457 self
8458 }
8459
8460 /// Sets the value of [period_seconds][crate::model::Probe::period_seconds].
8461 ///
8462 /// # Example
8463 /// ```ignore,no_run
8464 /// # use google_cloud_run_v2::model::Probe;
8465 /// let x = Probe::new().set_period_seconds(42);
8466 /// ```
8467 pub fn set_period_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8468 self.period_seconds = v.into();
8469 self
8470 }
8471
8472 /// Sets the value of [failure_threshold][crate::model::Probe::failure_threshold].
8473 ///
8474 /// # Example
8475 /// ```ignore,no_run
8476 /// # use google_cloud_run_v2::model::Probe;
8477 /// let x = Probe::new().set_failure_threshold(42);
8478 /// ```
8479 pub fn set_failure_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8480 self.failure_threshold = v.into();
8481 self
8482 }
8483
8484 /// Sets the value of [probe_type][crate::model::Probe::probe_type].
8485 ///
8486 /// Note that all the setters affecting `probe_type` are mutually
8487 /// exclusive.
8488 ///
8489 /// # Example
8490 /// ```ignore,no_run
8491 /// # use google_cloud_run_v2::model::Probe;
8492 /// use google_cloud_run_v2::model::HTTPGetAction;
8493 /// let x = Probe::new().set_probe_type(Some(
8494 /// google_cloud_run_v2::model::probe::ProbeType::HttpGet(HTTPGetAction::default().into())));
8495 /// ```
8496 pub fn set_probe_type<
8497 T: std::convert::Into<std::option::Option<crate::model::probe::ProbeType>>,
8498 >(
8499 mut self,
8500 v: T,
8501 ) -> Self {
8502 self.probe_type = v.into();
8503 self
8504 }
8505
8506 /// The value of [probe_type][crate::model::Probe::probe_type]
8507 /// if it holds a `HttpGet`, `None` if the field is not set or
8508 /// holds a different branch.
8509 pub fn http_get(&self) -> std::option::Option<&std::boxed::Box<crate::model::HTTPGetAction>> {
8510 #[allow(unreachable_patterns)]
8511 self.probe_type.as_ref().and_then(|v| match v {
8512 crate::model::probe::ProbeType::HttpGet(v) => std::option::Option::Some(v),
8513 _ => std::option::Option::None,
8514 })
8515 }
8516
8517 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8518 /// to hold a `HttpGet`.
8519 ///
8520 /// Note that all the setters affecting `probe_type` are
8521 /// mutually exclusive.
8522 ///
8523 /// # Example
8524 /// ```ignore,no_run
8525 /// # use google_cloud_run_v2::model::Probe;
8526 /// use google_cloud_run_v2::model::HTTPGetAction;
8527 /// let x = Probe::new().set_http_get(HTTPGetAction::default()/* use setters */);
8528 /// assert!(x.http_get().is_some());
8529 /// assert!(x.tcp_socket().is_none());
8530 /// assert!(x.grpc().is_none());
8531 /// ```
8532 pub fn set_http_get<T: std::convert::Into<std::boxed::Box<crate::model::HTTPGetAction>>>(
8533 mut self,
8534 v: T,
8535 ) -> Self {
8536 self.probe_type =
8537 std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(v.into()));
8538 self
8539 }
8540
8541 /// The value of [probe_type][crate::model::Probe::probe_type]
8542 /// if it holds a `TcpSocket`, `None` if the field is not set or
8543 /// holds a different branch.
8544 pub fn tcp_socket(
8545 &self,
8546 ) -> std::option::Option<&std::boxed::Box<crate::model::TCPSocketAction>> {
8547 #[allow(unreachable_patterns)]
8548 self.probe_type.as_ref().and_then(|v| match v {
8549 crate::model::probe::ProbeType::TcpSocket(v) => std::option::Option::Some(v),
8550 _ => std::option::Option::None,
8551 })
8552 }
8553
8554 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8555 /// to hold a `TcpSocket`.
8556 ///
8557 /// Note that all the setters affecting `probe_type` are
8558 /// mutually exclusive.
8559 ///
8560 /// # Example
8561 /// ```ignore,no_run
8562 /// # use google_cloud_run_v2::model::Probe;
8563 /// use google_cloud_run_v2::model::TCPSocketAction;
8564 /// let x = Probe::new().set_tcp_socket(TCPSocketAction::default()/* use setters */);
8565 /// assert!(x.tcp_socket().is_some());
8566 /// assert!(x.http_get().is_none());
8567 /// assert!(x.grpc().is_none());
8568 /// ```
8569 pub fn set_tcp_socket<T: std::convert::Into<std::boxed::Box<crate::model::TCPSocketAction>>>(
8570 mut self,
8571 v: T,
8572 ) -> Self {
8573 self.probe_type =
8574 std::option::Option::Some(crate::model::probe::ProbeType::TcpSocket(v.into()));
8575 self
8576 }
8577
8578 /// The value of [probe_type][crate::model::Probe::probe_type]
8579 /// if it holds a `Grpc`, `None` if the field is not set or
8580 /// holds a different branch.
8581 pub fn grpc(&self) -> std::option::Option<&std::boxed::Box<crate::model::GRPCAction>> {
8582 #[allow(unreachable_patterns)]
8583 self.probe_type.as_ref().and_then(|v| match v {
8584 crate::model::probe::ProbeType::Grpc(v) => std::option::Option::Some(v),
8585 _ => std::option::Option::None,
8586 })
8587 }
8588
8589 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8590 /// to hold a `Grpc`.
8591 ///
8592 /// Note that all the setters affecting `probe_type` are
8593 /// mutually exclusive.
8594 ///
8595 /// # Example
8596 /// ```ignore,no_run
8597 /// # use google_cloud_run_v2::model::Probe;
8598 /// use google_cloud_run_v2::model::GRPCAction;
8599 /// let x = Probe::new().set_grpc(GRPCAction::default()/* use setters */);
8600 /// assert!(x.grpc().is_some());
8601 /// assert!(x.http_get().is_none());
8602 /// assert!(x.tcp_socket().is_none());
8603 /// ```
8604 pub fn set_grpc<T: std::convert::Into<std::boxed::Box<crate::model::GRPCAction>>>(
8605 mut self,
8606 v: T,
8607 ) -> Self {
8608 self.probe_type = std::option::Option::Some(crate::model::probe::ProbeType::Grpc(v.into()));
8609 self
8610 }
8611}
8612
8613impl wkt::message::Message for Probe {
8614 fn typename() -> &'static str {
8615 "type.googleapis.com/google.cloud.run.v2.Probe"
8616 }
8617}
8618
8619/// Defines additional types related to [Probe].
8620pub mod probe {
8621 #[allow(unused_imports)]
8622 use super::*;
8623
8624 #[allow(missing_docs)]
8625 #[derive(Clone, Debug, PartialEq)]
8626 #[non_exhaustive]
8627 pub enum ProbeType {
8628 /// Optional. HTTPGet specifies the http request to perform.
8629 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8630 HttpGet(std::boxed::Box<crate::model::HTTPGetAction>),
8631 /// Optional. TCPSocket specifies an action involving a TCP port.
8632 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8633 TcpSocket(std::boxed::Box<crate::model::TCPSocketAction>),
8634 /// Optional. GRPC specifies an action involving a gRPC port.
8635 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8636 Grpc(std::boxed::Box<crate::model::GRPCAction>),
8637 }
8638}
8639
8640/// HTTPGetAction describes an action based on HTTP Get requests.
8641#[derive(Clone, Default, PartialEq)]
8642#[non_exhaustive]
8643pub struct HTTPGetAction {
8644 /// Optional. Path to access on the HTTP server. Defaults to '/'.
8645 pub path: std::string::String,
8646
8647 /// Optional. Custom headers to set in the request. HTTP allows repeated
8648 /// headers.
8649 pub http_headers: std::vec::Vec<crate::model::HTTPHeader>,
8650
8651 /// Optional. Port number to access on the container. Must be in the range 1 to
8652 /// 65535. If not specified, defaults to the exposed port of the container,
8653 /// which is the value of container.ports[0].containerPort.
8654 pub port: i32,
8655
8656 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8657}
8658
8659impl HTTPGetAction {
8660 /// Creates a new default instance.
8661 pub fn new() -> Self {
8662 std::default::Default::default()
8663 }
8664
8665 /// Sets the value of [path][crate::model::HTTPGetAction::path].
8666 ///
8667 /// # Example
8668 /// ```ignore,no_run
8669 /// # use google_cloud_run_v2::model::HTTPGetAction;
8670 /// let x = HTTPGetAction::new().set_path("example");
8671 /// ```
8672 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8673 self.path = v.into();
8674 self
8675 }
8676
8677 /// Sets the value of [http_headers][crate::model::HTTPGetAction::http_headers].
8678 ///
8679 /// # Example
8680 /// ```ignore,no_run
8681 /// # use google_cloud_run_v2::model::HTTPGetAction;
8682 /// use google_cloud_run_v2::model::HTTPHeader;
8683 /// let x = HTTPGetAction::new()
8684 /// .set_http_headers([
8685 /// HTTPHeader::default()/* use setters */,
8686 /// HTTPHeader::default()/* use (different) setters */,
8687 /// ]);
8688 /// ```
8689 pub fn set_http_headers<T, V>(mut self, v: T) -> Self
8690 where
8691 T: std::iter::IntoIterator<Item = V>,
8692 V: std::convert::Into<crate::model::HTTPHeader>,
8693 {
8694 use std::iter::Iterator;
8695 self.http_headers = v.into_iter().map(|i| i.into()).collect();
8696 self
8697 }
8698
8699 /// Sets the value of [port][crate::model::HTTPGetAction::port].
8700 ///
8701 /// # Example
8702 /// ```ignore,no_run
8703 /// # use google_cloud_run_v2::model::HTTPGetAction;
8704 /// let x = HTTPGetAction::new().set_port(42);
8705 /// ```
8706 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8707 self.port = v.into();
8708 self
8709 }
8710}
8711
8712impl wkt::message::Message for HTTPGetAction {
8713 fn typename() -> &'static str {
8714 "type.googleapis.com/google.cloud.run.v2.HTTPGetAction"
8715 }
8716}
8717
8718/// HTTPHeader describes a custom header to be used in HTTP probes
8719#[derive(Clone, Default, PartialEq)]
8720#[non_exhaustive]
8721pub struct HTTPHeader {
8722 /// Required. The header field name
8723 pub name: std::string::String,
8724
8725 /// Optional. The header field value
8726 pub value: std::string::String,
8727
8728 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8729}
8730
8731impl HTTPHeader {
8732 /// Creates a new default instance.
8733 pub fn new() -> Self {
8734 std::default::Default::default()
8735 }
8736
8737 /// Sets the value of [name][crate::model::HTTPHeader::name].
8738 ///
8739 /// # Example
8740 /// ```ignore,no_run
8741 /// # use google_cloud_run_v2::model::HTTPHeader;
8742 /// let x = HTTPHeader::new().set_name("example");
8743 /// ```
8744 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8745 self.name = v.into();
8746 self
8747 }
8748
8749 /// Sets the value of [value][crate::model::HTTPHeader::value].
8750 ///
8751 /// # Example
8752 /// ```ignore,no_run
8753 /// # use google_cloud_run_v2::model::HTTPHeader;
8754 /// let x = HTTPHeader::new().set_value("example");
8755 /// ```
8756 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8757 self.value = v.into();
8758 self
8759 }
8760}
8761
8762impl wkt::message::Message for HTTPHeader {
8763 fn typename() -> &'static str {
8764 "type.googleapis.com/google.cloud.run.v2.HTTPHeader"
8765 }
8766}
8767
8768/// TCPSocketAction describes an action based on opening a socket
8769#[derive(Clone, Default, PartialEq)]
8770#[non_exhaustive]
8771pub struct TCPSocketAction {
8772 /// Optional. Port number to access on the container. Must be in the range 1 to
8773 /// 65535. If not specified, defaults to the exposed port of the container,
8774 /// which is the value of container.ports[0].containerPort.
8775 pub port: i32,
8776
8777 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8778}
8779
8780impl TCPSocketAction {
8781 /// Creates a new default instance.
8782 pub fn new() -> Self {
8783 std::default::Default::default()
8784 }
8785
8786 /// Sets the value of [port][crate::model::TCPSocketAction::port].
8787 ///
8788 /// # Example
8789 /// ```ignore,no_run
8790 /// # use google_cloud_run_v2::model::TCPSocketAction;
8791 /// let x = TCPSocketAction::new().set_port(42);
8792 /// ```
8793 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8794 self.port = v.into();
8795 self
8796 }
8797}
8798
8799impl wkt::message::Message for TCPSocketAction {
8800 fn typename() -> &'static str {
8801 "type.googleapis.com/google.cloud.run.v2.TCPSocketAction"
8802 }
8803}
8804
8805/// GRPCAction describes an action involving a GRPC port.
8806#[derive(Clone, Default, PartialEq)]
8807#[non_exhaustive]
8808pub struct GRPCAction {
8809 /// Optional. Port number of the gRPC service. Number must be in the range 1 to
8810 /// 65535. If not specified, defaults to the exposed port of the container,
8811 /// which is the value of container.ports[0].containerPort.
8812 pub port: i32,
8813
8814 /// Optional. Service is the name of the service to place in the gRPC
8815 /// HealthCheckRequest (see
8816 /// <https://github.com/grpc/grpc/blob/master/doc/health-checking.md> ). If this
8817 /// is not specified, the default behavior is defined by gRPC.
8818 pub service: std::string::String,
8819
8820 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8821}
8822
8823impl GRPCAction {
8824 /// Creates a new default instance.
8825 pub fn new() -> Self {
8826 std::default::Default::default()
8827 }
8828
8829 /// Sets the value of [port][crate::model::GRPCAction::port].
8830 ///
8831 /// # Example
8832 /// ```ignore,no_run
8833 /// # use google_cloud_run_v2::model::GRPCAction;
8834 /// let x = GRPCAction::new().set_port(42);
8835 /// ```
8836 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8837 self.port = v.into();
8838 self
8839 }
8840
8841 /// Sets the value of [service][crate::model::GRPCAction::service].
8842 ///
8843 /// # Example
8844 /// ```ignore,no_run
8845 /// # use google_cloud_run_v2::model::GRPCAction;
8846 /// let x = GRPCAction::new().set_service("example");
8847 /// ```
8848 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8849 self.service = v.into();
8850 self
8851 }
8852}
8853
8854impl wkt::message::Message for GRPCAction {
8855 fn typename() -> &'static str {
8856 "type.googleapis.com/google.cloud.run.v2.GRPCAction"
8857 }
8858}
8859
8860/// Build information of the image.
8861#[derive(Clone, Default, PartialEq)]
8862#[non_exhaustive]
8863pub struct BuildInfo {
8864 /// Output only. Entry point of the function when the image is a Cloud Run
8865 /// function.
8866 pub function_target: std::string::String,
8867
8868 /// Output only. Source code location of the image.
8869 pub source_location: std::string::String,
8870
8871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8872}
8873
8874impl BuildInfo {
8875 /// Creates a new default instance.
8876 pub fn new() -> Self {
8877 std::default::Default::default()
8878 }
8879
8880 /// Sets the value of [function_target][crate::model::BuildInfo::function_target].
8881 ///
8882 /// # Example
8883 /// ```ignore,no_run
8884 /// # use google_cloud_run_v2::model::BuildInfo;
8885 /// let x = BuildInfo::new().set_function_target("example");
8886 /// ```
8887 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8888 self.function_target = v.into();
8889 self
8890 }
8891
8892 /// Sets the value of [source_location][crate::model::BuildInfo::source_location].
8893 ///
8894 /// # Example
8895 /// ```ignore,no_run
8896 /// # use google_cloud_run_v2::model::BuildInfo;
8897 /// let x = BuildInfo::new().set_source_location("example");
8898 /// ```
8899 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8900 self.source_location = v.into();
8901 self
8902 }
8903}
8904
8905impl wkt::message::Message for BuildInfo {
8906 fn typename() -> &'static str {
8907 "type.googleapis.com/google.cloud.run.v2.BuildInfo"
8908 }
8909}
8910
8911/// Source type for the container.
8912#[derive(Clone, Default, PartialEq)]
8913#[non_exhaustive]
8914pub struct SourceCode {
8915 /// The source type.
8916 pub source_type: std::option::Option<crate::model::source_code::SourceType>,
8917
8918 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8919}
8920
8921impl SourceCode {
8922 /// Creates a new default instance.
8923 pub fn new() -> Self {
8924 std::default::Default::default()
8925 }
8926
8927 /// Sets the value of [source_type][crate::model::SourceCode::source_type].
8928 ///
8929 /// Note that all the setters affecting `source_type` are mutually
8930 /// exclusive.
8931 ///
8932 /// # Example
8933 /// ```ignore,no_run
8934 /// # use google_cloud_run_v2::model::SourceCode;
8935 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8936 /// let x = SourceCode::new().set_source_type(Some(
8937 /// google_cloud_run_v2::model::source_code::SourceType::CloudStorageSource(CloudStorageSource::default().into())));
8938 /// ```
8939 pub fn set_source_type<
8940 T: std::convert::Into<std::option::Option<crate::model::source_code::SourceType>>,
8941 >(
8942 mut self,
8943 v: T,
8944 ) -> Self {
8945 self.source_type = v.into();
8946 self
8947 }
8948
8949 /// The value of [source_type][crate::model::SourceCode::source_type]
8950 /// if it holds a `CloudStorageSource`, `None` if the field is not set or
8951 /// holds a different branch.
8952 pub fn cloud_storage_source(
8953 &self,
8954 ) -> std::option::Option<&std::boxed::Box<crate::model::source_code::CloudStorageSource>> {
8955 #[allow(unreachable_patterns)]
8956 self.source_type.as_ref().and_then(|v| match v {
8957 crate::model::source_code::SourceType::CloudStorageSource(v) => {
8958 std::option::Option::Some(v)
8959 }
8960 _ => std::option::Option::None,
8961 })
8962 }
8963
8964 /// Sets the value of [source_type][crate::model::SourceCode::source_type]
8965 /// to hold a `CloudStorageSource`.
8966 ///
8967 /// Note that all the setters affecting `source_type` are
8968 /// mutually exclusive.
8969 ///
8970 /// # Example
8971 /// ```ignore,no_run
8972 /// # use google_cloud_run_v2::model::SourceCode;
8973 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8974 /// let x = SourceCode::new().set_cloud_storage_source(CloudStorageSource::default()/* use setters */);
8975 /// assert!(x.cloud_storage_source().is_some());
8976 /// ```
8977 pub fn set_cloud_storage_source<
8978 T: std::convert::Into<std::boxed::Box<crate::model::source_code::CloudStorageSource>>,
8979 >(
8980 mut self,
8981 v: T,
8982 ) -> Self {
8983 self.source_type = std::option::Option::Some(
8984 crate::model::source_code::SourceType::CloudStorageSource(v.into()),
8985 );
8986 self
8987 }
8988}
8989
8990impl wkt::message::Message for SourceCode {
8991 fn typename() -> &'static str {
8992 "type.googleapis.com/google.cloud.run.v2.SourceCode"
8993 }
8994}
8995
8996/// Defines additional types related to [SourceCode].
8997pub mod source_code {
8998 #[allow(unused_imports)]
8999 use super::*;
9000
9001 /// Cloud Storage source.
9002 #[derive(Clone, Default, PartialEq)]
9003 #[non_exhaustive]
9004 pub struct CloudStorageSource {
9005 /// Required. The Cloud Storage bucket name.
9006 pub bucket: std::string::String,
9007
9008 /// Required. The Cloud Storage object name.
9009 pub object: std::string::String,
9010
9011 /// Optional. The Cloud Storage object generation.
9012 pub generation: i64,
9013
9014 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9015 }
9016
9017 impl CloudStorageSource {
9018 /// Creates a new default instance.
9019 pub fn new() -> Self {
9020 std::default::Default::default()
9021 }
9022
9023 /// Sets the value of [bucket][crate::model::source_code::CloudStorageSource::bucket].
9024 ///
9025 /// # Example
9026 /// ```ignore,no_run
9027 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
9028 /// let x = CloudStorageSource::new().set_bucket("example");
9029 /// ```
9030 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9031 self.bucket = v.into();
9032 self
9033 }
9034
9035 /// Sets the value of [object][crate::model::source_code::CloudStorageSource::object].
9036 ///
9037 /// # Example
9038 /// ```ignore,no_run
9039 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
9040 /// let x = CloudStorageSource::new().set_object("example");
9041 /// ```
9042 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9043 self.object = v.into();
9044 self
9045 }
9046
9047 /// Sets the value of [generation][crate::model::source_code::CloudStorageSource::generation].
9048 ///
9049 /// # Example
9050 /// ```ignore,no_run
9051 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
9052 /// let x = CloudStorageSource::new().set_generation(42);
9053 /// ```
9054 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9055 self.generation = v.into();
9056 self
9057 }
9058 }
9059
9060 impl wkt::message::Message for CloudStorageSource {
9061 fn typename() -> &'static str {
9062 "type.googleapis.com/google.cloud.run.v2.SourceCode.CloudStorageSource"
9063 }
9064 }
9065
9066 /// The source type.
9067 #[derive(Clone, Debug, PartialEq)]
9068 #[non_exhaustive]
9069 pub enum SourceType {
9070 /// The source is a Cloud Storage bucket.
9071 CloudStorageSource(std::boxed::Box<crate::model::source_code::CloudStorageSource>),
9072 }
9073}
9074
9075/// Request message for obtaining a Revision by its full name.
9076#[derive(Clone, Default, PartialEq)]
9077#[non_exhaustive]
9078pub struct GetRevisionRequest {
9079 /// Required. The full name of the Revision.
9080 /// Format:
9081 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9082 pub name: std::string::String,
9083
9084 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9085}
9086
9087impl GetRevisionRequest {
9088 /// Creates a new default instance.
9089 pub fn new() -> Self {
9090 std::default::Default::default()
9091 }
9092
9093 /// Sets the value of [name][crate::model::GetRevisionRequest::name].
9094 ///
9095 /// # Example
9096 /// ```ignore,no_run
9097 /// # use google_cloud_run_v2::model::GetRevisionRequest;
9098 /// # let project_id = "project_id";
9099 /// # let location_id = "location_id";
9100 /// # let service_id = "service_id";
9101 /// # let revision_id = "revision_id";
9102 /// let x = GetRevisionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
9103 /// ```
9104 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9105 self.name = v.into();
9106 self
9107 }
9108}
9109
9110impl wkt::message::Message for GetRevisionRequest {
9111 fn typename() -> &'static str {
9112 "type.googleapis.com/google.cloud.run.v2.GetRevisionRequest"
9113 }
9114}
9115
9116/// Request message for retrieving a list of Revisions.
9117#[derive(Clone, Default, PartialEq)]
9118#[non_exhaustive]
9119pub struct ListRevisionsRequest {
9120 /// Required. The Service from which the Revisions should be listed.
9121 /// To list all Revisions across Services, use "-" instead of Service name.
9122 /// Format:
9123 /// projects/{project}/locations/{location}/services/{service}
9124 pub parent: std::string::String,
9125
9126 /// Maximum number of revisions to return in this call.
9127 pub page_size: i32,
9128
9129 /// A page token received from a previous call to ListRevisions.
9130 /// All other parameters must match.
9131 pub page_token: std::string::String,
9132
9133 /// If true, returns deleted (but unexpired) resources along with active ones.
9134 pub show_deleted: bool,
9135
9136 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9137}
9138
9139impl ListRevisionsRequest {
9140 /// Creates a new default instance.
9141 pub fn new() -> Self {
9142 std::default::Default::default()
9143 }
9144
9145 /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
9146 ///
9147 /// # Example
9148 /// ```ignore,no_run
9149 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9150 /// # let project_id = "project_id";
9151 /// # let location_id = "location_id";
9152 /// # let service_id = "service_id";
9153 /// let x = ListRevisionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
9154 /// ```
9155 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9156 self.parent = v.into();
9157 self
9158 }
9159
9160 /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
9161 ///
9162 /// # Example
9163 /// ```ignore,no_run
9164 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9165 /// let x = ListRevisionsRequest::new().set_page_size(42);
9166 /// ```
9167 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9168 self.page_size = v.into();
9169 self
9170 }
9171
9172 /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
9173 ///
9174 /// # Example
9175 /// ```ignore,no_run
9176 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9177 /// let x = ListRevisionsRequest::new().set_page_token("example");
9178 /// ```
9179 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9180 self.page_token = v.into();
9181 self
9182 }
9183
9184 /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
9185 ///
9186 /// # Example
9187 /// ```ignore,no_run
9188 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9189 /// let x = ListRevisionsRequest::new().set_show_deleted(true);
9190 /// ```
9191 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9192 self.show_deleted = v.into();
9193 self
9194 }
9195}
9196
9197impl wkt::message::Message for ListRevisionsRequest {
9198 fn typename() -> &'static str {
9199 "type.googleapis.com/google.cloud.run.v2.ListRevisionsRequest"
9200 }
9201}
9202
9203/// Response message containing a list of Revisions.
9204#[derive(Clone, Default, PartialEq)]
9205#[non_exhaustive]
9206pub struct ListRevisionsResponse {
9207 /// The resulting list of Revisions.
9208 pub revisions: std::vec::Vec<crate::model::Revision>,
9209
9210 /// A token indicating there are more items than page_size. Use it in the next
9211 /// ListRevisions request to continue.
9212 pub next_page_token: std::string::String,
9213
9214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9215}
9216
9217impl ListRevisionsResponse {
9218 /// Creates a new default instance.
9219 pub fn new() -> Self {
9220 std::default::Default::default()
9221 }
9222
9223 /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
9224 ///
9225 /// # Example
9226 /// ```ignore,no_run
9227 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9228 /// use google_cloud_run_v2::model::Revision;
9229 /// let x = ListRevisionsResponse::new()
9230 /// .set_revisions([
9231 /// Revision::default()/* use setters */,
9232 /// Revision::default()/* use (different) setters */,
9233 /// ]);
9234 /// ```
9235 pub fn set_revisions<T, V>(mut self, v: T) -> Self
9236 where
9237 T: std::iter::IntoIterator<Item = V>,
9238 V: std::convert::Into<crate::model::Revision>,
9239 {
9240 use std::iter::Iterator;
9241 self.revisions = v.into_iter().map(|i| i.into()).collect();
9242 self
9243 }
9244
9245 /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
9246 ///
9247 /// # Example
9248 /// ```ignore,no_run
9249 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9250 /// let x = ListRevisionsResponse::new().set_next_page_token("example");
9251 /// ```
9252 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9253 self.next_page_token = v.into();
9254 self
9255 }
9256}
9257
9258impl wkt::message::Message for ListRevisionsResponse {
9259 fn typename() -> &'static str {
9260 "type.googleapis.com/google.cloud.run.v2.ListRevisionsResponse"
9261 }
9262}
9263
9264#[doc(hidden)]
9265impl google_cloud_gax::paginator::internal::PageableResponse for ListRevisionsResponse {
9266 type PageItem = crate::model::Revision;
9267
9268 fn items(self) -> std::vec::Vec<Self::PageItem> {
9269 self.revisions
9270 }
9271
9272 fn next_page_token(&self) -> std::string::String {
9273 use std::clone::Clone;
9274 self.next_page_token.clone()
9275 }
9276}
9277
9278/// Request message for deleting a retired Revision.
9279/// Revision lifecycle is usually managed by making changes to the parent
9280/// Service. Only retired revisions can be deleted with this API.
9281#[derive(Clone, Default, PartialEq)]
9282#[non_exhaustive]
9283pub struct DeleteRevisionRequest {
9284 /// Required. The name of the Revision to delete.
9285 /// Format:
9286 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9287 pub name: std::string::String,
9288
9289 /// Indicates that the request should be validated without actually
9290 /// deleting any resources.
9291 pub validate_only: bool,
9292
9293 /// A system-generated fingerprint for this version of the
9294 /// resource. This may be used to detect modification conflict during updates.
9295 pub etag: std::string::String,
9296
9297 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9298}
9299
9300impl DeleteRevisionRequest {
9301 /// Creates a new default instance.
9302 pub fn new() -> Self {
9303 std::default::Default::default()
9304 }
9305
9306 /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
9307 ///
9308 /// # Example
9309 /// ```ignore,no_run
9310 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9311 /// # let project_id = "project_id";
9312 /// # let location_id = "location_id";
9313 /// # let service_id = "service_id";
9314 /// # let revision_id = "revision_id";
9315 /// let x = DeleteRevisionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
9316 /// ```
9317 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9318 self.name = v.into();
9319 self
9320 }
9321
9322 /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
9323 ///
9324 /// # Example
9325 /// ```ignore,no_run
9326 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9327 /// let x = DeleteRevisionRequest::new().set_validate_only(true);
9328 /// ```
9329 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9330 self.validate_only = v.into();
9331 self
9332 }
9333
9334 /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
9335 ///
9336 /// # Example
9337 /// ```ignore,no_run
9338 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9339 /// let x = DeleteRevisionRequest::new().set_etag("example");
9340 /// ```
9341 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9342 self.etag = v.into();
9343 self
9344 }
9345}
9346
9347impl wkt::message::Message for DeleteRevisionRequest {
9348 fn typename() -> &'static str {
9349 "type.googleapis.com/google.cloud.run.v2.DeleteRevisionRequest"
9350 }
9351}
9352
9353/// A Revision is an immutable snapshot of code and configuration. A Revision
9354/// references a container image. Revisions are only created by updates to its
9355/// parent Service.
9356#[derive(Clone, Default, PartialEq)]
9357#[non_exhaustive]
9358pub struct Revision {
9359 /// Output only. The unique name of this Revision.
9360 pub name: std::string::String,
9361
9362 /// Output only. Server assigned unique identifier for the Revision. The value
9363 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
9364 /// deleted.
9365 pub uid: std::string::String,
9366
9367 /// Output only. A number that monotonically increases every time the user
9368 /// modifies the desired state.
9369 pub generation: i64,
9370
9371 /// Output only. Unstructured key value map that can be used to organize and
9372 /// categorize objects. User-provided labels are shared with Google's billing
9373 /// system, so they can be used to filter, or break down billing charges by
9374 /// team, component, environment, state, etc. For more information, visit
9375 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
9376 /// <https://cloud.google.com/run/docs/configuring/labels>.
9377 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9378
9379 /// Output only. Unstructured key value map that may
9380 /// be set by external tools to store and arbitrary metadata.
9381 /// They are not queryable and should be preserved
9382 /// when modifying objects.
9383 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
9384
9385 /// Output only. The creation time.
9386 pub create_time: std::option::Option<wkt::Timestamp>,
9387
9388 /// Output only. The last-modified time.
9389 pub update_time: std::option::Option<wkt::Timestamp>,
9390
9391 /// Output only. For a deleted resource, the deletion time. It is only
9392 /// populated as a response to a Delete request.
9393 pub delete_time: std::option::Option<wkt::Timestamp>,
9394
9395 /// Output only. For a deleted resource, the time after which it will be
9396 /// permamently deleted. It is only populated as a response to a Delete
9397 /// request.
9398 pub expire_time: std::option::Option<wkt::Timestamp>,
9399
9400 /// The least stable launch stage needed to create this resource, as defined by
9401 /// [Google Cloud Platform Launch
9402 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
9403 /// `ALPHA`, `BETA`, and `GA`.
9404 ///
9405 /// Note that this value might not be what was used
9406 /// as input. For example, if ALPHA was provided as input in the parent
9407 /// resource, but only BETA and GA-level features are were, this field will be
9408 /// BETA.
9409 pub launch_stage: google_cloud_api::model::LaunchStage,
9410
9411 /// Output only. The name of the parent service.
9412 pub service: std::string::String,
9413
9414 /// Scaling settings for this revision.
9415 pub scaling: std::option::Option<crate::model::RevisionScaling>,
9416
9417 /// VPC Access configuration for this Revision. For more information, visit
9418 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
9419 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
9420
9421 /// Sets the maximum number of requests that each serving instance can receive.
9422 pub max_instance_request_concurrency: i32,
9423
9424 /// Max allowed time for an instance to respond to a request.
9425 pub timeout: std::option::Option<wkt::Duration>,
9426
9427 /// Email address of the IAM service account associated with the revision of
9428 /// the service. The service account represents the identity of the running
9429 /// revision, and determines what permissions the revision has.
9430 pub service_account: std::string::String,
9431
9432 /// Holds the single container that defines the unit of execution for this
9433 /// Revision.
9434 pub containers: std::vec::Vec<crate::model::Container>,
9435
9436 /// A list of Volumes to make available to containers.
9437 pub volumes: std::vec::Vec<crate::model::Volume>,
9438
9439 /// The execution environment being used to host this Revision.
9440 pub execution_environment: crate::model::ExecutionEnvironment,
9441
9442 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
9443 /// this container image. For more information, go to
9444 /// <https://cloud.google.com/run/docs/securing/using-cmek>
9445 pub encryption_key: std::string::String,
9446
9447 /// Enables service mesh connectivity.
9448 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
9449
9450 /// The action to take if the encryption key is revoked.
9451 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
9452
9453 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
9454 /// shutting down all instances. The minimum increment is 1 hour.
9455 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
9456
9457 /// Output only. Indicates whether the resource's reconciliation is still in
9458 /// progress. See comments in `Service.reconciling` for additional information
9459 /// on reconciliation process in Cloud Run.
9460 pub reconciling: bool,
9461
9462 /// Output only. The Condition of this Revision, containing its readiness
9463 /// status, and detailed error information in case it did not reach a serving
9464 /// state.
9465 pub conditions: std::vec::Vec<crate::model::Condition>,
9466
9467 /// Output only. The generation of this Revision currently serving traffic. See
9468 /// comments in `reconciling` for additional information on reconciliation
9469 /// process in Cloud Run.
9470 pub observed_generation: i64,
9471
9472 /// Output only. The Google Console URI to obtain logs for the Revision.
9473 pub log_uri: std::string::String,
9474
9475 /// Output only. Reserved for future use.
9476 pub satisfies_pzs: bool,
9477
9478 /// Enable session affinity.
9479 pub session_affinity: bool,
9480
9481 /// Output only. The current effective scaling settings for the revision.
9482 pub scaling_status: std::option::Option<crate::model::RevisionScalingStatus>,
9483
9484 /// The node selector for the revision.
9485 pub node_selector: std::option::Option<crate::model::NodeSelector>,
9486
9487 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
9488 /// revision.
9489 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
9490
9491 /// Output only. Email address of the authenticated creator.
9492 pub creator: std::string::String,
9493
9494 /// Output only. A system-generated fingerprint for this version of the
9495 /// resource. May be used to detect modification conflict during updates.
9496 pub etag: std::string::String,
9497
9498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9499}
9500
9501impl Revision {
9502 /// Creates a new default instance.
9503 pub fn new() -> Self {
9504 std::default::Default::default()
9505 }
9506
9507 /// Sets the value of [name][crate::model::Revision::name].
9508 ///
9509 /// # Example
9510 /// ```ignore,no_run
9511 /// # use google_cloud_run_v2::model::Revision;
9512 /// # let project_id = "project_id";
9513 /// # let location_id = "location_id";
9514 /// # let service_id = "service_id";
9515 /// # let revision_id = "revision_id";
9516 /// let x = Revision::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
9517 /// ```
9518 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9519 self.name = v.into();
9520 self
9521 }
9522
9523 /// Sets the value of [uid][crate::model::Revision::uid].
9524 ///
9525 /// # Example
9526 /// ```ignore,no_run
9527 /// # use google_cloud_run_v2::model::Revision;
9528 /// let x = Revision::new().set_uid("example");
9529 /// ```
9530 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9531 self.uid = v.into();
9532 self
9533 }
9534
9535 /// Sets the value of [generation][crate::model::Revision::generation].
9536 ///
9537 /// # Example
9538 /// ```ignore,no_run
9539 /// # use google_cloud_run_v2::model::Revision;
9540 /// let x = Revision::new().set_generation(42);
9541 /// ```
9542 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9543 self.generation = v.into();
9544 self
9545 }
9546
9547 /// Sets the value of [labels][crate::model::Revision::labels].
9548 ///
9549 /// # Example
9550 /// ```ignore,no_run
9551 /// # use google_cloud_run_v2::model::Revision;
9552 /// let x = Revision::new().set_labels([
9553 /// ("key0", "abc"),
9554 /// ("key1", "xyz"),
9555 /// ]);
9556 /// ```
9557 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9558 where
9559 T: std::iter::IntoIterator<Item = (K, V)>,
9560 K: std::convert::Into<std::string::String>,
9561 V: std::convert::Into<std::string::String>,
9562 {
9563 use std::iter::Iterator;
9564 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9565 self
9566 }
9567
9568 /// Sets the value of [annotations][crate::model::Revision::annotations].
9569 ///
9570 /// # Example
9571 /// ```ignore,no_run
9572 /// # use google_cloud_run_v2::model::Revision;
9573 /// let x = Revision::new().set_annotations([
9574 /// ("key0", "abc"),
9575 /// ("key1", "xyz"),
9576 /// ]);
9577 /// ```
9578 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
9579 where
9580 T: std::iter::IntoIterator<Item = (K, V)>,
9581 K: std::convert::Into<std::string::String>,
9582 V: std::convert::Into<std::string::String>,
9583 {
9584 use std::iter::Iterator;
9585 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9586 self
9587 }
9588
9589 /// Sets the value of [create_time][crate::model::Revision::create_time].
9590 ///
9591 /// # Example
9592 /// ```ignore,no_run
9593 /// # use google_cloud_run_v2::model::Revision;
9594 /// use wkt::Timestamp;
9595 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
9596 /// ```
9597 pub fn set_create_time<T>(mut self, v: T) -> Self
9598 where
9599 T: std::convert::Into<wkt::Timestamp>,
9600 {
9601 self.create_time = std::option::Option::Some(v.into());
9602 self
9603 }
9604
9605 /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
9606 ///
9607 /// # Example
9608 /// ```ignore,no_run
9609 /// # use google_cloud_run_v2::model::Revision;
9610 /// use wkt::Timestamp;
9611 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9612 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
9613 /// ```
9614 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9615 where
9616 T: std::convert::Into<wkt::Timestamp>,
9617 {
9618 self.create_time = v.map(|x| x.into());
9619 self
9620 }
9621
9622 /// Sets the value of [update_time][crate::model::Revision::update_time].
9623 ///
9624 /// # Example
9625 /// ```ignore,no_run
9626 /// # use google_cloud_run_v2::model::Revision;
9627 /// use wkt::Timestamp;
9628 /// let x = Revision::new().set_update_time(Timestamp::default()/* use setters */);
9629 /// ```
9630 pub fn set_update_time<T>(mut self, v: T) -> Self
9631 where
9632 T: std::convert::Into<wkt::Timestamp>,
9633 {
9634 self.update_time = std::option::Option::Some(v.into());
9635 self
9636 }
9637
9638 /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
9639 ///
9640 /// # Example
9641 /// ```ignore,no_run
9642 /// # use google_cloud_run_v2::model::Revision;
9643 /// use wkt::Timestamp;
9644 /// let x = Revision::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9645 /// let x = Revision::new().set_or_clear_update_time(None::<Timestamp>);
9646 /// ```
9647 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9648 where
9649 T: std::convert::Into<wkt::Timestamp>,
9650 {
9651 self.update_time = v.map(|x| x.into());
9652 self
9653 }
9654
9655 /// Sets the value of [delete_time][crate::model::Revision::delete_time].
9656 ///
9657 /// # Example
9658 /// ```ignore,no_run
9659 /// # use google_cloud_run_v2::model::Revision;
9660 /// use wkt::Timestamp;
9661 /// let x = Revision::new().set_delete_time(Timestamp::default()/* use setters */);
9662 /// ```
9663 pub fn set_delete_time<T>(mut self, v: T) -> Self
9664 where
9665 T: std::convert::Into<wkt::Timestamp>,
9666 {
9667 self.delete_time = std::option::Option::Some(v.into());
9668 self
9669 }
9670
9671 /// Sets or clears the value of [delete_time][crate::model::Revision::delete_time].
9672 ///
9673 /// # Example
9674 /// ```ignore,no_run
9675 /// # use google_cloud_run_v2::model::Revision;
9676 /// use wkt::Timestamp;
9677 /// let x = Revision::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
9678 /// let x = Revision::new().set_or_clear_delete_time(None::<Timestamp>);
9679 /// ```
9680 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9681 where
9682 T: std::convert::Into<wkt::Timestamp>,
9683 {
9684 self.delete_time = v.map(|x| x.into());
9685 self
9686 }
9687
9688 /// Sets the value of [expire_time][crate::model::Revision::expire_time].
9689 ///
9690 /// # Example
9691 /// ```ignore,no_run
9692 /// # use google_cloud_run_v2::model::Revision;
9693 /// use wkt::Timestamp;
9694 /// let x = Revision::new().set_expire_time(Timestamp::default()/* use setters */);
9695 /// ```
9696 pub fn set_expire_time<T>(mut self, v: T) -> Self
9697 where
9698 T: std::convert::Into<wkt::Timestamp>,
9699 {
9700 self.expire_time = std::option::Option::Some(v.into());
9701 self
9702 }
9703
9704 /// Sets or clears the value of [expire_time][crate::model::Revision::expire_time].
9705 ///
9706 /// # Example
9707 /// ```ignore,no_run
9708 /// # use google_cloud_run_v2::model::Revision;
9709 /// use wkt::Timestamp;
9710 /// let x = Revision::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9711 /// let x = Revision::new().set_or_clear_expire_time(None::<Timestamp>);
9712 /// ```
9713 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9714 where
9715 T: std::convert::Into<wkt::Timestamp>,
9716 {
9717 self.expire_time = v.map(|x| x.into());
9718 self
9719 }
9720
9721 /// Sets the value of [launch_stage][crate::model::Revision::launch_stage].
9722 ///
9723 /// # Example
9724 /// ```ignore,no_run
9725 /// # use google_cloud_run_v2::model::Revision;
9726 /// use google_cloud_api::model::LaunchStage;
9727 /// let x0 = Revision::new().set_launch_stage(LaunchStage::Unimplemented);
9728 /// let x1 = Revision::new().set_launch_stage(LaunchStage::Prelaunch);
9729 /// let x2 = Revision::new().set_launch_stage(LaunchStage::EarlyAccess);
9730 /// ```
9731 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
9732 mut self,
9733 v: T,
9734 ) -> Self {
9735 self.launch_stage = v.into();
9736 self
9737 }
9738
9739 /// Sets the value of [service][crate::model::Revision::service].
9740 ///
9741 /// # Example
9742 /// ```ignore,no_run
9743 /// # use google_cloud_run_v2::model::Revision;
9744 /// # let project_id = "project_id";
9745 /// # let location_id = "location_id";
9746 /// # let service_id = "service_id";
9747 /// let x = Revision::new().set_service(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
9748 /// ```
9749 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9750 self.service = v.into();
9751 self
9752 }
9753
9754 /// Sets the value of [scaling][crate::model::Revision::scaling].
9755 ///
9756 /// # Example
9757 /// ```ignore,no_run
9758 /// # use google_cloud_run_v2::model::Revision;
9759 /// use google_cloud_run_v2::model::RevisionScaling;
9760 /// let x = Revision::new().set_scaling(RevisionScaling::default()/* use setters */);
9761 /// ```
9762 pub fn set_scaling<T>(mut self, v: T) -> Self
9763 where
9764 T: std::convert::Into<crate::model::RevisionScaling>,
9765 {
9766 self.scaling = std::option::Option::Some(v.into());
9767 self
9768 }
9769
9770 /// Sets or clears the value of [scaling][crate::model::Revision::scaling].
9771 ///
9772 /// # Example
9773 /// ```ignore,no_run
9774 /// # use google_cloud_run_v2::model::Revision;
9775 /// use google_cloud_run_v2::model::RevisionScaling;
9776 /// let x = Revision::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
9777 /// let x = Revision::new().set_or_clear_scaling(None::<RevisionScaling>);
9778 /// ```
9779 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
9780 where
9781 T: std::convert::Into<crate::model::RevisionScaling>,
9782 {
9783 self.scaling = v.map(|x| x.into());
9784 self
9785 }
9786
9787 /// Sets the value of [vpc_access][crate::model::Revision::vpc_access].
9788 ///
9789 /// # Example
9790 /// ```ignore,no_run
9791 /// # use google_cloud_run_v2::model::Revision;
9792 /// use google_cloud_run_v2::model::VpcAccess;
9793 /// let x = Revision::new().set_vpc_access(VpcAccess::default()/* use setters */);
9794 /// ```
9795 pub fn set_vpc_access<T>(mut self, v: T) -> Self
9796 where
9797 T: std::convert::Into<crate::model::VpcAccess>,
9798 {
9799 self.vpc_access = std::option::Option::Some(v.into());
9800 self
9801 }
9802
9803 /// Sets or clears the value of [vpc_access][crate::model::Revision::vpc_access].
9804 ///
9805 /// # Example
9806 /// ```ignore,no_run
9807 /// # use google_cloud_run_v2::model::Revision;
9808 /// use google_cloud_run_v2::model::VpcAccess;
9809 /// let x = Revision::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
9810 /// let x = Revision::new().set_or_clear_vpc_access(None::<VpcAccess>);
9811 /// ```
9812 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
9813 where
9814 T: std::convert::Into<crate::model::VpcAccess>,
9815 {
9816 self.vpc_access = v.map(|x| x.into());
9817 self
9818 }
9819
9820 /// Sets the value of [max_instance_request_concurrency][crate::model::Revision::max_instance_request_concurrency].
9821 ///
9822 /// # Example
9823 /// ```ignore,no_run
9824 /// # use google_cloud_run_v2::model::Revision;
9825 /// let x = Revision::new().set_max_instance_request_concurrency(42);
9826 /// ```
9827 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
9828 mut self,
9829 v: T,
9830 ) -> Self {
9831 self.max_instance_request_concurrency = v.into();
9832 self
9833 }
9834
9835 /// Sets the value of [timeout][crate::model::Revision::timeout].
9836 ///
9837 /// # Example
9838 /// ```ignore,no_run
9839 /// # use google_cloud_run_v2::model::Revision;
9840 /// use wkt::Duration;
9841 /// let x = Revision::new().set_timeout(Duration::default()/* use setters */);
9842 /// ```
9843 pub fn set_timeout<T>(mut self, v: T) -> Self
9844 where
9845 T: std::convert::Into<wkt::Duration>,
9846 {
9847 self.timeout = std::option::Option::Some(v.into());
9848 self
9849 }
9850
9851 /// Sets or clears the value of [timeout][crate::model::Revision::timeout].
9852 ///
9853 /// # Example
9854 /// ```ignore,no_run
9855 /// # use google_cloud_run_v2::model::Revision;
9856 /// use wkt::Duration;
9857 /// let x = Revision::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
9858 /// let x = Revision::new().set_or_clear_timeout(None::<Duration>);
9859 /// ```
9860 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
9861 where
9862 T: std::convert::Into<wkt::Duration>,
9863 {
9864 self.timeout = v.map(|x| x.into());
9865 self
9866 }
9867
9868 /// Sets the value of [service_account][crate::model::Revision::service_account].
9869 ///
9870 /// # Example
9871 /// ```ignore,no_run
9872 /// # use google_cloud_run_v2::model::Revision;
9873 /// let x = Revision::new().set_service_account("example");
9874 /// ```
9875 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9876 self.service_account = v.into();
9877 self
9878 }
9879
9880 /// Sets the value of [containers][crate::model::Revision::containers].
9881 ///
9882 /// # Example
9883 /// ```ignore,no_run
9884 /// # use google_cloud_run_v2::model::Revision;
9885 /// use google_cloud_run_v2::model::Container;
9886 /// let x = Revision::new()
9887 /// .set_containers([
9888 /// Container::default()/* use setters */,
9889 /// Container::default()/* use (different) setters */,
9890 /// ]);
9891 /// ```
9892 pub fn set_containers<T, V>(mut self, v: T) -> Self
9893 where
9894 T: std::iter::IntoIterator<Item = V>,
9895 V: std::convert::Into<crate::model::Container>,
9896 {
9897 use std::iter::Iterator;
9898 self.containers = v.into_iter().map(|i| i.into()).collect();
9899 self
9900 }
9901
9902 /// Sets the value of [volumes][crate::model::Revision::volumes].
9903 ///
9904 /// # Example
9905 /// ```ignore,no_run
9906 /// # use google_cloud_run_v2::model::Revision;
9907 /// use google_cloud_run_v2::model::Volume;
9908 /// let x = Revision::new()
9909 /// .set_volumes([
9910 /// Volume::default()/* use setters */,
9911 /// Volume::default()/* use (different) setters */,
9912 /// ]);
9913 /// ```
9914 pub fn set_volumes<T, V>(mut self, v: T) -> Self
9915 where
9916 T: std::iter::IntoIterator<Item = V>,
9917 V: std::convert::Into<crate::model::Volume>,
9918 {
9919 use std::iter::Iterator;
9920 self.volumes = v.into_iter().map(|i| i.into()).collect();
9921 self
9922 }
9923
9924 /// Sets the value of [execution_environment][crate::model::Revision::execution_environment].
9925 ///
9926 /// # Example
9927 /// ```ignore,no_run
9928 /// # use google_cloud_run_v2::model::Revision;
9929 /// use google_cloud_run_v2::model::ExecutionEnvironment;
9930 /// let x0 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen1);
9931 /// let x1 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen2);
9932 /// ```
9933 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
9934 mut self,
9935 v: T,
9936 ) -> Self {
9937 self.execution_environment = v.into();
9938 self
9939 }
9940
9941 /// Sets the value of [encryption_key][crate::model::Revision::encryption_key].
9942 ///
9943 /// # Example
9944 /// ```ignore,no_run
9945 /// # use google_cloud_run_v2::model::Revision;
9946 /// let x = Revision::new().set_encryption_key("example");
9947 /// ```
9948 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9949 self.encryption_key = v.into();
9950 self
9951 }
9952
9953 /// Sets the value of [service_mesh][crate::model::Revision::service_mesh].
9954 ///
9955 /// # Example
9956 /// ```ignore,no_run
9957 /// # use google_cloud_run_v2::model::Revision;
9958 /// use google_cloud_run_v2::model::ServiceMesh;
9959 /// let x = Revision::new().set_service_mesh(ServiceMesh::default()/* use setters */);
9960 /// ```
9961 pub fn set_service_mesh<T>(mut self, v: T) -> Self
9962 where
9963 T: std::convert::Into<crate::model::ServiceMesh>,
9964 {
9965 self.service_mesh = std::option::Option::Some(v.into());
9966 self
9967 }
9968
9969 /// Sets or clears the value of [service_mesh][crate::model::Revision::service_mesh].
9970 ///
9971 /// # Example
9972 /// ```ignore,no_run
9973 /// # use google_cloud_run_v2::model::Revision;
9974 /// use google_cloud_run_v2::model::ServiceMesh;
9975 /// let x = Revision::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
9976 /// let x = Revision::new().set_or_clear_service_mesh(None::<ServiceMesh>);
9977 /// ```
9978 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
9979 where
9980 T: std::convert::Into<crate::model::ServiceMesh>,
9981 {
9982 self.service_mesh = v.map(|x| x.into());
9983 self
9984 }
9985
9986 /// Sets the value of [encryption_key_revocation_action][crate::model::Revision::encryption_key_revocation_action].
9987 ///
9988 /// # Example
9989 /// ```ignore,no_run
9990 /// # use google_cloud_run_v2::model::Revision;
9991 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
9992 /// let x0 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
9993 /// let x1 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
9994 /// ```
9995 pub fn set_encryption_key_revocation_action<
9996 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
9997 >(
9998 mut self,
9999 v: T,
10000 ) -> Self {
10001 self.encryption_key_revocation_action = v.into();
10002 self
10003 }
10004
10005 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
10006 ///
10007 /// # Example
10008 /// ```ignore,no_run
10009 /// # use google_cloud_run_v2::model::Revision;
10010 /// use wkt::Duration;
10011 /// let x = Revision::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
10012 /// ```
10013 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
10014 where
10015 T: std::convert::Into<wkt::Duration>,
10016 {
10017 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
10018 self
10019 }
10020
10021 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
10022 ///
10023 /// # Example
10024 /// ```ignore,no_run
10025 /// # use google_cloud_run_v2::model::Revision;
10026 /// use wkt::Duration;
10027 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
10028 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
10029 /// ```
10030 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
10031 mut self,
10032 v: std::option::Option<T>,
10033 ) -> Self
10034 where
10035 T: std::convert::Into<wkt::Duration>,
10036 {
10037 self.encryption_key_shutdown_duration = v.map(|x| x.into());
10038 self
10039 }
10040
10041 /// Sets the value of [reconciling][crate::model::Revision::reconciling].
10042 ///
10043 /// # Example
10044 /// ```ignore,no_run
10045 /// # use google_cloud_run_v2::model::Revision;
10046 /// let x = Revision::new().set_reconciling(true);
10047 /// ```
10048 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10049 self.reconciling = v.into();
10050 self
10051 }
10052
10053 /// Sets the value of [conditions][crate::model::Revision::conditions].
10054 ///
10055 /// # Example
10056 /// ```ignore,no_run
10057 /// # use google_cloud_run_v2::model::Revision;
10058 /// use google_cloud_run_v2::model::Condition;
10059 /// let x = Revision::new()
10060 /// .set_conditions([
10061 /// Condition::default()/* use setters */,
10062 /// Condition::default()/* use (different) setters */,
10063 /// ]);
10064 /// ```
10065 pub fn set_conditions<T, V>(mut self, v: T) -> Self
10066 where
10067 T: std::iter::IntoIterator<Item = V>,
10068 V: std::convert::Into<crate::model::Condition>,
10069 {
10070 use std::iter::Iterator;
10071 self.conditions = v.into_iter().map(|i| i.into()).collect();
10072 self
10073 }
10074
10075 /// Sets the value of [observed_generation][crate::model::Revision::observed_generation].
10076 ///
10077 /// # Example
10078 /// ```ignore,no_run
10079 /// # use google_cloud_run_v2::model::Revision;
10080 /// let x = Revision::new().set_observed_generation(42);
10081 /// ```
10082 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10083 self.observed_generation = v.into();
10084 self
10085 }
10086
10087 /// Sets the value of [log_uri][crate::model::Revision::log_uri].
10088 ///
10089 /// # Example
10090 /// ```ignore,no_run
10091 /// # use google_cloud_run_v2::model::Revision;
10092 /// let x = Revision::new().set_log_uri("example");
10093 /// ```
10094 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10095 self.log_uri = v.into();
10096 self
10097 }
10098
10099 /// Sets the value of [satisfies_pzs][crate::model::Revision::satisfies_pzs].
10100 ///
10101 /// # Example
10102 /// ```ignore,no_run
10103 /// # use google_cloud_run_v2::model::Revision;
10104 /// let x = Revision::new().set_satisfies_pzs(true);
10105 /// ```
10106 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10107 self.satisfies_pzs = v.into();
10108 self
10109 }
10110
10111 /// Sets the value of [session_affinity][crate::model::Revision::session_affinity].
10112 ///
10113 /// # Example
10114 /// ```ignore,no_run
10115 /// # use google_cloud_run_v2::model::Revision;
10116 /// let x = Revision::new().set_session_affinity(true);
10117 /// ```
10118 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10119 self.session_affinity = v.into();
10120 self
10121 }
10122
10123 /// Sets the value of [scaling_status][crate::model::Revision::scaling_status].
10124 ///
10125 /// # Example
10126 /// ```ignore,no_run
10127 /// # use google_cloud_run_v2::model::Revision;
10128 /// use google_cloud_run_v2::model::RevisionScalingStatus;
10129 /// let x = Revision::new().set_scaling_status(RevisionScalingStatus::default()/* use setters */);
10130 /// ```
10131 pub fn set_scaling_status<T>(mut self, v: T) -> Self
10132 where
10133 T: std::convert::Into<crate::model::RevisionScalingStatus>,
10134 {
10135 self.scaling_status = std::option::Option::Some(v.into());
10136 self
10137 }
10138
10139 /// Sets or clears the value of [scaling_status][crate::model::Revision::scaling_status].
10140 ///
10141 /// # Example
10142 /// ```ignore,no_run
10143 /// # use google_cloud_run_v2::model::Revision;
10144 /// use google_cloud_run_v2::model::RevisionScalingStatus;
10145 /// let x = Revision::new().set_or_clear_scaling_status(Some(RevisionScalingStatus::default()/* use setters */));
10146 /// let x = Revision::new().set_or_clear_scaling_status(None::<RevisionScalingStatus>);
10147 /// ```
10148 pub fn set_or_clear_scaling_status<T>(mut self, v: std::option::Option<T>) -> Self
10149 where
10150 T: std::convert::Into<crate::model::RevisionScalingStatus>,
10151 {
10152 self.scaling_status = v.map(|x| x.into());
10153 self
10154 }
10155
10156 /// Sets the value of [node_selector][crate::model::Revision::node_selector].
10157 ///
10158 /// # Example
10159 /// ```ignore,no_run
10160 /// # use google_cloud_run_v2::model::Revision;
10161 /// use google_cloud_run_v2::model::NodeSelector;
10162 /// let x = Revision::new().set_node_selector(NodeSelector::default()/* use setters */);
10163 /// ```
10164 pub fn set_node_selector<T>(mut self, v: T) -> Self
10165 where
10166 T: std::convert::Into<crate::model::NodeSelector>,
10167 {
10168 self.node_selector = std::option::Option::Some(v.into());
10169 self
10170 }
10171
10172 /// Sets or clears the value of [node_selector][crate::model::Revision::node_selector].
10173 ///
10174 /// # Example
10175 /// ```ignore,no_run
10176 /// # use google_cloud_run_v2::model::Revision;
10177 /// use google_cloud_run_v2::model::NodeSelector;
10178 /// let x = Revision::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10179 /// let x = Revision::new().set_or_clear_node_selector(None::<NodeSelector>);
10180 /// ```
10181 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10182 where
10183 T: std::convert::Into<crate::model::NodeSelector>,
10184 {
10185 self.node_selector = v.map(|x| x.into());
10186 self
10187 }
10188
10189 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10190 ///
10191 /// # Example
10192 /// ```ignore,no_run
10193 /// # use google_cloud_run_v2::model::Revision;
10194 /// let x = Revision::new().set_gpu_zonal_redundancy_disabled(true);
10195 /// ```
10196 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10197 where
10198 T: std::convert::Into<bool>,
10199 {
10200 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10201 self
10202 }
10203
10204 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10205 ///
10206 /// # Example
10207 /// ```ignore,no_run
10208 /// # use google_cloud_run_v2::model::Revision;
10209 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10210 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10211 /// ```
10212 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10213 mut self,
10214 v: std::option::Option<T>,
10215 ) -> Self
10216 where
10217 T: std::convert::Into<bool>,
10218 {
10219 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10220 self
10221 }
10222
10223 /// Sets the value of [creator][crate::model::Revision::creator].
10224 ///
10225 /// # Example
10226 /// ```ignore,no_run
10227 /// # use google_cloud_run_v2::model::Revision;
10228 /// let x = Revision::new().set_creator("example");
10229 /// ```
10230 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10231 self.creator = v.into();
10232 self
10233 }
10234
10235 /// Sets the value of [etag][crate::model::Revision::etag].
10236 ///
10237 /// # Example
10238 /// ```ignore,no_run
10239 /// # use google_cloud_run_v2::model::Revision;
10240 /// let x = Revision::new().set_etag("example");
10241 /// ```
10242 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10243 self.etag = v.into();
10244 self
10245 }
10246}
10247
10248impl wkt::message::Message for Revision {
10249 fn typename() -> &'static str {
10250 "type.googleapis.com/google.cloud.run.v2.Revision"
10251 }
10252}
10253
10254/// RevisionTemplate describes the data a revision should have when created from
10255/// a template.
10256#[derive(Clone, Default, PartialEq)]
10257#[non_exhaustive]
10258pub struct RevisionTemplate {
10259 /// Optional. The unique name for the revision. If this field is omitted, it
10260 /// will be automatically generated based on the Service name.
10261 pub revision: std::string::String,
10262
10263 /// Optional. Unstructured key value map that can be used to organize and
10264 /// categorize objects. User-provided labels are shared with Google's billing
10265 /// system, so they can be used to filter, or break down billing charges by
10266 /// team, component, environment, state, etc. For more information, visit
10267 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
10268 /// <https://cloud.google.com/run/docs/configuring/labels>.
10269 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10270
10271 /// Optional. Unstructured key value map that may be set by external tools to
10272 /// store and arbitrary metadata. They are not queryable and should be
10273 /// preserved when modifying objects.
10274 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
10275
10276 /// Optional. Scaling settings for this Revision.
10277 pub scaling: std::option::Option<crate::model::RevisionScaling>,
10278
10279 /// Optional. VPC Access configuration to use for this Revision. For more
10280 /// information, visit
10281 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
10282 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
10283
10284 /// Optional. Max allowed time for an instance to respond to a request.
10285 pub timeout: std::option::Option<wkt::Duration>,
10286
10287 /// Optional. Email address of the IAM service account associated with the
10288 /// revision of the service. The service account represents the identity of the
10289 /// running revision, and determines what permissions the revision has. If not
10290 /// provided, the revision will use the project's default service account.
10291 pub service_account: std::string::String,
10292
10293 /// Holds the single container that defines the unit of execution for this
10294 /// Revision.
10295 pub containers: std::vec::Vec<crate::model::Container>,
10296
10297 /// Optional. A list of Volumes to make available to containers.
10298 pub volumes: std::vec::Vec<crate::model::Volume>,
10299
10300 /// Optional. The sandbox environment to host this Revision.
10301 pub execution_environment: crate::model::ExecutionEnvironment,
10302
10303 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
10304 /// this container image. For more information, go to
10305 /// <https://cloud.google.com/run/docs/securing/using-cmek>
10306 pub encryption_key: std::string::String,
10307
10308 /// Optional. Sets the maximum number of requests that each serving instance
10309 /// can receive. If not specified or 0, concurrency defaults to 80 when
10310 /// requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
10311 pub max_instance_request_concurrency: i32,
10312
10313 /// Optional. Enables service mesh connectivity.
10314 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
10315
10316 /// Optional. The action to take if the encryption key is revoked.
10317 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
10318
10319 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
10320 /// before shutting down all instances. The minimum increment is 1 hour.
10321 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
10322
10323 /// Optional. Enable session affinity.
10324 pub session_affinity: bool,
10325
10326 /// Optional. Disables health checking containers during deployment.
10327 pub health_check_disabled: bool,
10328
10329 /// Optional. The node selector for the revision template.
10330 pub node_selector: std::option::Option<crate::model::NodeSelector>,
10331
10332 /// Optional. True if GPU zonal redundancy is disabled on this revision.
10333 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
10334
10335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10336}
10337
10338impl RevisionTemplate {
10339 /// Creates a new default instance.
10340 pub fn new() -> Self {
10341 std::default::Default::default()
10342 }
10343
10344 /// Sets the value of [revision][crate::model::RevisionTemplate::revision].
10345 ///
10346 /// # Example
10347 /// ```ignore,no_run
10348 /// # use google_cloud_run_v2::model::RevisionTemplate;
10349 /// # let project_id = "project_id";
10350 /// # let location_id = "location_id";
10351 /// # let service_id = "service_id";
10352 /// # let revision_id = "revision_id";
10353 /// let x = RevisionTemplate::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
10354 /// ```
10355 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10356 self.revision = v.into();
10357 self
10358 }
10359
10360 /// Sets the value of [labels][crate::model::RevisionTemplate::labels].
10361 ///
10362 /// # Example
10363 /// ```ignore,no_run
10364 /// # use google_cloud_run_v2::model::RevisionTemplate;
10365 /// let x = RevisionTemplate::new().set_labels([
10366 /// ("key0", "abc"),
10367 /// ("key1", "xyz"),
10368 /// ]);
10369 /// ```
10370 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10371 where
10372 T: std::iter::IntoIterator<Item = (K, V)>,
10373 K: std::convert::Into<std::string::String>,
10374 V: std::convert::Into<std::string::String>,
10375 {
10376 use std::iter::Iterator;
10377 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10378 self
10379 }
10380
10381 /// Sets the value of [annotations][crate::model::RevisionTemplate::annotations].
10382 ///
10383 /// # Example
10384 /// ```ignore,no_run
10385 /// # use google_cloud_run_v2::model::RevisionTemplate;
10386 /// let x = RevisionTemplate::new().set_annotations([
10387 /// ("key0", "abc"),
10388 /// ("key1", "xyz"),
10389 /// ]);
10390 /// ```
10391 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
10392 where
10393 T: std::iter::IntoIterator<Item = (K, V)>,
10394 K: std::convert::Into<std::string::String>,
10395 V: std::convert::Into<std::string::String>,
10396 {
10397 use std::iter::Iterator;
10398 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10399 self
10400 }
10401
10402 /// Sets the value of [scaling][crate::model::RevisionTemplate::scaling].
10403 ///
10404 /// # Example
10405 /// ```ignore,no_run
10406 /// # use google_cloud_run_v2::model::RevisionTemplate;
10407 /// use google_cloud_run_v2::model::RevisionScaling;
10408 /// let x = RevisionTemplate::new().set_scaling(RevisionScaling::default()/* use setters */);
10409 /// ```
10410 pub fn set_scaling<T>(mut self, v: T) -> Self
10411 where
10412 T: std::convert::Into<crate::model::RevisionScaling>,
10413 {
10414 self.scaling = std::option::Option::Some(v.into());
10415 self
10416 }
10417
10418 /// Sets or clears the value of [scaling][crate::model::RevisionTemplate::scaling].
10419 ///
10420 /// # Example
10421 /// ```ignore,no_run
10422 /// # use google_cloud_run_v2::model::RevisionTemplate;
10423 /// use google_cloud_run_v2::model::RevisionScaling;
10424 /// let x = RevisionTemplate::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
10425 /// let x = RevisionTemplate::new().set_or_clear_scaling(None::<RevisionScaling>);
10426 /// ```
10427 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
10428 where
10429 T: std::convert::Into<crate::model::RevisionScaling>,
10430 {
10431 self.scaling = v.map(|x| x.into());
10432 self
10433 }
10434
10435 /// Sets the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10436 ///
10437 /// # Example
10438 /// ```ignore,no_run
10439 /// # use google_cloud_run_v2::model::RevisionTemplate;
10440 /// use google_cloud_run_v2::model::VpcAccess;
10441 /// let x = RevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
10442 /// ```
10443 pub fn set_vpc_access<T>(mut self, v: T) -> Self
10444 where
10445 T: std::convert::Into<crate::model::VpcAccess>,
10446 {
10447 self.vpc_access = std::option::Option::Some(v.into());
10448 self
10449 }
10450
10451 /// Sets or clears the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10452 ///
10453 /// # Example
10454 /// ```ignore,no_run
10455 /// # use google_cloud_run_v2::model::RevisionTemplate;
10456 /// use google_cloud_run_v2::model::VpcAccess;
10457 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
10458 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
10459 /// ```
10460 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
10461 where
10462 T: std::convert::Into<crate::model::VpcAccess>,
10463 {
10464 self.vpc_access = v.map(|x| x.into());
10465 self
10466 }
10467
10468 /// Sets the value of [timeout][crate::model::RevisionTemplate::timeout].
10469 ///
10470 /// # Example
10471 /// ```ignore,no_run
10472 /// # use google_cloud_run_v2::model::RevisionTemplate;
10473 /// use wkt::Duration;
10474 /// let x = RevisionTemplate::new().set_timeout(Duration::default()/* use setters */);
10475 /// ```
10476 pub fn set_timeout<T>(mut self, v: T) -> Self
10477 where
10478 T: std::convert::Into<wkt::Duration>,
10479 {
10480 self.timeout = std::option::Option::Some(v.into());
10481 self
10482 }
10483
10484 /// Sets or clears the value of [timeout][crate::model::RevisionTemplate::timeout].
10485 ///
10486 /// # Example
10487 /// ```ignore,no_run
10488 /// # use google_cloud_run_v2::model::RevisionTemplate;
10489 /// use wkt::Duration;
10490 /// let x = RevisionTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
10491 /// let x = RevisionTemplate::new().set_or_clear_timeout(None::<Duration>);
10492 /// ```
10493 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
10494 where
10495 T: std::convert::Into<wkt::Duration>,
10496 {
10497 self.timeout = v.map(|x| x.into());
10498 self
10499 }
10500
10501 /// Sets the value of [service_account][crate::model::RevisionTemplate::service_account].
10502 ///
10503 /// # Example
10504 /// ```ignore,no_run
10505 /// # use google_cloud_run_v2::model::RevisionTemplate;
10506 /// let x = RevisionTemplate::new().set_service_account("example");
10507 /// ```
10508 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10509 self.service_account = v.into();
10510 self
10511 }
10512
10513 /// Sets the value of [containers][crate::model::RevisionTemplate::containers].
10514 ///
10515 /// # Example
10516 /// ```ignore,no_run
10517 /// # use google_cloud_run_v2::model::RevisionTemplate;
10518 /// use google_cloud_run_v2::model::Container;
10519 /// let x = RevisionTemplate::new()
10520 /// .set_containers([
10521 /// Container::default()/* use setters */,
10522 /// Container::default()/* use (different) setters */,
10523 /// ]);
10524 /// ```
10525 pub fn set_containers<T, V>(mut self, v: T) -> Self
10526 where
10527 T: std::iter::IntoIterator<Item = V>,
10528 V: std::convert::Into<crate::model::Container>,
10529 {
10530 use std::iter::Iterator;
10531 self.containers = v.into_iter().map(|i| i.into()).collect();
10532 self
10533 }
10534
10535 /// Sets the value of [volumes][crate::model::RevisionTemplate::volumes].
10536 ///
10537 /// # Example
10538 /// ```ignore,no_run
10539 /// # use google_cloud_run_v2::model::RevisionTemplate;
10540 /// use google_cloud_run_v2::model::Volume;
10541 /// let x = RevisionTemplate::new()
10542 /// .set_volumes([
10543 /// Volume::default()/* use setters */,
10544 /// Volume::default()/* use (different) setters */,
10545 /// ]);
10546 /// ```
10547 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10548 where
10549 T: std::iter::IntoIterator<Item = V>,
10550 V: std::convert::Into<crate::model::Volume>,
10551 {
10552 use std::iter::Iterator;
10553 self.volumes = v.into_iter().map(|i| i.into()).collect();
10554 self
10555 }
10556
10557 /// Sets the value of [execution_environment][crate::model::RevisionTemplate::execution_environment].
10558 ///
10559 /// # Example
10560 /// ```ignore,no_run
10561 /// # use google_cloud_run_v2::model::RevisionTemplate;
10562 /// use google_cloud_run_v2::model::ExecutionEnvironment;
10563 /// let x0 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
10564 /// let x1 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
10565 /// ```
10566 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
10567 mut self,
10568 v: T,
10569 ) -> Self {
10570 self.execution_environment = v.into();
10571 self
10572 }
10573
10574 /// Sets the value of [encryption_key][crate::model::RevisionTemplate::encryption_key].
10575 ///
10576 /// # Example
10577 /// ```ignore,no_run
10578 /// # use google_cloud_run_v2::model::RevisionTemplate;
10579 /// let x = RevisionTemplate::new().set_encryption_key("example");
10580 /// ```
10581 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10582 self.encryption_key = v.into();
10583 self
10584 }
10585
10586 /// Sets the value of [max_instance_request_concurrency][crate::model::RevisionTemplate::max_instance_request_concurrency].
10587 ///
10588 /// # Example
10589 /// ```ignore,no_run
10590 /// # use google_cloud_run_v2::model::RevisionTemplate;
10591 /// let x = RevisionTemplate::new().set_max_instance_request_concurrency(42);
10592 /// ```
10593 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
10594 mut self,
10595 v: T,
10596 ) -> Self {
10597 self.max_instance_request_concurrency = v.into();
10598 self
10599 }
10600
10601 /// Sets the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10602 ///
10603 /// # Example
10604 /// ```ignore,no_run
10605 /// # use google_cloud_run_v2::model::RevisionTemplate;
10606 /// use google_cloud_run_v2::model::ServiceMesh;
10607 /// let x = RevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
10608 /// ```
10609 pub fn set_service_mesh<T>(mut self, v: T) -> Self
10610 where
10611 T: std::convert::Into<crate::model::ServiceMesh>,
10612 {
10613 self.service_mesh = std::option::Option::Some(v.into());
10614 self
10615 }
10616
10617 /// Sets or clears the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10618 ///
10619 /// # Example
10620 /// ```ignore,no_run
10621 /// # use google_cloud_run_v2::model::RevisionTemplate;
10622 /// use google_cloud_run_v2::model::ServiceMesh;
10623 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
10624 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
10625 /// ```
10626 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
10627 where
10628 T: std::convert::Into<crate::model::ServiceMesh>,
10629 {
10630 self.service_mesh = v.map(|x| x.into());
10631 self
10632 }
10633
10634 /// Sets the value of [encryption_key_revocation_action][crate::model::RevisionTemplate::encryption_key_revocation_action].
10635 ///
10636 /// # Example
10637 /// ```ignore,no_run
10638 /// # use google_cloud_run_v2::model::RevisionTemplate;
10639 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
10640 /// let x0 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
10641 /// let x1 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
10642 /// ```
10643 pub fn set_encryption_key_revocation_action<
10644 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
10645 >(
10646 mut self,
10647 v: T,
10648 ) -> Self {
10649 self.encryption_key_revocation_action = v.into();
10650 self
10651 }
10652
10653 /// Sets the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10654 ///
10655 /// # Example
10656 /// ```ignore,no_run
10657 /// # use google_cloud_run_v2::model::RevisionTemplate;
10658 /// use wkt::Duration;
10659 /// let x = RevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
10660 /// ```
10661 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
10662 where
10663 T: std::convert::Into<wkt::Duration>,
10664 {
10665 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
10666 self
10667 }
10668
10669 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10670 ///
10671 /// # Example
10672 /// ```ignore,no_run
10673 /// # use google_cloud_run_v2::model::RevisionTemplate;
10674 /// use wkt::Duration;
10675 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
10676 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
10677 /// ```
10678 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
10679 mut self,
10680 v: std::option::Option<T>,
10681 ) -> Self
10682 where
10683 T: std::convert::Into<wkt::Duration>,
10684 {
10685 self.encryption_key_shutdown_duration = v.map(|x| x.into());
10686 self
10687 }
10688
10689 /// Sets the value of [session_affinity][crate::model::RevisionTemplate::session_affinity].
10690 ///
10691 /// # Example
10692 /// ```ignore,no_run
10693 /// # use google_cloud_run_v2::model::RevisionTemplate;
10694 /// let x = RevisionTemplate::new().set_session_affinity(true);
10695 /// ```
10696 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10697 self.session_affinity = v.into();
10698 self
10699 }
10700
10701 /// Sets the value of [health_check_disabled][crate::model::RevisionTemplate::health_check_disabled].
10702 ///
10703 /// # Example
10704 /// ```ignore,no_run
10705 /// # use google_cloud_run_v2::model::RevisionTemplate;
10706 /// let x = RevisionTemplate::new().set_health_check_disabled(true);
10707 /// ```
10708 pub fn set_health_check_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10709 self.health_check_disabled = v.into();
10710 self
10711 }
10712
10713 /// Sets the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10714 ///
10715 /// # Example
10716 /// ```ignore,no_run
10717 /// # use google_cloud_run_v2::model::RevisionTemplate;
10718 /// use google_cloud_run_v2::model::NodeSelector;
10719 /// let x = RevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
10720 /// ```
10721 pub fn set_node_selector<T>(mut self, v: T) -> Self
10722 where
10723 T: std::convert::Into<crate::model::NodeSelector>,
10724 {
10725 self.node_selector = std::option::Option::Some(v.into());
10726 self
10727 }
10728
10729 /// Sets or clears the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10730 ///
10731 /// # Example
10732 /// ```ignore,no_run
10733 /// # use google_cloud_run_v2::model::RevisionTemplate;
10734 /// use google_cloud_run_v2::model::NodeSelector;
10735 /// let x = RevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10736 /// let x = RevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
10737 /// ```
10738 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10739 where
10740 T: std::convert::Into<crate::model::NodeSelector>,
10741 {
10742 self.node_selector = v.map(|x| x.into());
10743 self
10744 }
10745
10746 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10747 ///
10748 /// # Example
10749 /// ```ignore,no_run
10750 /// # use google_cloud_run_v2::model::RevisionTemplate;
10751 /// let x = RevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
10752 /// ```
10753 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10754 where
10755 T: std::convert::Into<bool>,
10756 {
10757 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10758 self
10759 }
10760
10761 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10762 ///
10763 /// # Example
10764 /// ```ignore,no_run
10765 /// # use google_cloud_run_v2::model::RevisionTemplate;
10766 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10767 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10768 /// ```
10769 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10770 mut self,
10771 v: std::option::Option<T>,
10772 ) -> Self
10773 where
10774 T: std::convert::Into<bool>,
10775 {
10776 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10777 self
10778 }
10779}
10780
10781impl wkt::message::Message for RevisionTemplate {
10782 fn typename() -> &'static str {
10783 "type.googleapis.com/google.cloud.run.v2.RevisionTemplate"
10784 }
10785}
10786
10787/// Request message for creating a Service.
10788#[derive(Clone, Default, PartialEq)]
10789#[non_exhaustive]
10790pub struct CreateServiceRequest {
10791 /// Required. The location and project in which this service should be created.
10792 /// Format: projects/{project}/locations/{location}, where {project} can be
10793 /// project id or number. Only lowercase characters, digits, and hyphens.
10794 pub parent: std::string::String,
10795
10796 /// Required. The Service instance to create.
10797 pub service: std::option::Option<crate::model::Service>,
10798
10799 /// Required. The unique identifier for the Service. It must begin with letter,
10800 /// and cannot end with hyphen; must contain fewer than 50 characters.
10801 /// The name of the service becomes {parent}/services/{service_id}.
10802 pub service_id: std::string::String,
10803
10804 /// Indicates that the request should be validated and default values
10805 /// populated, without persisting the request or creating any resources.
10806 pub validate_only: bool,
10807
10808 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10809}
10810
10811impl CreateServiceRequest {
10812 /// Creates a new default instance.
10813 pub fn new() -> Self {
10814 std::default::Default::default()
10815 }
10816
10817 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
10818 ///
10819 /// # Example
10820 /// ```ignore,no_run
10821 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10822 /// # let project_id = "project_id";
10823 /// # let location_id = "location_id";
10824 /// let x = CreateServiceRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
10825 /// ```
10826 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10827 self.parent = v.into();
10828 self
10829 }
10830
10831 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
10832 ///
10833 /// # Example
10834 /// ```ignore,no_run
10835 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10836 /// use google_cloud_run_v2::model::Service;
10837 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
10838 /// ```
10839 pub fn set_service<T>(mut self, v: T) -> Self
10840 where
10841 T: std::convert::Into<crate::model::Service>,
10842 {
10843 self.service = std::option::Option::Some(v.into());
10844 self
10845 }
10846
10847 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
10848 ///
10849 /// # Example
10850 /// ```ignore,no_run
10851 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10852 /// use google_cloud_run_v2::model::Service;
10853 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10854 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
10855 /// ```
10856 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10857 where
10858 T: std::convert::Into<crate::model::Service>,
10859 {
10860 self.service = v.map(|x| x.into());
10861 self
10862 }
10863
10864 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
10865 ///
10866 /// # Example
10867 /// ```ignore,no_run
10868 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10869 /// let x = CreateServiceRequest::new().set_service_id("example");
10870 /// ```
10871 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10872 self.service_id = v.into();
10873 self
10874 }
10875
10876 /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
10877 ///
10878 /// # Example
10879 /// ```ignore,no_run
10880 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10881 /// let x = CreateServiceRequest::new().set_validate_only(true);
10882 /// ```
10883 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10884 self.validate_only = v.into();
10885 self
10886 }
10887}
10888
10889impl wkt::message::Message for CreateServiceRequest {
10890 fn typename() -> &'static str {
10891 "type.googleapis.com/google.cloud.run.v2.CreateServiceRequest"
10892 }
10893}
10894
10895/// Request message for updating a service.
10896#[derive(Clone, Default, PartialEq)]
10897#[non_exhaustive]
10898pub struct UpdateServiceRequest {
10899 /// Optional. The list of fields to be updated.
10900 pub update_mask: std::option::Option<wkt::FieldMask>,
10901
10902 /// Required. The Service to be updated.
10903 pub service: std::option::Option<crate::model::Service>,
10904
10905 /// Indicates that the request should be validated and default values
10906 /// populated, without persisting the request or updating any resources.
10907 pub validate_only: bool,
10908
10909 /// Optional. If set to true, and if the Service does not exist, it will create
10910 /// a new one. The caller must have 'run.services.create' permissions if this
10911 /// is set to true and the Service does not exist.
10912 pub allow_missing: bool,
10913
10914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10915}
10916
10917impl UpdateServiceRequest {
10918 /// Creates a new default instance.
10919 pub fn new() -> Self {
10920 std::default::Default::default()
10921 }
10922
10923 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10924 ///
10925 /// # Example
10926 /// ```ignore,no_run
10927 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10928 /// use wkt::FieldMask;
10929 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10930 /// ```
10931 pub fn set_update_mask<T>(mut self, v: T) -> Self
10932 where
10933 T: std::convert::Into<wkt::FieldMask>,
10934 {
10935 self.update_mask = std::option::Option::Some(v.into());
10936 self
10937 }
10938
10939 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10940 ///
10941 /// # Example
10942 /// ```ignore,no_run
10943 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10944 /// use wkt::FieldMask;
10945 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10946 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10947 /// ```
10948 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10949 where
10950 T: std::convert::Into<wkt::FieldMask>,
10951 {
10952 self.update_mask = v.map(|x| x.into());
10953 self
10954 }
10955
10956 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
10957 ///
10958 /// # Example
10959 /// ```ignore,no_run
10960 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10961 /// use google_cloud_run_v2::model::Service;
10962 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
10963 /// ```
10964 pub fn set_service<T>(mut self, v: T) -> Self
10965 where
10966 T: std::convert::Into<crate::model::Service>,
10967 {
10968 self.service = std::option::Option::Some(v.into());
10969 self
10970 }
10971
10972 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
10973 ///
10974 /// # Example
10975 /// ```ignore,no_run
10976 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10977 /// use google_cloud_run_v2::model::Service;
10978 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10979 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
10980 /// ```
10981 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10982 where
10983 T: std::convert::Into<crate::model::Service>,
10984 {
10985 self.service = v.map(|x| x.into());
10986 self
10987 }
10988
10989 /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
10990 ///
10991 /// # Example
10992 /// ```ignore,no_run
10993 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10994 /// let x = UpdateServiceRequest::new().set_validate_only(true);
10995 /// ```
10996 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10997 self.validate_only = v.into();
10998 self
10999 }
11000
11001 /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
11002 ///
11003 /// # Example
11004 /// ```ignore,no_run
11005 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
11006 /// let x = UpdateServiceRequest::new().set_allow_missing(true);
11007 /// ```
11008 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11009 self.allow_missing = v.into();
11010 self
11011 }
11012}
11013
11014impl wkt::message::Message for UpdateServiceRequest {
11015 fn typename() -> &'static str {
11016 "type.googleapis.com/google.cloud.run.v2.UpdateServiceRequest"
11017 }
11018}
11019
11020/// Request message for retrieving a list of Services.
11021#[derive(Clone, Default, PartialEq)]
11022#[non_exhaustive]
11023pub struct ListServicesRequest {
11024 /// Required. The location and project to list resources on.
11025 /// Location must be a valid Google Cloud region, and cannot be the "-"
11026 /// wildcard. Format: projects/{project}/locations/{location}, where {project}
11027 /// can be project id or number.
11028 pub parent: std::string::String,
11029
11030 /// Maximum number of Services to return in this call.
11031 pub page_size: i32,
11032
11033 /// A page token received from a previous call to ListServices.
11034 /// All other parameters must match.
11035 pub page_token: std::string::String,
11036
11037 /// If true, returns deleted (but unexpired) resources along with active ones.
11038 pub show_deleted: bool,
11039
11040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11041}
11042
11043impl ListServicesRequest {
11044 /// Creates a new default instance.
11045 pub fn new() -> Self {
11046 std::default::Default::default()
11047 }
11048
11049 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
11050 ///
11051 /// # Example
11052 /// ```ignore,no_run
11053 /// # use google_cloud_run_v2::model::ListServicesRequest;
11054 /// # let project_id = "project_id";
11055 /// # let location_id = "location_id";
11056 /// let x = ListServicesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
11057 /// ```
11058 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11059 self.parent = v.into();
11060 self
11061 }
11062
11063 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
11064 ///
11065 /// # Example
11066 /// ```ignore,no_run
11067 /// # use google_cloud_run_v2::model::ListServicesRequest;
11068 /// let x = ListServicesRequest::new().set_page_size(42);
11069 /// ```
11070 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11071 self.page_size = v.into();
11072 self
11073 }
11074
11075 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
11076 ///
11077 /// # Example
11078 /// ```ignore,no_run
11079 /// # use google_cloud_run_v2::model::ListServicesRequest;
11080 /// let x = ListServicesRequest::new().set_page_token("example");
11081 /// ```
11082 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11083 self.page_token = v.into();
11084 self
11085 }
11086
11087 /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
11088 ///
11089 /// # Example
11090 /// ```ignore,no_run
11091 /// # use google_cloud_run_v2::model::ListServicesRequest;
11092 /// let x = ListServicesRequest::new().set_show_deleted(true);
11093 /// ```
11094 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11095 self.show_deleted = v.into();
11096 self
11097 }
11098}
11099
11100impl wkt::message::Message for ListServicesRequest {
11101 fn typename() -> &'static str {
11102 "type.googleapis.com/google.cloud.run.v2.ListServicesRequest"
11103 }
11104}
11105
11106/// Response message containing a list of Services.
11107#[derive(Clone, Default, PartialEq)]
11108#[non_exhaustive]
11109pub struct ListServicesResponse {
11110 /// The resulting list of Services.
11111 pub services: std::vec::Vec<crate::model::Service>,
11112
11113 /// A token indicating there are more items than page_size. Use it in the next
11114 /// ListServices request to continue.
11115 pub next_page_token: std::string::String,
11116
11117 /// Output only. For global requests, returns the list of regions that could
11118 /// not be reached within the deadline.
11119 pub unreachable: std::vec::Vec<std::string::String>,
11120
11121 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11122}
11123
11124impl ListServicesResponse {
11125 /// Creates a new default instance.
11126 pub fn new() -> Self {
11127 std::default::Default::default()
11128 }
11129
11130 /// Sets the value of [services][crate::model::ListServicesResponse::services].
11131 ///
11132 /// # Example
11133 /// ```ignore,no_run
11134 /// # use google_cloud_run_v2::model::ListServicesResponse;
11135 /// use google_cloud_run_v2::model::Service;
11136 /// let x = ListServicesResponse::new()
11137 /// .set_services([
11138 /// Service::default()/* use setters */,
11139 /// Service::default()/* use (different) setters */,
11140 /// ]);
11141 /// ```
11142 pub fn set_services<T, V>(mut self, v: T) -> Self
11143 where
11144 T: std::iter::IntoIterator<Item = V>,
11145 V: std::convert::Into<crate::model::Service>,
11146 {
11147 use std::iter::Iterator;
11148 self.services = v.into_iter().map(|i| i.into()).collect();
11149 self
11150 }
11151
11152 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
11153 ///
11154 /// # Example
11155 /// ```ignore,no_run
11156 /// # use google_cloud_run_v2::model::ListServicesResponse;
11157 /// let x = ListServicesResponse::new().set_next_page_token("example");
11158 /// ```
11159 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11160 self.next_page_token = v.into();
11161 self
11162 }
11163
11164 /// Sets the value of [unreachable][crate::model::ListServicesResponse::unreachable].
11165 ///
11166 /// # Example
11167 /// ```ignore,no_run
11168 /// # use google_cloud_run_v2::model::ListServicesResponse;
11169 /// let x = ListServicesResponse::new().set_unreachable(["a", "b", "c"]);
11170 /// ```
11171 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
11172 where
11173 T: std::iter::IntoIterator<Item = V>,
11174 V: std::convert::Into<std::string::String>,
11175 {
11176 use std::iter::Iterator;
11177 self.unreachable = v.into_iter().map(|i| i.into()).collect();
11178 self
11179 }
11180}
11181
11182impl wkt::message::Message for ListServicesResponse {
11183 fn typename() -> &'static str {
11184 "type.googleapis.com/google.cloud.run.v2.ListServicesResponse"
11185 }
11186}
11187
11188#[doc(hidden)]
11189impl google_cloud_gax::paginator::internal::PageableResponse for ListServicesResponse {
11190 type PageItem = crate::model::Service;
11191
11192 fn items(self) -> std::vec::Vec<Self::PageItem> {
11193 self.services
11194 }
11195
11196 fn next_page_token(&self) -> std::string::String {
11197 use std::clone::Clone;
11198 self.next_page_token.clone()
11199 }
11200}
11201
11202/// Request message for obtaining a Service by its full name.
11203#[derive(Clone, Default, PartialEq)]
11204#[non_exhaustive]
11205pub struct GetServiceRequest {
11206 /// Required. The full name of the Service.
11207 /// Format: projects/{project}/locations/{location}/services/{service}, where
11208 /// {project} can be project id or number.
11209 pub name: std::string::String,
11210
11211 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11212}
11213
11214impl GetServiceRequest {
11215 /// Creates a new default instance.
11216 pub fn new() -> Self {
11217 std::default::Default::default()
11218 }
11219
11220 /// Sets the value of [name][crate::model::GetServiceRequest::name].
11221 ///
11222 /// # Example
11223 /// ```ignore,no_run
11224 /// # use google_cloud_run_v2::model::GetServiceRequest;
11225 /// # let project_id = "project_id";
11226 /// # let location_id = "location_id";
11227 /// # let service_id = "service_id";
11228 /// let x = GetServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
11229 /// ```
11230 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11231 self.name = v.into();
11232 self
11233 }
11234}
11235
11236impl wkt::message::Message for GetServiceRequest {
11237 fn typename() -> &'static str {
11238 "type.googleapis.com/google.cloud.run.v2.GetServiceRequest"
11239 }
11240}
11241
11242/// Request message to delete a Service by its full name.
11243#[derive(Clone, Default, PartialEq)]
11244#[non_exhaustive]
11245pub struct DeleteServiceRequest {
11246 /// Required. The full name of the Service.
11247 /// Format: projects/{project}/locations/{location}/services/{service}, where
11248 /// {project} can be project id or number.
11249 pub name: std::string::String,
11250
11251 /// Indicates that the request should be validated without actually
11252 /// deleting any resources.
11253 pub validate_only: bool,
11254
11255 /// A system-generated fingerprint for this version of the
11256 /// resource. May be used to detect modification conflict during updates.
11257 pub etag: std::string::String,
11258
11259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11260}
11261
11262impl DeleteServiceRequest {
11263 /// Creates a new default instance.
11264 pub fn new() -> Self {
11265 std::default::Default::default()
11266 }
11267
11268 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
11269 ///
11270 /// # Example
11271 /// ```ignore,no_run
11272 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11273 /// # let project_id = "project_id";
11274 /// # let location_id = "location_id";
11275 /// # let service_id = "service_id";
11276 /// let x = DeleteServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
11277 /// ```
11278 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11279 self.name = v.into();
11280 self
11281 }
11282
11283 /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
11284 ///
11285 /// # Example
11286 /// ```ignore,no_run
11287 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11288 /// let x = DeleteServiceRequest::new().set_validate_only(true);
11289 /// ```
11290 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11291 self.validate_only = v.into();
11292 self
11293 }
11294
11295 /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
11296 ///
11297 /// # Example
11298 /// ```ignore,no_run
11299 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11300 /// let x = DeleteServiceRequest::new().set_etag("example");
11301 /// ```
11302 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11303 self.etag = v.into();
11304 self
11305 }
11306}
11307
11308impl wkt::message::Message for DeleteServiceRequest {
11309 fn typename() -> &'static str {
11310 "type.googleapis.com/google.cloud.run.v2.DeleteServiceRequest"
11311 }
11312}
11313
11314/// Service acts as a top-level container that manages a set of
11315/// configurations and revision templates which implement a network service.
11316/// Service exists to provide a singular abstraction which can be access
11317/// controlled, reasoned about, and which encapsulates software lifecycle
11318/// decisions such as rollout policy and team resource ownership.
11319#[derive(Clone, Default, PartialEq)]
11320#[non_exhaustive]
11321pub struct Service {
11322 /// Identifier. The fully qualified name of this Service. In
11323 /// CreateServiceRequest, this field is ignored, and instead composed from
11324 /// CreateServiceRequest.parent and CreateServiceRequest.service_id.
11325 ///
11326 /// Format:
11327 /// projects/{project}/locations/{location}/services/{service_id}
11328 pub name: std::string::String,
11329
11330 /// User-provided description of the Service. This field currently has a
11331 /// 512-character limit.
11332 pub description: std::string::String,
11333
11334 /// Output only. Server assigned unique identifier for the trigger. The value
11335 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
11336 /// deleted.
11337 pub uid: std::string::String,
11338
11339 /// Output only. A number that monotonically increases every time the user
11340 /// modifies the desired state.
11341 /// Please note that unlike v1, this is an int64 value. As with most Google
11342 /// APIs, its JSON representation will be a `string` instead of an `integer`.
11343 pub generation: i64,
11344
11345 /// Optional. Unstructured key value map that can be used to organize and
11346 /// categorize objects. User-provided labels are shared with Google's billing
11347 /// system, so they can be used to filter, or break down billing charges by
11348 /// team, component, environment, state, etc. For more information, visit
11349 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
11350 /// <https://cloud.google.com/run/docs/configuring/labels>.
11351 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11352
11353 /// Optional. Unstructured key value map that may be set by external tools to
11354 /// store and arbitrary metadata. They are not queryable and should be
11355 /// preserved when modifying objects.
11356 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
11357
11358 /// Output only. The creation time.
11359 pub create_time: std::option::Option<wkt::Timestamp>,
11360
11361 /// Output only. The last-modified time.
11362 pub update_time: std::option::Option<wkt::Timestamp>,
11363
11364 /// Output only. The deletion time. It is only populated as a response to a
11365 /// Delete request.
11366 pub delete_time: std::option::Option<wkt::Timestamp>,
11367
11368 /// Output only. For a deleted resource, the time after which it will be
11369 /// permanently deleted.
11370 pub expire_time: std::option::Option<wkt::Timestamp>,
11371
11372 /// Output only. Email address of the authenticated creator.
11373 pub creator: std::string::String,
11374
11375 /// Output only. Email address of the last authenticated modifier.
11376 pub last_modifier: std::string::String,
11377
11378 /// Arbitrary identifier for the API client.
11379 pub client: std::string::String,
11380
11381 /// Arbitrary version identifier for the API client.
11382 pub client_version: std::string::String,
11383
11384 /// Optional. Provides the ingress settings for this Service. On output,
11385 /// returns the currently observed ingress settings, or
11386 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
11387 pub ingress: crate::model::IngressTraffic,
11388
11389 /// Optional. The launch stage as defined by [Google Cloud Platform
11390 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
11391 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
11392 /// is assumed.
11393 /// Set the launch stage to a preview stage on input to allow use of preview
11394 /// features in that stage. On read (or output), describes whether the resource
11395 /// uses preview features.
11396 ///
11397 /// For example, if ALPHA is provided as input, but only BETA and GA-level
11398 /// features are used, this field will be BETA on output.
11399 pub launch_stage: google_cloud_api::model::LaunchStage,
11400
11401 /// Optional. Settings for the Binary Authorization feature.
11402 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
11403
11404 /// Required. The template used to create revisions for this Service.
11405 pub template: std::option::Option<crate::model::RevisionTemplate>,
11406
11407 /// Optional. Specifies how to distribute traffic over a collection of
11408 /// Revisions belonging to the Service. If traffic is empty or not provided,
11409 /// defaults to 100% traffic to the latest `Ready` Revision.
11410 pub traffic: std::vec::Vec<crate::model::TrafficTarget>,
11411
11412 /// Optional. Specifies service-level scaling settings
11413 pub scaling: std::option::Option<crate::model::ServiceScaling>,
11414
11415 /// Optional. Disables IAM permission check for run.routes.invoke for callers
11416 /// of this service. For more information, visit
11417 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
11418 pub invoker_iam_disabled: bool,
11419
11420 /// Optional. Disables public resolution of the default URI of this service.
11421 pub default_uri_disabled: bool,
11422
11423 /// Output only. All URLs serving traffic for this Service.
11424 pub urls: std::vec::Vec<std::string::String>,
11425
11426 /// Optional. IAP settings on the Service.
11427 pub iap_enabled: bool,
11428
11429 /// Optional. Settings for multi-region deployment.
11430 pub multi_region_settings: std::option::Option<crate::model::service::MultiRegionSettings>,
11431
11432 /// One or more custom audiences that you want this service to support. Specify
11433 /// each custom audience as the full URL in a string. The custom audiences are
11434 /// encoded in the token and used to authenticate requests. For more
11435 /// information, see
11436 /// <https://cloud.google.com/run/docs/configuring/custom-audiences>.
11437 pub custom_audiences: std::vec::Vec<std::string::String>,
11438
11439 /// Output only. The generation of this Service currently serving traffic. See
11440 /// comments in `reconciling` for additional information on reconciliation
11441 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
11442 /// As with most Google APIs, its JSON representation will be a `string`
11443 /// instead of an `integer`.
11444 pub observed_generation: i64,
11445
11446 /// Output only. The Condition of this Service, containing its readiness
11447 /// status, and detailed error information in case it did not reach a serving
11448 /// state. See comments in `reconciling` for additional information on
11449 /// reconciliation process in Cloud Run.
11450 pub terminal_condition: std::option::Option<crate::model::Condition>,
11451
11452 /// Output only. The Conditions of all other associated sub-resources. They
11453 /// contain additional diagnostics information in case the Service does not
11454 /// reach its Serving state. See comments in `reconciling` for additional
11455 /// information on reconciliation process in Cloud Run.
11456 pub conditions: std::vec::Vec<crate::model::Condition>,
11457
11458 /// Output only. Name of the latest revision that is serving traffic. See
11459 /// comments in `reconciling` for additional information on reconciliation
11460 /// process in Cloud Run.
11461 pub latest_ready_revision: std::string::String,
11462
11463 /// Output only. Name of the last created revision. See comments in
11464 /// `reconciling` for additional information on reconciliation process in Cloud
11465 /// Run.
11466 pub latest_created_revision: std::string::String,
11467
11468 /// Output only. Detailed status information for corresponding traffic targets.
11469 /// See comments in `reconciling` for additional information on reconciliation
11470 /// process in Cloud Run.
11471 pub traffic_statuses: std::vec::Vec<crate::model::TrafficTargetStatus>,
11472
11473 /// Output only. The main URI in which this Service is serving traffic.
11474 pub uri: std::string::String,
11475
11476 /// Output only. Reserved for future use.
11477 pub satisfies_pzs: bool,
11478
11479 /// Output only. True if Cloud Run Threat Detection monitoring is enabled for
11480 /// the parent project of this Service.
11481 pub threat_detection_enabled: bool,
11482
11483 /// Optional. Configuration for building a Cloud Run function.
11484 pub build_config: std::option::Option<crate::model::BuildConfig>,
11485
11486 /// Output only. Returns true if the Service is currently being acted upon by
11487 /// the system to bring it into the desired state.
11488 ///
11489 /// When a new Service is created, or an existing one is updated, Cloud Run
11490 /// will asynchronously perform all necessary steps to bring the Service to the
11491 /// desired serving state. This process is called reconciliation.
11492 /// While reconciliation is in process, `observed_generation`,
11493 /// `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient
11494 /// values that might mismatch the intended state: Once reconciliation is over
11495 /// (and this field is false), there are two possible outcomes: reconciliation
11496 /// succeeded and the serving state matches the Service, or there was an error,
11497 /// and reconciliation failed. This state can be found in
11498 /// `terminal_condition.state`.
11499 ///
11500 /// If reconciliation succeeded, the following fields will match: `traffic` and
11501 /// `traffic_statuses`, `observed_generation` and `generation`,
11502 /// `latest_ready_revision` and `latest_created_revision`.
11503 ///
11504 /// If reconciliation failed, `traffic_statuses`, `observed_generation`, and
11505 /// `latest_ready_revision` will have the state of the last serving revision,
11506 /// or empty for newly created Services. Additional information on the failure
11507 /// can be found in `terminal_condition` and `conditions`.
11508 pub reconciling: bool,
11509
11510 /// Optional. A system-generated fingerprint for this version of the
11511 /// resource. May be used to detect modification conflict during updates.
11512 pub etag: std::string::String,
11513
11514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11515}
11516
11517impl Service {
11518 /// Creates a new default instance.
11519 pub fn new() -> Self {
11520 std::default::Default::default()
11521 }
11522
11523 /// Sets the value of [name][crate::model::Service::name].
11524 ///
11525 /// # Example
11526 /// ```ignore,no_run
11527 /// # use google_cloud_run_v2::model::Service;
11528 /// # let project_id = "project_id";
11529 /// # let location_id = "location_id";
11530 /// # let service_id = "service_id";
11531 /// let x = Service::new().set_name(format!("projects/{project_id}/locations/{location_id}/services/{service_id}"));
11532 /// ```
11533 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11534 self.name = v.into();
11535 self
11536 }
11537
11538 /// Sets the value of [description][crate::model::Service::description].
11539 ///
11540 /// # Example
11541 /// ```ignore,no_run
11542 /// # use google_cloud_run_v2::model::Service;
11543 /// let x = Service::new().set_description("example");
11544 /// ```
11545 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11546 self.description = v.into();
11547 self
11548 }
11549
11550 /// Sets the value of [uid][crate::model::Service::uid].
11551 ///
11552 /// # Example
11553 /// ```ignore,no_run
11554 /// # use google_cloud_run_v2::model::Service;
11555 /// let x = Service::new().set_uid("example");
11556 /// ```
11557 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11558 self.uid = v.into();
11559 self
11560 }
11561
11562 /// Sets the value of [generation][crate::model::Service::generation].
11563 ///
11564 /// # Example
11565 /// ```ignore,no_run
11566 /// # use google_cloud_run_v2::model::Service;
11567 /// let x = Service::new().set_generation(42);
11568 /// ```
11569 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11570 self.generation = v.into();
11571 self
11572 }
11573
11574 /// Sets the value of [labels][crate::model::Service::labels].
11575 ///
11576 /// # Example
11577 /// ```ignore,no_run
11578 /// # use google_cloud_run_v2::model::Service;
11579 /// let x = Service::new().set_labels([
11580 /// ("key0", "abc"),
11581 /// ("key1", "xyz"),
11582 /// ]);
11583 /// ```
11584 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11585 where
11586 T: std::iter::IntoIterator<Item = (K, V)>,
11587 K: std::convert::Into<std::string::String>,
11588 V: std::convert::Into<std::string::String>,
11589 {
11590 use std::iter::Iterator;
11591 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11592 self
11593 }
11594
11595 /// Sets the value of [annotations][crate::model::Service::annotations].
11596 ///
11597 /// # Example
11598 /// ```ignore,no_run
11599 /// # use google_cloud_run_v2::model::Service;
11600 /// let x = Service::new().set_annotations([
11601 /// ("key0", "abc"),
11602 /// ("key1", "xyz"),
11603 /// ]);
11604 /// ```
11605 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
11606 where
11607 T: std::iter::IntoIterator<Item = (K, V)>,
11608 K: std::convert::Into<std::string::String>,
11609 V: std::convert::Into<std::string::String>,
11610 {
11611 use std::iter::Iterator;
11612 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11613 self
11614 }
11615
11616 /// Sets the value of [create_time][crate::model::Service::create_time].
11617 ///
11618 /// # Example
11619 /// ```ignore,no_run
11620 /// # use google_cloud_run_v2::model::Service;
11621 /// use wkt::Timestamp;
11622 /// let x = Service::new().set_create_time(Timestamp::default()/* use setters */);
11623 /// ```
11624 pub fn set_create_time<T>(mut self, v: T) -> Self
11625 where
11626 T: std::convert::Into<wkt::Timestamp>,
11627 {
11628 self.create_time = std::option::Option::Some(v.into());
11629 self
11630 }
11631
11632 /// Sets or clears the value of [create_time][crate::model::Service::create_time].
11633 ///
11634 /// # Example
11635 /// ```ignore,no_run
11636 /// # use google_cloud_run_v2::model::Service;
11637 /// use wkt::Timestamp;
11638 /// let x = Service::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11639 /// let x = Service::new().set_or_clear_create_time(None::<Timestamp>);
11640 /// ```
11641 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11642 where
11643 T: std::convert::Into<wkt::Timestamp>,
11644 {
11645 self.create_time = v.map(|x| x.into());
11646 self
11647 }
11648
11649 /// Sets the value of [update_time][crate::model::Service::update_time].
11650 ///
11651 /// # Example
11652 /// ```ignore,no_run
11653 /// # use google_cloud_run_v2::model::Service;
11654 /// use wkt::Timestamp;
11655 /// let x = Service::new().set_update_time(Timestamp::default()/* use setters */);
11656 /// ```
11657 pub fn set_update_time<T>(mut self, v: T) -> Self
11658 where
11659 T: std::convert::Into<wkt::Timestamp>,
11660 {
11661 self.update_time = std::option::Option::Some(v.into());
11662 self
11663 }
11664
11665 /// Sets or clears the value of [update_time][crate::model::Service::update_time].
11666 ///
11667 /// # Example
11668 /// ```ignore,no_run
11669 /// # use google_cloud_run_v2::model::Service;
11670 /// use wkt::Timestamp;
11671 /// let x = Service::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11672 /// let x = Service::new().set_or_clear_update_time(None::<Timestamp>);
11673 /// ```
11674 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11675 where
11676 T: std::convert::Into<wkt::Timestamp>,
11677 {
11678 self.update_time = v.map(|x| x.into());
11679 self
11680 }
11681
11682 /// Sets the value of [delete_time][crate::model::Service::delete_time].
11683 ///
11684 /// # Example
11685 /// ```ignore,no_run
11686 /// # use google_cloud_run_v2::model::Service;
11687 /// use wkt::Timestamp;
11688 /// let x = Service::new().set_delete_time(Timestamp::default()/* use setters */);
11689 /// ```
11690 pub fn set_delete_time<T>(mut self, v: T) -> Self
11691 where
11692 T: std::convert::Into<wkt::Timestamp>,
11693 {
11694 self.delete_time = std::option::Option::Some(v.into());
11695 self
11696 }
11697
11698 /// Sets or clears the value of [delete_time][crate::model::Service::delete_time].
11699 ///
11700 /// # Example
11701 /// ```ignore,no_run
11702 /// # use google_cloud_run_v2::model::Service;
11703 /// use wkt::Timestamp;
11704 /// let x = Service::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
11705 /// let x = Service::new().set_or_clear_delete_time(None::<Timestamp>);
11706 /// ```
11707 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
11708 where
11709 T: std::convert::Into<wkt::Timestamp>,
11710 {
11711 self.delete_time = v.map(|x| x.into());
11712 self
11713 }
11714
11715 /// Sets the value of [expire_time][crate::model::Service::expire_time].
11716 ///
11717 /// # Example
11718 /// ```ignore,no_run
11719 /// # use google_cloud_run_v2::model::Service;
11720 /// use wkt::Timestamp;
11721 /// let x = Service::new().set_expire_time(Timestamp::default()/* use setters */);
11722 /// ```
11723 pub fn set_expire_time<T>(mut self, v: T) -> Self
11724 where
11725 T: std::convert::Into<wkt::Timestamp>,
11726 {
11727 self.expire_time = std::option::Option::Some(v.into());
11728 self
11729 }
11730
11731 /// Sets or clears the value of [expire_time][crate::model::Service::expire_time].
11732 ///
11733 /// # Example
11734 /// ```ignore,no_run
11735 /// # use google_cloud_run_v2::model::Service;
11736 /// use wkt::Timestamp;
11737 /// let x = Service::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
11738 /// let x = Service::new().set_or_clear_expire_time(None::<Timestamp>);
11739 /// ```
11740 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
11741 where
11742 T: std::convert::Into<wkt::Timestamp>,
11743 {
11744 self.expire_time = v.map(|x| x.into());
11745 self
11746 }
11747
11748 /// Sets the value of [creator][crate::model::Service::creator].
11749 ///
11750 /// # Example
11751 /// ```ignore,no_run
11752 /// # use google_cloud_run_v2::model::Service;
11753 /// let x = Service::new().set_creator("example");
11754 /// ```
11755 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11756 self.creator = v.into();
11757 self
11758 }
11759
11760 /// Sets the value of [last_modifier][crate::model::Service::last_modifier].
11761 ///
11762 /// # Example
11763 /// ```ignore,no_run
11764 /// # use google_cloud_run_v2::model::Service;
11765 /// let x = Service::new().set_last_modifier("example");
11766 /// ```
11767 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11768 self.last_modifier = v.into();
11769 self
11770 }
11771
11772 /// Sets the value of [client][crate::model::Service::client].
11773 ///
11774 /// # Example
11775 /// ```ignore,no_run
11776 /// # use google_cloud_run_v2::model::Service;
11777 /// let x = Service::new().set_client("example");
11778 /// ```
11779 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11780 self.client = v.into();
11781 self
11782 }
11783
11784 /// Sets the value of [client_version][crate::model::Service::client_version].
11785 ///
11786 /// # Example
11787 /// ```ignore,no_run
11788 /// # use google_cloud_run_v2::model::Service;
11789 /// let x = Service::new().set_client_version("example");
11790 /// ```
11791 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11792 self.client_version = v.into();
11793 self
11794 }
11795
11796 /// Sets the value of [ingress][crate::model::Service::ingress].
11797 ///
11798 /// # Example
11799 /// ```ignore,no_run
11800 /// # use google_cloud_run_v2::model::Service;
11801 /// use google_cloud_run_v2::model::IngressTraffic;
11802 /// let x0 = Service::new().set_ingress(IngressTraffic::All);
11803 /// let x1 = Service::new().set_ingress(IngressTraffic::InternalOnly);
11804 /// let x2 = Service::new().set_ingress(IngressTraffic::InternalLoadBalancer);
11805 /// ```
11806 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
11807 mut self,
11808 v: T,
11809 ) -> Self {
11810 self.ingress = v.into();
11811 self
11812 }
11813
11814 /// Sets the value of [launch_stage][crate::model::Service::launch_stage].
11815 ///
11816 /// # Example
11817 /// ```ignore,no_run
11818 /// # use google_cloud_run_v2::model::Service;
11819 /// use google_cloud_api::model::LaunchStage;
11820 /// let x0 = Service::new().set_launch_stage(LaunchStage::Unimplemented);
11821 /// let x1 = Service::new().set_launch_stage(LaunchStage::Prelaunch);
11822 /// let x2 = Service::new().set_launch_stage(LaunchStage::EarlyAccess);
11823 /// ```
11824 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
11825 mut self,
11826 v: T,
11827 ) -> Self {
11828 self.launch_stage = v.into();
11829 self
11830 }
11831
11832 /// Sets the value of [binary_authorization][crate::model::Service::binary_authorization].
11833 ///
11834 /// # Example
11835 /// ```ignore,no_run
11836 /// # use google_cloud_run_v2::model::Service;
11837 /// use google_cloud_run_v2::model::BinaryAuthorization;
11838 /// let x = Service::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
11839 /// ```
11840 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
11841 where
11842 T: std::convert::Into<crate::model::BinaryAuthorization>,
11843 {
11844 self.binary_authorization = std::option::Option::Some(v.into());
11845 self
11846 }
11847
11848 /// Sets or clears the value of [binary_authorization][crate::model::Service::binary_authorization].
11849 ///
11850 /// # Example
11851 /// ```ignore,no_run
11852 /// # use google_cloud_run_v2::model::Service;
11853 /// use google_cloud_run_v2::model::BinaryAuthorization;
11854 /// let x = Service::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
11855 /// let x = Service::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
11856 /// ```
11857 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
11858 where
11859 T: std::convert::Into<crate::model::BinaryAuthorization>,
11860 {
11861 self.binary_authorization = v.map(|x| x.into());
11862 self
11863 }
11864
11865 /// Sets the value of [template][crate::model::Service::template].
11866 ///
11867 /// # Example
11868 /// ```ignore,no_run
11869 /// # use google_cloud_run_v2::model::Service;
11870 /// use google_cloud_run_v2::model::RevisionTemplate;
11871 /// let x = Service::new().set_template(RevisionTemplate::default()/* use setters */);
11872 /// ```
11873 pub fn set_template<T>(mut self, v: T) -> Self
11874 where
11875 T: std::convert::Into<crate::model::RevisionTemplate>,
11876 {
11877 self.template = std::option::Option::Some(v.into());
11878 self
11879 }
11880
11881 /// Sets or clears the value of [template][crate::model::Service::template].
11882 ///
11883 /// # Example
11884 /// ```ignore,no_run
11885 /// # use google_cloud_run_v2::model::Service;
11886 /// use google_cloud_run_v2::model::RevisionTemplate;
11887 /// let x = Service::new().set_or_clear_template(Some(RevisionTemplate::default()/* use setters */));
11888 /// let x = Service::new().set_or_clear_template(None::<RevisionTemplate>);
11889 /// ```
11890 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
11891 where
11892 T: std::convert::Into<crate::model::RevisionTemplate>,
11893 {
11894 self.template = v.map(|x| x.into());
11895 self
11896 }
11897
11898 /// Sets the value of [traffic][crate::model::Service::traffic].
11899 ///
11900 /// # Example
11901 /// ```ignore,no_run
11902 /// # use google_cloud_run_v2::model::Service;
11903 /// use google_cloud_run_v2::model::TrafficTarget;
11904 /// let x = Service::new()
11905 /// .set_traffic([
11906 /// TrafficTarget::default()/* use setters */,
11907 /// TrafficTarget::default()/* use (different) setters */,
11908 /// ]);
11909 /// ```
11910 pub fn set_traffic<T, V>(mut self, v: T) -> Self
11911 where
11912 T: std::iter::IntoIterator<Item = V>,
11913 V: std::convert::Into<crate::model::TrafficTarget>,
11914 {
11915 use std::iter::Iterator;
11916 self.traffic = v.into_iter().map(|i| i.into()).collect();
11917 self
11918 }
11919
11920 /// Sets the value of [scaling][crate::model::Service::scaling].
11921 ///
11922 /// # Example
11923 /// ```ignore,no_run
11924 /// # use google_cloud_run_v2::model::Service;
11925 /// use google_cloud_run_v2::model::ServiceScaling;
11926 /// let x = Service::new().set_scaling(ServiceScaling::default()/* use setters */);
11927 /// ```
11928 pub fn set_scaling<T>(mut self, v: T) -> Self
11929 where
11930 T: std::convert::Into<crate::model::ServiceScaling>,
11931 {
11932 self.scaling = std::option::Option::Some(v.into());
11933 self
11934 }
11935
11936 /// Sets or clears the value of [scaling][crate::model::Service::scaling].
11937 ///
11938 /// # Example
11939 /// ```ignore,no_run
11940 /// # use google_cloud_run_v2::model::Service;
11941 /// use google_cloud_run_v2::model::ServiceScaling;
11942 /// let x = Service::new().set_or_clear_scaling(Some(ServiceScaling::default()/* use setters */));
11943 /// let x = Service::new().set_or_clear_scaling(None::<ServiceScaling>);
11944 /// ```
11945 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
11946 where
11947 T: std::convert::Into<crate::model::ServiceScaling>,
11948 {
11949 self.scaling = v.map(|x| x.into());
11950 self
11951 }
11952
11953 /// Sets the value of [invoker_iam_disabled][crate::model::Service::invoker_iam_disabled].
11954 ///
11955 /// # Example
11956 /// ```ignore,no_run
11957 /// # use google_cloud_run_v2::model::Service;
11958 /// let x = Service::new().set_invoker_iam_disabled(true);
11959 /// ```
11960 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11961 self.invoker_iam_disabled = v.into();
11962 self
11963 }
11964
11965 /// Sets the value of [default_uri_disabled][crate::model::Service::default_uri_disabled].
11966 ///
11967 /// # Example
11968 /// ```ignore,no_run
11969 /// # use google_cloud_run_v2::model::Service;
11970 /// let x = Service::new().set_default_uri_disabled(true);
11971 /// ```
11972 pub fn set_default_uri_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11973 self.default_uri_disabled = v.into();
11974 self
11975 }
11976
11977 /// Sets the value of [urls][crate::model::Service::urls].
11978 ///
11979 /// # Example
11980 /// ```ignore,no_run
11981 /// # use google_cloud_run_v2::model::Service;
11982 /// let x = Service::new().set_urls(["a", "b", "c"]);
11983 /// ```
11984 pub fn set_urls<T, V>(mut self, v: T) -> Self
11985 where
11986 T: std::iter::IntoIterator<Item = V>,
11987 V: std::convert::Into<std::string::String>,
11988 {
11989 use std::iter::Iterator;
11990 self.urls = v.into_iter().map(|i| i.into()).collect();
11991 self
11992 }
11993
11994 /// Sets the value of [iap_enabled][crate::model::Service::iap_enabled].
11995 ///
11996 /// # Example
11997 /// ```ignore,no_run
11998 /// # use google_cloud_run_v2::model::Service;
11999 /// let x = Service::new().set_iap_enabled(true);
12000 /// ```
12001 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12002 self.iap_enabled = v.into();
12003 self
12004 }
12005
12006 /// Sets the value of [multi_region_settings][crate::model::Service::multi_region_settings].
12007 ///
12008 /// # Example
12009 /// ```ignore,no_run
12010 /// # use google_cloud_run_v2::model::Service;
12011 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
12012 /// let x = Service::new().set_multi_region_settings(MultiRegionSettings::default()/* use setters */);
12013 /// ```
12014 pub fn set_multi_region_settings<T>(mut self, v: T) -> Self
12015 where
12016 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
12017 {
12018 self.multi_region_settings = std::option::Option::Some(v.into());
12019 self
12020 }
12021
12022 /// Sets or clears the value of [multi_region_settings][crate::model::Service::multi_region_settings].
12023 ///
12024 /// # Example
12025 /// ```ignore,no_run
12026 /// # use google_cloud_run_v2::model::Service;
12027 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
12028 /// let x = Service::new().set_or_clear_multi_region_settings(Some(MultiRegionSettings::default()/* use setters */));
12029 /// let x = Service::new().set_or_clear_multi_region_settings(None::<MultiRegionSettings>);
12030 /// ```
12031 pub fn set_or_clear_multi_region_settings<T>(mut self, v: std::option::Option<T>) -> Self
12032 where
12033 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
12034 {
12035 self.multi_region_settings = v.map(|x| x.into());
12036 self
12037 }
12038
12039 /// Sets the value of [custom_audiences][crate::model::Service::custom_audiences].
12040 ///
12041 /// # Example
12042 /// ```ignore,no_run
12043 /// # use google_cloud_run_v2::model::Service;
12044 /// let x = Service::new().set_custom_audiences(["a", "b", "c"]);
12045 /// ```
12046 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
12047 where
12048 T: std::iter::IntoIterator<Item = V>,
12049 V: std::convert::Into<std::string::String>,
12050 {
12051 use std::iter::Iterator;
12052 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
12053 self
12054 }
12055
12056 /// Sets the value of [observed_generation][crate::model::Service::observed_generation].
12057 ///
12058 /// # Example
12059 /// ```ignore,no_run
12060 /// # use google_cloud_run_v2::model::Service;
12061 /// let x = Service::new().set_observed_generation(42);
12062 /// ```
12063 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12064 self.observed_generation = v.into();
12065 self
12066 }
12067
12068 /// Sets the value of [terminal_condition][crate::model::Service::terminal_condition].
12069 ///
12070 /// # Example
12071 /// ```ignore,no_run
12072 /// # use google_cloud_run_v2::model::Service;
12073 /// use google_cloud_run_v2::model::Condition;
12074 /// let x = Service::new().set_terminal_condition(Condition::default()/* use setters */);
12075 /// ```
12076 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
12077 where
12078 T: std::convert::Into<crate::model::Condition>,
12079 {
12080 self.terminal_condition = std::option::Option::Some(v.into());
12081 self
12082 }
12083
12084 /// Sets or clears the value of [terminal_condition][crate::model::Service::terminal_condition].
12085 ///
12086 /// # Example
12087 /// ```ignore,no_run
12088 /// # use google_cloud_run_v2::model::Service;
12089 /// use google_cloud_run_v2::model::Condition;
12090 /// let x = Service::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
12091 /// let x = Service::new().set_or_clear_terminal_condition(None::<Condition>);
12092 /// ```
12093 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
12094 where
12095 T: std::convert::Into<crate::model::Condition>,
12096 {
12097 self.terminal_condition = v.map(|x| x.into());
12098 self
12099 }
12100
12101 /// Sets the value of [conditions][crate::model::Service::conditions].
12102 ///
12103 /// # Example
12104 /// ```ignore,no_run
12105 /// # use google_cloud_run_v2::model::Service;
12106 /// use google_cloud_run_v2::model::Condition;
12107 /// let x = Service::new()
12108 /// .set_conditions([
12109 /// Condition::default()/* use setters */,
12110 /// Condition::default()/* use (different) setters */,
12111 /// ]);
12112 /// ```
12113 pub fn set_conditions<T, V>(mut self, v: T) -> Self
12114 where
12115 T: std::iter::IntoIterator<Item = V>,
12116 V: std::convert::Into<crate::model::Condition>,
12117 {
12118 use std::iter::Iterator;
12119 self.conditions = v.into_iter().map(|i| i.into()).collect();
12120 self
12121 }
12122
12123 /// Sets the value of [latest_ready_revision][crate::model::Service::latest_ready_revision].
12124 ///
12125 /// # Example
12126 /// ```ignore,no_run
12127 /// # use google_cloud_run_v2::model::Service;
12128 /// # let project_id = "project_id";
12129 /// # let location_id = "location_id";
12130 /// # let service_id = "service_id";
12131 /// # let revision_id = "revision_id";
12132 /// let x = Service::new().set_latest_ready_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
12133 /// ```
12134 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
12135 mut self,
12136 v: T,
12137 ) -> Self {
12138 self.latest_ready_revision = v.into();
12139 self
12140 }
12141
12142 /// Sets the value of [latest_created_revision][crate::model::Service::latest_created_revision].
12143 ///
12144 /// # Example
12145 /// ```ignore,no_run
12146 /// # use google_cloud_run_v2::model::Service;
12147 /// # let project_id = "project_id";
12148 /// # let location_id = "location_id";
12149 /// # let service_id = "service_id";
12150 /// # let revision_id = "revision_id";
12151 /// let x = Service::new().set_latest_created_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
12152 /// ```
12153 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
12154 mut self,
12155 v: T,
12156 ) -> Self {
12157 self.latest_created_revision = v.into();
12158 self
12159 }
12160
12161 /// Sets the value of [traffic_statuses][crate::model::Service::traffic_statuses].
12162 ///
12163 /// # Example
12164 /// ```ignore,no_run
12165 /// # use google_cloud_run_v2::model::Service;
12166 /// use google_cloud_run_v2::model::TrafficTargetStatus;
12167 /// let x = Service::new()
12168 /// .set_traffic_statuses([
12169 /// TrafficTargetStatus::default()/* use setters */,
12170 /// TrafficTargetStatus::default()/* use (different) setters */,
12171 /// ]);
12172 /// ```
12173 pub fn set_traffic_statuses<T, V>(mut self, v: T) -> Self
12174 where
12175 T: std::iter::IntoIterator<Item = V>,
12176 V: std::convert::Into<crate::model::TrafficTargetStatus>,
12177 {
12178 use std::iter::Iterator;
12179 self.traffic_statuses = v.into_iter().map(|i| i.into()).collect();
12180 self
12181 }
12182
12183 /// Sets the value of [uri][crate::model::Service::uri].
12184 ///
12185 /// # Example
12186 /// ```ignore,no_run
12187 /// # use google_cloud_run_v2::model::Service;
12188 /// let x = Service::new().set_uri("example");
12189 /// ```
12190 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12191 self.uri = v.into();
12192 self
12193 }
12194
12195 /// Sets the value of [satisfies_pzs][crate::model::Service::satisfies_pzs].
12196 ///
12197 /// # Example
12198 /// ```ignore,no_run
12199 /// # use google_cloud_run_v2::model::Service;
12200 /// let x = Service::new().set_satisfies_pzs(true);
12201 /// ```
12202 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12203 self.satisfies_pzs = v.into();
12204 self
12205 }
12206
12207 /// Sets the value of [threat_detection_enabled][crate::model::Service::threat_detection_enabled].
12208 ///
12209 /// # Example
12210 /// ```ignore,no_run
12211 /// # use google_cloud_run_v2::model::Service;
12212 /// let x = Service::new().set_threat_detection_enabled(true);
12213 /// ```
12214 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12215 self.threat_detection_enabled = v.into();
12216 self
12217 }
12218
12219 /// Sets the value of [build_config][crate::model::Service::build_config].
12220 ///
12221 /// # Example
12222 /// ```ignore,no_run
12223 /// # use google_cloud_run_v2::model::Service;
12224 /// use google_cloud_run_v2::model::BuildConfig;
12225 /// let x = Service::new().set_build_config(BuildConfig::default()/* use setters */);
12226 /// ```
12227 pub fn set_build_config<T>(mut self, v: T) -> Self
12228 where
12229 T: std::convert::Into<crate::model::BuildConfig>,
12230 {
12231 self.build_config = std::option::Option::Some(v.into());
12232 self
12233 }
12234
12235 /// Sets or clears the value of [build_config][crate::model::Service::build_config].
12236 ///
12237 /// # Example
12238 /// ```ignore,no_run
12239 /// # use google_cloud_run_v2::model::Service;
12240 /// use google_cloud_run_v2::model::BuildConfig;
12241 /// let x = Service::new().set_or_clear_build_config(Some(BuildConfig::default()/* use setters */));
12242 /// let x = Service::new().set_or_clear_build_config(None::<BuildConfig>);
12243 /// ```
12244 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
12245 where
12246 T: std::convert::Into<crate::model::BuildConfig>,
12247 {
12248 self.build_config = v.map(|x| x.into());
12249 self
12250 }
12251
12252 /// Sets the value of [reconciling][crate::model::Service::reconciling].
12253 ///
12254 /// # Example
12255 /// ```ignore,no_run
12256 /// # use google_cloud_run_v2::model::Service;
12257 /// let x = Service::new().set_reconciling(true);
12258 /// ```
12259 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12260 self.reconciling = v.into();
12261 self
12262 }
12263
12264 /// Sets the value of [etag][crate::model::Service::etag].
12265 ///
12266 /// # Example
12267 /// ```ignore,no_run
12268 /// # use google_cloud_run_v2::model::Service;
12269 /// let x = Service::new().set_etag("example");
12270 /// ```
12271 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12272 self.etag = v.into();
12273 self
12274 }
12275}
12276
12277impl wkt::message::Message for Service {
12278 fn typename() -> &'static str {
12279 "type.googleapis.com/google.cloud.run.v2.Service"
12280 }
12281}
12282
12283/// Defines additional types related to [Service].
12284pub mod service {
12285 #[allow(unused_imports)]
12286 use super::*;
12287
12288 /// Settings for multi-region deployment.
12289 #[derive(Clone, Default, PartialEq)]
12290 #[non_exhaustive]
12291 pub struct MultiRegionSettings {
12292 /// Required. List of regions to deploy to, including primary region.
12293 pub regions: std::vec::Vec<std::string::String>,
12294
12295 /// Optional. System-generated unique id for the multi-region Service.
12296 pub multi_region_id: std::string::String,
12297
12298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12299 }
12300
12301 impl MultiRegionSettings {
12302 /// Creates a new default instance.
12303 pub fn new() -> Self {
12304 std::default::Default::default()
12305 }
12306
12307 /// Sets the value of [regions][crate::model::service::MultiRegionSettings::regions].
12308 ///
12309 /// # Example
12310 /// ```ignore,no_run
12311 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12312 /// let x = MultiRegionSettings::new().set_regions(["a", "b", "c"]);
12313 /// ```
12314 pub fn set_regions<T, V>(mut self, v: T) -> Self
12315 where
12316 T: std::iter::IntoIterator<Item = V>,
12317 V: std::convert::Into<std::string::String>,
12318 {
12319 use std::iter::Iterator;
12320 self.regions = v.into_iter().map(|i| i.into()).collect();
12321 self
12322 }
12323
12324 /// Sets the value of [multi_region_id][crate::model::service::MultiRegionSettings::multi_region_id].
12325 ///
12326 /// # Example
12327 /// ```ignore,no_run
12328 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12329 /// let x = MultiRegionSettings::new().set_multi_region_id("example");
12330 /// ```
12331 pub fn set_multi_region_id<T: std::convert::Into<std::string::String>>(
12332 mut self,
12333 v: T,
12334 ) -> Self {
12335 self.multi_region_id = v.into();
12336 self
12337 }
12338 }
12339
12340 impl wkt::message::Message for MultiRegionSettings {
12341 fn typename() -> &'static str {
12342 "type.googleapis.com/google.cloud.run.v2.Service.MultiRegionSettings"
12343 }
12344 }
12345}
12346
12347/// Effective settings for the current revision
12348#[derive(Clone, Default, PartialEq)]
12349#[non_exhaustive]
12350pub struct RevisionScalingStatus {
12351 /// The current number of min instances provisioned for this revision.
12352 pub desired_min_instance_count: i32,
12353
12354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12355}
12356
12357impl RevisionScalingStatus {
12358 /// Creates a new default instance.
12359 pub fn new() -> Self {
12360 std::default::Default::default()
12361 }
12362
12363 /// Sets the value of [desired_min_instance_count][crate::model::RevisionScalingStatus::desired_min_instance_count].
12364 ///
12365 /// # Example
12366 /// ```ignore,no_run
12367 /// # use google_cloud_run_v2::model::RevisionScalingStatus;
12368 /// let x = RevisionScalingStatus::new().set_desired_min_instance_count(42);
12369 /// ```
12370 pub fn set_desired_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12371 self.desired_min_instance_count = v.into();
12372 self
12373 }
12374}
12375
12376impl wkt::message::Message for RevisionScalingStatus {
12377 fn typename() -> &'static str {
12378 "type.googleapis.com/google.cloud.run.v2.RevisionScalingStatus"
12379 }
12380}
12381
12382/// Request message for obtaining a Task by its full name.
12383#[derive(Clone, Default, PartialEq)]
12384#[non_exhaustive]
12385pub struct GetTaskRequest {
12386 /// Required. The full name of the Task.
12387 /// Format:
12388 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
12389 pub name: std::string::String,
12390
12391 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12392}
12393
12394impl GetTaskRequest {
12395 /// Creates a new default instance.
12396 pub fn new() -> Self {
12397 std::default::Default::default()
12398 }
12399
12400 /// Sets the value of [name][crate::model::GetTaskRequest::name].
12401 ///
12402 /// # Example
12403 /// ```ignore,no_run
12404 /// # use google_cloud_run_v2::model::GetTaskRequest;
12405 /// # let project_id = "project_id";
12406 /// # let location_id = "location_id";
12407 /// # let job_id = "job_id";
12408 /// # let execution_id = "execution_id";
12409 /// # let task_id = "task_id";
12410 /// let x = GetTaskRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}/tasks/{task_id}"));
12411 /// ```
12412 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12413 self.name = v.into();
12414 self
12415 }
12416}
12417
12418impl wkt::message::Message for GetTaskRequest {
12419 fn typename() -> &'static str {
12420 "type.googleapis.com/google.cloud.run.v2.GetTaskRequest"
12421 }
12422}
12423
12424/// Request message for retrieving a list of Tasks.
12425#[derive(Clone, Default, PartialEq)]
12426#[non_exhaustive]
12427pub struct ListTasksRequest {
12428 /// Required. The Execution from which the Tasks should be listed.
12429 /// To list all Tasks across Executions of a Job, use "-" instead of Execution
12430 /// name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
12431 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
12432 pub parent: std::string::String,
12433
12434 /// Maximum number of Tasks to return in this call.
12435 pub page_size: i32,
12436
12437 /// A page token received from a previous call to ListTasks.
12438 /// All other parameters must match.
12439 pub page_token: std::string::String,
12440
12441 /// If true, returns deleted (but unexpired) resources along with active ones.
12442 pub show_deleted: bool,
12443
12444 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12445}
12446
12447impl ListTasksRequest {
12448 /// Creates a new default instance.
12449 pub fn new() -> Self {
12450 std::default::Default::default()
12451 }
12452
12453 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
12454 ///
12455 /// # Example
12456 /// ```ignore,no_run
12457 /// # use google_cloud_run_v2::model::ListTasksRequest;
12458 /// # let project_id = "project_id";
12459 /// # let location_id = "location_id";
12460 /// # let job_id = "job_id";
12461 /// # let execution_id = "execution_id";
12462 /// let x = ListTasksRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
12463 /// ```
12464 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12465 self.parent = v.into();
12466 self
12467 }
12468
12469 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
12470 ///
12471 /// # Example
12472 /// ```ignore,no_run
12473 /// # use google_cloud_run_v2::model::ListTasksRequest;
12474 /// let x = ListTasksRequest::new().set_page_size(42);
12475 /// ```
12476 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12477 self.page_size = v.into();
12478 self
12479 }
12480
12481 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
12482 ///
12483 /// # Example
12484 /// ```ignore,no_run
12485 /// # use google_cloud_run_v2::model::ListTasksRequest;
12486 /// let x = ListTasksRequest::new().set_page_token("example");
12487 /// ```
12488 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12489 self.page_token = v.into();
12490 self
12491 }
12492
12493 /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
12494 ///
12495 /// # Example
12496 /// ```ignore,no_run
12497 /// # use google_cloud_run_v2::model::ListTasksRequest;
12498 /// let x = ListTasksRequest::new().set_show_deleted(true);
12499 /// ```
12500 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12501 self.show_deleted = v.into();
12502 self
12503 }
12504}
12505
12506impl wkt::message::Message for ListTasksRequest {
12507 fn typename() -> &'static str {
12508 "type.googleapis.com/google.cloud.run.v2.ListTasksRequest"
12509 }
12510}
12511
12512/// Response message containing a list of Tasks.
12513#[derive(Clone, Default, PartialEq)]
12514#[non_exhaustive]
12515pub struct ListTasksResponse {
12516 /// The resulting list of Tasks.
12517 pub tasks: std::vec::Vec<crate::model::Task>,
12518
12519 /// A token indicating there are more items than page_size. Use it in the next
12520 /// ListTasks request to continue.
12521 pub next_page_token: std::string::String,
12522
12523 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12524}
12525
12526impl ListTasksResponse {
12527 /// Creates a new default instance.
12528 pub fn new() -> Self {
12529 std::default::Default::default()
12530 }
12531
12532 /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
12533 ///
12534 /// # Example
12535 /// ```ignore,no_run
12536 /// # use google_cloud_run_v2::model::ListTasksResponse;
12537 /// use google_cloud_run_v2::model::Task;
12538 /// let x = ListTasksResponse::new()
12539 /// .set_tasks([
12540 /// Task::default()/* use setters */,
12541 /// Task::default()/* use (different) setters */,
12542 /// ]);
12543 /// ```
12544 pub fn set_tasks<T, V>(mut self, v: T) -> Self
12545 where
12546 T: std::iter::IntoIterator<Item = V>,
12547 V: std::convert::Into<crate::model::Task>,
12548 {
12549 use std::iter::Iterator;
12550 self.tasks = v.into_iter().map(|i| i.into()).collect();
12551 self
12552 }
12553
12554 /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
12555 ///
12556 /// # Example
12557 /// ```ignore,no_run
12558 /// # use google_cloud_run_v2::model::ListTasksResponse;
12559 /// let x = ListTasksResponse::new().set_next_page_token("example");
12560 /// ```
12561 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12562 self.next_page_token = v.into();
12563 self
12564 }
12565}
12566
12567impl wkt::message::Message for ListTasksResponse {
12568 fn typename() -> &'static str {
12569 "type.googleapis.com/google.cloud.run.v2.ListTasksResponse"
12570 }
12571}
12572
12573#[doc(hidden)]
12574impl google_cloud_gax::paginator::internal::PageableResponse for ListTasksResponse {
12575 type PageItem = crate::model::Task;
12576
12577 fn items(self) -> std::vec::Vec<Self::PageItem> {
12578 self.tasks
12579 }
12580
12581 fn next_page_token(&self) -> std::string::String {
12582 use std::clone::Clone;
12583 self.next_page_token.clone()
12584 }
12585}
12586
12587/// Task represents a single run of a container to completion.
12588#[derive(Clone, Default, PartialEq)]
12589#[non_exhaustive]
12590pub struct Task {
12591 /// Output only. The unique name of this Task.
12592 pub name: std::string::String,
12593
12594 /// Output only. Server assigned unique identifier for the Task. The value is a
12595 /// UUID4 string and guaranteed to remain unchanged until the resource is
12596 /// deleted.
12597 pub uid: std::string::String,
12598
12599 /// Output only. A number that monotonically increases every time the user
12600 /// modifies the desired state.
12601 pub generation: i64,
12602
12603 /// Output only. Unstructured key value map that can be used to organize and
12604 /// categorize objects. User-provided labels are shared with Google's billing
12605 /// system, so they can be used to filter, or break down billing charges by
12606 /// team, component, environment, state, etc. For more information, visit
12607 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
12608 /// <https://cloud.google.com/run/docs/configuring/labels>
12609 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12610
12611 /// Output only. Unstructured key value map that may
12612 /// be set by external tools to store and arbitrary metadata.
12613 /// They are not queryable and should be preserved
12614 /// when modifying objects.
12615 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12616
12617 /// Output only. Represents time when the task was created by the system.
12618 /// It is not guaranteed to be set in happens-before order across separate
12619 /// operations.
12620 pub create_time: std::option::Option<wkt::Timestamp>,
12621
12622 /// Output only. Represents time when the task was scheduled to run by the
12623 /// system. It is not guaranteed to be set in happens-before order across
12624 /// separate operations.
12625 pub scheduled_time: std::option::Option<wkt::Timestamp>,
12626
12627 /// Output only. Represents time when the task started to run.
12628 /// It is not guaranteed to be set in happens-before order across separate
12629 /// operations.
12630 pub start_time: std::option::Option<wkt::Timestamp>,
12631
12632 /// Output only. Represents time when the Task was completed. It is not
12633 /// guaranteed to be set in happens-before order across separate operations.
12634 pub completion_time: std::option::Option<wkt::Timestamp>,
12635
12636 /// Output only. The last-modified time.
12637 pub update_time: std::option::Option<wkt::Timestamp>,
12638
12639 /// Output only. For a deleted resource, the deletion time. It is only
12640 /// populated as a response to a Delete request.
12641 pub delete_time: std::option::Option<wkt::Timestamp>,
12642
12643 /// Output only. For a deleted resource, the time after which it will be
12644 /// permamently deleted. It is only populated as a response to a Delete
12645 /// request.
12646 pub expire_time: std::option::Option<wkt::Timestamp>,
12647
12648 /// Output only. The name of the parent Job.
12649 pub job: std::string::String,
12650
12651 /// Output only. The name of the parent Execution.
12652 pub execution: std::string::String,
12653
12654 /// Holds the single container that defines the unit of execution for this
12655 /// task.
12656 pub containers: std::vec::Vec<crate::model::Container>,
12657
12658 /// A list of Volumes to make available to containers.
12659 pub volumes: std::vec::Vec<crate::model::Volume>,
12660
12661 /// Number of retries allowed per Task, before marking this Task failed.
12662 pub max_retries: i32,
12663
12664 /// Max allowed time duration the Task may be active before the system will
12665 /// actively try to mark it failed and kill associated containers. This applies
12666 /// per attempt of a task, meaning each retry can run for the full timeout.
12667 pub timeout: std::option::Option<wkt::Duration>,
12668
12669 /// Email address of the IAM service account associated with the Task of a
12670 /// Job. The service account represents the identity of the
12671 /// running task, and determines what permissions the task has. If
12672 /// not provided, the task will use the project's default service account.
12673 pub service_account: std::string::String,
12674
12675 /// The execution environment being used to host this Task.
12676 pub execution_environment: crate::model::ExecutionEnvironment,
12677
12678 /// Output only. Indicates whether the resource's reconciliation is still in
12679 /// progress. See comments in `Job.reconciling` for additional information on
12680 /// reconciliation process in Cloud Run.
12681 pub reconciling: bool,
12682
12683 /// Output only. The Condition of this Task, containing its readiness status,
12684 /// and detailed error information in case it did not reach the desired state.
12685 pub conditions: std::vec::Vec<crate::model::Condition>,
12686
12687 /// Output only. The generation of this Task. See comments in `Job.reconciling`
12688 /// for additional information on reconciliation process in Cloud Run.
12689 pub observed_generation: i64,
12690
12691 /// Output only. Index of the Task, unique per execution, and beginning at 0.
12692 pub index: i32,
12693
12694 /// Output only. The number of times this Task was retried.
12695 /// Tasks are retried when they fail up to the maxRetries limit.
12696 pub retried: i32,
12697
12698 /// Output only. Result of the last attempt of this Task.
12699 pub last_attempt_result: std::option::Option<crate::model::TaskAttemptResult>,
12700
12701 /// Output only. A reference to a customer managed encryption key (CMEK) to use
12702 /// to encrypt this container image. For more information, go to
12703 /// <https://cloud.google.com/run/docs/securing/using-cmek>
12704 pub encryption_key: std::string::String,
12705
12706 /// Output only. VPC Access configuration to use for this Task. For more
12707 /// information, visit
12708 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
12709 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
12710
12711 /// Output only. URI where logs for this execution can be found in Cloud
12712 /// Console.
12713 pub log_uri: std::string::String,
12714
12715 /// Output only. Reserved for future use.
12716 pub satisfies_pzs: bool,
12717
12718 /// Output only. The node selector for the task.
12719 pub node_selector: std::option::Option<crate::model::NodeSelector>,
12720
12721 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
12722 /// task.
12723 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
12724
12725 /// Output only. A system-generated fingerprint for this version of the
12726 /// resource. May be used to detect modification conflict during updates.
12727 pub etag: std::string::String,
12728
12729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12730}
12731
12732impl Task {
12733 /// Creates a new default instance.
12734 pub fn new() -> Self {
12735 std::default::Default::default()
12736 }
12737
12738 /// Sets the value of [name][crate::model::Task::name].
12739 ///
12740 /// # Example
12741 /// ```ignore,no_run
12742 /// # use google_cloud_run_v2::model::Task;
12743 /// # let project_id = "project_id";
12744 /// # let location_id = "location_id";
12745 /// # let job_id = "job_id";
12746 /// # let execution_id = "execution_id";
12747 /// # let task_id = "task_id";
12748 /// let x = Task::new().set_name(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}/tasks/{task_id}"));
12749 /// ```
12750 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12751 self.name = v.into();
12752 self
12753 }
12754
12755 /// Sets the value of [uid][crate::model::Task::uid].
12756 ///
12757 /// # Example
12758 /// ```ignore,no_run
12759 /// # use google_cloud_run_v2::model::Task;
12760 /// let x = Task::new().set_uid("example");
12761 /// ```
12762 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12763 self.uid = v.into();
12764 self
12765 }
12766
12767 /// Sets the value of [generation][crate::model::Task::generation].
12768 ///
12769 /// # Example
12770 /// ```ignore,no_run
12771 /// # use google_cloud_run_v2::model::Task;
12772 /// let x = Task::new().set_generation(42);
12773 /// ```
12774 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12775 self.generation = v.into();
12776 self
12777 }
12778
12779 /// Sets the value of [labels][crate::model::Task::labels].
12780 ///
12781 /// # Example
12782 /// ```ignore,no_run
12783 /// # use google_cloud_run_v2::model::Task;
12784 /// let x = Task::new().set_labels([
12785 /// ("key0", "abc"),
12786 /// ("key1", "xyz"),
12787 /// ]);
12788 /// ```
12789 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12790 where
12791 T: std::iter::IntoIterator<Item = (K, V)>,
12792 K: std::convert::Into<std::string::String>,
12793 V: std::convert::Into<std::string::String>,
12794 {
12795 use std::iter::Iterator;
12796 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12797 self
12798 }
12799
12800 /// Sets the value of [annotations][crate::model::Task::annotations].
12801 ///
12802 /// # Example
12803 /// ```ignore,no_run
12804 /// # use google_cloud_run_v2::model::Task;
12805 /// let x = Task::new().set_annotations([
12806 /// ("key0", "abc"),
12807 /// ("key1", "xyz"),
12808 /// ]);
12809 /// ```
12810 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12811 where
12812 T: std::iter::IntoIterator<Item = (K, V)>,
12813 K: std::convert::Into<std::string::String>,
12814 V: std::convert::Into<std::string::String>,
12815 {
12816 use std::iter::Iterator;
12817 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12818 self
12819 }
12820
12821 /// Sets the value of [create_time][crate::model::Task::create_time].
12822 ///
12823 /// # Example
12824 /// ```ignore,no_run
12825 /// # use google_cloud_run_v2::model::Task;
12826 /// use wkt::Timestamp;
12827 /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
12828 /// ```
12829 pub fn set_create_time<T>(mut self, v: T) -> Self
12830 where
12831 T: std::convert::Into<wkt::Timestamp>,
12832 {
12833 self.create_time = std::option::Option::Some(v.into());
12834 self
12835 }
12836
12837 /// Sets or clears the value of [create_time][crate::model::Task::create_time].
12838 ///
12839 /// # Example
12840 /// ```ignore,no_run
12841 /// # use google_cloud_run_v2::model::Task;
12842 /// use wkt::Timestamp;
12843 /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12844 /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
12845 /// ```
12846 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12847 where
12848 T: std::convert::Into<wkt::Timestamp>,
12849 {
12850 self.create_time = v.map(|x| x.into());
12851 self
12852 }
12853
12854 /// Sets the value of [scheduled_time][crate::model::Task::scheduled_time].
12855 ///
12856 /// # Example
12857 /// ```ignore,no_run
12858 /// # use google_cloud_run_v2::model::Task;
12859 /// use wkt::Timestamp;
12860 /// let x = Task::new().set_scheduled_time(Timestamp::default()/* use setters */);
12861 /// ```
12862 pub fn set_scheduled_time<T>(mut self, v: T) -> Self
12863 where
12864 T: std::convert::Into<wkt::Timestamp>,
12865 {
12866 self.scheduled_time = std::option::Option::Some(v.into());
12867 self
12868 }
12869
12870 /// Sets or clears the value of [scheduled_time][crate::model::Task::scheduled_time].
12871 ///
12872 /// # Example
12873 /// ```ignore,no_run
12874 /// # use google_cloud_run_v2::model::Task;
12875 /// use wkt::Timestamp;
12876 /// let x = Task::new().set_or_clear_scheduled_time(Some(Timestamp::default()/* use setters */));
12877 /// let x = Task::new().set_or_clear_scheduled_time(None::<Timestamp>);
12878 /// ```
12879 pub fn set_or_clear_scheduled_time<T>(mut self, v: std::option::Option<T>) -> Self
12880 where
12881 T: std::convert::Into<wkt::Timestamp>,
12882 {
12883 self.scheduled_time = v.map(|x| x.into());
12884 self
12885 }
12886
12887 /// Sets the value of [start_time][crate::model::Task::start_time].
12888 ///
12889 /// # Example
12890 /// ```ignore,no_run
12891 /// # use google_cloud_run_v2::model::Task;
12892 /// use wkt::Timestamp;
12893 /// let x = Task::new().set_start_time(Timestamp::default()/* use setters */);
12894 /// ```
12895 pub fn set_start_time<T>(mut self, v: T) -> Self
12896 where
12897 T: std::convert::Into<wkt::Timestamp>,
12898 {
12899 self.start_time = std::option::Option::Some(v.into());
12900 self
12901 }
12902
12903 /// Sets or clears the value of [start_time][crate::model::Task::start_time].
12904 ///
12905 /// # Example
12906 /// ```ignore,no_run
12907 /// # use google_cloud_run_v2::model::Task;
12908 /// use wkt::Timestamp;
12909 /// let x = Task::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
12910 /// let x = Task::new().set_or_clear_start_time(None::<Timestamp>);
12911 /// ```
12912 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
12913 where
12914 T: std::convert::Into<wkt::Timestamp>,
12915 {
12916 self.start_time = v.map(|x| x.into());
12917 self
12918 }
12919
12920 /// Sets the value of [completion_time][crate::model::Task::completion_time].
12921 ///
12922 /// # Example
12923 /// ```ignore,no_run
12924 /// # use google_cloud_run_v2::model::Task;
12925 /// use wkt::Timestamp;
12926 /// let x = Task::new().set_completion_time(Timestamp::default()/* use setters */);
12927 /// ```
12928 pub fn set_completion_time<T>(mut self, v: T) -> Self
12929 where
12930 T: std::convert::Into<wkt::Timestamp>,
12931 {
12932 self.completion_time = std::option::Option::Some(v.into());
12933 self
12934 }
12935
12936 /// Sets or clears the value of [completion_time][crate::model::Task::completion_time].
12937 ///
12938 /// # Example
12939 /// ```ignore,no_run
12940 /// # use google_cloud_run_v2::model::Task;
12941 /// use wkt::Timestamp;
12942 /// let x = Task::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
12943 /// let x = Task::new().set_or_clear_completion_time(None::<Timestamp>);
12944 /// ```
12945 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
12946 where
12947 T: std::convert::Into<wkt::Timestamp>,
12948 {
12949 self.completion_time = v.map(|x| x.into());
12950 self
12951 }
12952
12953 /// Sets the value of [update_time][crate::model::Task::update_time].
12954 ///
12955 /// # Example
12956 /// ```ignore,no_run
12957 /// # use google_cloud_run_v2::model::Task;
12958 /// use wkt::Timestamp;
12959 /// let x = Task::new().set_update_time(Timestamp::default()/* use setters */);
12960 /// ```
12961 pub fn set_update_time<T>(mut self, v: T) -> Self
12962 where
12963 T: std::convert::Into<wkt::Timestamp>,
12964 {
12965 self.update_time = std::option::Option::Some(v.into());
12966 self
12967 }
12968
12969 /// Sets or clears the value of [update_time][crate::model::Task::update_time].
12970 ///
12971 /// # Example
12972 /// ```ignore,no_run
12973 /// # use google_cloud_run_v2::model::Task;
12974 /// use wkt::Timestamp;
12975 /// let x = Task::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12976 /// let x = Task::new().set_or_clear_update_time(None::<Timestamp>);
12977 /// ```
12978 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12979 where
12980 T: std::convert::Into<wkt::Timestamp>,
12981 {
12982 self.update_time = v.map(|x| x.into());
12983 self
12984 }
12985
12986 /// Sets the value of [delete_time][crate::model::Task::delete_time].
12987 ///
12988 /// # Example
12989 /// ```ignore,no_run
12990 /// # use google_cloud_run_v2::model::Task;
12991 /// use wkt::Timestamp;
12992 /// let x = Task::new().set_delete_time(Timestamp::default()/* use setters */);
12993 /// ```
12994 pub fn set_delete_time<T>(mut self, v: T) -> Self
12995 where
12996 T: std::convert::Into<wkt::Timestamp>,
12997 {
12998 self.delete_time = std::option::Option::Some(v.into());
12999 self
13000 }
13001
13002 /// Sets or clears the value of [delete_time][crate::model::Task::delete_time].
13003 ///
13004 /// # Example
13005 /// ```ignore,no_run
13006 /// # use google_cloud_run_v2::model::Task;
13007 /// use wkt::Timestamp;
13008 /// let x = Task::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
13009 /// let x = Task::new().set_or_clear_delete_time(None::<Timestamp>);
13010 /// ```
13011 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
13012 where
13013 T: std::convert::Into<wkt::Timestamp>,
13014 {
13015 self.delete_time = v.map(|x| x.into());
13016 self
13017 }
13018
13019 /// Sets the value of [expire_time][crate::model::Task::expire_time].
13020 ///
13021 /// # Example
13022 /// ```ignore,no_run
13023 /// # use google_cloud_run_v2::model::Task;
13024 /// use wkt::Timestamp;
13025 /// let x = Task::new().set_expire_time(Timestamp::default()/* use setters */);
13026 /// ```
13027 pub fn set_expire_time<T>(mut self, v: T) -> Self
13028 where
13029 T: std::convert::Into<wkt::Timestamp>,
13030 {
13031 self.expire_time = std::option::Option::Some(v.into());
13032 self
13033 }
13034
13035 /// Sets or clears the value of [expire_time][crate::model::Task::expire_time].
13036 ///
13037 /// # Example
13038 /// ```ignore,no_run
13039 /// # use google_cloud_run_v2::model::Task;
13040 /// use wkt::Timestamp;
13041 /// let x = Task::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
13042 /// let x = Task::new().set_or_clear_expire_time(None::<Timestamp>);
13043 /// ```
13044 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
13045 where
13046 T: std::convert::Into<wkt::Timestamp>,
13047 {
13048 self.expire_time = v.map(|x| x.into());
13049 self
13050 }
13051
13052 /// Sets the value of [job][crate::model::Task::job].
13053 ///
13054 /// # Example
13055 /// ```ignore,no_run
13056 /// # use google_cloud_run_v2::model::Task;
13057 /// # let project_id = "project_id";
13058 /// # let location_id = "location_id";
13059 /// # let job_id = "job_id";
13060 /// let x = Task::new().set_job(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}"));
13061 /// ```
13062 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13063 self.job = v.into();
13064 self
13065 }
13066
13067 /// Sets the value of [execution][crate::model::Task::execution].
13068 ///
13069 /// # Example
13070 /// ```ignore,no_run
13071 /// # use google_cloud_run_v2::model::Task;
13072 /// # let project_id = "project_id";
13073 /// # let location_id = "location_id";
13074 /// # let job_id = "job_id";
13075 /// # let execution_id = "execution_id";
13076 /// let x = Task::new().set_execution(format!("projects/{project_id}/locations/{location_id}/jobs/{job_id}/executions/{execution_id}"));
13077 /// ```
13078 pub fn set_execution<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13079 self.execution = v.into();
13080 self
13081 }
13082
13083 /// Sets the value of [containers][crate::model::Task::containers].
13084 ///
13085 /// # Example
13086 /// ```ignore,no_run
13087 /// # use google_cloud_run_v2::model::Task;
13088 /// use google_cloud_run_v2::model::Container;
13089 /// let x = Task::new()
13090 /// .set_containers([
13091 /// Container::default()/* use setters */,
13092 /// Container::default()/* use (different) setters */,
13093 /// ]);
13094 /// ```
13095 pub fn set_containers<T, V>(mut self, v: T) -> Self
13096 where
13097 T: std::iter::IntoIterator<Item = V>,
13098 V: std::convert::Into<crate::model::Container>,
13099 {
13100 use std::iter::Iterator;
13101 self.containers = v.into_iter().map(|i| i.into()).collect();
13102 self
13103 }
13104
13105 /// Sets the value of [volumes][crate::model::Task::volumes].
13106 ///
13107 /// # Example
13108 /// ```ignore,no_run
13109 /// # use google_cloud_run_v2::model::Task;
13110 /// use google_cloud_run_v2::model::Volume;
13111 /// let x = Task::new()
13112 /// .set_volumes([
13113 /// Volume::default()/* use setters */,
13114 /// Volume::default()/* use (different) setters */,
13115 /// ]);
13116 /// ```
13117 pub fn set_volumes<T, V>(mut self, v: T) -> Self
13118 where
13119 T: std::iter::IntoIterator<Item = V>,
13120 V: std::convert::Into<crate::model::Volume>,
13121 {
13122 use std::iter::Iterator;
13123 self.volumes = v.into_iter().map(|i| i.into()).collect();
13124 self
13125 }
13126
13127 /// Sets the value of [max_retries][crate::model::Task::max_retries].
13128 ///
13129 /// # Example
13130 /// ```ignore,no_run
13131 /// # use google_cloud_run_v2::model::Task;
13132 /// let x = Task::new().set_max_retries(42);
13133 /// ```
13134 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13135 self.max_retries = v.into();
13136 self
13137 }
13138
13139 /// Sets the value of [timeout][crate::model::Task::timeout].
13140 ///
13141 /// # Example
13142 /// ```ignore,no_run
13143 /// # use google_cloud_run_v2::model::Task;
13144 /// use wkt::Duration;
13145 /// let x = Task::new().set_timeout(Duration::default()/* use setters */);
13146 /// ```
13147 pub fn set_timeout<T>(mut self, v: T) -> Self
13148 where
13149 T: std::convert::Into<wkt::Duration>,
13150 {
13151 self.timeout = std::option::Option::Some(v.into());
13152 self
13153 }
13154
13155 /// Sets or clears the value of [timeout][crate::model::Task::timeout].
13156 ///
13157 /// # Example
13158 /// ```ignore,no_run
13159 /// # use google_cloud_run_v2::model::Task;
13160 /// use wkt::Duration;
13161 /// let x = Task::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13162 /// let x = Task::new().set_or_clear_timeout(None::<Duration>);
13163 /// ```
13164 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13165 where
13166 T: std::convert::Into<wkt::Duration>,
13167 {
13168 self.timeout = v.map(|x| x.into());
13169 self
13170 }
13171
13172 /// Sets the value of [service_account][crate::model::Task::service_account].
13173 ///
13174 /// # Example
13175 /// ```ignore,no_run
13176 /// # use google_cloud_run_v2::model::Task;
13177 /// let x = Task::new().set_service_account("example");
13178 /// ```
13179 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13180 self.service_account = v.into();
13181 self
13182 }
13183
13184 /// Sets the value of [execution_environment][crate::model::Task::execution_environment].
13185 ///
13186 /// # Example
13187 /// ```ignore,no_run
13188 /// # use google_cloud_run_v2::model::Task;
13189 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13190 /// let x0 = Task::new().set_execution_environment(ExecutionEnvironment::Gen1);
13191 /// let x1 = Task::new().set_execution_environment(ExecutionEnvironment::Gen2);
13192 /// ```
13193 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13194 mut self,
13195 v: T,
13196 ) -> Self {
13197 self.execution_environment = v.into();
13198 self
13199 }
13200
13201 /// Sets the value of [reconciling][crate::model::Task::reconciling].
13202 ///
13203 /// # Example
13204 /// ```ignore,no_run
13205 /// # use google_cloud_run_v2::model::Task;
13206 /// let x = Task::new().set_reconciling(true);
13207 /// ```
13208 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13209 self.reconciling = v.into();
13210 self
13211 }
13212
13213 /// Sets the value of [conditions][crate::model::Task::conditions].
13214 ///
13215 /// # Example
13216 /// ```ignore,no_run
13217 /// # use google_cloud_run_v2::model::Task;
13218 /// use google_cloud_run_v2::model::Condition;
13219 /// let x = Task::new()
13220 /// .set_conditions([
13221 /// Condition::default()/* use setters */,
13222 /// Condition::default()/* use (different) setters */,
13223 /// ]);
13224 /// ```
13225 pub fn set_conditions<T, V>(mut self, v: T) -> Self
13226 where
13227 T: std::iter::IntoIterator<Item = V>,
13228 V: std::convert::Into<crate::model::Condition>,
13229 {
13230 use std::iter::Iterator;
13231 self.conditions = v.into_iter().map(|i| i.into()).collect();
13232 self
13233 }
13234
13235 /// Sets the value of [observed_generation][crate::model::Task::observed_generation].
13236 ///
13237 /// # Example
13238 /// ```ignore,no_run
13239 /// # use google_cloud_run_v2::model::Task;
13240 /// let x = Task::new().set_observed_generation(42);
13241 /// ```
13242 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13243 self.observed_generation = v.into();
13244 self
13245 }
13246
13247 /// Sets the value of [index][crate::model::Task::index].
13248 ///
13249 /// # Example
13250 /// ```ignore,no_run
13251 /// # use google_cloud_run_v2::model::Task;
13252 /// let x = Task::new().set_index(42);
13253 /// ```
13254 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13255 self.index = v.into();
13256 self
13257 }
13258
13259 /// Sets the value of [retried][crate::model::Task::retried].
13260 ///
13261 /// # Example
13262 /// ```ignore,no_run
13263 /// # use google_cloud_run_v2::model::Task;
13264 /// let x = Task::new().set_retried(42);
13265 /// ```
13266 pub fn set_retried<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13267 self.retried = v.into();
13268 self
13269 }
13270
13271 /// Sets the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13272 ///
13273 /// # Example
13274 /// ```ignore,no_run
13275 /// # use google_cloud_run_v2::model::Task;
13276 /// use google_cloud_run_v2::model::TaskAttemptResult;
13277 /// let x = Task::new().set_last_attempt_result(TaskAttemptResult::default()/* use setters */);
13278 /// ```
13279 pub fn set_last_attempt_result<T>(mut self, v: T) -> Self
13280 where
13281 T: std::convert::Into<crate::model::TaskAttemptResult>,
13282 {
13283 self.last_attempt_result = std::option::Option::Some(v.into());
13284 self
13285 }
13286
13287 /// Sets or clears the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13288 ///
13289 /// # Example
13290 /// ```ignore,no_run
13291 /// # use google_cloud_run_v2::model::Task;
13292 /// use google_cloud_run_v2::model::TaskAttemptResult;
13293 /// let x = Task::new().set_or_clear_last_attempt_result(Some(TaskAttemptResult::default()/* use setters */));
13294 /// let x = Task::new().set_or_clear_last_attempt_result(None::<TaskAttemptResult>);
13295 /// ```
13296 pub fn set_or_clear_last_attempt_result<T>(mut self, v: std::option::Option<T>) -> Self
13297 where
13298 T: std::convert::Into<crate::model::TaskAttemptResult>,
13299 {
13300 self.last_attempt_result = v.map(|x| x.into());
13301 self
13302 }
13303
13304 /// Sets the value of [encryption_key][crate::model::Task::encryption_key].
13305 ///
13306 /// # Example
13307 /// ```ignore,no_run
13308 /// # use google_cloud_run_v2::model::Task;
13309 /// let x = Task::new().set_encryption_key("example");
13310 /// ```
13311 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13312 self.encryption_key = v.into();
13313 self
13314 }
13315
13316 /// Sets the value of [vpc_access][crate::model::Task::vpc_access].
13317 ///
13318 /// # Example
13319 /// ```ignore,no_run
13320 /// # use google_cloud_run_v2::model::Task;
13321 /// use google_cloud_run_v2::model::VpcAccess;
13322 /// let x = Task::new().set_vpc_access(VpcAccess::default()/* use setters */);
13323 /// ```
13324 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13325 where
13326 T: std::convert::Into<crate::model::VpcAccess>,
13327 {
13328 self.vpc_access = std::option::Option::Some(v.into());
13329 self
13330 }
13331
13332 /// Sets or clears the value of [vpc_access][crate::model::Task::vpc_access].
13333 ///
13334 /// # Example
13335 /// ```ignore,no_run
13336 /// # use google_cloud_run_v2::model::Task;
13337 /// use google_cloud_run_v2::model::VpcAccess;
13338 /// let x = Task::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13339 /// let x = Task::new().set_or_clear_vpc_access(None::<VpcAccess>);
13340 /// ```
13341 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13342 where
13343 T: std::convert::Into<crate::model::VpcAccess>,
13344 {
13345 self.vpc_access = v.map(|x| x.into());
13346 self
13347 }
13348
13349 /// Sets the value of [log_uri][crate::model::Task::log_uri].
13350 ///
13351 /// # Example
13352 /// ```ignore,no_run
13353 /// # use google_cloud_run_v2::model::Task;
13354 /// let x = Task::new().set_log_uri("example");
13355 /// ```
13356 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13357 self.log_uri = v.into();
13358 self
13359 }
13360
13361 /// Sets the value of [satisfies_pzs][crate::model::Task::satisfies_pzs].
13362 ///
13363 /// # Example
13364 /// ```ignore,no_run
13365 /// # use google_cloud_run_v2::model::Task;
13366 /// let x = Task::new().set_satisfies_pzs(true);
13367 /// ```
13368 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13369 self.satisfies_pzs = v.into();
13370 self
13371 }
13372
13373 /// Sets the value of [node_selector][crate::model::Task::node_selector].
13374 ///
13375 /// # Example
13376 /// ```ignore,no_run
13377 /// # use google_cloud_run_v2::model::Task;
13378 /// use google_cloud_run_v2::model::NodeSelector;
13379 /// let x = Task::new().set_node_selector(NodeSelector::default()/* use setters */);
13380 /// ```
13381 pub fn set_node_selector<T>(mut self, v: T) -> Self
13382 where
13383 T: std::convert::Into<crate::model::NodeSelector>,
13384 {
13385 self.node_selector = std::option::Option::Some(v.into());
13386 self
13387 }
13388
13389 /// Sets or clears the value of [node_selector][crate::model::Task::node_selector].
13390 ///
13391 /// # Example
13392 /// ```ignore,no_run
13393 /// # use google_cloud_run_v2::model::Task;
13394 /// use google_cloud_run_v2::model::NodeSelector;
13395 /// let x = Task::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13396 /// let x = Task::new().set_or_clear_node_selector(None::<NodeSelector>);
13397 /// ```
13398 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13399 where
13400 T: std::convert::Into<crate::model::NodeSelector>,
13401 {
13402 self.node_selector = v.map(|x| x.into());
13403 self
13404 }
13405
13406 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13407 ///
13408 /// # Example
13409 /// ```ignore,no_run
13410 /// # use google_cloud_run_v2::model::Task;
13411 /// let x = Task::new().set_gpu_zonal_redundancy_disabled(true);
13412 /// ```
13413 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13414 where
13415 T: std::convert::Into<bool>,
13416 {
13417 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13418 self
13419 }
13420
13421 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13422 ///
13423 /// # Example
13424 /// ```ignore,no_run
13425 /// # use google_cloud_run_v2::model::Task;
13426 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13427 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13428 /// ```
13429 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13430 mut self,
13431 v: std::option::Option<T>,
13432 ) -> Self
13433 where
13434 T: std::convert::Into<bool>,
13435 {
13436 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13437 self
13438 }
13439
13440 /// Sets the value of [etag][crate::model::Task::etag].
13441 ///
13442 /// # Example
13443 /// ```ignore,no_run
13444 /// # use google_cloud_run_v2::model::Task;
13445 /// let x = Task::new().set_etag("example");
13446 /// ```
13447 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13448 self.etag = v.into();
13449 self
13450 }
13451}
13452
13453impl wkt::message::Message for Task {
13454 fn typename() -> &'static str {
13455 "type.googleapis.com/google.cloud.run.v2.Task"
13456 }
13457}
13458
13459/// Result of a task attempt.
13460#[derive(Clone, Default, PartialEq)]
13461#[non_exhaustive]
13462pub struct TaskAttemptResult {
13463 /// Output only. The status of this attempt.
13464 /// If the status code is OK, then the attempt succeeded.
13465 pub status: std::option::Option<google_cloud_rpc::model::Status>,
13466
13467 /// Output only. The exit code of this attempt.
13468 /// This may be unset if the container was unable to exit cleanly with a code
13469 /// due to some other failure.
13470 /// See status field for possible failure details.
13471 ///
13472 /// At most one of exit_code or term_signal will be set.
13473 pub exit_code: i32,
13474
13475 /// Output only. Termination signal of the container. This is set to non-zero
13476 /// if the container is terminated by the system.
13477 ///
13478 /// At most one of exit_code or term_signal will be set.
13479 pub term_signal: i32,
13480
13481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13482}
13483
13484impl TaskAttemptResult {
13485 /// Creates a new default instance.
13486 pub fn new() -> Self {
13487 std::default::Default::default()
13488 }
13489
13490 /// Sets the value of [status][crate::model::TaskAttemptResult::status].
13491 ///
13492 /// # Example
13493 /// ```ignore,no_run
13494 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13495 /// use google_cloud_rpc::model::Status;
13496 /// let x = TaskAttemptResult::new().set_status(Status::default()/* use setters */);
13497 /// ```
13498 pub fn set_status<T>(mut self, v: T) -> Self
13499 where
13500 T: std::convert::Into<google_cloud_rpc::model::Status>,
13501 {
13502 self.status = std::option::Option::Some(v.into());
13503 self
13504 }
13505
13506 /// Sets or clears the value of [status][crate::model::TaskAttemptResult::status].
13507 ///
13508 /// # Example
13509 /// ```ignore,no_run
13510 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13511 /// use google_cloud_rpc::model::Status;
13512 /// let x = TaskAttemptResult::new().set_or_clear_status(Some(Status::default()/* use setters */));
13513 /// let x = TaskAttemptResult::new().set_or_clear_status(None::<Status>);
13514 /// ```
13515 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
13516 where
13517 T: std::convert::Into<google_cloud_rpc::model::Status>,
13518 {
13519 self.status = v.map(|x| x.into());
13520 self
13521 }
13522
13523 /// Sets the value of [exit_code][crate::model::TaskAttemptResult::exit_code].
13524 ///
13525 /// # Example
13526 /// ```ignore,no_run
13527 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13528 /// let x = TaskAttemptResult::new().set_exit_code(42);
13529 /// ```
13530 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13531 self.exit_code = v.into();
13532 self
13533 }
13534
13535 /// Sets the value of [term_signal][crate::model::TaskAttemptResult::term_signal].
13536 ///
13537 /// # Example
13538 /// ```ignore,no_run
13539 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13540 /// let x = TaskAttemptResult::new().set_term_signal(42);
13541 /// ```
13542 pub fn set_term_signal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13543 self.term_signal = v.into();
13544 self
13545 }
13546}
13547
13548impl wkt::message::Message for TaskAttemptResult {
13549 fn typename() -> &'static str {
13550 "type.googleapis.com/google.cloud.run.v2.TaskAttemptResult"
13551 }
13552}
13553
13554/// TaskTemplate describes the data a task should have when created
13555/// from a template.
13556#[derive(Clone, Default, PartialEq)]
13557#[non_exhaustive]
13558pub struct TaskTemplate {
13559 /// Holds the single container that defines the unit of execution for this
13560 /// task.
13561 pub containers: std::vec::Vec<crate::model::Container>,
13562
13563 /// Optional. A list of Volumes to make available to containers.
13564 pub volumes: std::vec::Vec<crate::model::Volume>,
13565
13566 /// Optional. Max allowed time duration the Task may be active before the
13567 /// system will actively try to mark it failed and kill associated containers.
13568 /// This applies per attempt of a task, meaning each retry can run for the full
13569 /// timeout. Defaults to 600 seconds.
13570 pub timeout: std::option::Option<wkt::Duration>,
13571
13572 /// Optional. Email address of the IAM service account associated with the Task
13573 /// of a Job. The service account represents the identity of the running task,
13574 /// and determines what permissions the task has. If not provided, the task
13575 /// will use the project's default service account.
13576 pub service_account: std::string::String,
13577
13578 /// Optional. The execution environment being used to host this Task.
13579 pub execution_environment: crate::model::ExecutionEnvironment,
13580
13581 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
13582 /// this container image. For more information, go to
13583 /// <https://cloud.google.com/run/docs/securing/using-cmek>
13584 pub encryption_key: std::string::String,
13585
13586 /// Optional. VPC Access configuration to use for this Task. For more
13587 /// information, visit
13588 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13589 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
13590
13591 /// Optional. The node selector for the task template.
13592 pub node_selector: std::option::Option<crate::model::NodeSelector>,
13593
13594 /// Optional. True if GPU zonal redundancy is disabled on this task template.
13595 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
13596
13597 #[allow(missing_docs)]
13598 pub retries: std::option::Option<crate::model::task_template::Retries>,
13599
13600 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13601}
13602
13603impl TaskTemplate {
13604 /// Creates a new default instance.
13605 pub fn new() -> Self {
13606 std::default::Default::default()
13607 }
13608
13609 /// Sets the value of [containers][crate::model::TaskTemplate::containers].
13610 ///
13611 /// # Example
13612 /// ```ignore,no_run
13613 /// # use google_cloud_run_v2::model::TaskTemplate;
13614 /// use google_cloud_run_v2::model::Container;
13615 /// let x = TaskTemplate::new()
13616 /// .set_containers([
13617 /// Container::default()/* use setters */,
13618 /// Container::default()/* use (different) setters */,
13619 /// ]);
13620 /// ```
13621 pub fn set_containers<T, V>(mut self, v: T) -> Self
13622 where
13623 T: std::iter::IntoIterator<Item = V>,
13624 V: std::convert::Into<crate::model::Container>,
13625 {
13626 use std::iter::Iterator;
13627 self.containers = v.into_iter().map(|i| i.into()).collect();
13628 self
13629 }
13630
13631 /// Sets the value of [volumes][crate::model::TaskTemplate::volumes].
13632 ///
13633 /// # Example
13634 /// ```ignore,no_run
13635 /// # use google_cloud_run_v2::model::TaskTemplate;
13636 /// use google_cloud_run_v2::model::Volume;
13637 /// let x = TaskTemplate::new()
13638 /// .set_volumes([
13639 /// Volume::default()/* use setters */,
13640 /// Volume::default()/* use (different) setters */,
13641 /// ]);
13642 /// ```
13643 pub fn set_volumes<T, V>(mut self, v: T) -> Self
13644 where
13645 T: std::iter::IntoIterator<Item = V>,
13646 V: std::convert::Into<crate::model::Volume>,
13647 {
13648 use std::iter::Iterator;
13649 self.volumes = v.into_iter().map(|i| i.into()).collect();
13650 self
13651 }
13652
13653 /// Sets the value of [timeout][crate::model::TaskTemplate::timeout].
13654 ///
13655 /// # Example
13656 /// ```ignore,no_run
13657 /// # use google_cloud_run_v2::model::TaskTemplate;
13658 /// use wkt::Duration;
13659 /// let x = TaskTemplate::new().set_timeout(Duration::default()/* use setters */);
13660 /// ```
13661 pub fn set_timeout<T>(mut self, v: T) -> Self
13662 where
13663 T: std::convert::Into<wkt::Duration>,
13664 {
13665 self.timeout = std::option::Option::Some(v.into());
13666 self
13667 }
13668
13669 /// Sets or clears the value of [timeout][crate::model::TaskTemplate::timeout].
13670 ///
13671 /// # Example
13672 /// ```ignore,no_run
13673 /// # use google_cloud_run_v2::model::TaskTemplate;
13674 /// use wkt::Duration;
13675 /// let x = TaskTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13676 /// let x = TaskTemplate::new().set_or_clear_timeout(None::<Duration>);
13677 /// ```
13678 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13679 where
13680 T: std::convert::Into<wkt::Duration>,
13681 {
13682 self.timeout = v.map(|x| x.into());
13683 self
13684 }
13685
13686 /// Sets the value of [service_account][crate::model::TaskTemplate::service_account].
13687 ///
13688 /// # Example
13689 /// ```ignore,no_run
13690 /// # use google_cloud_run_v2::model::TaskTemplate;
13691 /// let x = TaskTemplate::new().set_service_account("example");
13692 /// ```
13693 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13694 self.service_account = v.into();
13695 self
13696 }
13697
13698 /// Sets the value of [execution_environment][crate::model::TaskTemplate::execution_environment].
13699 ///
13700 /// # Example
13701 /// ```ignore,no_run
13702 /// # use google_cloud_run_v2::model::TaskTemplate;
13703 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13704 /// let x0 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
13705 /// let x1 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
13706 /// ```
13707 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13708 mut self,
13709 v: T,
13710 ) -> Self {
13711 self.execution_environment = v.into();
13712 self
13713 }
13714
13715 /// Sets the value of [encryption_key][crate::model::TaskTemplate::encryption_key].
13716 ///
13717 /// # Example
13718 /// ```ignore,no_run
13719 /// # use google_cloud_run_v2::model::TaskTemplate;
13720 /// let x = TaskTemplate::new().set_encryption_key("example");
13721 /// ```
13722 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13723 self.encryption_key = v.into();
13724 self
13725 }
13726
13727 /// Sets the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13728 ///
13729 /// # Example
13730 /// ```ignore,no_run
13731 /// # use google_cloud_run_v2::model::TaskTemplate;
13732 /// use google_cloud_run_v2::model::VpcAccess;
13733 /// let x = TaskTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
13734 /// ```
13735 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13736 where
13737 T: std::convert::Into<crate::model::VpcAccess>,
13738 {
13739 self.vpc_access = std::option::Option::Some(v.into());
13740 self
13741 }
13742
13743 /// Sets or clears the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13744 ///
13745 /// # Example
13746 /// ```ignore,no_run
13747 /// # use google_cloud_run_v2::model::TaskTemplate;
13748 /// use google_cloud_run_v2::model::VpcAccess;
13749 /// let x = TaskTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13750 /// let x = TaskTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
13751 /// ```
13752 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13753 where
13754 T: std::convert::Into<crate::model::VpcAccess>,
13755 {
13756 self.vpc_access = v.map(|x| x.into());
13757 self
13758 }
13759
13760 /// Sets the value of [node_selector][crate::model::TaskTemplate::node_selector].
13761 ///
13762 /// # Example
13763 /// ```ignore,no_run
13764 /// # use google_cloud_run_v2::model::TaskTemplate;
13765 /// use google_cloud_run_v2::model::NodeSelector;
13766 /// let x = TaskTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
13767 /// ```
13768 pub fn set_node_selector<T>(mut self, v: T) -> Self
13769 where
13770 T: std::convert::Into<crate::model::NodeSelector>,
13771 {
13772 self.node_selector = std::option::Option::Some(v.into());
13773 self
13774 }
13775
13776 /// Sets or clears the value of [node_selector][crate::model::TaskTemplate::node_selector].
13777 ///
13778 /// # Example
13779 /// ```ignore,no_run
13780 /// # use google_cloud_run_v2::model::TaskTemplate;
13781 /// use google_cloud_run_v2::model::NodeSelector;
13782 /// let x = TaskTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13783 /// let x = TaskTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
13784 /// ```
13785 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13786 where
13787 T: std::convert::Into<crate::model::NodeSelector>,
13788 {
13789 self.node_selector = v.map(|x| x.into());
13790 self
13791 }
13792
13793 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13794 ///
13795 /// # Example
13796 /// ```ignore,no_run
13797 /// # use google_cloud_run_v2::model::TaskTemplate;
13798 /// let x = TaskTemplate::new().set_gpu_zonal_redundancy_disabled(true);
13799 /// ```
13800 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13801 where
13802 T: std::convert::Into<bool>,
13803 {
13804 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13805 self
13806 }
13807
13808 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13809 ///
13810 /// # Example
13811 /// ```ignore,no_run
13812 /// # use google_cloud_run_v2::model::TaskTemplate;
13813 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13814 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13815 /// ```
13816 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13817 mut self,
13818 v: std::option::Option<T>,
13819 ) -> Self
13820 where
13821 T: std::convert::Into<bool>,
13822 {
13823 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13824 self
13825 }
13826
13827 /// Sets the value of [retries][crate::model::TaskTemplate::retries].
13828 ///
13829 /// Note that all the setters affecting `retries` are mutually
13830 /// exclusive.
13831 ///
13832 /// # Example
13833 /// ```ignore,no_run
13834 /// # use google_cloud_run_v2::model::TaskTemplate;
13835 /// use google_cloud_run_v2::model::task_template::Retries;
13836 /// let x = TaskTemplate::new().set_retries(Some(Retries::MaxRetries(42)));
13837 /// ```
13838 pub fn set_retries<
13839 T: std::convert::Into<std::option::Option<crate::model::task_template::Retries>>,
13840 >(
13841 mut self,
13842 v: T,
13843 ) -> Self {
13844 self.retries = v.into();
13845 self
13846 }
13847
13848 /// The value of [retries][crate::model::TaskTemplate::retries]
13849 /// if it holds a `MaxRetries`, `None` if the field is not set or
13850 /// holds a different branch.
13851 pub fn max_retries(&self) -> std::option::Option<&i32> {
13852 #[allow(unreachable_patterns)]
13853 self.retries.as_ref().and_then(|v| match v {
13854 crate::model::task_template::Retries::MaxRetries(v) => std::option::Option::Some(v),
13855 _ => std::option::Option::None,
13856 })
13857 }
13858
13859 /// Sets the value of [retries][crate::model::TaskTemplate::retries]
13860 /// to hold a `MaxRetries`.
13861 ///
13862 /// Note that all the setters affecting `retries` are
13863 /// mutually exclusive.
13864 ///
13865 /// # Example
13866 /// ```ignore,no_run
13867 /// # use google_cloud_run_v2::model::TaskTemplate;
13868 /// let x = TaskTemplate::new().set_max_retries(42);
13869 /// assert!(x.max_retries().is_some());
13870 /// ```
13871 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13872 self.retries =
13873 std::option::Option::Some(crate::model::task_template::Retries::MaxRetries(v.into()));
13874 self
13875 }
13876}
13877
13878impl wkt::message::Message for TaskTemplate {
13879 fn typename() -> &'static str {
13880 "type.googleapis.com/google.cloud.run.v2.TaskTemplate"
13881 }
13882}
13883
13884/// Defines additional types related to [TaskTemplate].
13885pub mod task_template {
13886 #[allow(unused_imports)]
13887 use super::*;
13888
13889 #[allow(missing_docs)]
13890 #[derive(Clone, Debug, PartialEq)]
13891 #[non_exhaustive]
13892 pub enum Retries {
13893 /// Number of retries allowed per Task, before marking this Task failed.
13894 /// Defaults to 3.
13895 MaxRetries(i32),
13896 }
13897}
13898
13899/// Holds a single traffic routing entry for the Service. Allocations can be done
13900/// to a specific Revision name, or pointing to the latest Ready Revision.
13901#[derive(Clone, Default, PartialEq)]
13902#[non_exhaustive]
13903pub struct TrafficTarget {
13904 /// The allocation type for this traffic target.
13905 pub r#type: crate::model::TrafficTargetAllocationType,
13906
13907 /// Revision to which to send this portion of traffic, if traffic allocation is
13908 /// by revision.
13909 pub revision: std::string::String,
13910
13911 /// Specifies percent of the traffic to this Revision.
13912 /// This defaults to zero if unspecified.
13913 pub percent: i32,
13914
13915 /// Indicates a string to be part of the URI to exclusively reference this
13916 /// target.
13917 pub tag: std::string::String,
13918
13919 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13920}
13921
13922impl TrafficTarget {
13923 /// Creates a new default instance.
13924 pub fn new() -> Self {
13925 std::default::Default::default()
13926 }
13927
13928 /// Sets the value of [r#type][crate::model::TrafficTarget::type].
13929 ///
13930 /// # Example
13931 /// ```ignore,no_run
13932 /// # use google_cloud_run_v2::model::TrafficTarget;
13933 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13934 /// let x0 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Latest);
13935 /// let x1 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Revision);
13936 /// ```
13937 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13938 mut self,
13939 v: T,
13940 ) -> Self {
13941 self.r#type = v.into();
13942 self
13943 }
13944
13945 /// Sets the value of [revision][crate::model::TrafficTarget::revision].
13946 ///
13947 /// # Example
13948 /// ```ignore,no_run
13949 /// # use google_cloud_run_v2::model::TrafficTarget;
13950 /// # let project_id = "project_id";
13951 /// # let location_id = "location_id";
13952 /// # let service_id = "service_id";
13953 /// # let revision_id = "revision_id";
13954 /// let x = TrafficTarget::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
13955 /// ```
13956 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13957 self.revision = v.into();
13958 self
13959 }
13960
13961 /// Sets the value of [percent][crate::model::TrafficTarget::percent].
13962 ///
13963 /// # Example
13964 /// ```ignore,no_run
13965 /// # use google_cloud_run_v2::model::TrafficTarget;
13966 /// let x = TrafficTarget::new().set_percent(42);
13967 /// ```
13968 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13969 self.percent = v.into();
13970 self
13971 }
13972
13973 /// Sets the value of [tag][crate::model::TrafficTarget::tag].
13974 ///
13975 /// # Example
13976 /// ```ignore,no_run
13977 /// # use google_cloud_run_v2::model::TrafficTarget;
13978 /// let x = TrafficTarget::new().set_tag("example");
13979 /// ```
13980 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13981 self.tag = v.into();
13982 self
13983 }
13984}
13985
13986impl wkt::message::Message for TrafficTarget {
13987 fn typename() -> &'static str {
13988 "type.googleapis.com/google.cloud.run.v2.TrafficTarget"
13989 }
13990}
13991
13992/// Represents the observed state of a single `TrafficTarget` entry.
13993#[derive(Clone, Default, PartialEq)]
13994#[non_exhaustive]
13995pub struct TrafficTargetStatus {
13996 /// The allocation type for this traffic target.
13997 pub r#type: crate::model::TrafficTargetAllocationType,
13998
13999 /// Revision to which this traffic is sent.
14000 pub revision: std::string::String,
14001
14002 /// Specifies percent of the traffic to this Revision.
14003 pub percent: i32,
14004
14005 /// Indicates the string used in the URI to exclusively reference this target.
14006 pub tag: std::string::String,
14007
14008 /// Displays the target URI.
14009 pub uri: std::string::String,
14010
14011 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14012}
14013
14014impl TrafficTargetStatus {
14015 /// Creates a new default instance.
14016 pub fn new() -> Self {
14017 std::default::Default::default()
14018 }
14019
14020 /// Sets the value of [r#type][crate::model::TrafficTargetStatus::type].
14021 ///
14022 /// # Example
14023 /// ```ignore,no_run
14024 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14025 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
14026 /// let x0 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Latest);
14027 /// let x1 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Revision);
14028 /// ```
14029 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
14030 mut self,
14031 v: T,
14032 ) -> Self {
14033 self.r#type = v.into();
14034 self
14035 }
14036
14037 /// Sets the value of [revision][crate::model::TrafficTargetStatus::revision].
14038 ///
14039 /// # Example
14040 /// ```ignore,no_run
14041 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14042 /// # let project_id = "project_id";
14043 /// # let location_id = "location_id";
14044 /// # let service_id = "service_id";
14045 /// # let revision_id = "revision_id";
14046 /// let x = TrafficTargetStatus::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
14047 /// ```
14048 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14049 self.revision = v.into();
14050 self
14051 }
14052
14053 /// Sets the value of [percent][crate::model::TrafficTargetStatus::percent].
14054 ///
14055 /// # Example
14056 /// ```ignore,no_run
14057 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14058 /// let x = TrafficTargetStatus::new().set_percent(42);
14059 /// ```
14060 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14061 self.percent = v.into();
14062 self
14063 }
14064
14065 /// Sets the value of [tag][crate::model::TrafficTargetStatus::tag].
14066 ///
14067 /// # Example
14068 /// ```ignore,no_run
14069 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14070 /// let x = TrafficTargetStatus::new().set_tag("example");
14071 /// ```
14072 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14073 self.tag = v.into();
14074 self
14075 }
14076
14077 /// Sets the value of [uri][crate::model::TrafficTargetStatus::uri].
14078 ///
14079 /// # Example
14080 /// ```ignore,no_run
14081 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
14082 /// let x = TrafficTargetStatus::new().set_uri("example");
14083 /// ```
14084 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14085 self.uri = v.into();
14086 self
14087 }
14088}
14089
14090impl wkt::message::Message for TrafficTargetStatus {
14091 fn typename() -> &'static str {
14092 "type.googleapis.com/google.cloud.run.v2.TrafficTargetStatus"
14093 }
14094}
14095
14096/// VPC Access settings. For more information on sending traffic to a VPC
14097/// network, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
14098#[derive(Clone, Default, PartialEq)]
14099#[non_exhaustive]
14100pub struct VpcAccess {
14101 /// VPC Access connector name.
14102 /// Format: `projects/{project}/locations/{location}/connectors/{connector}`,
14103 /// where `{project}` can be project id or number.
14104 /// For more information on sending traffic to a VPC network via a connector,
14105 /// visit <https://cloud.google.com/run/docs/configuring/vpc-connectors>.
14106 pub connector: std::string::String,
14107
14108 /// Optional. Traffic VPC egress settings. If not provided, it defaults to
14109 /// PRIVATE_RANGES_ONLY.
14110 pub egress: crate::model::vpc_access::VpcEgress,
14111
14112 /// Optional. Direct VPC egress settings. Currently only single network
14113 /// interface is supported.
14114 pub network_interfaces: std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
14115
14116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14117}
14118
14119impl VpcAccess {
14120 /// Creates a new default instance.
14121 pub fn new() -> Self {
14122 std::default::Default::default()
14123 }
14124
14125 /// Sets the value of [connector][crate::model::VpcAccess::connector].
14126 ///
14127 /// # Example
14128 /// ```ignore,no_run
14129 /// # use google_cloud_run_v2::model::VpcAccess;
14130 /// let x = VpcAccess::new().set_connector("example");
14131 /// ```
14132 pub fn set_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14133 self.connector = v.into();
14134 self
14135 }
14136
14137 /// Sets the value of [egress][crate::model::VpcAccess::egress].
14138 ///
14139 /// # Example
14140 /// ```ignore,no_run
14141 /// # use google_cloud_run_v2::model::VpcAccess;
14142 /// use google_cloud_run_v2::model::vpc_access::VpcEgress;
14143 /// let x0 = VpcAccess::new().set_egress(VpcEgress::AllTraffic);
14144 /// let x1 = VpcAccess::new().set_egress(VpcEgress::PrivateRangesOnly);
14145 /// ```
14146 pub fn set_egress<T: std::convert::Into<crate::model::vpc_access::VpcEgress>>(
14147 mut self,
14148 v: T,
14149 ) -> Self {
14150 self.egress = v.into();
14151 self
14152 }
14153
14154 /// Sets the value of [network_interfaces][crate::model::VpcAccess::network_interfaces].
14155 ///
14156 /// # Example
14157 /// ```ignore,no_run
14158 /// # use google_cloud_run_v2::model::VpcAccess;
14159 /// use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14160 /// let x = VpcAccess::new()
14161 /// .set_network_interfaces([
14162 /// NetworkInterface::default()/* use setters */,
14163 /// NetworkInterface::default()/* use (different) setters */,
14164 /// ]);
14165 /// ```
14166 pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
14167 where
14168 T: std::iter::IntoIterator<Item = V>,
14169 V: std::convert::Into<crate::model::vpc_access::NetworkInterface>,
14170 {
14171 use std::iter::Iterator;
14172 self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
14173 self
14174 }
14175}
14176
14177impl wkt::message::Message for VpcAccess {
14178 fn typename() -> &'static str {
14179 "type.googleapis.com/google.cloud.run.v2.VpcAccess"
14180 }
14181}
14182
14183/// Defines additional types related to [VpcAccess].
14184pub mod vpc_access {
14185 #[allow(unused_imports)]
14186 use super::*;
14187
14188 /// Direct VPC egress settings.
14189 #[derive(Clone, Default, PartialEq)]
14190 #[non_exhaustive]
14191 pub struct NetworkInterface {
14192 /// Optional. The VPC network that the Cloud Run resource will be able to
14193 /// send traffic to. At least one of network or subnetwork must be specified.
14194 /// If both network and subnetwork are specified, the given VPC subnetwork
14195 /// must belong to the given VPC network. If network is not specified, it
14196 /// will be looked up from the subnetwork.
14197 pub network: std::string::String,
14198
14199 /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs
14200 /// from. At least one of network or subnetwork must be specified. If both
14201 /// network and subnetwork are specified, the given VPC subnetwork must
14202 /// belong to the given VPC network. If subnetwork is not specified, the
14203 /// subnetwork with the same name with the network will be used.
14204 pub subnetwork: std::string::String,
14205
14206 /// Optional. Network tags applied to this Cloud Run resource.
14207 pub tags: std::vec::Vec<std::string::String>,
14208
14209 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14210 }
14211
14212 impl NetworkInterface {
14213 /// Creates a new default instance.
14214 pub fn new() -> Self {
14215 std::default::Default::default()
14216 }
14217
14218 /// Sets the value of [network][crate::model::vpc_access::NetworkInterface::network].
14219 ///
14220 /// # Example
14221 /// ```ignore,no_run
14222 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14223 /// let x = NetworkInterface::new().set_network("example");
14224 /// ```
14225 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14226 self.network = v.into();
14227 self
14228 }
14229
14230 /// Sets the value of [subnetwork][crate::model::vpc_access::NetworkInterface::subnetwork].
14231 ///
14232 /// # Example
14233 /// ```ignore,no_run
14234 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14235 /// let x = NetworkInterface::new().set_subnetwork("example");
14236 /// ```
14237 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14238 self.subnetwork = v.into();
14239 self
14240 }
14241
14242 /// Sets the value of [tags][crate::model::vpc_access::NetworkInterface::tags].
14243 ///
14244 /// # Example
14245 /// ```ignore,no_run
14246 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14247 /// let x = NetworkInterface::new().set_tags(["a", "b", "c"]);
14248 /// ```
14249 pub fn set_tags<T, V>(mut self, v: T) -> Self
14250 where
14251 T: std::iter::IntoIterator<Item = V>,
14252 V: std::convert::Into<std::string::String>,
14253 {
14254 use std::iter::Iterator;
14255 self.tags = v.into_iter().map(|i| i.into()).collect();
14256 self
14257 }
14258 }
14259
14260 impl wkt::message::Message for NetworkInterface {
14261 fn typename() -> &'static str {
14262 "type.googleapis.com/google.cloud.run.v2.VpcAccess.NetworkInterface"
14263 }
14264 }
14265
14266 /// Egress options for VPC access.
14267 ///
14268 /// # Working with unknown values
14269 ///
14270 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14271 /// additional enum variants at any time. Adding new variants is not considered
14272 /// a breaking change. Applications should write their code in anticipation of:
14273 ///
14274 /// - New values appearing in future releases of the client library, **and**
14275 /// - New values received dynamically, without application changes.
14276 ///
14277 /// Please consult the [Working with enums] section in the user guide for some
14278 /// guidelines.
14279 ///
14280 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14281 #[derive(Clone, Debug, PartialEq)]
14282 #[non_exhaustive]
14283 pub enum VpcEgress {
14284 /// Unspecified
14285 Unspecified,
14286 /// All outbound traffic is routed through the VPC connector.
14287 AllTraffic,
14288 /// Only private IP ranges are routed through the VPC connector.
14289 PrivateRangesOnly,
14290 /// If set, the enum was initialized with an unknown value.
14291 ///
14292 /// Applications can examine the value using [VpcEgress::value] or
14293 /// [VpcEgress::name].
14294 UnknownValue(vpc_egress::UnknownValue),
14295 }
14296
14297 #[doc(hidden)]
14298 pub mod vpc_egress {
14299 #[allow(unused_imports)]
14300 use super::*;
14301 #[derive(Clone, Debug, PartialEq)]
14302 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14303 }
14304
14305 impl VpcEgress {
14306 /// Gets the enum value.
14307 ///
14308 /// Returns `None` if the enum contains an unknown value deserialized from
14309 /// the string representation of enums.
14310 pub fn value(&self) -> std::option::Option<i32> {
14311 match self {
14312 Self::Unspecified => std::option::Option::Some(0),
14313 Self::AllTraffic => std::option::Option::Some(1),
14314 Self::PrivateRangesOnly => std::option::Option::Some(2),
14315 Self::UnknownValue(u) => u.0.value(),
14316 }
14317 }
14318
14319 /// Gets the enum value as a string.
14320 ///
14321 /// Returns `None` if the enum contains an unknown value deserialized from
14322 /// the integer representation of enums.
14323 pub fn name(&self) -> std::option::Option<&str> {
14324 match self {
14325 Self::Unspecified => std::option::Option::Some("VPC_EGRESS_UNSPECIFIED"),
14326 Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
14327 Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
14328 Self::UnknownValue(u) => u.0.name(),
14329 }
14330 }
14331 }
14332
14333 impl std::default::Default for VpcEgress {
14334 fn default() -> Self {
14335 use std::convert::From;
14336 Self::from(0)
14337 }
14338 }
14339
14340 impl std::fmt::Display for VpcEgress {
14341 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14342 wkt::internal::display_enum(f, self.name(), self.value())
14343 }
14344 }
14345
14346 impl std::convert::From<i32> for VpcEgress {
14347 fn from(value: i32) -> Self {
14348 match value {
14349 0 => Self::Unspecified,
14350 1 => Self::AllTraffic,
14351 2 => Self::PrivateRangesOnly,
14352 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14353 wkt::internal::UnknownEnumValue::Integer(value),
14354 )),
14355 }
14356 }
14357 }
14358
14359 impl std::convert::From<&str> for VpcEgress {
14360 fn from(value: &str) -> Self {
14361 use std::string::ToString;
14362 match value {
14363 "VPC_EGRESS_UNSPECIFIED" => Self::Unspecified,
14364 "ALL_TRAFFIC" => Self::AllTraffic,
14365 "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
14366 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14367 wkt::internal::UnknownEnumValue::String(value.to_string()),
14368 )),
14369 }
14370 }
14371 }
14372
14373 impl serde::ser::Serialize for VpcEgress {
14374 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14375 where
14376 S: serde::Serializer,
14377 {
14378 match self {
14379 Self::Unspecified => serializer.serialize_i32(0),
14380 Self::AllTraffic => serializer.serialize_i32(1),
14381 Self::PrivateRangesOnly => serializer.serialize_i32(2),
14382 Self::UnknownValue(u) => u.0.serialize(serializer),
14383 }
14384 }
14385 }
14386
14387 impl<'de> serde::de::Deserialize<'de> for VpcEgress {
14388 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14389 where
14390 D: serde::Deserializer<'de>,
14391 {
14392 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VpcEgress>::new(
14393 ".google.cloud.run.v2.VpcAccess.VpcEgress",
14394 ))
14395 }
14396 }
14397}
14398
14399/// Settings for Binary Authorization feature.
14400#[derive(Clone, Default, PartialEq)]
14401#[non_exhaustive]
14402pub struct BinaryAuthorization {
14403 /// Optional. If present, indicates to use Breakglass using this justification.
14404 /// If use_default is False, then it must be empty.
14405 /// For more information on breakglass, see
14406 /// <https://cloud.google.com/binary-authorization/docs/using-breakglass>
14407 pub breakglass_justification: std::string::String,
14408
14409 #[allow(missing_docs)]
14410 pub binauthz_method: std::option::Option<crate::model::binary_authorization::BinauthzMethod>,
14411
14412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14413}
14414
14415impl BinaryAuthorization {
14416 /// Creates a new default instance.
14417 pub fn new() -> Self {
14418 std::default::Default::default()
14419 }
14420
14421 /// Sets the value of [breakglass_justification][crate::model::BinaryAuthorization::breakglass_justification].
14422 ///
14423 /// # Example
14424 /// ```ignore,no_run
14425 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14426 /// let x = BinaryAuthorization::new().set_breakglass_justification("example");
14427 /// ```
14428 pub fn set_breakglass_justification<T: std::convert::Into<std::string::String>>(
14429 mut self,
14430 v: T,
14431 ) -> Self {
14432 self.breakglass_justification = v.into();
14433 self
14434 }
14435
14436 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method].
14437 ///
14438 /// Note that all the setters affecting `binauthz_method` are mutually
14439 /// exclusive.
14440 ///
14441 /// # Example
14442 /// ```ignore,no_run
14443 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14444 /// use google_cloud_run_v2::model::binary_authorization::BinauthzMethod;
14445 /// let x = BinaryAuthorization::new().set_binauthz_method(Some(BinauthzMethod::UseDefault(true)));
14446 /// ```
14447 pub fn set_binauthz_method<
14448 T: std::convert::Into<std::option::Option<crate::model::binary_authorization::BinauthzMethod>>,
14449 >(
14450 mut self,
14451 v: T,
14452 ) -> Self {
14453 self.binauthz_method = v.into();
14454 self
14455 }
14456
14457 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14458 /// if it holds a `UseDefault`, `None` if the field is not set or
14459 /// holds a different branch.
14460 pub fn use_default(&self) -> std::option::Option<&bool> {
14461 #[allow(unreachable_patterns)]
14462 self.binauthz_method.as_ref().and_then(|v| match v {
14463 crate::model::binary_authorization::BinauthzMethod::UseDefault(v) => {
14464 std::option::Option::Some(v)
14465 }
14466 _ => std::option::Option::None,
14467 })
14468 }
14469
14470 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14471 /// to hold a `UseDefault`.
14472 ///
14473 /// Note that all the setters affecting `binauthz_method` are
14474 /// mutually exclusive.
14475 ///
14476 /// # Example
14477 /// ```ignore,no_run
14478 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14479 /// let x = BinaryAuthorization::new().set_use_default(true);
14480 /// assert!(x.use_default().is_some());
14481 /// assert!(x.policy().is_none());
14482 /// ```
14483 pub fn set_use_default<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14484 self.binauthz_method = std::option::Option::Some(
14485 crate::model::binary_authorization::BinauthzMethod::UseDefault(v.into()),
14486 );
14487 self
14488 }
14489
14490 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14491 /// if it holds a `Policy`, `None` if the field is not set or
14492 /// holds a different branch.
14493 pub fn policy(&self) -> std::option::Option<&std::string::String> {
14494 #[allow(unreachable_patterns)]
14495 self.binauthz_method.as_ref().and_then(|v| match v {
14496 crate::model::binary_authorization::BinauthzMethod::Policy(v) => {
14497 std::option::Option::Some(v)
14498 }
14499 _ => std::option::Option::None,
14500 })
14501 }
14502
14503 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14504 /// to hold a `Policy`.
14505 ///
14506 /// Note that all the setters affecting `binauthz_method` are
14507 /// mutually exclusive.
14508 ///
14509 /// # Example
14510 /// ```ignore,no_run
14511 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14512 /// let x = BinaryAuthorization::new().set_policy("example");
14513 /// assert!(x.policy().is_some());
14514 /// assert!(x.use_default().is_none());
14515 /// ```
14516 pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14517 self.binauthz_method = std::option::Option::Some(
14518 crate::model::binary_authorization::BinauthzMethod::Policy(v.into()),
14519 );
14520 self
14521 }
14522}
14523
14524impl wkt::message::Message for BinaryAuthorization {
14525 fn typename() -> &'static str {
14526 "type.googleapis.com/google.cloud.run.v2.BinaryAuthorization"
14527 }
14528}
14529
14530/// Defines additional types related to [BinaryAuthorization].
14531pub mod binary_authorization {
14532 #[allow(unused_imports)]
14533 use super::*;
14534
14535 #[allow(missing_docs)]
14536 #[derive(Clone, Debug, PartialEq)]
14537 #[non_exhaustive]
14538 pub enum BinauthzMethod {
14539 /// Optional. If True, indicates to use the default project's binary
14540 /// authorization policy. If False, binary authorization will be disabled.
14541 UseDefault(bool),
14542 /// Optional. The path to a binary authorization policy.
14543 /// Format: `projects/{project}/platforms/cloudRun/{policy-name}`
14544 Policy(std::string::String),
14545 }
14546}
14547
14548/// Settings for revision-level scaling settings.
14549#[derive(Clone, Default, PartialEq)]
14550#[non_exhaustive]
14551pub struct RevisionScaling {
14552 /// Optional. Minimum number of serving instances that this resource should
14553 /// have.
14554 pub min_instance_count: i32,
14555
14556 /// Optional. Maximum number of serving instances that this resource should
14557 /// have. When unspecified, the field is set to the server default value of
14558 /// 100. For more information see
14559 /// <https://cloud.google.com/run/docs/configuring/max-instances>
14560 pub max_instance_count: i32,
14561
14562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14563}
14564
14565impl RevisionScaling {
14566 /// Creates a new default instance.
14567 pub fn new() -> Self {
14568 std::default::Default::default()
14569 }
14570
14571 /// Sets the value of [min_instance_count][crate::model::RevisionScaling::min_instance_count].
14572 ///
14573 /// # Example
14574 /// ```ignore,no_run
14575 /// # use google_cloud_run_v2::model::RevisionScaling;
14576 /// let x = RevisionScaling::new().set_min_instance_count(42);
14577 /// ```
14578 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14579 self.min_instance_count = v.into();
14580 self
14581 }
14582
14583 /// Sets the value of [max_instance_count][crate::model::RevisionScaling::max_instance_count].
14584 ///
14585 /// # Example
14586 /// ```ignore,no_run
14587 /// # use google_cloud_run_v2::model::RevisionScaling;
14588 /// let x = RevisionScaling::new().set_max_instance_count(42);
14589 /// ```
14590 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14591 self.max_instance_count = v.into();
14592 self
14593 }
14594}
14595
14596impl wkt::message::Message for RevisionScaling {
14597 fn typename() -> &'static str {
14598 "type.googleapis.com/google.cloud.run.v2.RevisionScaling"
14599 }
14600}
14601
14602/// Settings for Cloud Service Mesh. For more information see
14603/// <https://cloud.google.com/service-mesh/docs/overview>.
14604#[derive(Clone, Default, PartialEq)]
14605#[non_exhaustive]
14606pub struct ServiceMesh {
14607 /// The Mesh resource name. Format:
14608 /// `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can
14609 /// be project id or number.
14610 pub mesh: std::string::String,
14611
14612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14613}
14614
14615impl ServiceMesh {
14616 /// Creates a new default instance.
14617 pub fn new() -> Self {
14618 std::default::Default::default()
14619 }
14620
14621 /// Sets the value of [mesh][crate::model::ServiceMesh::mesh].
14622 ///
14623 /// # Example
14624 /// ```ignore,no_run
14625 /// # use google_cloud_run_v2::model::ServiceMesh;
14626 /// let x = ServiceMesh::new().set_mesh("example");
14627 /// ```
14628 pub fn set_mesh<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14629 self.mesh = v.into();
14630 self
14631 }
14632}
14633
14634impl wkt::message::Message for ServiceMesh {
14635 fn typename() -> &'static str {
14636 "type.googleapis.com/google.cloud.run.v2.ServiceMesh"
14637 }
14638}
14639
14640/// Scaling settings applied at the service level rather than
14641/// at the revision level.
14642#[derive(Clone, Default, PartialEq)]
14643#[non_exhaustive]
14644pub struct ServiceScaling {
14645 /// Optional. total min instances for the service. This number of instances is
14646 /// divided among all revisions with specified traffic based on the percent
14647 /// of traffic they are receiving.
14648 pub min_instance_count: i32,
14649
14650 /// Optional. The scaling mode for the service.
14651 pub scaling_mode: crate::model::service_scaling::ScalingMode,
14652
14653 /// Optional. total max instances for the service. This number of instances is
14654 /// divided among all revisions with specified traffic based on the percent
14655 /// of traffic they are receiving.
14656 pub max_instance_count: i32,
14657
14658 /// Optional. total instance count for the service in manual scaling mode. This
14659 /// number of instances is divided among all revisions with specified traffic
14660 /// based on the percent of traffic they are receiving.
14661 pub manual_instance_count: std::option::Option<i32>,
14662
14663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14664}
14665
14666impl ServiceScaling {
14667 /// Creates a new default instance.
14668 pub fn new() -> Self {
14669 std::default::Default::default()
14670 }
14671
14672 /// Sets the value of [min_instance_count][crate::model::ServiceScaling::min_instance_count].
14673 ///
14674 /// # Example
14675 /// ```ignore,no_run
14676 /// # use google_cloud_run_v2::model::ServiceScaling;
14677 /// let x = ServiceScaling::new().set_min_instance_count(42);
14678 /// ```
14679 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14680 self.min_instance_count = v.into();
14681 self
14682 }
14683
14684 /// Sets the value of [scaling_mode][crate::model::ServiceScaling::scaling_mode].
14685 ///
14686 /// # Example
14687 /// ```ignore,no_run
14688 /// # use google_cloud_run_v2::model::ServiceScaling;
14689 /// use google_cloud_run_v2::model::service_scaling::ScalingMode;
14690 /// let x0 = ServiceScaling::new().set_scaling_mode(ScalingMode::Automatic);
14691 /// let x1 = ServiceScaling::new().set_scaling_mode(ScalingMode::Manual);
14692 /// ```
14693 pub fn set_scaling_mode<T: std::convert::Into<crate::model::service_scaling::ScalingMode>>(
14694 mut self,
14695 v: T,
14696 ) -> Self {
14697 self.scaling_mode = v.into();
14698 self
14699 }
14700
14701 /// Sets the value of [max_instance_count][crate::model::ServiceScaling::max_instance_count].
14702 ///
14703 /// # Example
14704 /// ```ignore,no_run
14705 /// # use google_cloud_run_v2::model::ServiceScaling;
14706 /// let x = ServiceScaling::new().set_max_instance_count(42);
14707 /// ```
14708 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14709 self.max_instance_count = v.into();
14710 self
14711 }
14712
14713 /// Sets the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14714 ///
14715 /// # Example
14716 /// ```ignore,no_run
14717 /// # use google_cloud_run_v2::model::ServiceScaling;
14718 /// let x = ServiceScaling::new().set_manual_instance_count(42);
14719 /// ```
14720 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14721 where
14722 T: std::convert::Into<i32>,
14723 {
14724 self.manual_instance_count = std::option::Option::Some(v.into());
14725 self
14726 }
14727
14728 /// Sets or clears the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14729 ///
14730 /// # Example
14731 /// ```ignore,no_run
14732 /// # use google_cloud_run_v2::model::ServiceScaling;
14733 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(Some(42));
14734 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14735 /// ```
14736 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14737 where
14738 T: std::convert::Into<i32>,
14739 {
14740 self.manual_instance_count = v.map(|x| x.into());
14741 self
14742 }
14743}
14744
14745impl wkt::message::Message for ServiceScaling {
14746 fn typename() -> &'static str {
14747 "type.googleapis.com/google.cloud.run.v2.ServiceScaling"
14748 }
14749}
14750
14751/// Defines additional types related to [ServiceScaling].
14752pub mod service_scaling {
14753 #[allow(unused_imports)]
14754 use super::*;
14755
14756 /// The scaling mode for the service. If not provided, it defaults to
14757 /// AUTOMATIC.
14758 ///
14759 /// # Working with unknown values
14760 ///
14761 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14762 /// additional enum variants at any time. Adding new variants is not considered
14763 /// a breaking change. Applications should write their code in anticipation of:
14764 ///
14765 /// - New values appearing in future releases of the client library, **and**
14766 /// - New values received dynamically, without application changes.
14767 ///
14768 /// Please consult the [Working with enums] section in the user guide for some
14769 /// guidelines.
14770 ///
14771 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14772 #[derive(Clone, Debug, PartialEq)]
14773 #[non_exhaustive]
14774 pub enum ScalingMode {
14775 /// Unspecified.
14776 Unspecified,
14777 /// Scale based on traffic between min and max instances.
14778 Automatic,
14779 /// Scale to exactly min instances and ignore max instances.
14780 Manual,
14781 /// If set, the enum was initialized with an unknown value.
14782 ///
14783 /// Applications can examine the value using [ScalingMode::value] or
14784 /// [ScalingMode::name].
14785 UnknownValue(scaling_mode::UnknownValue),
14786 }
14787
14788 #[doc(hidden)]
14789 pub mod scaling_mode {
14790 #[allow(unused_imports)]
14791 use super::*;
14792 #[derive(Clone, Debug, PartialEq)]
14793 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14794 }
14795
14796 impl ScalingMode {
14797 /// Gets the enum value.
14798 ///
14799 /// Returns `None` if the enum contains an unknown value deserialized from
14800 /// the string representation of enums.
14801 pub fn value(&self) -> std::option::Option<i32> {
14802 match self {
14803 Self::Unspecified => std::option::Option::Some(0),
14804 Self::Automatic => std::option::Option::Some(1),
14805 Self::Manual => std::option::Option::Some(2),
14806 Self::UnknownValue(u) => u.0.value(),
14807 }
14808 }
14809
14810 /// Gets the enum value as a string.
14811 ///
14812 /// Returns `None` if the enum contains an unknown value deserialized from
14813 /// the integer representation of enums.
14814 pub fn name(&self) -> std::option::Option<&str> {
14815 match self {
14816 Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
14817 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
14818 Self::Manual => std::option::Option::Some("MANUAL"),
14819 Self::UnknownValue(u) => u.0.name(),
14820 }
14821 }
14822 }
14823
14824 impl std::default::Default for ScalingMode {
14825 fn default() -> Self {
14826 use std::convert::From;
14827 Self::from(0)
14828 }
14829 }
14830
14831 impl std::fmt::Display for ScalingMode {
14832 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14833 wkt::internal::display_enum(f, self.name(), self.value())
14834 }
14835 }
14836
14837 impl std::convert::From<i32> for ScalingMode {
14838 fn from(value: i32) -> Self {
14839 match value {
14840 0 => Self::Unspecified,
14841 1 => Self::Automatic,
14842 2 => Self::Manual,
14843 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14844 wkt::internal::UnknownEnumValue::Integer(value),
14845 )),
14846 }
14847 }
14848 }
14849
14850 impl std::convert::From<&str> for ScalingMode {
14851 fn from(value: &str) -> Self {
14852 use std::string::ToString;
14853 match value {
14854 "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
14855 "AUTOMATIC" => Self::Automatic,
14856 "MANUAL" => Self::Manual,
14857 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14858 wkt::internal::UnknownEnumValue::String(value.to_string()),
14859 )),
14860 }
14861 }
14862 }
14863
14864 impl serde::ser::Serialize for ScalingMode {
14865 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14866 where
14867 S: serde::Serializer,
14868 {
14869 match self {
14870 Self::Unspecified => serializer.serialize_i32(0),
14871 Self::Automatic => serializer.serialize_i32(1),
14872 Self::Manual => serializer.serialize_i32(2),
14873 Self::UnknownValue(u) => u.0.serialize(serializer),
14874 }
14875 }
14876 }
14877
14878 impl<'de> serde::de::Deserialize<'de> for ScalingMode {
14879 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14880 where
14881 D: serde::Deserializer<'de>,
14882 {
14883 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
14884 ".google.cloud.run.v2.ServiceScaling.ScalingMode",
14885 ))
14886 }
14887 }
14888}
14889
14890/// Worker pool scaling settings.
14891#[derive(Clone, Default, PartialEq)]
14892#[non_exhaustive]
14893pub struct WorkerPoolScaling {
14894 /// Optional. The total number of instances in manual scaling mode.
14895 pub manual_instance_count: std::option::Option<i32>,
14896
14897 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14898}
14899
14900impl WorkerPoolScaling {
14901 /// Creates a new default instance.
14902 pub fn new() -> Self {
14903 std::default::Default::default()
14904 }
14905
14906 /// Sets the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14907 ///
14908 /// # Example
14909 /// ```ignore,no_run
14910 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14911 /// let x = WorkerPoolScaling::new().set_manual_instance_count(42);
14912 /// ```
14913 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14914 where
14915 T: std::convert::Into<i32>,
14916 {
14917 self.manual_instance_count = std::option::Option::Some(v.into());
14918 self
14919 }
14920
14921 /// Sets or clears the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14922 ///
14923 /// # Example
14924 /// ```ignore,no_run
14925 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14926 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(Some(42));
14927 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14928 /// ```
14929 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14930 where
14931 T: std::convert::Into<i32>,
14932 {
14933 self.manual_instance_count = v.map(|x| x.into());
14934 self
14935 }
14936}
14937
14938impl wkt::message::Message for WorkerPoolScaling {
14939 fn typename() -> &'static str {
14940 "type.googleapis.com/google.cloud.run.v2.WorkerPoolScaling"
14941 }
14942}
14943
14944/// Hardware constraints configuration.
14945#[derive(Clone, Default, PartialEq)]
14946#[non_exhaustive]
14947pub struct NodeSelector {
14948 /// Required. GPU accelerator type to attach to an instance.
14949 pub accelerator: std::string::String,
14950
14951 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14952}
14953
14954impl NodeSelector {
14955 /// Creates a new default instance.
14956 pub fn new() -> Self {
14957 std::default::Default::default()
14958 }
14959
14960 /// Sets the value of [accelerator][crate::model::NodeSelector::accelerator].
14961 ///
14962 /// # Example
14963 /// ```ignore,no_run
14964 /// # use google_cloud_run_v2::model::NodeSelector;
14965 /// let x = NodeSelector::new().set_accelerator("example");
14966 /// ```
14967 pub fn set_accelerator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14968 self.accelerator = v.into();
14969 self
14970 }
14971}
14972
14973impl wkt::message::Message for NodeSelector {
14974 fn typename() -> &'static str {
14975 "type.googleapis.com/google.cloud.run.v2.NodeSelector"
14976 }
14977}
14978
14979/// Describes the Build step of the function that builds a container from the
14980/// given source.
14981#[derive(Clone, Default, PartialEq)]
14982#[non_exhaustive]
14983pub struct BuildConfig {
14984 /// Output only. The Cloud Build name of the latest successful deployment of
14985 /// the function.
14986 pub name: std::string::String,
14987
14988 /// The Cloud Storage bucket URI where the function source code is located.
14989 pub source_location: std::string::String,
14990
14991 /// Optional. The name of the function (as defined in source code) that will be
14992 /// executed. Defaults to the resource name suffix, if not specified. For
14993 /// backward compatibility, if function with given name is not found, then the
14994 /// system will try to use function named "function".
14995 pub function_target: std::string::String,
14996
14997 /// Optional. Artifact Registry URI to store the built image.
14998 pub image_uri: std::string::String,
14999
15000 /// Optional. The base image used to build the function.
15001 pub base_image: std::string::String,
15002
15003 /// Optional. Sets whether the function will receive automatic base image
15004 /// updates.
15005 pub enable_automatic_updates: bool,
15006
15007 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
15008 /// build the Cloud Run function. The format of this field is
15009 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
15010 /// `{project}` and `{region}` are the project id and region respectively where
15011 /// the worker pool is defined and `{workerPool}` is the short name of the
15012 /// worker pool.
15013 pub worker_pool: std::string::String,
15014
15015 /// Optional. User-provided build-time environment variables for the function
15016 pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
15017
15018 /// Optional. Service account to be used for building the container. The format
15019 /// of this field is
15020 /// `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
15021 pub service_account: std::string::String,
15022
15023 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15024}
15025
15026impl BuildConfig {
15027 /// Creates a new default instance.
15028 pub fn new() -> Self {
15029 std::default::Default::default()
15030 }
15031
15032 /// Sets the value of [name][crate::model::BuildConfig::name].
15033 ///
15034 /// # Example
15035 /// ```ignore,no_run
15036 /// # use google_cloud_run_v2::model::BuildConfig;
15037 /// let x = BuildConfig::new().set_name("example");
15038 /// ```
15039 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15040 self.name = v.into();
15041 self
15042 }
15043
15044 /// Sets the value of [source_location][crate::model::BuildConfig::source_location].
15045 ///
15046 /// # Example
15047 /// ```ignore,no_run
15048 /// # use google_cloud_run_v2::model::BuildConfig;
15049 /// let x = BuildConfig::new().set_source_location("example");
15050 /// ```
15051 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15052 self.source_location = v.into();
15053 self
15054 }
15055
15056 /// Sets the value of [function_target][crate::model::BuildConfig::function_target].
15057 ///
15058 /// # Example
15059 /// ```ignore,no_run
15060 /// # use google_cloud_run_v2::model::BuildConfig;
15061 /// let x = BuildConfig::new().set_function_target("example");
15062 /// ```
15063 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15064 self.function_target = v.into();
15065 self
15066 }
15067
15068 /// Sets the value of [image_uri][crate::model::BuildConfig::image_uri].
15069 ///
15070 /// # Example
15071 /// ```ignore,no_run
15072 /// # use google_cloud_run_v2::model::BuildConfig;
15073 /// let x = BuildConfig::new().set_image_uri("example");
15074 /// ```
15075 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15076 self.image_uri = v.into();
15077 self
15078 }
15079
15080 /// Sets the value of [base_image][crate::model::BuildConfig::base_image].
15081 ///
15082 /// # Example
15083 /// ```ignore,no_run
15084 /// # use google_cloud_run_v2::model::BuildConfig;
15085 /// let x = BuildConfig::new().set_base_image("example");
15086 /// ```
15087 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15088 self.base_image = v.into();
15089 self
15090 }
15091
15092 /// Sets the value of [enable_automatic_updates][crate::model::BuildConfig::enable_automatic_updates].
15093 ///
15094 /// # Example
15095 /// ```ignore,no_run
15096 /// # use google_cloud_run_v2::model::BuildConfig;
15097 /// let x = BuildConfig::new().set_enable_automatic_updates(true);
15098 /// ```
15099 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15100 self.enable_automatic_updates = v.into();
15101 self
15102 }
15103
15104 /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
15105 ///
15106 /// # Example
15107 /// ```ignore,no_run
15108 /// # use google_cloud_run_v2::model::BuildConfig;
15109 /// let x = BuildConfig::new().set_worker_pool("example");
15110 /// ```
15111 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15112 self.worker_pool = v.into();
15113 self
15114 }
15115
15116 /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
15117 ///
15118 /// # Example
15119 /// ```ignore,no_run
15120 /// # use google_cloud_run_v2::model::BuildConfig;
15121 /// let x = BuildConfig::new().set_environment_variables([
15122 /// ("key0", "abc"),
15123 /// ("key1", "xyz"),
15124 /// ]);
15125 /// ```
15126 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
15127 where
15128 T: std::iter::IntoIterator<Item = (K, V)>,
15129 K: std::convert::Into<std::string::String>,
15130 V: std::convert::Into<std::string::String>,
15131 {
15132 use std::iter::Iterator;
15133 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15134 self
15135 }
15136
15137 /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
15138 ///
15139 /// # Example
15140 /// ```ignore,no_run
15141 /// # use google_cloud_run_v2::model::BuildConfig;
15142 /// let x = BuildConfig::new().set_service_account("example");
15143 /// ```
15144 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15145 self.service_account = v.into();
15146 self
15147 }
15148}
15149
15150impl wkt::message::Message for BuildConfig {
15151 fn typename() -> &'static str {
15152 "type.googleapis.com/google.cloud.run.v2.BuildConfig"
15153 }
15154}
15155
15156/// Request message for creating a WorkerPool.
15157#[derive(Clone, Default, PartialEq)]
15158#[non_exhaustive]
15159pub struct CreateWorkerPoolRequest {
15160 /// Required. The location and project in which this worker pool should be
15161 /// created. Format: `projects/{project}/locations/{location}`, where
15162 /// `{project}` can be project id or number. Only lowercase characters, digits,
15163 /// and hyphens.
15164 pub parent: std::string::String,
15165
15166 /// Required. The WorkerPool instance to create.
15167 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15168
15169 /// Required. The unique identifier for the WorkerPool. It must begin with
15170 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
15171 /// The name of the worker pool becomes
15172 /// `{parent}/workerPools/{worker_pool_id}`.
15173 pub worker_pool_id: std::string::String,
15174
15175 /// Optional. Indicates that the request should be validated and default values
15176 /// populated, without persisting the request or creating any resources.
15177 pub validate_only: bool,
15178
15179 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15180}
15181
15182impl CreateWorkerPoolRequest {
15183 /// Creates a new default instance.
15184 pub fn new() -> Self {
15185 std::default::Default::default()
15186 }
15187
15188 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
15189 ///
15190 /// # Example
15191 /// ```ignore,no_run
15192 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15193 /// # let project_id = "project_id";
15194 /// # let location_id = "location_id";
15195 /// let x = CreateWorkerPoolRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
15196 /// ```
15197 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15198 self.parent = v.into();
15199 self
15200 }
15201
15202 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
15203 ///
15204 /// # Example
15205 /// ```ignore,no_run
15206 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15207 /// use google_cloud_run_v2::model::WorkerPool;
15208 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15209 /// ```
15210 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15211 where
15212 T: std::convert::Into<crate::model::WorkerPool>,
15213 {
15214 self.worker_pool = std::option::Option::Some(v.into());
15215 self
15216 }
15217
15218 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
15219 ///
15220 /// # Example
15221 /// ```ignore,no_run
15222 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15223 /// use google_cloud_run_v2::model::WorkerPool;
15224 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15225 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15226 /// ```
15227 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15228 where
15229 T: std::convert::Into<crate::model::WorkerPool>,
15230 {
15231 self.worker_pool = v.map(|x| x.into());
15232 self
15233 }
15234
15235 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
15236 ///
15237 /// # Example
15238 /// ```ignore,no_run
15239 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15240 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
15241 /// ```
15242 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15243 self.worker_pool_id = v.into();
15244 self
15245 }
15246
15247 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
15248 ///
15249 /// # Example
15250 /// ```ignore,no_run
15251 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
15252 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
15253 /// ```
15254 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15255 self.validate_only = v.into();
15256 self
15257 }
15258}
15259
15260impl wkt::message::Message for CreateWorkerPoolRequest {
15261 fn typename() -> &'static str {
15262 "type.googleapis.com/google.cloud.run.v2.CreateWorkerPoolRequest"
15263 }
15264}
15265
15266/// Request message for updating a worker pool.
15267#[derive(Clone, Default, PartialEq)]
15268#[non_exhaustive]
15269pub struct UpdateWorkerPoolRequest {
15270 /// Optional. The list of fields to be updated.
15271 pub update_mask: std::option::Option<wkt::FieldMask>,
15272
15273 /// Required. The WorkerPool to be updated.
15274 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15275
15276 /// Optional. Indicates that the request should be validated and default values
15277 /// populated, without persisting the request or updating any resources.
15278 pub validate_only: bool,
15279
15280 /// Optional. If set to true, and if the WorkerPool does not exist, it will
15281 /// create a new one. The caller must have 'run.workerpools.create' permissions
15282 /// if this is set to true and the WorkerPool does not exist.
15283 pub allow_missing: bool,
15284
15285 /// Optional. If set to true, a new revision will be created from the template
15286 /// even if the system doesn't detect any changes from the previously deployed
15287 /// revision.
15288 ///
15289 /// This may be useful for cases where the underlying resources need to be
15290 /// recreated or reinitialized. For example if the image is specified by label,
15291 /// but the underlying image digest has changed) or if the container performs
15292 /// deployment initialization work that needs to be performed again.
15293 pub force_new_revision: bool,
15294
15295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15296}
15297
15298impl UpdateWorkerPoolRequest {
15299 /// Creates a new default instance.
15300 pub fn new() -> Self {
15301 std::default::Default::default()
15302 }
15303
15304 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15305 ///
15306 /// # Example
15307 /// ```ignore,no_run
15308 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15309 /// use wkt::FieldMask;
15310 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15311 /// ```
15312 pub fn set_update_mask<T>(mut self, v: T) -> Self
15313 where
15314 T: std::convert::Into<wkt::FieldMask>,
15315 {
15316 self.update_mask = std::option::Option::Some(v.into());
15317 self
15318 }
15319
15320 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15321 ///
15322 /// # Example
15323 /// ```ignore,no_run
15324 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15325 /// use wkt::FieldMask;
15326 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15327 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15328 /// ```
15329 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15330 where
15331 T: std::convert::Into<wkt::FieldMask>,
15332 {
15333 self.update_mask = v.map(|x| x.into());
15334 self
15335 }
15336
15337 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15338 ///
15339 /// # Example
15340 /// ```ignore,no_run
15341 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15342 /// use google_cloud_run_v2::model::WorkerPool;
15343 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15344 /// ```
15345 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15346 where
15347 T: std::convert::Into<crate::model::WorkerPool>,
15348 {
15349 self.worker_pool = std::option::Option::Some(v.into());
15350 self
15351 }
15352
15353 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15354 ///
15355 /// # Example
15356 /// ```ignore,no_run
15357 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15358 /// use google_cloud_run_v2::model::WorkerPool;
15359 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15360 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15361 /// ```
15362 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15363 where
15364 T: std::convert::Into<crate::model::WorkerPool>,
15365 {
15366 self.worker_pool = v.map(|x| x.into());
15367 self
15368 }
15369
15370 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
15371 ///
15372 /// # Example
15373 /// ```ignore,no_run
15374 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15375 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
15376 /// ```
15377 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15378 self.validate_only = v.into();
15379 self
15380 }
15381
15382 /// Sets the value of [allow_missing][crate::model::UpdateWorkerPoolRequest::allow_missing].
15383 ///
15384 /// # Example
15385 /// ```ignore,no_run
15386 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15387 /// let x = UpdateWorkerPoolRequest::new().set_allow_missing(true);
15388 /// ```
15389 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15390 self.allow_missing = v.into();
15391 self
15392 }
15393
15394 /// Sets the value of [force_new_revision][crate::model::UpdateWorkerPoolRequest::force_new_revision].
15395 ///
15396 /// # Example
15397 /// ```ignore,no_run
15398 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15399 /// let x = UpdateWorkerPoolRequest::new().set_force_new_revision(true);
15400 /// ```
15401 pub fn set_force_new_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15402 self.force_new_revision = v.into();
15403 self
15404 }
15405}
15406
15407impl wkt::message::Message for UpdateWorkerPoolRequest {
15408 fn typename() -> &'static str {
15409 "type.googleapis.com/google.cloud.run.v2.UpdateWorkerPoolRequest"
15410 }
15411}
15412
15413/// Request message for retrieving a list of WorkerPools.
15414#[derive(Clone, Default, PartialEq)]
15415#[non_exhaustive]
15416pub struct ListWorkerPoolsRequest {
15417 /// Required. The location and project to list resources on.
15418 /// Location must be a valid Google Cloud region, and cannot be the "-"
15419 /// wildcard. Format: `projects/{project}/locations/{location}`, where
15420 /// `{project}` can be project id or number.
15421 pub parent: std::string::String,
15422
15423 /// Maximum number of WorkerPools to return in this call.
15424 pub page_size: i32,
15425
15426 /// A page token received from a previous call to ListWorkerPools.
15427 /// All other parameters must match.
15428 pub page_token: std::string::String,
15429
15430 /// If true, returns deleted (but unexpired) resources along with active ones.
15431 pub show_deleted: bool,
15432
15433 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15434}
15435
15436impl ListWorkerPoolsRequest {
15437 /// Creates a new default instance.
15438 pub fn new() -> Self {
15439 std::default::Default::default()
15440 }
15441
15442 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
15443 ///
15444 /// # Example
15445 /// ```ignore,no_run
15446 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15447 /// # let project_id = "project_id";
15448 /// # let location_id = "location_id";
15449 /// let x = ListWorkerPoolsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
15450 /// ```
15451 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15452 self.parent = v.into();
15453 self
15454 }
15455
15456 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
15457 ///
15458 /// # Example
15459 /// ```ignore,no_run
15460 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15461 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
15462 /// ```
15463 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15464 self.page_size = v.into();
15465 self
15466 }
15467
15468 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
15469 ///
15470 /// # Example
15471 /// ```ignore,no_run
15472 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15473 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
15474 /// ```
15475 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15476 self.page_token = v.into();
15477 self
15478 }
15479
15480 /// Sets the value of [show_deleted][crate::model::ListWorkerPoolsRequest::show_deleted].
15481 ///
15482 /// # Example
15483 /// ```ignore,no_run
15484 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15485 /// let x = ListWorkerPoolsRequest::new().set_show_deleted(true);
15486 /// ```
15487 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15488 self.show_deleted = v.into();
15489 self
15490 }
15491}
15492
15493impl wkt::message::Message for ListWorkerPoolsRequest {
15494 fn typename() -> &'static str {
15495 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsRequest"
15496 }
15497}
15498
15499/// Response message containing a list of WorkerPools.
15500#[derive(Clone, Default, PartialEq)]
15501#[non_exhaustive]
15502pub struct ListWorkerPoolsResponse {
15503 /// The resulting list of WorkerPools.
15504 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
15505
15506 /// A token indicating there are more items than page_size. Use it in the next
15507 /// ListWorkerPools request to continue.
15508 pub next_page_token: std::string::String,
15509
15510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15511}
15512
15513impl ListWorkerPoolsResponse {
15514 /// Creates a new default instance.
15515 pub fn new() -> Self {
15516 std::default::Default::default()
15517 }
15518
15519 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
15520 ///
15521 /// # Example
15522 /// ```ignore,no_run
15523 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15524 /// use google_cloud_run_v2::model::WorkerPool;
15525 /// let x = ListWorkerPoolsResponse::new()
15526 /// .set_worker_pools([
15527 /// WorkerPool::default()/* use setters */,
15528 /// WorkerPool::default()/* use (different) setters */,
15529 /// ]);
15530 /// ```
15531 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
15532 where
15533 T: std::iter::IntoIterator<Item = V>,
15534 V: std::convert::Into<crate::model::WorkerPool>,
15535 {
15536 use std::iter::Iterator;
15537 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
15538 self
15539 }
15540
15541 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
15542 ///
15543 /// # Example
15544 /// ```ignore,no_run
15545 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15546 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
15547 /// ```
15548 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15549 self.next_page_token = v.into();
15550 self
15551 }
15552}
15553
15554impl wkt::message::Message for ListWorkerPoolsResponse {
15555 fn typename() -> &'static str {
15556 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsResponse"
15557 }
15558}
15559
15560#[doc(hidden)]
15561impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
15562 type PageItem = crate::model::WorkerPool;
15563
15564 fn items(self) -> std::vec::Vec<Self::PageItem> {
15565 self.worker_pools
15566 }
15567
15568 fn next_page_token(&self) -> std::string::String {
15569 use std::clone::Clone;
15570 self.next_page_token.clone()
15571 }
15572}
15573
15574/// Request message for obtaining a WorkerPool by its full name.
15575#[derive(Clone, Default, PartialEq)]
15576#[non_exhaustive]
15577pub struct GetWorkerPoolRequest {
15578 /// Required. The full name of the WorkerPool.
15579 /// Format:
15580 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15581 /// `{project}` can be project id or number.
15582 pub name: std::string::String,
15583
15584 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15585}
15586
15587impl GetWorkerPoolRequest {
15588 /// Creates a new default instance.
15589 pub fn new() -> Self {
15590 std::default::Default::default()
15591 }
15592
15593 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
15594 ///
15595 /// # Example
15596 /// ```ignore,no_run
15597 /// # use google_cloud_run_v2::model::GetWorkerPoolRequest;
15598 /// # let project_id = "project_id";
15599 /// # let location_id = "location_id";
15600 /// # let worker_pool_id = "worker_pool_id";
15601 /// let x = GetWorkerPoolRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
15602 /// ```
15603 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15604 self.name = v.into();
15605 self
15606 }
15607}
15608
15609impl wkt::message::Message for GetWorkerPoolRequest {
15610 fn typename() -> &'static str {
15611 "type.googleapis.com/google.cloud.run.v2.GetWorkerPoolRequest"
15612 }
15613}
15614
15615/// Request message to delete a WorkerPool by its full name.
15616#[derive(Clone, Default, PartialEq)]
15617#[non_exhaustive]
15618pub struct DeleteWorkerPoolRequest {
15619 /// Required. The full name of the WorkerPool.
15620 /// Format:
15621 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15622 /// `{project}` can be project id or number.
15623 pub name: std::string::String,
15624
15625 /// Optional. Indicates that the request should be validated without actually
15626 /// deleting any resources.
15627 pub validate_only: bool,
15628
15629 /// A system-generated fingerprint for this version of the
15630 /// resource. May be used to detect modification conflict during updates.
15631 pub etag: std::string::String,
15632
15633 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15634}
15635
15636impl DeleteWorkerPoolRequest {
15637 /// Creates a new default instance.
15638 pub fn new() -> Self {
15639 std::default::Default::default()
15640 }
15641
15642 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
15643 ///
15644 /// # Example
15645 /// ```ignore,no_run
15646 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15647 /// # let project_id = "project_id";
15648 /// # let location_id = "location_id";
15649 /// # let worker_pool_id = "worker_pool_id";
15650 /// let x = DeleteWorkerPoolRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
15651 /// ```
15652 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15653 self.name = v.into();
15654 self
15655 }
15656
15657 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
15658 ///
15659 /// # Example
15660 /// ```ignore,no_run
15661 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15662 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
15663 /// ```
15664 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15665 self.validate_only = v.into();
15666 self
15667 }
15668
15669 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
15670 ///
15671 /// # Example
15672 /// ```ignore,no_run
15673 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15674 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
15675 /// ```
15676 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15677 self.etag = v.into();
15678 self
15679 }
15680}
15681
15682impl wkt::message::Message for DeleteWorkerPoolRequest {
15683 fn typename() -> &'static str {
15684 "type.googleapis.com/google.cloud.run.v2.DeleteWorkerPoolRequest"
15685 }
15686}
15687
15688/// WorkerPool acts as a top-level container that manages a set of
15689/// configurations and revision templates which implement a pull-based workload.
15690/// WorkerPool exists to provide a singular abstraction which can be access
15691/// controlled, reasoned about, and which encapsulates software lifecycle
15692/// decisions such as rollout policy and team resource ownership.
15693#[derive(Clone, Default, PartialEq)]
15694#[non_exhaustive]
15695pub struct WorkerPool {
15696 /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest,
15697 /// this field is ignored, and instead composed from
15698 /// CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id.
15699 ///
15700 /// Format:
15701 /// `projects/{project}/locations/{location}/workerPools/{worker_id}`
15702 pub name: std::string::String,
15703
15704 /// User-provided description of the WorkerPool. This field currently has a
15705 /// 512-character limit.
15706 pub description: std::string::String,
15707
15708 /// Output only. Server assigned unique identifier for the trigger. The value
15709 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
15710 /// deleted.
15711 pub uid: std::string::String,
15712
15713 /// Output only. A number that monotonically increases every time the user
15714 /// modifies the desired state.
15715 /// Please note that unlike v1, this is an int64 value. As with most Google
15716 /// APIs, its JSON representation will be a `string` instead of an `integer`.
15717 pub generation: i64,
15718
15719 /// Optional. Unstructured key value map that can be used to organize and
15720 /// categorize objects. User-provided labels are shared with Google's billing
15721 /// system, so they can be used to filter, or break down billing charges by
15722 /// team, component, environment, state, etc. For more information, visit
15723 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
15724 /// <https://cloud.google.com/run/docs/configuring/labels>.
15725 ///
15726 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
15727 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15728 /// namespaces, and they will be rejected. All system labels in v1 now have a
15729 /// corresponding field in v2 WorkerPool.
15730 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15731
15732 /// Optional. Unstructured key value map that may be set by external tools to
15733 /// store and arbitrary metadata. They are not queryable and should be
15734 /// preserved when modifying objects.
15735 ///
15736 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
15737 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15738 /// namespaces, and they will be rejected in new resources. All system
15739 /// annotations in v1 now have a corresponding field in v2 WorkerPool.
15740 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
15741
15742 /// Output only. The creation time.
15743 pub create_time: std::option::Option<wkt::Timestamp>,
15744
15745 /// Output only. The last-modified time.
15746 pub update_time: std::option::Option<wkt::Timestamp>,
15747
15748 /// Output only. The deletion time. It is only populated as a response to a
15749 /// Delete request.
15750 pub delete_time: std::option::Option<wkt::Timestamp>,
15751
15752 /// Output only. For a deleted resource, the time after which it will be
15753 /// permamently deleted.
15754 pub expire_time: std::option::Option<wkt::Timestamp>,
15755
15756 /// Output only. Email address of the authenticated creator.
15757 pub creator: std::string::String,
15758
15759 /// Output only. Email address of the last authenticated modifier.
15760 pub last_modifier: std::string::String,
15761
15762 /// Arbitrary identifier for the API client.
15763 pub client: std::string::String,
15764
15765 /// Arbitrary version identifier for the API client.
15766 pub client_version: std::string::String,
15767
15768 /// Optional. The launch stage as defined by [Google Cloud Platform
15769 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
15770 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
15771 /// is assumed.
15772 /// Set the launch stage to a preview stage on input to allow use of preview
15773 /// features in that stage. On read (or output), describes whether the
15774 /// resource uses preview features.
15775 ///
15776 /// For example, if ALPHA is provided as input, but only BETA and GA-level
15777 /// features are used, this field will be BETA on output.
15778 pub launch_stage: google_cloud_api::model::LaunchStage,
15779
15780 /// Optional. Settings for the Binary Authorization feature.
15781 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
15782
15783 /// Required. The template used to create revisions for this WorkerPool.
15784 pub template: std::option::Option<crate::model::WorkerPoolRevisionTemplate>,
15785
15786 /// Optional. Specifies how to distribute instances over a collection of
15787 /// Revisions belonging to the WorkerPool. If instance split is empty or not
15788 /// provided, defaults to 100% instances assigned to the latest `Ready`
15789 /// Revision.
15790 pub instance_splits: std::vec::Vec<crate::model::InstanceSplit>,
15791
15792 /// Optional. Specifies worker-pool-level scaling settings
15793 pub scaling: std::option::Option<crate::model::WorkerPoolScaling>,
15794
15795 /// Output only. The generation of this WorkerPool currently serving workloads.
15796 /// See comments in `reconciling` for additional information on reconciliation
15797 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
15798 /// As with most Google APIs, its JSON representation will be a `string`
15799 /// instead of an `integer`.
15800 pub observed_generation: i64,
15801
15802 /// Output only. The Condition of this WorkerPool, containing its readiness
15803 /// status, and detailed error information in case it did not reach a serving
15804 /// state. See comments in `reconciling` for additional information on
15805 /// reconciliation process in Cloud Run.
15806 pub terminal_condition: std::option::Option<crate::model::Condition>,
15807
15808 /// Output only. The Conditions of all other associated sub-resources. They
15809 /// contain additional diagnostics information in case the WorkerPool does not
15810 /// reach its Serving state. See comments in `reconciling` for additional
15811 /// information on reconciliation process in Cloud Run.
15812 pub conditions: std::vec::Vec<crate::model::Condition>,
15813
15814 /// Output only. Name of the latest revision that is serving workloads. See
15815 /// comments in `reconciling` for additional information on reconciliation
15816 /// process in Cloud Run.
15817 pub latest_ready_revision: std::string::String,
15818
15819 /// Output only. Name of the last created revision. See comments in
15820 /// `reconciling` for additional information on reconciliation process in Cloud
15821 /// Run.
15822 pub latest_created_revision: std::string::String,
15823
15824 /// Output only. Detailed status information for corresponding instance splits.
15825 /// See comments in `reconciling` for additional information on reconciliation
15826 /// process in Cloud Run.
15827 pub instance_split_statuses: std::vec::Vec<crate::model::InstanceSplitStatus>,
15828
15829 /// Output only. Indicates whether Cloud Run Threat Detection monitoring is
15830 /// enabled for the parent project of this worker pool.
15831 pub threat_detection_enabled: bool,
15832
15833 /// Deprecated: Not supported, and ignored by Cloud Run.
15834 #[deprecated]
15835 pub custom_audiences: std::vec::Vec<std::string::String>,
15836
15837 /// Output only. Reserved for future use.
15838 pub satisfies_pzs: bool,
15839
15840 /// Output only. Returns true if the WorkerPool is currently being acted upon
15841 /// by the system to bring it into the desired state.
15842 ///
15843 /// When a new WorkerPool is created, or an existing one is updated, Cloud Run
15844 /// will asynchronously perform all necessary steps to bring the WorkerPool to
15845 /// the desired serving state. This process is called reconciliation. While
15846 /// reconciliation is in process, `observed_generation`,
15847 /// `latest_ready_revison`, `instance_split_statuses`, and `uri` will have
15848 /// transient values that might mismatch the intended state: Once
15849 /// reconciliation is over (and this field is false), there are two possible
15850 /// outcomes: reconciliation succeeded and the serving state matches the
15851 /// WorkerPool, or there was an error, and reconciliation failed. This state
15852 /// can be found in `terminal_condition.state`.
15853 ///
15854 /// If reconciliation succeeded, the following fields will match:
15855 /// `instance_splits` and `instance_split_statuses`, `observed_generation` and
15856 /// `generation`, `latest_ready_revision` and `latest_created_revision`.
15857 ///
15858 /// If reconciliation failed, `instance_split_statuses`, `observed_generation`,
15859 /// and `latest_ready_revision` will have the state of the last serving
15860 /// revision, or empty for newly created WorkerPools. Additional information on
15861 /// the failure can be found in `terminal_condition` and `conditions`.
15862 pub reconciling: bool,
15863
15864 /// Optional. A system-generated fingerprint for this version of the
15865 /// resource. May be used to detect modification conflict during updates.
15866 pub etag: std::string::String,
15867
15868 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15869}
15870
15871impl WorkerPool {
15872 /// Creates a new default instance.
15873 pub fn new() -> Self {
15874 std::default::Default::default()
15875 }
15876
15877 /// Sets the value of [name][crate::model::WorkerPool::name].
15878 ///
15879 /// # Example
15880 /// ```ignore,no_run
15881 /// # use google_cloud_run_v2::model::WorkerPool;
15882 /// # let project_id = "project_id";
15883 /// # let location_id = "location_id";
15884 /// # let worker_pool_id = "worker_pool_id";
15885 /// let x = WorkerPool::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
15886 /// ```
15887 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15888 self.name = v.into();
15889 self
15890 }
15891
15892 /// Sets the value of [description][crate::model::WorkerPool::description].
15893 ///
15894 /// # Example
15895 /// ```ignore,no_run
15896 /// # use google_cloud_run_v2::model::WorkerPool;
15897 /// let x = WorkerPool::new().set_description("example");
15898 /// ```
15899 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15900 self.description = v.into();
15901 self
15902 }
15903
15904 /// Sets the value of [uid][crate::model::WorkerPool::uid].
15905 ///
15906 /// # Example
15907 /// ```ignore,no_run
15908 /// # use google_cloud_run_v2::model::WorkerPool;
15909 /// let x = WorkerPool::new().set_uid("example");
15910 /// ```
15911 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15912 self.uid = v.into();
15913 self
15914 }
15915
15916 /// Sets the value of [generation][crate::model::WorkerPool::generation].
15917 ///
15918 /// # Example
15919 /// ```ignore,no_run
15920 /// # use google_cloud_run_v2::model::WorkerPool;
15921 /// let x = WorkerPool::new().set_generation(42);
15922 /// ```
15923 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15924 self.generation = v.into();
15925 self
15926 }
15927
15928 /// Sets the value of [labels][crate::model::WorkerPool::labels].
15929 ///
15930 /// # Example
15931 /// ```ignore,no_run
15932 /// # use google_cloud_run_v2::model::WorkerPool;
15933 /// let x = WorkerPool::new().set_labels([
15934 /// ("key0", "abc"),
15935 /// ("key1", "xyz"),
15936 /// ]);
15937 /// ```
15938 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15939 where
15940 T: std::iter::IntoIterator<Item = (K, V)>,
15941 K: std::convert::Into<std::string::String>,
15942 V: std::convert::Into<std::string::String>,
15943 {
15944 use std::iter::Iterator;
15945 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15946 self
15947 }
15948
15949 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
15950 ///
15951 /// # Example
15952 /// ```ignore,no_run
15953 /// # use google_cloud_run_v2::model::WorkerPool;
15954 /// let x = WorkerPool::new().set_annotations([
15955 /// ("key0", "abc"),
15956 /// ("key1", "xyz"),
15957 /// ]);
15958 /// ```
15959 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
15960 where
15961 T: std::iter::IntoIterator<Item = (K, V)>,
15962 K: std::convert::Into<std::string::String>,
15963 V: std::convert::Into<std::string::String>,
15964 {
15965 use std::iter::Iterator;
15966 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15967 self
15968 }
15969
15970 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
15971 ///
15972 /// # Example
15973 /// ```ignore,no_run
15974 /// # use google_cloud_run_v2::model::WorkerPool;
15975 /// use wkt::Timestamp;
15976 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
15977 /// ```
15978 pub fn set_create_time<T>(mut self, v: T) -> Self
15979 where
15980 T: std::convert::Into<wkt::Timestamp>,
15981 {
15982 self.create_time = std::option::Option::Some(v.into());
15983 self
15984 }
15985
15986 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
15987 ///
15988 /// # Example
15989 /// ```ignore,no_run
15990 /// # use google_cloud_run_v2::model::WorkerPool;
15991 /// use wkt::Timestamp;
15992 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15993 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
15994 /// ```
15995 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15996 where
15997 T: std::convert::Into<wkt::Timestamp>,
15998 {
15999 self.create_time = v.map(|x| x.into());
16000 self
16001 }
16002
16003 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
16004 ///
16005 /// # Example
16006 /// ```ignore,no_run
16007 /// # use google_cloud_run_v2::model::WorkerPool;
16008 /// use wkt::Timestamp;
16009 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
16010 /// ```
16011 pub fn set_update_time<T>(mut self, v: T) -> Self
16012 where
16013 T: std::convert::Into<wkt::Timestamp>,
16014 {
16015 self.update_time = std::option::Option::Some(v.into());
16016 self
16017 }
16018
16019 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
16020 ///
16021 /// # Example
16022 /// ```ignore,no_run
16023 /// # use google_cloud_run_v2::model::WorkerPool;
16024 /// use wkt::Timestamp;
16025 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
16026 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
16027 /// ```
16028 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16029 where
16030 T: std::convert::Into<wkt::Timestamp>,
16031 {
16032 self.update_time = v.map(|x| x.into());
16033 self
16034 }
16035
16036 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
16037 ///
16038 /// # Example
16039 /// ```ignore,no_run
16040 /// # use google_cloud_run_v2::model::WorkerPool;
16041 /// use wkt::Timestamp;
16042 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
16043 /// ```
16044 pub fn set_delete_time<T>(mut self, v: T) -> Self
16045 where
16046 T: std::convert::Into<wkt::Timestamp>,
16047 {
16048 self.delete_time = std::option::Option::Some(v.into());
16049 self
16050 }
16051
16052 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
16053 ///
16054 /// # Example
16055 /// ```ignore,no_run
16056 /// # use google_cloud_run_v2::model::WorkerPool;
16057 /// use wkt::Timestamp;
16058 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
16059 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
16060 /// ```
16061 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
16062 where
16063 T: std::convert::Into<wkt::Timestamp>,
16064 {
16065 self.delete_time = v.map(|x| x.into());
16066 self
16067 }
16068
16069 /// Sets the value of [expire_time][crate::model::WorkerPool::expire_time].
16070 ///
16071 /// # Example
16072 /// ```ignore,no_run
16073 /// # use google_cloud_run_v2::model::WorkerPool;
16074 /// use wkt::Timestamp;
16075 /// let x = WorkerPool::new().set_expire_time(Timestamp::default()/* use setters */);
16076 /// ```
16077 pub fn set_expire_time<T>(mut self, v: T) -> Self
16078 where
16079 T: std::convert::Into<wkt::Timestamp>,
16080 {
16081 self.expire_time = std::option::Option::Some(v.into());
16082 self
16083 }
16084
16085 /// Sets or clears the value of [expire_time][crate::model::WorkerPool::expire_time].
16086 ///
16087 /// # Example
16088 /// ```ignore,no_run
16089 /// # use google_cloud_run_v2::model::WorkerPool;
16090 /// use wkt::Timestamp;
16091 /// let x = WorkerPool::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
16092 /// let x = WorkerPool::new().set_or_clear_expire_time(None::<Timestamp>);
16093 /// ```
16094 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
16095 where
16096 T: std::convert::Into<wkt::Timestamp>,
16097 {
16098 self.expire_time = v.map(|x| x.into());
16099 self
16100 }
16101
16102 /// Sets the value of [creator][crate::model::WorkerPool::creator].
16103 ///
16104 /// # Example
16105 /// ```ignore,no_run
16106 /// # use google_cloud_run_v2::model::WorkerPool;
16107 /// let x = WorkerPool::new().set_creator("example");
16108 /// ```
16109 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16110 self.creator = v.into();
16111 self
16112 }
16113
16114 /// Sets the value of [last_modifier][crate::model::WorkerPool::last_modifier].
16115 ///
16116 /// # Example
16117 /// ```ignore,no_run
16118 /// # use google_cloud_run_v2::model::WorkerPool;
16119 /// let x = WorkerPool::new().set_last_modifier("example");
16120 /// ```
16121 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16122 self.last_modifier = v.into();
16123 self
16124 }
16125
16126 /// Sets the value of [client][crate::model::WorkerPool::client].
16127 ///
16128 /// # Example
16129 /// ```ignore,no_run
16130 /// # use google_cloud_run_v2::model::WorkerPool;
16131 /// let x = WorkerPool::new().set_client("example");
16132 /// ```
16133 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16134 self.client = v.into();
16135 self
16136 }
16137
16138 /// Sets the value of [client_version][crate::model::WorkerPool::client_version].
16139 ///
16140 /// # Example
16141 /// ```ignore,no_run
16142 /// # use google_cloud_run_v2::model::WorkerPool;
16143 /// let x = WorkerPool::new().set_client_version("example");
16144 /// ```
16145 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16146 self.client_version = v.into();
16147 self
16148 }
16149
16150 /// Sets the value of [launch_stage][crate::model::WorkerPool::launch_stage].
16151 ///
16152 /// # Example
16153 /// ```ignore,no_run
16154 /// # use google_cloud_run_v2::model::WorkerPool;
16155 /// use google_cloud_api::model::LaunchStage;
16156 /// let x0 = WorkerPool::new().set_launch_stage(LaunchStage::Unimplemented);
16157 /// let x1 = WorkerPool::new().set_launch_stage(LaunchStage::Prelaunch);
16158 /// let x2 = WorkerPool::new().set_launch_stage(LaunchStage::EarlyAccess);
16159 /// ```
16160 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
16161 mut self,
16162 v: T,
16163 ) -> Self {
16164 self.launch_stage = v.into();
16165 self
16166 }
16167
16168 /// Sets the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
16169 ///
16170 /// # Example
16171 /// ```ignore,no_run
16172 /// # use google_cloud_run_v2::model::WorkerPool;
16173 /// use google_cloud_run_v2::model::BinaryAuthorization;
16174 /// let x = WorkerPool::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
16175 /// ```
16176 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
16177 where
16178 T: std::convert::Into<crate::model::BinaryAuthorization>,
16179 {
16180 self.binary_authorization = std::option::Option::Some(v.into());
16181 self
16182 }
16183
16184 /// Sets or clears the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
16185 ///
16186 /// # Example
16187 /// ```ignore,no_run
16188 /// # use google_cloud_run_v2::model::WorkerPool;
16189 /// use google_cloud_run_v2::model::BinaryAuthorization;
16190 /// let x = WorkerPool::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
16191 /// let x = WorkerPool::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
16192 /// ```
16193 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
16194 where
16195 T: std::convert::Into<crate::model::BinaryAuthorization>,
16196 {
16197 self.binary_authorization = v.map(|x| x.into());
16198 self
16199 }
16200
16201 /// Sets the value of [template][crate::model::WorkerPool::template].
16202 ///
16203 /// # Example
16204 /// ```ignore,no_run
16205 /// # use google_cloud_run_v2::model::WorkerPool;
16206 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16207 /// let x = WorkerPool::new().set_template(WorkerPoolRevisionTemplate::default()/* use setters */);
16208 /// ```
16209 pub fn set_template<T>(mut self, v: T) -> Self
16210 where
16211 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
16212 {
16213 self.template = std::option::Option::Some(v.into());
16214 self
16215 }
16216
16217 /// Sets or clears the value of [template][crate::model::WorkerPool::template].
16218 ///
16219 /// # Example
16220 /// ```ignore,no_run
16221 /// # use google_cloud_run_v2::model::WorkerPool;
16222 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16223 /// let x = WorkerPool::new().set_or_clear_template(Some(WorkerPoolRevisionTemplate::default()/* use setters */));
16224 /// let x = WorkerPool::new().set_or_clear_template(None::<WorkerPoolRevisionTemplate>);
16225 /// ```
16226 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
16227 where
16228 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
16229 {
16230 self.template = v.map(|x| x.into());
16231 self
16232 }
16233
16234 /// Sets the value of [instance_splits][crate::model::WorkerPool::instance_splits].
16235 ///
16236 /// # Example
16237 /// ```ignore,no_run
16238 /// # use google_cloud_run_v2::model::WorkerPool;
16239 /// use google_cloud_run_v2::model::InstanceSplit;
16240 /// let x = WorkerPool::new()
16241 /// .set_instance_splits([
16242 /// InstanceSplit::default()/* use setters */,
16243 /// InstanceSplit::default()/* use (different) setters */,
16244 /// ]);
16245 /// ```
16246 pub fn set_instance_splits<T, V>(mut self, v: T) -> Self
16247 where
16248 T: std::iter::IntoIterator<Item = V>,
16249 V: std::convert::Into<crate::model::InstanceSplit>,
16250 {
16251 use std::iter::Iterator;
16252 self.instance_splits = v.into_iter().map(|i| i.into()).collect();
16253 self
16254 }
16255
16256 /// Sets the value of [scaling][crate::model::WorkerPool::scaling].
16257 ///
16258 /// # Example
16259 /// ```ignore,no_run
16260 /// # use google_cloud_run_v2::model::WorkerPool;
16261 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16262 /// let x = WorkerPool::new().set_scaling(WorkerPoolScaling::default()/* use setters */);
16263 /// ```
16264 pub fn set_scaling<T>(mut self, v: T) -> Self
16265 where
16266 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16267 {
16268 self.scaling = std::option::Option::Some(v.into());
16269 self
16270 }
16271
16272 /// Sets or clears the value of [scaling][crate::model::WorkerPool::scaling].
16273 ///
16274 /// # Example
16275 /// ```ignore,no_run
16276 /// # use google_cloud_run_v2::model::WorkerPool;
16277 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16278 /// let x = WorkerPool::new().set_or_clear_scaling(Some(WorkerPoolScaling::default()/* use setters */));
16279 /// let x = WorkerPool::new().set_or_clear_scaling(None::<WorkerPoolScaling>);
16280 /// ```
16281 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
16282 where
16283 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16284 {
16285 self.scaling = v.map(|x| x.into());
16286 self
16287 }
16288
16289 /// Sets the value of [observed_generation][crate::model::WorkerPool::observed_generation].
16290 ///
16291 /// # Example
16292 /// ```ignore,no_run
16293 /// # use google_cloud_run_v2::model::WorkerPool;
16294 /// let x = WorkerPool::new().set_observed_generation(42);
16295 /// ```
16296 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16297 self.observed_generation = v.into();
16298 self
16299 }
16300
16301 /// Sets the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16302 ///
16303 /// # Example
16304 /// ```ignore,no_run
16305 /// # use google_cloud_run_v2::model::WorkerPool;
16306 /// use google_cloud_run_v2::model::Condition;
16307 /// let x = WorkerPool::new().set_terminal_condition(Condition::default()/* use setters */);
16308 /// ```
16309 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
16310 where
16311 T: std::convert::Into<crate::model::Condition>,
16312 {
16313 self.terminal_condition = std::option::Option::Some(v.into());
16314 self
16315 }
16316
16317 /// Sets or clears the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16318 ///
16319 /// # Example
16320 /// ```ignore,no_run
16321 /// # use google_cloud_run_v2::model::WorkerPool;
16322 /// use google_cloud_run_v2::model::Condition;
16323 /// let x = WorkerPool::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
16324 /// let x = WorkerPool::new().set_or_clear_terminal_condition(None::<Condition>);
16325 /// ```
16326 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
16327 where
16328 T: std::convert::Into<crate::model::Condition>,
16329 {
16330 self.terminal_condition = v.map(|x| x.into());
16331 self
16332 }
16333
16334 /// Sets the value of [conditions][crate::model::WorkerPool::conditions].
16335 ///
16336 /// # Example
16337 /// ```ignore,no_run
16338 /// # use google_cloud_run_v2::model::WorkerPool;
16339 /// use google_cloud_run_v2::model::Condition;
16340 /// let x = WorkerPool::new()
16341 /// .set_conditions([
16342 /// Condition::default()/* use setters */,
16343 /// Condition::default()/* use (different) setters */,
16344 /// ]);
16345 /// ```
16346 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16347 where
16348 T: std::iter::IntoIterator<Item = V>,
16349 V: std::convert::Into<crate::model::Condition>,
16350 {
16351 use std::iter::Iterator;
16352 self.conditions = v.into_iter().map(|i| i.into()).collect();
16353 self
16354 }
16355
16356 /// Sets the value of [latest_ready_revision][crate::model::WorkerPool::latest_ready_revision].
16357 ///
16358 /// # Example
16359 /// ```ignore,no_run
16360 /// # use google_cloud_run_v2::model::WorkerPool;
16361 /// # let project_id = "project_id";
16362 /// # let location_id = "location_id";
16363 /// # let service_id = "service_id";
16364 /// # let revision_id = "revision_id";
16365 /// let x = WorkerPool::new().set_latest_ready_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
16366 /// ```
16367 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
16368 mut self,
16369 v: T,
16370 ) -> Self {
16371 self.latest_ready_revision = v.into();
16372 self
16373 }
16374
16375 /// Sets the value of [latest_created_revision][crate::model::WorkerPool::latest_created_revision].
16376 ///
16377 /// # Example
16378 /// ```ignore,no_run
16379 /// # use google_cloud_run_v2::model::WorkerPool;
16380 /// # let project_id = "project_id";
16381 /// # let location_id = "location_id";
16382 /// # let service_id = "service_id";
16383 /// # let revision_id = "revision_id";
16384 /// let x = WorkerPool::new().set_latest_created_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
16385 /// ```
16386 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
16387 mut self,
16388 v: T,
16389 ) -> Self {
16390 self.latest_created_revision = v.into();
16391 self
16392 }
16393
16394 /// Sets the value of [instance_split_statuses][crate::model::WorkerPool::instance_split_statuses].
16395 ///
16396 /// # Example
16397 /// ```ignore,no_run
16398 /// # use google_cloud_run_v2::model::WorkerPool;
16399 /// use google_cloud_run_v2::model::InstanceSplitStatus;
16400 /// let x = WorkerPool::new()
16401 /// .set_instance_split_statuses([
16402 /// InstanceSplitStatus::default()/* use setters */,
16403 /// InstanceSplitStatus::default()/* use (different) setters */,
16404 /// ]);
16405 /// ```
16406 pub fn set_instance_split_statuses<T, V>(mut self, v: T) -> Self
16407 where
16408 T: std::iter::IntoIterator<Item = V>,
16409 V: std::convert::Into<crate::model::InstanceSplitStatus>,
16410 {
16411 use std::iter::Iterator;
16412 self.instance_split_statuses = v.into_iter().map(|i| i.into()).collect();
16413 self
16414 }
16415
16416 /// Sets the value of [threat_detection_enabled][crate::model::WorkerPool::threat_detection_enabled].
16417 ///
16418 /// # Example
16419 /// ```ignore,no_run
16420 /// # use google_cloud_run_v2::model::WorkerPool;
16421 /// let x = WorkerPool::new().set_threat_detection_enabled(true);
16422 /// ```
16423 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16424 self.threat_detection_enabled = v.into();
16425 self
16426 }
16427
16428 /// Sets the value of [custom_audiences][crate::model::WorkerPool::custom_audiences].
16429 ///
16430 /// # Example
16431 /// ```ignore,no_run
16432 /// # use google_cloud_run_v2::model::WorkerPool;
16433 /// let x = WorkerPool::new().set_custom_audiences(["a", "b", "c"]);
16434 /// ```
16435 #[deprecated]
16436 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
16437 where
16438 T: std::iter::IntoIterator<Item = V>,
16439 V: std::convert::Into<std::string::String>,
16440 {
16441 use std::iter::Iterator;
16442 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
16443 self
16444 }
16445
16446 /// Sets the value of [satisfies_pzs][crate::model::WorkerPool::satisfies_pzs].
16447 ///
16448 /// # Example
16449 /// ```ignore,no_run
16450 /// # use google_cloud_run_v2::model::WorkerPool;
16451 /// let x = WorkerPool::new().set_satisfies_pzs(true);
16452 /// ```
16453 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16454 self.satisfies_pzs = v.into();
16455 self
16456 }
16457
16458 /// Sets the value of [reconciling][crate::model::WorkerPool::reconciling].
16459 ///
16460 /// # Example
16461 /// ```ignore,no_run
16462 /// # use google_cloud_run_v2::model::WorkerPool;
16463 /// let x = WorkerPool::new().set_reconciling(true);
16464 /// ```
16465 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16466 self.reconciling = v.into();
16467 self
16468 }
16469
16470 /// Sets the value of [etag][crate::model::WorkerPool::etag].
16471 ///
16472 /// # Example
16473 /// ```ignore,no_run
16474 /// # use google_cloud_run_v2::model::WorkerPool;
16475 /// let x = WorkerPool::new().set_etag("example");
16476 /// ```
16477 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16478 self.etag = v.into();
16479 self
16480 }
16481}
16482
16483impl wkt::message::Message for WorkerPool {
16484 fn typename() -> &'static str {
16485 "type.googleapis.com/google.cloud.run.v2.WorkerPool"
16486 }
16487}
16488
16489/// WorkerPoolRevisionTemplate describes the data a worker pool revision should
16490/// have when created from a template.
16491#[derive(Clone, Default, PartialEq)]
16492#[non_exhaustive]
16493pub struct WorkerPoolRevisionTemplate {
16494 /// Optional. The unique name for the revision. If this field is omitted, it
16495 /// will be automatically generated based on the WorkerPool name.
16496 pub revision: std::string::String,
16497
16498 /// Optional. Unstructured key value map that can be used to organize and
16499 /// categorize objects. User-provided labels are shared with Google's billing
16500 /// system, so they can be used to filter, or break down billing charges by
16501 /// team, component, environment, state, etc. For more information, visit
16502 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
16503 /// <https://cloud.google.com/run/docs/configuring/labels>.
16504 ///
16505 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
16506 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16507 /// namespaces, and they will be rejected. All system labels in v1 now have a
16508 /// corresponding field in v2 WorkerPoolRevisionTemplate.
16509 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16510
16511 /// Optional. Unstructured key value map that may be set by external tools to
16512 /// store and arbitrary metadata. They are not queryable and should be
16513 /// preserved when modifying objects.
16514 ///
16515 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
16516 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16517 /// namespaces, and they will be rejected. All system annotations in v1 now
16518 /// have a corresponding field in v2 WorkerPoolRevisionTemplate.
16519 ///
16520 /// This field follows Kubernetes annotations' namespacing, limits, and
16521 /// rules.
16522 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
16523
16524 /// Optional. VPC Access configuration to use for this Revision. For more
16525 /// information, visit
16526 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
16527 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
16528
16529 /// Optional. Email address of the IAM service account associated with the
16530 /// revision of the service. The service account represents the identity of the
16531 /// running revision, and determines what permissions the revision has. If not
16532 /// provided, the revision will use the project's default service account.
16533 pub service_account: std::string::String,
16534
16535 /// Holds list of the containers that defines the unit of execution for this
16536 /// Revision.
16537 pub containers: std::vec::Vec<crate::model::Container>,
16538
16539 /// Optional. A list of Volumes to make available to containers.
16540 pub volumes: std::vec::Vec<crate::model::Volume>,
16541
16542 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
16543 /// this container image. For more information, go to
16544 /// <https://cloud.google.com/run/docs/securing/using-cmek>
16545 pub encryption_key: std::string::String,
16546
16547 /// Optional. Enables service mesh connectivity.
16548 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
16549
16550 /// Optional. The action to take if the encryption key is revoked.
16551 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
16552
16553 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
16554 /// before shutting down all instances. The minimum increment is 1 hour.
16555 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
16556
16557 /// Optional. The node selector for the revision template.
16558 pub node_selector: std::option::Option<crate::model::NodeSelector>,
16559
16560 /// Optional. True if GPU zonal redundancy is disabled on this worker pool.
16561 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
16562
16563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16564}
16565
16566impl WorkerPoolRevisionTemplate {
16567 /// Creates a new default instance.
16568 pub fn new() -> Self {
16569 std::default::Default::default()
16570 }
16571
16572 /// Sets the value of [revision][crate::model::WorkerPoolRevisionTemplate::revision].
16573 ///
16574 /// # Example
16575 /// ```ignore,no_run
16576 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16577 /// # let project_id = "project_id";
16578 /// # let location_id = "location_id";
16579 /// # let service_id = "service_id";
16580 /// # let revision_id = "revision_id";
16581 /// let x = WorkerPoolRevisionTemplate::new().set_revision(format!("projects/{project_id}/locations/{location_id}/services/{service_id}/revisions/{revision_id}"));
16582 /// ```
16583 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16584 self.revision = v.into();
16585 self
16586 }
16587
16588 /// Sets the value of [labels][crate::model::WorkerPoolRevisionTemplate::labels].
16589 ///
16590 /// # Example
16591 /// ```ignore,no_run
16592 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16593 /// let x = WorkerPoolRevisionTemplate::new().set_labels([
16594 /// ("key0", "abc"),
16595 /// ("key1", "xyz"),
16596 /// ]);
16597 /// ```
16598 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16599 where
16600 T: std::iter::IntoIterator<Item = (K, V)>,
16601 K: std::convert::Into<std::string::String>,
16602 V: std::convert::Into<std::string::String>,
16603 {
16604 use std::iter::Iterator;
16605 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16606 self
16607 }
16608
16609 /// Sets the value of [annotations][crate::model::WorkerPoolRevisionTemplate::annotations].
16610 ///
16611 /// # Example
16612 /// ```ignore,no_run
16613 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16614 /// let x = WorkerPoolRevisionTemplate::new().set_annotations([
16615 /// ("key0", "abc"),
16616 /// ("key1", "xyz"),
16617 /// ]);
16618 /// ```
16619 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
16620 where
16621 T: std::iter::IntoIterator<Item = (K, V)>,
16622 K: std::convert::Into<std::string::String>,
16623 V: std::convert::Into<std::string::String>,
16624 {
16625 use std::iter::Iterator;
16626 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16627 self
16628 }
16629
16630 /// Sets the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16631 ///
16632 /// # Example
16633 /// ```ignore,no_run
16634 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16635 /// use google_cloud_run_v2::model::VpcAccess;
16636 /// let x = WorkerPoolRevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
16637 /// ```
16638 pub fn set_vpc_access<T>(mut self, v: T) -> Self
16639 where
16640 T: std::convert::Into<crate::model::VpcAccess>,
16641 {
16642 self.vpc_access = std::option::Option::Some(v.into());
16643 self
16644 }
16645
16646 /// Sets or clears the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16647 ///
16648 /// # Example
16649 /// ```ignore,no_run
16650 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16651 /// use google_cloud_run_v2::model::VpcAccess;
16652 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
16653 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
16654 /// ```
16655 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
16656 where
16657 T: std::convert::Into<crate::model::VpcAccess>,
16658 {
16659 self.vpc_access = v.map(|x| x.into());
16660 self
16661 }
16662
16663 /// Sets the value of [service_account][crate::model::WorkerPoolRevisionTemplate::service_account].
16664 ///
16665 /// # Example
16666 /// ```ignore,no_run
16667 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16668 /// let x = WorkerPoolRevisionTemplate::new().set_service_account("example");
16669 /// ```
16670 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16671 self.service_account = v.into();
16672 self
16673 }
16674
16675 /// Sets the value of [containers][crate::model::WorkerPoolRevisionTemplate::containers].
16676 ///
16677 /// # Example
16678 /// ```ignore,no_run
16679 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16680 /// use google_cloud_run_v2::model::Container;
16681 /// let x = WorkerPoolRevisionTemplate::new()
16682 /// .set_containers([
16683 /// Container::default()/* use setters */,
16684 /// Container::default()/* use (different) setters */,
16685 /// ]);
16686 /// ```
16687 pub fn set_containers<T, V>(mut self, v: T) -> Self
16688 where
16689 T: std::iter::IntoIterator<Item = V>,
16690 V: std::convert::Into<crate::model::Container>,
16691 {
16692 use std::iter::Iterator;
16693 self.containers = v.into_iter().map(|i| i.into()).collect();
16694 self
16695 }
16696
16697 /// Sets the value of [volumes][crate::model::WorkerPoolRevisionTemplate::volumes].
16698 ///
16699 /// # Example
16700 /// ```ignore,no_run
16701 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16702 /// use google_cloud_run_v2::model::Volume;
16703 /// let x = WorkerPoolRevisionTemplate::new()
16704 /// .set_volumes([
16705 /// Volume::default()/* use setters */,
16706 /// Volume::default()/* use (different) setters */,
16707 /// ]);
16708 /// ```
16709 pub fn set_volumes<T, V>(mut self, v: T) -> Self
16710 where
16711 T: std::iter::IntoIterator<Item = V>,
16712 V: std::convert::Into<crate::model::Volume>,
16713 {
16714 use std::iter::Iterator;
16715 self.volumes = v.into_iter().map(|i| i.into()).collect();
16716 self
16717 }
16718
16719 /// Sets the value of [encryption_key][crate::model::WorkerPoolRevisionTemplate::encryption_key].
16720 ///
16721 /// # Example
16722 /// ```ignore,no_run
16723 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16724 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key("example");
16725 /// ```
16726 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16727 self.encryption_key = v.into();
16728 self
16729 }
16730
16731 /// Sets the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16732 ///
16733 /// # Example
16734 /// ```ignore,no_run
16735 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16736 /// use google_cloud_run_v2::model::ServiceMesh;
16737 /// let x = WorkerPoolRevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
16738 /// ```
16739 pub fn set_service_mesh<T>(mut self, v: T) -> Self
16740 where
16741 T: std::convert::Into<crate::model::ServiceMesh>,
16742 {
16743 self.service_mesh = std::option::Option::Some(v.into());
16744 self
16745 }
16746
16747 /// Sets or clears the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16748 ///
16749 /// # Example
16750 /// ```ignore,no_run
16751 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16752 /// use google_cloud_run_v2::model::ServiceMesh;
16753 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
16754 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
16755 /// ```
16756 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
16757 where
16758 T: std::convert::Into<crate::model::ServiceMesh>,
16759 {
16760 self.service_mesh = v.map(|x| x.into());
16761 self
16762 }
16763
16764 /// Sets the value of [encryption_key_revocation_action][crate::model::WorkerPoolRevisionTemplate::encryption_key_revocation_action].
16765 ///
16766 /// # Example
16767 /// ```ignore,no_run
16768 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16769 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
16770 /// let x0 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
16771 /// let x1 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
16772 /// ```
16773 pub fn set_encryption_key_revocation_action<
16774 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
16775 >(
16776 mut self,
16777 v: T,
16778 ) -> Self {
16779 self.encryption_key_revocation_action = v.into();
16780 self
16781 }
16782
16783 /// Sets the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16784 ///
16785 /// # Example
16786 /// ```ignore,no_run
16787 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16788 /// use wkt::Duration;
16789 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
16790 /// ```
16791 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
16792 where
16793 T: std::convert::Into<wkt::Duration>,
16794 {
16795 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
16796 self
16797 }
16798
16799 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16800 ///
16801 /// # Example
16802 /// ```ignore,no_run
16803 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16804 /// use wkt::Duration;
16805 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
16806 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
16807 /// ```
16808 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
16809 mut self,
16810 v: std::option::Option<T>,
16811 ) -> Self
16812 where
16813 T: std::convert::Into<wkt::Duration>,
16814 {
16815 self.encryption_key_shutdown_duration = v.map(|x| x.into());
16816 self
16817 }
16818
16819 /// Sets the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16820 ///
16821 /// # Example
16822 /// ```ignore,no_run
16823 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16824 /// use google_cloud_run_v2::model::NodeSelector;
16825 /// let x = WorkerPoolRevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
16826 /// ```
16827 pub fn set_node_selector<T>(mut self, v: T) -> Self
16828 where
16829 T: std::convert::Into<crate::model::NodeSelector>,
16830 {
16831 self.node_selector = std::option::Option::Some(v.into());
16832 self
16833 }
16834
16835 /// Sets or clears the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16836 ///
16837 /// # Example
16838 /// ```ignore,no_run
16839 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16840 /// use google_cloud_run_v2::model::NodeSelector;
16841 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
16842 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
16843 /// ```
16844 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
16845 where
16846 T: std::convert::Into<crate::model::NodeSelector>,
16847 {
16848 self.node_selector = v.map(|x| x.into());
16849 self
16850 }
16851
16852 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16853 ///
16854 /// # Example
16855 /// ```ignore,no_run
16856 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16857 /// let x = WorkerPoolRevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
16858 /// ```
16859 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
16860 where
16861 T: std::convert::Into<bool>,
16862 {
16863 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
16864 self
16865 }
16866
16867 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16868 ///
16869 /// # Example
16870 /// ```ignore,no_run
16871 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16872 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
16873 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
16874 /// ```
16875 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
16876 mut self,
16877 v: std::option::Option<T>,
16878 ) -> Self
16879 where
16880 T: std::convert::Into<bool>,
16881 {
16882 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
16883 self
16884 }
16885}
16886
16887impl wkt::message::Message for WorkerPoolRevisionTemplate {
16888 fn typename() -> &'static str {
16889 "type.googleapis.com/google.cloud.run.v2.WorkerPoolRevisionTemplate"
16890 }
16891}
16892
16893/// The type of instance split allocation.
16894///
16895/// # Working with unknown values
16896///
16897/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16898/// additional enum variants at any time. Adding new variants is not considered
16899/// a breaking change. Applications should write their code in anticipation of:
16900///
16901/// - New values appearing in future releases of the client library, **and**
16902/// - New values received dynamically, without application changes.
16903///
16904/// Please consult the [Working with enums] section in the user guide for some
16905/// guidelines.
16906///
16907/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16908#[derive(Clone, Debug, PartialEq)]
16909#[non_exhaustive]
16910pub enum InstanceSplitAllocationType {
16911 /// Unspecified instance allocation type.
16912 Unspecified,
16913 /// Allocates instances to the Service's latest ready Revision.
16914 Latest,
16915 /// Allocates instances to a Revision by name.
16916 Revision,
16917 /// If set, the enum was initialized with an unknown value.
16918 ///
16919 /// Applications can examine the value using [InstanceSplitAllocationType::value] or
16920 /// [InstanceSplitAllocationType::name].
16921 UnknownValue(instance_split_allocation_type::UnknownValue),
16922}
16923
16924#[doc(hidden)]
16925pub mod instance_split_allocation_type {
16926 #[allow(unused_imports)]
16927 use super::*;
16928 #[derive(Clone, Debug, PartialEq)]
16929 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16930}
16931
16932impl InstanceSplitAllocationType {
16933 /// Gets the enum value.
16934 ///
16935 /// Returns `None` if the enum contains an unknown value deserialized from
16936 /// the string representation of enums.
16937 pub fn value(&self) -> std::option::Option<i32> {
16938 match self {
16939 Self::Unspecified => std::option::Option::Some(0),
16940 Self::Latest => std::option::Option::Some(1),
16941 Self::Revision => std::option::Option::Some(2),
16942 Self::UnknownValue(u) => u.0.value(),
16943 }
16944 }
16945
16946 /// Gets the enum value as a string.
16947 ///
16948 /// Returns `None` if the enum contains an unknown value deserialized from
16949 /// the integer representation of enums.
16950 pub fn name(&self) -> std::option::Option<&str> {
16951 match self {
16952 Self::Unspecified => {
16953 std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED")
16954 }
16955 Self::Latest => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST"),
16956 Self::Revision => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION"),
16957 Self::UnknownValue(u) => u.0.name(),
16958 }
16959 }
16960}
16961
16962impl std::default::Default for InstanceSplitAllocationType {
16963 fn default() -> Self {
16964 use std::convert::From;
16965 Self::from(0)
16966 }
16967}
16968
16969impl std::fmt::Display for InstanceSplitAllocationType {
16970 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16971 wkt::internal::display_enum(f, self.name(), self.value())
16972 }
16973}
16974
16975impl std::convert::From<i32> for InstanceSplitAllocationType {
16976 fn from(value: i32) -> Self {
16977 match value {
16978 0 => Self::Unspecified,
16979 1 => Self::Latest,
16980 2 => Self::Revision,
16981 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16982 wkt::internal::UnknownEnumValue::Integer(value),
16983 )),
16984 }
16985 }
16986}
16987
16988impl std::convert::From<&str> for InstanceSplitAllocationType {
16989 fn from(value: &str) -> Self {
16990 use std::string::ToString;
16991 match value {
16992 "INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16993 "INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST" => Self::Latest,
16994 "INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION" => Self::Revision,
16995 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16996 wkt::internal::UnknownEnumValue::String(value.to_string()),
16997 )),
16998 }
16999 }
17000}
17001
17002impl serde::ser::Serialize for InstanceSplitAllocationType {
17003 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17004 where
17005 S: serde::Serializer,
17006 {
17007 match self {
17008 Self::Unspecified => serializer.serialize_i32(0),
17009 Self::Latest => serializer.serialize_i32(1),
17010 Self::Revision => serializer.serialize_i32(2),
17011 Self::UnknownValue(u) => u.0.serialize(serializer),
17012 }
17013 }
17014}
17015
17016impl<'de> serde::de::Deserialize<'de> for InstanceSplitAllocationType {
17017 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17018 where
17019 D: serde::Deserializer<'de>,
17020 {
17021 deserializer.deserialize_any(
17022 wkt::internal::EnumVisitor::<InstanceSplitAllocationType>::new(
17023 ".google.cloud.run.v2.InstanceSplitAllocationType",
17024 ),
17025 )
17026 }
17027}
17028
17029/// The type of instance allocation.
17030///
17031/// # Working with unknown values
17032///
17033/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17034/// additional enum variants at any time. Adding new variants is not considered
17035/// a breaking change. Applications should write their code in anticipation of:
17036///
17037/// - New values appearing in future releases of the client library, **and**
17038/// - New values received dynamically, without application changes.
17039///
17040/// Please consult the [Working with enums] section in the user guide for some
17041/// guidelines.
17042///
17043/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17044#[derive(Clone, Debug, PartialEq)]
17045#[non_exhaustive]
17046pub enum TrafficTargetAllocationType {
17047 /// Unspecified instance allocation type.
17048 Unspecified,
17049 /// Allocates instances to the Service's latest ready Revision.
17050 Latest,
17051 /// Allocates instances to a Revision by name.
17052 Revision,
17053 /// If set, the enum was initialized with an unknown value.
17054 ///
17055 /// Applications can examine the value using [TrafficTargetAllocationType::value] or
17056 /// [TrafficTargetAllocationType::name].
17057 UnknownValue(traffic_target_allocation_type::UnknownValue),
17058}
17059
17060#[doc(hidden)]
17061pub mod traffic_target_allocation_type {
17062 #[allow(unused_imports)]
17063 use super::*;
17064 #[derive(Clone, Debug, PartialEq)]
17065 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17066}
17067
17068impl TrafficTargetAllocationType {
17069 /// Gets the enum value.
17070 ///
17071 /// Returns `None` if the enum contains an unknown value deserialized from
17072 /// the string representation of enums.
17073 pub fn value(&self) -> std::option::Option<i32> {
17074 match self {
17075 Self::Unspecified => std::option::Option::Some(0),
17076 Self::Latest => std::option::Option::Some(1),
17077 Self::Revision => std::option::Option::Some(2),
17078 Self::UnknownValue(u) => u.0.value(),
17079 }
17080 }
17081
17082 /// Gets the enum value as a string.
17083 ///
17084 /// Returns `None` if the enum contains an unknown value deserialized from
17085 /// the integer representation of enums.
17086 pub fn name(&self) -> std::option::Option<&str> {
17087 match self {
17088 Self::Unspecified => {
17089 std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED")
17090 }
17091 Self::Latest => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
17092 Self::Revision => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"),
17093 Self::UnknownValue(u) => u.0.name(),
17094 }
17095 }
17096}
17097
17098impl std::default::Default for TrafficTargetAllocationType {
17099 fn default() -> Self {
17100 use std::convert::From;
17101 Self::from(0)
17102 }
17103}
17104
17105impl std::fmt::Display for TrafficTargetAllocationType {
17106 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17107 wkt::internal::display_enum(f, self.name(), self.value())
17108 }
17109}
17110
17111impl std::convert::From<i32> for TrafficTargetAllocationType {
17112 fn from(value: i32) -> Self {
17113 match value {
17114 0 => Self::Unspecified,
17115 1 => Self::Latest,
17116 2 => Self::Revision,
17117 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
17118 wkt::internal::UnknownEnumValue::Integer(value),
17119 )),
17120 }
17121 }
17122}
17123
17124impl std::convert::From<&str> for TrafficTargetAllocationType {
17125 fn from(value: &str) -> Self {
17126 use std::string::ToString;
17127 match value {
17128 "TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17129 "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST" => Self::Latest,
17130 "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION" => Self::Revision,
17131 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
17132 wkt::internal::UnknownEnumValue::String(value.to_string()),
17133 )),
17134 }
17135 }
17136}
17137
17138impl serde::ser::Serialize for TrafficTargetAllocationType {
17139 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17140 where
17141 S: serde::Serializer,
17142 {
17143 match self {
17144 Self::Unspecified => serializer.serialize_i32(0),
17145 Self::Latest => serializer.serialize_i32(1),
17146 Self::Revision => serializer.serialize_i32(2),
17147 Self::UnknownValue(u) => u.0.serialize(serializer),
17148 }
17149 }
17150}
17151
17152impl<'de> serde::de::Deserialize<'de> for TrafficTargetAllocationType {
17153 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17154 where
17155 D: serde::Deserializer<'de>,
17156 {
17157 deserializer.deserialize_any(
17158 wkt::internal::EnumVisitor::<TrafficTargetAllocationType>::new(
17159 ".google.cloud.run.v2.TrafficTargetAllocationType",
17160 ),
17161 )
17162 }
17163}
17164
17165/// Allowed ingress traffic for the Container.
17166///
17167/// # Working with unknown values
17168///
17169/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17170/// additional enum variants at any time. Adding new variants is not considered
17171/// a breaking change. Applications should write their code in anticipation of:
17172///
17173/// - New values appearing in future releases of the client library, **and**
17174/// - New values received dynamically, without application changes.
17175///
17176/// Please consult the [Working with enums] section in the user guide for some
17177/// guidelines.
17178///
17179/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17180#[derive(Clone, Debug, PartialEq)]
17181#[non_exhaustive]
17182pub enum IngressTraffic {
17183 /// Unspecified
17184 Unspecified,
17185 /// All inbound traffic is allowed.
17186 All,
17187 /// Only internal traffic is allowed.
17188 InternalOnly,
17189 /// Both internal and Google Cloud Load Balancer traffic is allowed.
17190 InternalLoadBalancer,
17191 /// No ingress traffic is allowed.
17192 None,
17193 /// If set, the enum was initialized with an unknown value.
17194 ///
17195 /// Applications can examine the value using [IngressTraffic::value] or
17196 /// [IngressTraffic::name].
17197 UnknownValue(ingress_traffic::UnknownValue),
17198}
17199
17200#[doc(hidden)]
17201pub mod ingress_traffic {
17202 #[allow(unused_imports)]
17203 use super::*;
17204 #[derive(Clone, Debug, PartialEq)]
17205 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17206}
17207
17208impl IngressTraffic {
17209 /// Gets the enum value.
17210 ///
17211 /// Returns `None` if the enum contains an unknown value deserialized from
17212 /// the string representation of enums.
17213 pub fn value(&self) -> std::option::Option<i32> {
17214 match self {
17215 Self::Unspecified => std::option::Option::Some(0),
17216 Self::All => std::option::Option::Some(1),
17217 Self::InternalOnly => std::option::Option::Some(2),
17218 Self::InternalLoadBalancer => std::option::Option::Some(3),
17219 Self::None => std::option::Option::Some(4),
17220 Self::UnknownValue(u) => u.0.value(),
17221 }
17222 }
17223
17224 /// Gets the enum value as a string.
17225 ///
17226 /// Returns `None` if the enum contains an unknown value deserialized from
17227 /// the integer representation of enums.
17228 pub fn name(&self) -> std::option::Option<&str> {
17229 match self {
17230 Self::Unspecified => std::option::Option::Some("INGRESS_TRAFFIC_UNSPECIFIED"),
17231 Self::All => std::option::Option::Some("INGRESS_TRAFFIC_ALL"),
17232 Self::InternalOnly => std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_ONLY"),
17233 Self::InternalLoadBalancer => {
17234 std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER")
17235 }
17236 Self::None => std::option::Option::Some("INGRESS_TRAFFIC_NONE"),
17237 Self::UnknownValue(u) => u.0.name(),
17238 }
17239 }
17240}
17241
17242impl std::default::Default for IngressTraffic {
17243 fn default() -> Self {
17244 use std::convert::From;
17245 Self::from(0)
17246 }
17247}
17248
17249impl std::fmt::Display for IngressTraffic {
17250 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17251 wkt::internal::display_enum(f, self.name(), self.value())
17252 }
17253}
17254
17255impl std::convert::From<i32> for IngressTraffic {
17256 fn from(value: i32) -> Self {
17257 match value {
17258 0 => Self::Unspecified,
17259 1 => Self::All,
17260 2 => Self::InternalOnly,
17261 3 => Self::InternalLoadBalancer,
17262 4 => Self::None,
17263 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
17264 wkt::internal::UnknownEnumValue::Integer(value),
17265 )),
17266 }
17267 }
17268}
17269
17270impl std::convert::From<&str> for IngressTraffic {
17271 fn from(value: &str) -> Self {
17272 use std::string::ToString;
17273 match value {
17274 "INGRESS_TRAFFIC_UNSPECIFIED" => Self::Unspecified,
17275 "INGRESS_TRAFFIC_ALL" => Self::All,
17276 "INGRESS_TRAFFIC_INTERNAL_ONLY" => Self::InternalOnly,
17277 "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER" => Self::InternalLoadBalancer,
17278 "INGRESS_TRAFFIC_NONE" => Self::None,
17279 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
17280 wkt::internal::UnknownEnumValue::String(value.to_string()),
17281 )),
17282 }
17283 }
17284}
17285
17286impl serde::ser::Serialize for IngressTraffic {
17287 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17288 where
17289 S: serde::Serializer,
17290 {
17291 match self {
17292 Self::Unspecified => serializer.serialize_i32(0),
17293 Self::All => serializer.serialize_i32(1),
17294 Self::InternalOnly => serializer.serialize_i32(2),
17295 Self::InternalLoadBalancer => serializer.serialize_i32(3),
17296 Self::None => serializer.serialize_i32(4),
17297 Self::UnknownValue(u) => u.0.serialize(serializer),
17298 }
17299 }
17300}
17301
17302impl<'de> serde::de::Deserialize<'de> for IngressTraffic {
17303 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17304 where
17305 D: serde::Deserializer<'de>,
17306 {
17307 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressTraffic>::new(
17308 ".google.cloud.run.v2.IngressTraffic",
17309 ))
17310 }
17311}
17312
17313/// Alternatives for execution environments.
17314///
17315/// # Working with unknown values
17316///
17317/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17318/// additional enum variants at any time. Adding new variants is not considered
17319/// a breaking change. Applications should write their code in anticipation of:
17320///
17321/// - New values appearing in future releases of the client library, **and**
17322/// - New values received dynamically, without application changes.
17323///
17324/// Please consult the [Working with enums] section in the user guide for some
17325/// guidelines.
17326///
17327/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17328#[derive(Clone, Debug, PartialEq)]
17329#[non_exhaustive]
17330pub enum ExecutionEnvironment {
17331 /// Unspecified
17332 Unspecified,
17333 /// Uses the First Generation environment.
17334 Gen1,
17335 /// Uses Second Generation environment.
17336 Gen2,
17337 /// If set, the enum was initialized with an unknown value.
17338 ///
17339 /// Applications can examine the value using [ExecutionEnvironment::value] or
17340 /// [ExecutionEnvironment::name].
17341 UnknownValue(execution_environment::UnknownValue),
17342}
17343
17344#[doc(hidden)]
17345pub mod execution_environment {
17346 #[allow(unused_imports)]
17347 use super::*;
17348 #[derive(Clone, Debug, PartialEq)]
17349 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17350}
17351
17352impl ExecutionEnvironment {
17353 /// Gets the enum value.
17354 ///
17355 /// Returns `None` if the enum contains an unknown value deserialized from
17356 /// the string representation of enums.
17357 pub fn value(&self) -> std::option::Option<i32> {
17358 match self {
17359 Self::Unspecified => std::option::Option::Some(0),
17360 Self::Gen1 => std::option::Option::Some(1),
17361 Self::Gen2 => std::option::Option::Some(2),
17362 Self::UnknownValue(u) => u.0.value(),
17363 }
17364 }
17365
17366 /// Gets the enum value as a string.
17367 ///
17368 /// Returns `None` if the enum contains an unknown value deserialized from
17369 /// the integer representation of enums.
17370 pub fn name(&self) -> std::option::Option<&str> {
17371 match self {
17372 Self::Unspecified => std::option::Option::Some("EXECUTION_ENVIRONMENT_UNSPECIFIED"),
17373 Self::Gen1 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN1"),
17374 Self::Gen2 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN2"),
17375 Self::UnknownValue(u) => u.0.name(),
17376 }
17377 }
17378}
17379
17380impl std::default::Default for ExecutionEnvironment {
17381 fn default() -> Self {
17382 use std::convert::From;
17383 Self::from(0)
17384 }
17385}
17386
17387impl std::fmt::Display for ExecutionEnvironment {
17388 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17389 wkt::internal::display_enum(f, self.name(), self.value())
17390 }
17391}
17392
17393impl std::convert::From<i32> for ExecutionEnvironment {
17394 fn from(value: i32) -> Self {
17395 match value {
17396 0 => Self::Unspecified,
17397 1 => Self::Gen1,
17398 2 => Self::Gen2,
17399 _ => Self::UnknownValue(execution_environment::UnknownValue(
17400 wkt::internal::UnknownEnumValue::Integer(value),
17401 )),
17402 }
17403 }
17404}
17405
17406impl std::convert::From<&str> for ExecutionEnvironment {
17407 fn from(value: &str) -> Self {
17408 use std::string::ToString;
17409 match value {
17410 "EXECUTION_ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
17411 "EXECUTION_ENVIRONMENT_GEN1" => Self::Gen1,
17412 "EXECUTION_ENVIRONMENT_GEN2" => Self::Gen2,
17413 _ => Self::UnknownValue(execution_environment::UnknownValue(
17414 wkt::internal::UnknownEnumValue::String(value.to_string()),
17415 )),
17416 }
17417 }
17418}
17419
17420impl serde::ser::Serialize for ExecutionEnvironment {
17421 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17422 where
17423 S: serde::Serializer,
17424 {
17425 match self {
17426 Self::Unspecified => serializer.serialize_i32(0),
17427 Self::Gen1 => serializer.serialize_i32(1),
17428 Self::Gen2 => serializer.serialize_i32(2),
17429 Self::UnknownValue(u) => u.0.serialize(serializer),
17430 }
17431 }
17432}
17433
17434impl<'de> serde::de::Deserialize<'de> for ExecutionEnvironment {
17435 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17436 where
17437 D: serde::Deserializer<'de>,
17438 {
17439 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionEnvironment>::new(
17440 ".google.cloud.run.v2.ExecutionEnvironment",
17441 ))
17442 }
17443}
17444
17445/// Specifies behavior if an encryption key used by a resource is revoked.
17446///
17447/// # Working with unknown values
17448///
17449/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17450/// additional enum variants at any time. Adding new variants is not considered
17451/// a breaking change. Applications should write their code in anticipation of:
17452///
17453/// - New values appearing in future releases of the client library, **and**
17454/// - New values received dynamically, without application changes.
17455///
17456/// Please consult the [Working with enums] section in the user guide for some
17457/// guidelines.
17458///
17459/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17460#[derive(Clone, Debug, PartialEq)]
17461#[non_exhaustive]
17462pub enum EncryptionKeyRevocationAction {
17463 /// Unspecified
17464 Unspecified,
17465 /// Prevents the creation of new instances.
17466 PreventNew,
17467 /// Shuts down existing instances, and prevents creation of new ones.
17468 Shutdown,
17469 /// If set, the enum was initialized with an unknown value.
17470 ///
17471 /// Applications can examine the value using [EncryptionKeyRevocationAction::value] or
17472 /// [EncryptionKeyRevocationAction::name].
17473 UnknownValue(encryption_key_revocation_action::UnknownValue),
17474}
17475
17476#[doc(hidden)]
17477pub mod encryption_key_revocation_action {
17478 #[allow(unused_imports)]
17479 use super::*;
17480 #[derive(Clone, Debug, PartialEq)]
17481 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17482}
17483
17484impl EncryptionKeyRevocationAction {
17485 /// Gets the enum value.
17486 ///
17487 /// Returns `None` if the enum contains an unknown value deserialized from
17488 /// the string representation of enums.
17489 pub fn value(&self) -> std::option::Option<i32> {
17490 match self {
17491 Self::Unspecified => std::option::Option::Some(0),
17492 Self::PreventNew => std::option::Option::Some(1),
17493 Self::Shutdown => std::option::Option::Some(2),
17494 Self::UnknownValue(u) => u.0.value(),
17495 }
17496 }
17497
17498 /// Gets the enum value as a string.
17499 ///
17500 /// Returns `None` if the enum contains an unknown value deserialized from
17501 /// the integer representation of enums.
17502 pub fn name(&self) -> std::option::Option<&str> {
17503 match self {
17504 Self::Unspecified => {
17505 std::option::Option::Some("ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED")
17506 }
17507 Self::PreventNew => std::option::Option::Some("PREVENT_NEW"),
17508 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
17509 Self::UnknownValue(u) => u.0.name(),
17510 }
17511 }
17512}
17513
17514impl std::default::Default for EncryptionKeyRevocationAction {
17515 fn default() -> Self {
17516 use std::convert::From;
17517 Self::from(0)
17518 }
17519}
17520
17521impl std::fmt::Display for EncryptionKeyRevocationAction {
17522 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17523 wkt::internal::display_enum(f, self.name(), self.value())
17524 }
17525}
17526
17527impl std::convert::From<i32> for EncryptionKeyRevocationAction {
17528 fn from(value: i32) -> Self {
17529 match value {
17530 0 => Self::Unspecified,
17531 1 => Self::PreventNew,
17532 2 => Self::Shutdown,
17533 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17534 wkt::internal::UnknownEnumValue::Integer(value),
17535 )),
17536 }
17537 }
17538}
17539
17540impl std::convert::From<&str> for EncryptionKeyRevocationAction {
17541 fn from(value: &str) -> Self {
17542 use std::string::ToString;
17543 match value {
17544 "ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED" => Self::Unspecified,
17545 "PREVENT_NEW" => Self::PreventNew,
17546 "SHUTDOWN" => Self::Shutdown,
17547 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17548 wkt::internal::UnknownEnumValue::String(value.to_string()),
17549 )),
17550 }
17551 }
17552}
17553
17554impl serde::ser::Serialize for EncryptionKeyRevocationAction {
17555 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17556 where
17557 S: serde::Serializer,
17558 {
17559 match self {
17560 Self::Unspecified => serializer.serialize_i32(0),
17561 Self::PreventNew => serializer.serialize_i32(1),
17562 Self::Shutdown => serializer.serialize_i32(2),
17563 Self::UnknownValue(u) => u.0.serialize(serializer),
17564 }
17565 }
17566}
17567
17568impl<'de> serde::de::Deserialize<'de> for EncryptionKeyRevocationAction {
17569 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17570 where
17571 D: serde::Deserializer<'de>,
17572 {
17573 deserializer.deserialize_any(
17574 wkt::internal::EnumVisitor::<EncryptionKeyRevocationAction>::new(
17575 ".google.cloud.run.v2.EncryptionKeyRevocationAction",
17576 ),
17577 )
17578 }
17579}