google_cloud_run_v2/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_iam_v1;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_rpc;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Request message for submitting a Build.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct SubmitBuildRequest {
44 /// Required. The project and location to build in. Location must be a region,
45 /// e.g., 'us-central1' or 'global' if the global builder is to be used.
46 /// Format:
47 /// `projects/{project}/locations/{location}`
48 pub parent: std::string::String,
49
50 /// Required. Artifact Registry URI to store the built image.
51 pub image_uri: std::string::String,
52
53 /// Optional. The service account to use for the build. If not set, the default
54 /// Cloud Build service account for the project will be used.
55 pub service_account: std::string::String,
56
57 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
58 /// build the function. The format of this field is
59 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
60 /// `{project}` and `{region}` are the project id and region respectively where
61 /// the worker pool is defined and `{workerPool}` is the short name of the
62 /// worker pool.
63 pub worker_pool: std::string::String,
64
65 /// Optional. Additional tags to annotate the build.
66 pub tags: std::vec::Vec<std::string::String>,
67
68 /// Optional. The machine type from default pool to use for the build. If left
69 /// blank, cloudbuild will use a sensible default. Currently only E2_HIGHCPU_8
70 /// is supported. If worker_pool is set, this field will be ignored.
71 pub machine_type: std::string::String,
72
73 /// Optional. The release track of the client that initiated the build request.
74 pub release_track: google_cloud_api::model::LaunchStage,
75
76 /// Optional. The client that initiated the build request.
77 pub client: std::string::String,
78
79 /// Location of source.
80 pub source: std::option::Option<crate::model::submit_build_request::Source>,
81
82 /// Build type must be one of the following.
83 pub build_type: std::option::Option<crate::model::submit_build_request::BuildType>,
84
85 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
86}
87
88impl SubmitBuildRequest {
89 pub fn new() -> Self {
90 std::default::Default::default()
91 }
92
93 /// Sets the value of [parent][crate::model::SubmitBuildRequest::parent].
94 ///
95 /// # Example
96 /// ```ignore,no_run
97 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
98 /// let x = SubmitBuildRequest::new().set_parent("example");
99 /// ```
100 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
101 self.parent = v.into();
102 self
103 }
104
105 /// Sets the value of [image_uri][crate::model::SubmitBuildRequest::image_uri].
106 ///
107 /// # Example
108 /// ```ignore,no_run
109 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
110 /// let x = SubmitBuildRequest::new().set_image_uri("example");
111 /// ```
112 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
113 self.image_uri = v.into();
114 self
115 }
116
117 /// Sets the value of [service_account][crate::model::SubmitBuildRequest::service_account].
118 ///
119 /// # Example
120 /// ```ignore,no_run
121 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
122 /// let x = SubmitBuildRequest::new().set_service_account("example");
123 /// ```
124 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
125 self.service_account = v.into();
126 self
127 }
128
129 /// Sets the value of [worker_pool][crate::model::SubmitBuildRequest::worker_pool].
130 ///
131 /// # Example
132 /// ```ignore,no_run
133 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
134 /// let x = SubmitBuildRequest::new().set_worker_pool("example");
135 /// ```
136 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
137 self.worker_pool = v.into();
138 self
139 }
140
141 /// Sets the value of [tags][crate::model::SubmitBuildRequest::tags].
142 ///
143 /// # Example
144 /// ```ignore,no_run
145 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
146 /// let x = SubmitBuildRequest::new().set_tags(["a", "b", "c"]);
147 /// ```
148 pub fn set_tags<T, V>(mut self, v: T) -> Self
149 where
150 T: std::iter::IntoIterator<Item = V>,
151 V: std::convert::Into<std::string::String>,
152 {
153 use std::iter::Iterator;
154 self.tags = v.into_iter().map(|i| i.into()).collect();
155 self
156 }
157
158 /// Sets the value of [machine_type][crate::model::SubmitBuildRequest::machine_type].
159 ///
160 /// # Example
161 /// ```ignore,no_run
162 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
163 /// let x = SubmitBuildRequest::new().set_machine_type("example");
164 /// ```
165 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
166 self.machine_type = v.into();
167 self
168 }
169
170 /// Sets the value of [release_track][crate::model::SubmitBuildRequest::release_track].
171 ///
172 /// # Example
173 /// ```ignore,no_run
174 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
175 /// use google_cloud_api::model::LaunchStage;
176 /// let x0 = SubmitBuildRequest::new().set_release_track(LaunchStage::Unimplemented);
177 /// let x1 = SubmitBuildRequest::new().set_release_track(LaunchStage::Prelaunch);
178 /// let x2 = SubmitBuildRequest::new().set_release_track(LaunchStage::EarlyAccess);
179 /// ```
180 pub fn set_release_track<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
181 mut self,
182 v: T,
183 ) -> Self {
184 self.release_track = v.into();
185 self
186 }
187
188 /// Sets the value of [client][crate::model::SubmitBuildRequest::client].
189 ///
190 /// # Example
191 /// ```ignore,no_run
192 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
193 /// let x = SubmitBuildRequest::new().set_client("example");
194 /// ```
195 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
196 self.client = v.into();
197 self
198 }
199
200 /// Sets the value of [source][crate::model::SubmitBuildRequest::source].
201 ///
202 /// Note that all the setters affecting `source` are mutually
203 /// exclusive.
204 ///
205 /// # Example
206 /// ```ignore,no_run
207 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
208 /// use google_cloud_run_v2::model::StorageSource;
209 /// let x = SubmitBuildRequest::new().set_source(Some(
210 /// google_cloud_run_v2::model::submit_build_request::Source::StorageSource(StorageSource::default().into())));
211 /// ```
212 pub fn set_source<
213 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::Source>>,
214 >(
215 mut self,
216 v: T,
217 ) -> Self {
218 self.source = v.into();
219 self
220 }
221
222 /// The value of [source][crate::model::SubmitBuildRequest::source]
223 /// if it holds a `StorageSource`, `None` if the field is not set or
224 /// holds a different branch.
225 pub fn storage_source(
226 &self,
227 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
228 #[allow(unreachable_patterns)]
229 self.source.as_ref().and_then(|v| match v {
230 crate::model::submit_build_request::Source::StorageSource(v) => {
231 std::option::Option::Some(v)
232 }
233 _ => std::option::Option::None,
234 })
235 }
236
237 /// Sets the value of [source][crate::model::SubmitBuildRequest::source]
238 /// to hold a `StorageSource`.
239 ///
240 /// Note that all the setters affecting `source` are
241 /// mutually exclusive.
242 ///
243 /// # Example
244 /// ```ignore,no_run
245 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
246 /// use google_cloud_run_v2::model::StorageSource;
247 /// let x = SubmitBuildRequest::new().set_storage_source(StorageSource::default()/* use setters */);
248 /// assert!(x.storage_source().is_some());
249 /// ```
250 pub fn set_storage_source<
251 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
252 >(
253 mut self,
254 v: T,
255 ) -> Self {
256 self.source = std::option::Option::Some(
257 crate::model::submit_build_request::Source::StorageSource(v.into()),
258 );
259 self
260 }
261
262 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type].
263 ///
264 /// Note that all the setters affecting `build_type` are mutually
265 /// exclusive.
266 ///
267 /// # Example
268 /// ```ignore,no_run
269 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
270 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
271 /// let x = SubmitBuildRequest::new().set_build_type(Some(
272 /// google_cloud_run_v2::model::submit_build_request::BuildType::BuildpackBuild(BuildpacksBuild::default().into())));
273 /// ```
274 pub fn set_build_type<
275 T: std::convert::Into<std::option::Option<crate::model::submit_build_request::BuildType>>,
276 >(
277 mut self,
278 v: T,
279 ) -> Self {
280 self.build_type = v.into();
281 self
282 }
283
284 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
285 /// if it holds a `BuildpackBuild`, `None` if the field is not set or
286 /// holds a different branch.
287 pub fn buildpack_build(
288 &self,
289 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>
290 {
291 #[allow(unreachable_patterns)]
292 self.build_type.as_ref().and_then(|v| match v {
293 crate::model::submit_build_request::BuildType::BuildpackBuild(v) => {
294 std::option::Option::Some(v)
295 }
296 _ => std::option::Option::None,
297 })
298 }
299
300 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
301 /// to hold a `BuildpackBuild`.
302 ///
303 /// Note that all the setters affecting `build_type` are
304 /// mutually exclusive.
305 ///
306 /// # Example
307 /// ```ignore,no_run
308 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
309 /// use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
310 /// let x = SubmitBuildRequest::new().set_buildpack_build(BuildpacksBuild::default()/* use setters */);
311 /// assert!(x.buildpack_build().is_some());
312 /// assert!(x.docker_build().is_none());
313 /// ```
314 pub fn set_buildpack_build<
315 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>,
316 >(
317 mut self,
318 v: T,
319 ) -> Self {
320 self.build_type = std::option::Option::Some(
321 crate::model::submit_build_request::BuildType::BuildpackBuild(v.into()),
322 );
323 self
324 }
325
326 /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
327 /// if it holds a `DockerBuild`, `None` if the field is not set or
328 /// holds a different branch.
329 pub fn docker_build(
330 &self,
331 ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::DockerBuild>>
332 {
333 #[allow(unreachable_patterns)]
334 self.build_type.as_ref().and_then(|v| match v {
335 crate::model::submit_build_request::BuildType::DockerBuild(v) => {
336 std::option::Option::Some(v)
337 }
338 _ => std::option::Option::None,
339 })
340 }
341
342 /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
343 /// to hold a `DockerBuild`.
344 ///
345 /// Note that all the setters affecting `build_type` are
346 /// mutually exclusive.
347 ///
348 /// # Example
349 /// ```ignore,no_run
350 /// # use google_cloud_run_v2::model::SubmitBuildRequest;
351 /// use google_cloud_run_v2::model::submit_build_request::DockerBuild;
352 /// let x = SubmitBuildRequest::new().set_docker_build(DockerBuild::default()/* use setters */);
353 /// assert!(x.docker_build().is_some());
354 /// assert!(x.buildpack_build().is_none());
355 /// ```
356 pub fn set_docker_build<
357 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
358 >(
359 mut self,
360 v: T,
361 ) -> Self {
362 self.build_type = std::option::Option::Some(
363 crate::model::submit_build_request::BuildType::DockerBuild(v.into()),
364 );
365 self
366 }
367}
368
369impl wkt::message::Message for SubmitBuildRequest {
370 fn typename() -> &'static str {
371 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest"
372 }
373}
374
375/// Defines additional types related to [SubmitBuildRequest].
376pub mod submit_build_request {
377 #[allow(unused_imports)]
378 use super::*;
379
380 /// Build the source using Docker. This means the source has a Dockerfile.
381 #[derive(Clone, Default, PartialEq)]
382 #[non_exhaustive]
383 pub struct DockerBuild {
384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
385 }
386
387 impl DockerBuild {
388 pub fn new() -> Self {
389 std::default::Default::default()
390 }
391 }
392
393 impl wkt::message::Message for DockerBuild {
394 fn typename() -> &'static str {
395 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.DockerBuild"
396 }
397 }
398
399 /// Build the source using Buildpacks.
400 #[derive(Clone, Default, PartialEq)]
401 #[non_exhaustive]
402 pub struct BuildpacksBuild {
403 /// The runtime name, e.g. 'go113'. Leave blank for generic builds.
404 #[deprecated]
405 pub runtime: std::string::String,
406
407 /// Optional. Name of the function target if the source is a function source.
408 /// Required for function builds.
409 pub function_target: std::string::String,
410
411 /// Optional. cache_image_uri is the GCR/AR URL where the cache image will be
412 /// stored. cache_image_uri is optional and omitting it will disable caching.
413 /// This URL must be stable across builds. It is used to derive a
414 /// build-specific temporary URL by substituting the tag with the build ID.
415 /// The build will clean up the temporary image on a best-effort basis.
416 pub cache_image_uri: std::string::String,
417
418 /// Optional. The base image to use for the build.
419 pub base_image: std::string::String,
420
421 /// Optional. User-provided build-time environment variables.
422 pub environment_variables:
423 std::collections::HashMap<std::string::String, std::string::String>,
424
425 /// Optional. Whether or not the application container will be enrolled in
426 /// automatic base image updates. When true, the application will be built on
427 /// a scratch base image, so the base layers can be appended at run time.
428 pub enable_automatic_updates: bool,
429
430 /// Optional. project_descriptor stores the path to the project descriptor
431 /// file. When empty, it means that there is no project descriptor file in
432 /// the source.
433 pub project_descriptor: std::string::String,
434
435 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
436 }
437
438 impl BuildpacksBuild {
439 pub fn new() -> Self {
440 std::default::Default::default()
441 }
442
443 /// Sets the value of [runtime][crate::model::submit_build_request::BuildpacksBuild::runtime].
444 ///
445 /// # Example
446 /// ```ignore,no_run
447 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
448 /// let x = BuildpacksBuild::new().set_runtime("example");
449 /// ```
450 #[deprecated]
451 pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
452 self.runtime = v.into();
453 self
454 }
455
456 /// Sets the value of [function_target][crate::model::submit_build_request::BuildpacksBuild::function_target].
457 ///
458 /// # Example
459 /// ```ignore,no_run
460 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
461 /// let x = BuildpacksBuild::new().set_function_target("example");
462 /// ```
463 pub fn set_function_target<T: std::convert::Into<std::string::String>>(
464 mut self,
465 v: T,
466 ) -> Self {
467 self.function_target = v.into();
468 self
469 }
470
471 /// Sets the value of [cache_image_uri][crate::model::submit_build_request::BuildpacksBuild::cache_image_uri].
472 ///
473 /// # Example
474 /// ```ignore,no_run
475 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
476 /// let x = BuildpacksBuild::new().set_cache_image_uri("example");
477 /// ```
478 pub fn set_cache_image_uri<T: std::convert::Into<std::string::String>>(
479 mut self,
480 v: T,
481 ) -> Self {
482 self.cache_image_uri = v.into();
483 self
484 }
485
486 /// Sets the value of [base_image][crate::model::submit_build_request::BuildpacksBuild::base_image].
487 ///
488 /// # Example
489 /// ```ignore,no_run
490 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
491 /// let x = BuildpacksBuild::new().set_base_image("example");
492 /// ```
493 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
494 self.base_image = v.into();
495 self
496 }
497
498 /// Sets the value of [environment_variables][crate::model::submit_build_request::BuildpacksBuild::environment_variables].
499 ///
500 /// # Example
501 /// ```ignore,no_run
502 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
503 /// let x = BuildpacksBuild::new().set_environment_variables([
504 /// ("key0", "abc"),
505 /// ("key1", "xyz"),
506 /// ]);
507 /// ```
508 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
509 where
510 T: std::iter::IntoIterator<Item = (K, V)>,
511 K: std::convert::Into<std::string::String>,
512 V: std::convert::Into<std::string::String>,
513 {
514 use std::iter::Iterator;
515 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
516 self
517 }
518
519 /// Sets the value of [enable_automatic_updates][crate::model::submit_build_request::BuildpacksBuild::enable_automatic_updates].
520 ///
521 /// # Example
522 /// ```ignore,no_run
523 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
524 /// let x = BuildpacksBuild::new().set_enable_automatic_updates(true);
525 /// ```
526 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
527 self.enable_automatic_updates = v.into();
528 self
529 }
530
531 /// Sets the value of [project_descriptor][crate::model::submit_build_request::BuildpacksBuild::project_descriptor].
532 ///
533 /// # Example
534 /// ```ignore,no_run
535 /// # use google_cloud_run_v2::model::submit_build_request::BuildpacksBuild;
536 /// let x = BuildpacksBuild::new().set_project_descriptor("example");
537 /// ```
538 pub fn set_project_descriptor<T: std::convert::Into<std::string::String>>(
539 mut self,
540 v: T,
541 ) -> Self {
542 self.project_descriptor = v.into();
543 self
544 }
545 }
546
547 impl wkt::message::Message for BuildpacksBuild {
548 fn typename() -> &'static str {
549 "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuild"
550 }
551 }
552
553 /// Location of source.
554 #[derive(Clone, Debug, PartialEq)]
555 #[non_exhaustive]
556 pub enum Source {
557 /// Required. Source for the build.
558 StorageSource(std::boxed::Box<crate::model::StorageSource>),
559 }
560
561 /// Build type must be one of the following.
562 #[derive(Clone, Debug, PartialEq)]
563 #[non_exhaustive]
564 pub enum BuildType {
565 /// Build the source using Buildpacks.
566 BuildpackBuild(std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>),
567 /// Build the source using Docker. This means the source has a Dockerfile.
568 DockerBuild(std::boxed::Box<crate::model::submit_build_request::DockerBuild>),
569 }
570}
571
572/// Response message for submitting a Build.
573#[derive(Clone, Default, PartialEq)]
574#[non_exhaustive]
575pub struct SubmitBuildResponse {
576 /// Cloud Build operation to be polled via CloudBuild API.
577 pub build_operation: std::option::Option<google_cloud_longrunning::model::Operation>,
578
579 /// URI of the base builder image in Artifact Registry being used in the build.
580 /// Used to opt into automatic base image updates.
581 pub base_image_uri: std::string::String,
582
583 /// Warning message for the base image.
584 pub base_image_warning: std::string::String,
585
586 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
587}
588
589impl SubmitBuildResponse {
590 pub fn new() -> Self {
591 std::default::Default::default()
592 }
593
594 /// Sets the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
595 ///
596 /// # Example
597 /// ```ignore,no_run
598 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
599 /// use google_cloud_longrunning::model::Operation;
600 /// let x = SubmitBuildResponse::new().set_build_operation(Operation::default()/* use setters */);
601 /// ```
602 pub fn set_build_operation<T>(mut self, v: T) -> Self
603 where
604 T: std::convert::Into<google_cloud_longrunning::model::Operation>,
605 {
606 self.build_operation = std::option::Option::Some(v.into());
607 self
608 }
609
610 /// Sets or clears the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
611 ///
612 /// # Example
613 /// ```ignore,no_run
614 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
615 /// use google_cloud_longrunning::model::Operation;
616 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(Some(Operation::default()/* use setters */));
617 /// let x = SubmitBuildResponse::new().set_or_clear_build_operation(None::<Operation>);
618 /// ```
619 pub fn set_or_clear_build_operation<T>(mut self, v: std::option::Option<T>) -> Self
620 where
621 T: std::convert::Into<google_cloud_longrunning::model::Operation>,
622 {
623 self.build_operation = v.map(|x| x.into());
624 self
625 }
626
627 /// Sets the value of [base_image_uri][crate::model::SubmitBuildResponse::base_image_uri].
628 ///
629 /// # Example
630 /// ```ignore,no_run
631 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
632 /// let x = SubmitBuildResponse::new().set_base_image_uri("example");
633 /// ```
634 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
635 self.base_image_uri = v.into();
636 self
637 }
638
639 /// Sets the value of [base_image_warning][crate::model::SubmitBuildResponse::base_image_warning].
640 ///
641 /// # Example
642 /// ```ignore,no_run
643 /// # use google_cloud_run_v2::model::SubmitBuildResponse;
644 /// let x = SubmitBuildResponse::new().set_base_image_warning("example");
645 /// ```
646 pub fn set_base_image_warning<T: std::convert::Into<std::string::String>>(
647 mut self,
648 v: T,
649 ) -> Self {
650 self.base_image_warning = v.into();
651 self
652 }
653}
654
655impl wkt::message::Message for SubmitBuildResponse {
656 fn typename() -> &'static str {
657 "type.googleapis.com/google.cloud.run.v2.SubmitBuildResponse"
658 }
659}
660
661/// Location of the source in an archive file in Google Cloud Storage.
662#[derive(Clone, Default, PartialEq)]
663#[non_exhaustive]
664pub struct StorageSource {
665 /// Required. Google Cloud Storage bucket containing the source (see
666 /// [Bucket Name
667 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
668 pub bucket: std::string::String,
669
670 /// Required. Google Cloud Storage object containing the source.
671 ///
672 /// This object must be a gzipped archive file (`.tar.gz`) containing source to
673 /// build.
674 pub object: std::string::String,
675
676 /// Optional. Google Cloud Storage generation for the object. If the generation
677 /// is omitted, the latest generation will be used.
678 pub generation: i64,
679
680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
681}
682
683impl StorageSource {
684 pub fn new() -> Self {
685 std::default::Default::default()
686 }
687
688 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
689 ///
690 /// # Example
691 /// ```ignore,no_run
692 /// # use google_cloud_run_v2::model::StorageSource;
693 /// let x = StorageSource::new().set_bucket("example");
694 /// ```
695 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
696 self.bucket = v.into();
697 self
698 }
699
700 /// Sets the value of [object][crate::model::StorageSource::object].
701 ///
702 /// # Example
703 /// ```ignore,no_run
704 /// # use google_cloud_run_v2::model::StorageSource;
705 /// let x = StorageSource::new().set_object("example");
706 /// ```
707 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
708 self.object = v.into();
709 self
710 }
711
712 /// Sets the value of [generation][crate::model::StorageSource::generation].
713 ///
714 /// # Example
715 /// ```ignore,no_run
716 /// # use google_cloud_run_v2::model::StorageSource;
717 /// let x = StorageSource::new().set_generation(42);
718 /// ```
719 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
720 self.generation = v.into();
721 self
722 }
723}
724
725impl wkt::message::Message for StorageSource {
726 fn typename() -> &'static str {
727 "type.googleapis.com/google.cloud.run.v2.StorageSource"
728 }
729}
730
731/// Defines a status condition for a resource.
732#[derive(Clone, Default, PartialEq)]
733#[non_exhaustive]
734pub struct Condition {
735 /// type is used to communicate the status of the reconciliation process.
736 /// See also:
737 /// <https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting>
738 /// Types common to all resources include:
739 ///
740 /// * "Ready": True when the Resource is ready.
741 pub r#type: std::string::String,
742
743 /// State of the condition.
744 pub state: crate::model::condition::State,
745
746 /// Human readable message indicating details about the current status.
747 pub message: std::string::String,
748
749 /// Last time the condition transitioned from one status to another.
750 pub last_transition_time: std::option::Option<wkt::Timestamp>,
751
752 /// How to interpret failures of this condition, one of Error, Warning, Info
753 pub severity: crate::model::condition::Severity,
754
755 /// The reason for this condition. Depending on the condition type,
756 /// it will populate one of these fields.
757 /// Successful conditions cannot have a reason.
758 pub reasons: std::option::Option<crate::model::condition::Reasons>,
759
760 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
761}
762
763impl Condition {
764 pub fn new() -> Self {
765 std::default::Default::default()
766 }
767
768 /// Sets the value of [r#type][crate::model::Condition::type].
769 ///
770 /// # Example
771 /// ```ignore,no_run
772 /// # use google_cloud_run_v2::model::Condition;
773 /// let x = Condition::new().set_type("example");
774 /// ```
775 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
776 self.r#type = v.into();
777 self
778 }
779
780 /// Sets the value of [state][crate::model::Condition::state].
781 ///
782 /// # Example
783 /// ```ignore,no_run
784 /// # use google_cloud_run_v2::model::Condition;
785 /// use google_cloud_run_v2::model::condition::State;
786 /// let x0 = Condition::new().set_state(State::ConditionPending);
787 /// let x1 = Condition::new().set_state(State::ConditionReconciling);
788 /// let x2 = Condition::new().set_state(State::ConditionFailed);
789 /// ```
790 pub fn set_state<T: std::convert::Into<crate::model::condition::State>>(
791 mut self,
792 v: T,
793 ) -> Self {
794 self.state = v.into();
795 self
796 }
797
798 /// Sets the value of [message][crate::model::Condition::message].
799 ///
800 /// # Example
801 /// ```ignore,no_run
802 /// # use google_cloud_run_v2::model::Condition;
803 /// let x = Condition::new().set_message("example");
804 /// ```
805 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
806 self.message = v.into();
807 self
808 }
809
810 /// Sets the value of [last_transition_time][crate::model::Condition::last_transition_time].
811 ///
812 /// # Example
813 /// ```ignore,no_run
814 /// # use google_cloud_run_v2::model::Condition;
815 /// use wkt::Timestamp;
816 /// let x = Condition::new().set_last_transition_time(Timestamp::default()/* use setters */);
817 /// ```
818 pub fn set_last_transition_time<T>(mut self, v: T) -> Self
819 where
820 T: std::convert::Into<wkt::Timestamp>,
821 {
822 self.last_transition_time = std::option::Option::Some(v.into());
823 self
824 }
825
826 /// Sets or clears the value of [last_transition_time][crate::model::Condition::last_transition_time].
827 ///
828 /// # Example
829 /// ```ignore,no_run
830 /// # use google_cloud_run_v2::model::Condition;
831 /// use wkt::Timestamp;
832 /// let x = Condition::new().set_or_clear_last_transition_time(Some(Timestamp::default()/* use setters */));
833 /// let x = Condition::new().set_or_clear_last_transition_time(None::<Timestamp>);
834 /// ```
835 pub fn set_or_clear_last_transition_time<T>(mut self, v: std::option::Option<T>) -> Self
836 where
837 T: std::convert::Into<wkt::Timestamp>,
838 {
839 self.last_transition_time = v.map(|x| x.into());
840 self
841 }
842
843 /// Sets the value of [severity][crate::model::Condition::severity].
844 ///
845 /// # Example
846 /// ```ignore,no_run
847 /// # use google_cloud_run_v2::model::Condition;
848 /// use google_cloud_run_v2::model::condition::Severity;
849 /// let x0 = Condition::new().set_severity(Severity::Error);
850 /// let x1 = Condition::new().set_severity(Severity::Warning);
851 /// let x2 = Condition::new().set_severity(Severity::Info);
852 /// ```
853 pub fn set_severity<T: std::convert::Into<crate::model::condition::Severity>>(
854 mut self,
855 v: T,
856 ) -> Self {
857 self.severity = v.into();
858 self
859 }
860
861 /// Sets the value of [reasons][crate::model::Condition::reasons].
862 ///
863 /// Note that all the setters affecting `reasons` are mutually
864 /// exclusive.
865 ///
866 /// # Example
867 /// ```ignore,no_run
868 /// # use google_cloud_run_v2::model::Condition;
869 /// use google_cloud_run_v2::model::condition::CommonReason;
870 /// let x0 = Condition::new().set_reasons(Some(
871 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::Unknown)));
872 /// let x1 = Condition::new().set_reasons(Some(
873 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::RevisionFailed)));
874 /// let x2 = Condition::new().set_reasons(Some(
875 /// google_cloud_run_v2::model::condition::Reasons::Reason(CommonReason::ProgressDeadlineExceeded)));
876 /// ```
877 pub fn set_reasons<
878 T: std::convert::Into<std::option::Option<crate::model::condition::Reasons>>,
879 >(
880 mut self,
881 v: T,
882 ) -> Self {
883 self.reasons = v.into();
884 self
885 }
886
887 /// The value of [reasons][crate::model::Condition::reasons]
888 /// if it holds a `Reason`, `None` if the field is not set or
889 /// holds a different branch.
890 pub fn reason(&self) -> std::option::Option<&crate::model::condition::CommonReason> {
891 #[allow(unreachable_patterns)]
892 self.reasons.as_ref().and_then(|v| match v {
893 crate::model::condition::Reasons::Reason(v) => std::option::Option::Some(v),
894 _ => std::option::Option::None,
895 })
896 }
897
898 /// Sets the value of [reasons][crate::model::Condition::reasons]
899 /// to hold a `Reason`.
900 ///
901 /// Note that all the setters affecting `reasons` are
902 /// mutually exclusive.
903 ///
904 /// # Example
905 /// ```ignore,no_run
906 /// # use google_cloud_run_v2::model::Condition;
907 /// use google_cloud_run_v2::model::condition::CommonReason;
908 /// let x0 = Condition::new().set_reason(CommonReason::Unknown);
909 /// let x1 = Condition::new().set_reason(CommonReason::RevisionFailed);
910 /// let x2 = Condition::new().set_reason(CommonReason::ProgressDeadlineExceeded);
911 /// assert!(x0.reason().is_some());
912 /// assert!(x0.revision_reason().is_none());
913 /// assert!(x0.execution_reason().is_none());
914 /// assert!(x1.reason().is_some());
915 /// assert!(x1.revision_reason().is_none());
916 /// assert!(x1.execution_reason().is_none());
917 /// assert!(x2.reason().is_some());
918 /// assert!(x2.revision_reason().is_none());
919 /// assert!(x2.execution_reason().is_none());
920 /// ```
921 pub fn set_reason<T: std::convert::Into<crate::model::condition::CommonReason>>(
922 mut self,
923 v: T,
924 ) -> Self {
925 self.reasons =
926 std::option::Option::Some(crate::model::condition::Reasons::Reason(v.into()));
927 self
928 }
929
930 /// The value of [reasons][crate::model::Condition::reasons]
931 /// if it holds a `RevisionReason`, `None` if the field is not set or
932 /// holds a different branch.
933 pub fn revision_reason(&self) -> std::option::Option<&crate::model::condition::RevisionReason> {
934 #[allow(unreachable_patterns)]
935 self.reasons.as_ref().and_then(|v| match v {
936 crate::model::condition::Reasons::RevisionReason(v) => std::option::Option::Some(v),
937 _ => std::option::Option::None,
938 })
939 }
940
941 /// Sets the value of [reasons][crate::model::Condition::reasons]
942 /// to hold a `RevisionReason`.
943 ///
944 /// Note that all the setters affecting `reasons` are
945 /// mutually exclusive.
946 ///
947 /// # Example
948 /// ```ignore,no_run
949 /// # use google_cloud_run_v2::model::Condition;
950 /// use google_cloud_run_v2::model::condition::RevisionReason;
951 /// let x0 = Condition::new().set_revision_reason(RevisionReason::Pending);
952 /// let x1 = Condition::new().set_revision_reason(RevisionReason::Reserve);
953 /// let x2 = Condition::new().set_revision_reason(RevisionReason::Retired);
954 /// assert!(x0.revision_reason().is_some());
955 /// assert!(x0.reason().is_none());
956 /// assert!(x0.execution_reason().is_none());
957 /// assert!(x1.revision_reason().is_some());
958 /// assert!(x1.reason().is_none());
959 /// assert!(x1.execution_reason().is_none());
960 /// assert!(x2.revision_reason().is_some());
961 /// assert!(x2.reason().is_none());
962 /// assert!(x2.execution_reason().is_none());
963 /// ```
964 pub fn set_revision_reason<T: std::convert::Into<crate::model::condition::RevisionReason>>(
965 mut self,
966 v: T,
967 ) -> Self {
968 self.reasons =
969 std::option::Option::Some(crate::model::condition::Reasons::RevisionReason(v.into()));
970 self
971 }
972
973 /// The value of [reasons][crate::model::Condition::reasons]
974 /// if it holds a `ExecutionReason`, `None` if the field is not set or
975 /// holds a different branch.
976 pub fn execution_reason(
977 &self,
978 ) -> std::option::Option<&crate::model::condition::ExecutionReason> {
979 #[allow(unreachable_patterns)]
980 self.reasons.as_ref().and_then(|v| match v {
981 crate::model::condition::Reasons::ExecutionReason(v) => std::option::Option::Some(v),
982 _ => std::option::Option::None,
983 })
984 }
985
986 /// Sets the value of [reasons][crate::model::Condition::reasons]
987 /// to hold a `ExecutionReason`.
988 ///
989 /// Note that all the setters affecting `reasons` are
990 /// mutually exclusive.
991 ///
992 /// # Example
993 /// ```ignore,no_run
994 /// # use google_cloud_run_v2::model::Condition;
995 /// use google_cloud_run_v2::model::condition::ExecutionReason;
996 /// let x0 = Condition::new().set_execution_reason(ExecutionReason::JobStatusServicePollingError);
997 /// let x1 = Condition::new().set_execution_reason(ExecutionReason::NonZeroExitCode);
998 /// let x2 = Condition::new().set_execution_reason(ExecutionReason::Cancelled);
999 /// assert!(x0.execution_reason().is_some());
1000 /// assert!(x0.reason().is_none());
1001 /// assert!(x0.revision_reason().is_none());
1002 /// assert!(x1.execution_reason().is_some());
1003 /// assert!(x1.reason().is_none());
1004 /// assert!(x1.revision_reason().is_none());
1005 /// assert!(x2.execution_reason().is_some());
1006 /// assert!(x2.reason().is_none());
1007 /// assert!(x2.revision_reason().is_none());
1008 /// ```
1009 pub fn set_execution_reason<T: std::convert::Into<crate::model::condition::ExecutionReason>>(
1010 mut self,
1011 v: T,
1012 ) -> Self {
1013 self.reasons =
1014 std::option::Option::Some(crate::model::condition::Reasons::ExecutionReason(v.into()));
1015 self
1016 }
1017}
1018
1019impl wkt::message::Message for Condition {
1020 fn typename() -> &'static str {
1021 "type.googleapis.com/google.cloud.run.v2.Condition"
1022 }
1023}
1024
1025/// Defines additional types related to [Condition].
1026pub mod condition {
1027 #[allow(unused_imports)]
1028 use super::*;
1029
1030 /// Represents the possible Condition states.
1031 ///
1032 /// # Working with unknown values
1033 ///
1034 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1035 /// additional enum variants at any time. Adding new variants is not considered
1036 /// a breaking change. Applications should write their code in anticipation of:
1037 ///
1038 /// - New values appearing in future releases of the client library, **and**
1039 /// - New values received dynamically, without application changes.
1040 ///
1041 /// Please consult the [Working with enums] section in the user guide for some
1042 /// guidelines.
1043 ///
1044 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1045 #[derive(Clone, Debug, PartialEq)]
1046 #[non_exhaustive]
1047 pub enum State {
1048 /// The default value. This value is used if the state is omitted.
1049 Unspecified,
1050 /// Transient state: Reconciliation has not started yet.
1051 ConditionPending,
1052 /// Transient state: reconciliation is still in progress.
1053 ConditionReconciling,
1054 /// Terminal state: Reconciliation did not succeed.
1055 ConditionFailed,
1056 /// Terminal state: Reconciliation completed successfully.
1057 ConditionSucceeded,
1058 /// If set, the enum was initialized with an unknown value.
1059 ///
1060 /// Applications can examine the value using [State::value] or
1061 /// [State::name].
1062 UnknownValue(state::UnknownValue),
1063 }
1064
1065 #[doc(hidden)]
1066 pub mod state {
1067 #[allow(unused_imports)]
1068 use super::*;
1069 #[derive(Clone, Debug, PartialEq)]
1070 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1071 }
1072
1073 impl State {
1074 /// Gets the enum value.
1075 ///
1076 /// Returns `None` if the enum contains an unknown value deserialized from
1077 /// the string representation of enums.
1078 pub fn value(&self) -> std::option::Option<i32> {
1079 match self {
1080 Self::Unspecified => std::option::Option::Some(0),
1081 Self::ConditionPending => std::option::Option::Some(1),
1082 Self::ConditionReconciling => std::option::Option::Some(2),
1083 Self::ConditionFailed => std::option::Option::Some(3),
1084 Self::ConditionSucceeded => std::option::Option::Some(4),
1085 Self::UnknownValue(u) => u.0.value(),
1086 }
1087 }
1088
1089 /// Gets the enum value as a string.
1090 ///
1091 /// Returns `None` if the enum contains an unknown value deserialized from
1092 /// the integer representation of enums.
1093 pub fn name(&self) -> std::option::Option<&str> {
1094 match self {
1095 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1096 Self::ConditionPending => std::option::Option::Some("CONDITION_PENDING"),
1097 Self::ConditionReconciling => std::option::Option::Some("CONDITION_RECONCILING"),
1098 Self::ConditionFailed => std::option::Option::Some("CONDITION_FAILED"),
1099 Self::ConditionSucceeded => std::option::Option::Some("CONDITION_SUCCEEDED"),
1100 Self::UnknownValue(u) => u.0.name(),
1101 }
1102 }
1103 }
1104
1105 impl std::default::Default for State {
1106 fn default() -> Self {
1107 use std::convert::From;
1108 Self::from(0)
1109 }
1110 }
1111
1112 impl std::fmt::Display for State {
1113 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1114 wkt::internal::display_enum(f, self.name(), self.value())
1115 }
1116 }
1117
1118 impl std::convert::From<i32> for State {
1119 fn from(value: i32) -> Self {
1120 match value {
1121 0 => Self::Unspecified,
1122 1 => Self::ConditionPending,
1123 2 => Self::ConditionReconciling,
1124 3 => Self::ConditionFailed,
1125 4 => Self::ConditionSucceeded,
1126 _ => Self::UnknownValue(state::UnknownValue(
1127 wkt::internal::UnknownEnumValue::Integer(value),
1128 )),
1129 }
1130 }
1131 }
1132
1133 impl std::convert::From<&str> for State {
1134 fn from(value: &str) -> Self {
1135 use std::string::ToString;
1136 match value {
1137 "STATE_UNSPECIFIED" => Self::Unspecified,
1138 "CONDITION_PENDING" => Self::ConditionPending,
1139 "CONDITION_RECONCILING" => Self::ConditionReconciling,
1140 "CONDITION_FAILED" => Self::ConditionFailed,
1141 "CONDITION_SUCCEEDED" => Self::ConditionSucceeded,
1142 _ => Self::UnknownValue(state::UnknownValue(
1143 wkt::internal::UnknownEnumValue::String(value.to_string()),
1144 )),
1145 }
1146 }
1147 }
1148
1149 impl serde::ser::Serialize for State {
1150 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1151 where
1152 S: serde::Serializer,
1153 {
1154 match self {
1155 Self::Unspecified => serializer.serialize_i32(0),
1156 Self::ConditionPending => serializer.serialize_i32(1),
1157 Self::ConditionReconciling => serializer.serialize_i32(2),
1158 Self::ConditionFailed => serializer.serialize_i32(3),
1159 Self::ConditionSucceeded => serializer.serialize_i32(4),
1160 Self::UnknownValue(u) => u.0.serialize(serializer),
1161 }
1162 }
1163 }
1164
1165 impl<'de> serde::de::Deserialize<'de> for State {
1166 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1167 where
1168 D: serde::Deserializer<'de>,
1169 {
1170 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1171 ".google.cloud.run.v2.Condition.State",
1172 ))
1173 }
1174 }
1175
1176 /// Represents the severity of the condition failures.
1177 ///
1178 /// # Working with unknown values
1179 ///
1180 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1181 /// additional enum variants at any time. Adding new variants is not considered
1182 /// a breaking change. Applications should write their code in anticipation of:
1183 ///
1184 /// - New values appearing in future releases of the client library, **and**
1185 /// - New values received dynamically, without application changes.
1186 ///
1187 /// Please consult the [Working with enums] section in the user guide for some
1188 /// guidelines.
1189 ///
1190 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1191 #[derive(Clone, Debug, PartialEq)]
1192 #[non_exhaustive]
1193 pub enum Severity {
1194 /// Unspecified severity
1195 Unspecified,
1196 /// Error severity.
1197 Error,
1198 /// Warning severity.
1199 Warning,
1200 /// Info severity.
1201 Info,
1202 /// If set, the enum was initialized with an unknown value.
1203 ///
1204 /// Applications can examine the value using [Severity::value] or
1205 /// [Severity::name].
1206 UnknownValue(severity::UnknownValue),
1207 }
1208
1209 #[doc(hidden)]
1210 pub mod severity {
1211 #[allow(unused_imports)]
1212 use super::*;
1213 #[derive(Clone, Debug, PartialEq)]
1214 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1215 }
1216
1217 impl Severity {
1218 /// Gets the enum value.
1219 ///
1220 /// Returns `None` if the enum contains an unknown value deserialized from
1221 /// the string representation of enums.
1222 pub fn value(&self) -> std::option::Option<i32> {
1223 match self {
1224 Self::Unspecified => std::option::Option::Some(0),
1225 Self::Error => std::option::Option::Some(1),
1226 Self::Warning => std::option::Option::Some(2),
1227 Self::Info => std::option::Option::Some(3),
1228 Self::UnknownValue(u) => u.0.value(),
1229 }
1230 }
1231
1232 /// Gets the enum value as a string.
1233 ///
1234 /// Returns `None` if the enum contains an unknown value deserialized from
1235 /// the integer representation of enums.
1236 pub fn name(&self) -> std::option::Option<&str> {
1237 match self {
1238 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
1239 Self::Error => std::option::Option::Some("ERROR"),
1240 Self::Warning => std::option::Option::Some("WARNING"),
1241 Self::Info => std::option::Option::Some("INFO"),
1242 Self::UnknownValue(u) => u.0.name(),
1243 }
1244 }
1245 }
1246
1247 impl std::default::Default for Severity {
1248 fn default() -> Self {
1249 use std::convert::From;
1250 Self::from(0)
1251 }
1252 }
1253
1254 impl std::fmt::Display for Severity {
1255 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1256 wkt::internal::display_enum(f, self.name(), self.value())
1257 }
1258 }
1259
1260 impl std::convert::From<i32> for Severity {
1261 fn from(value: i32) -> Self {
1262 match value {
1263 0 => Self::Unspecified,
1264 1 => Self::Error,
1265 2 => Self::Warning,
1266 3 => Self::Info,
1267 _ => Self::UnknownValue(severity::UnknownValue(
1268 wkt::internal::UnknownEnumValue::Integer(value),
1269 )),
1270 }
1271 }
1272 }
1273
1274 impl std::convert::From<&str> for Severity {
1275 fn from(value: &str) -> Self {
1276 use std::string::ToString;
1277 match value {
1278 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
1279 "ERROR" => Self::Error,
1280 "WARNING" => Self::Warning,
1281 "INFO" => Self::Info,
1282 _ => Self::UnknownValue(severity::UnknownValue(
1283 wkt::internal::UnknownEnumValue::String(value.to_string()),
1284 )),
1285 }
1286 }
1287 }
1288
1289 impl serde::ser::Serialize for Severity {
1290 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1291 where
1292 S: serde::Serializer,
1293 {
1294 match self {
1295 Self::Unspecified => serializer.serialize_i32(0),
1296 Self::Error => serializer.serialize_i32(1),
1297 Self::Warning => serializer.serialize_i32(2),
1298 Self::Info => serializer.serialize_i32(3),
1299 Self::UnknownValue(u) => u.0.serialize(serializer),
1300 }
1301 }
1302 }
1303
1304 impl<'de> serde::de::Deserialize<'de> for Severity {
1305 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1306 where
1307 D: serde::Deserializer<'de>,
1308 {
1309 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
1310 ".google.cloud.run.v2.Condition.Severity",
1311 ))
1312 }
1313 }
1314
1315 /// Reasons common to all types of conditions.
1316 ///
1317 /// # Working with unknown values
1318 ///
1319 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1320 /// additional enum variants at any time. Adding new variants is not considered
1321 /// a breaking change. Applications should write their code in anticipation of:
1322 ///
1323 /// - New values appearing in future releases of the client library, **and**
1324 /// - New values received dynamically, without application changes.
1325 ///
1326 /// Please consult the [Working with enums] section in the user guide for some
1327 /// guidelines.
1328 ///
1329 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1330 #[derive(Clone, Debug, PartialEq)]
1331 #[non_exhaustive]
1332 pub enum CommonReason {
1333 /// Default value.
1334 Undefined,
1335 /// Reason unknown. Further details will be in message.
1336 Unknown,
1337 /// Revision creation process failed.
1338 RevisionFailed,
1339 /// Timed out waiting for completion.
1340 ProgressDeadlineExceeded,
1341 /// The container image path is incorrect.
1342 ContainerMissing,
1343 /// Insufficient permissions on the container image.
1344 ContainerPermissionDenied,
1345 /// Container image is not authorized by policy.
1346 ContainerImageUnauthorized,
1347 /// Container image policy authorization check failed.
1348 ContainerImageAuthorizationCheckFailed,
1349 /// Insufficient permissions on encryption key.
1350 EncryptionKeyPermissionDenied,
1351 /// Permission check on encryption key failed.
1352 EncryptionKeyCheckFailed,
1353 /// At least one Access check on secrets failed.
1354 SecretsAccessCheckFailed,
1355 /// Waiting for operation to complete.
1356 WaitingForOperation,
1357 /// System will retry immediately.
1358 ImmediateRetry,
1359 /// System will retry later; current attempt failed.
1360 PostponedRetry,
1361 /// An internal error occurred. Further information may be in the message.
1362 Internal,
1363 /// User-provided VPC network was not found.
1364 VpcNetworkNotFound,
1365 /// If set, the enum was initialized with an unknown value.
1366 ///
1367 /// Applications can examine the value using [CommonReason::value] or
1368 /// [CommonReason::name].
1369 UnknownValue(common_reason::UnknownValue),
1370 }
1371
1372 #[doc(hidden)]
1373 pub mod common_reason {
1374 #[allow(unused_imports)]
1375 use super::*;
1376 #[derive(Clone, Debug, PartialEq)]
1377 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1378 }
1379
1380 impl CommonReason {
1381 /// Gets the enum value.
1382 ///
1383 /// Returns `None` if the enum contains an unknown value deserialized from
1384 /// the string representation of enums.
1385 pub fn value(&self) -> std::option::Option<i32> {
1386 match self {
1387 Self::Undefined => std::option::Option::Some(0),
1388 Self::Unknown => std::option::Option::Some(1),
1389 Self::RevisionFailed => std::option::Option::Some(3),
1390 Self::ProgressDeadlineExceeded => std::option::Option::Some(4),
1391 Self::ContainerMissing => std::option::Option::Some(6),
1392 Self::ContainerPermissionDenied => std::option::Option::Some(7),
1393 Self::ContainerImageUnauthorized => std::option::Option::Some(8),
1394 Self::ContainerImageAuthorizationCheckFailed => std::option::Option::Some(9),
1395 Self::EncryptionKeyPermissionDenied => std::option::Option::Some(10),
1396 Self::EncryptionKeyCheckFailed => std::option::Option::Some(11),
1397 Self::SecretsAccessCheckFailed => std::option::Option::Some(12),
1398 Self::WaitingForOperation => std::option::Option::Some(13),
1399 Self::ImmediateRetry => std::option::Option::Some(14),
1400 Self::PostponedRetry => std::option::Option::Some(15),
1401 Self::Internal => std::option::Option::Some(16),
1402 Self::VpcNetworkNotFound => std::option::Option::Some(17),
1403 Self::UnknownValue(u) => u.0.value(),
1404 }
1405 }
1406
1407 /// Gets the enum value as a string.
1408 ///
1409 /// Returns `None` if the enum contains an unknown value deserialized from
1410 /// the integer representation of enums.
1411 pub fn name(&self) -> std::option::Option<&str> {
1412 match self {
1413 Self::Undefined => std::option::Option::Some("COMMON_REASON_UNDEFINED"),
1414 Self::Unknown => std::option::Option::Some("UNKNOWN"),
1415 Self::RevisionFailed => std::option::Option::Some("REVISION_FAILED"),
1416 Self::ProgressDeadlineExceeded => {
1417 std::option::Option::Some("PROGRESS_DEADLINE_EXCEEDED")
1418 }
1419 Self::ContainerMissing => std::option::Option::Some("CONTAINER_MISSING"),
1420 Self::ContainerPermissionDenied => {
1421 std::option::Option::Some("CONTAINER_PERMISSION_DENIED")
1422 }
1423 Self::ContainerImageUnauthorized => {
1424 std::option::Option::Some("CONTAINER_IMAGE_UNAUTHORIZED")
1425 }
1426 Self::ContainerImageAuthorizationCheckFailed => {
1427 std::option::Option::Some("CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED")
1428 }
1429 Self::EncryptionKeyPermissionDenied => {
1430 std::option::Option::Some("ENCRYPTION_KEY_PERMISSION_DENIED")
1431 }
1432 Self::EncryptionKeyCheckFailed => {
1433 std::option::Option::Some("ENCRYPTION_KEY_CHECK_FAILED")
1434 }
1435 Self::SecretsAccessCheckFailed => {
1436 std::option::Option::Some("SECRETS_ACCESS_CHECK_FAILED")
1437 }
1438 Self::WaitingForOperation => std::option::Option::Some("WAITING_FOR_OPERATION"),
1439 Self::ImmediateRetry => std::option::Option::Some("IMMEDIATE_RETRY"),
1440 Self::PostponedRetry => std::option::Option::Some("POSTPONED_RETRY"),
1441 Self::Internal => std::option::Option::Some("INTERNAL"),
1442 Self::VpcNetworkNotFound => std::option::Option::Some("VPC_NETWORK_NOT_FOUND"),
1443 Self::UnknownValue(u) => u.0.name(),
1444 }
1445 }
1446 }
1447
1448 impl std::default::Default for CommonReason {
1449 fn default() -> Self {
1450 use std::convert::From;
1451 Self::from(0)
1452 }
1453 }
1454
1455 impl std::fmt::Display for CommonReason {
1456 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1457 wkt::internal::display_enum(f, self.name(), self.value())
1458 }
1459 }
1460
1461 impl std::convert::From<i32> for CommonReason {
1462 fn from(value: i32) -> Self {
1463 match value {
1464 0 => Self::Undefined,
1465 1 => Self::Unknown,
1466 3 => Self::RevisionFailed,
1467 4 => Self::ProgressDeadlineExceeded,
1468 6 => Self::ContainerMissing,
1469 7 => Self::ContainerPermissionDenied,
1470 8 => Self::ContainerImageUnauthorized,
1471 9 => Self::ContainerImageAuthorizationCheckFailed,
1472 10 => Self::EncryptionKeyPermissionDenied,
1473 11 => Self::EncryptionKeyCheckFailed,
1474 12 => Self::SecretsAccessCheckFailed,
1475 13 => Self::WaitingForOperation,
1476 14 => Self::ImmediateRetry,
1477 15 => Self::PostponedRetry,
1478 16 => Self::Internal,
1479 17 => Self::VpcNetworkNotFound,
1480 _ => Self::UnknownValue(common_reason::UnknownValue(
1481 wkt::internal::UnknownEnumValue::Integer(value),
1482 )),
1483 }
1484 }
1485 }
1486
1487 impl std::convert::From<&str> for CommonReason {
1488 fn from(value: &str) -> Self {
1489 use std::string::ToString;
1490 match value {
1491 "COMMON_REASON_UNDEFINED" => Self::Undefined,
1492 "UNKNOWN" => Self::Unknown,
1493 "REVISION_FAILED" => Self::RevisionFailed,
1494 "PROGRESS_DEADLINE_EXCEEDED" => Self::ProgressDeadlineExceeded,
1495 "CONTAINER_MISSING" => Self::ContainerMissing,
1496 "CONTAINER_PERMISSION_DENIED" => Self::ContainerPermissionDenied,
1497 "CONTAINER_IMAGE_UNAUTHORIZED" => Self::ContainerImageUnauthorized,
1498 "CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED" => {
1499 Self::ContainerImageAuthorizationCheckFailed
1500 }
1501 "ENCRYPTION_KEY_PERMISSION_DENIED" => Self::EncryptionKeyPermissionDenied,
1502 "ENCRYPTION_KEY_CHECK_FAILED" => Self::EncryptionKeyCheckFailed,
1503 "SECRETS_ACCESS_CHECK_FAILED" => Self::SecretsAccessCheckFailed,
1504 "WAITING_FOR_OPERATION" => Self::WaitingForOperation,
1505 "IMMEDIATE_RETRY" => Self::ImmediateRetry,
1506 "POSTPONED_RETRY" => Self::PostponedRetry,
1507 "INTERNAL" => Self::Internal,
1508 "VPC_NETWORK_NOT_FOUND" => Self::VpcNetworkNotFound,
1509 _ => Self::UnknownValue(common_reason::UnknownValue(
1510 wkt::internal::UnknownEnumValue::String(value.to_string()),
1511 )),
1512 }
1513 }
1514 }
1515
1516 impl serde::ser::Serialize for CommonReason {
1517 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1518 where
1519 S: serde::Serializer,
1520 {
1521 match self {
1522 Self::Undefined => serializer.serialize_i32(0),
1523 Self::Unknown => serializer.serialize_i32(1),
1524 Self::RevisionFailed => serializer.serialize_i32(3),
1525 Self::ProgressDeadlineExceeded => serializer.serialize_i32(4),
1526 Self::ContainerMissing => serializer.serialize_i32(6),
1527 Self::ContainerPermissionDenied => serializer.serialize_i32(7),
1528 Self::ContainerImageUnauthorized => serializer.serialize_i32(8),
1529 Self::ContainerImageAuthorizationCheckFailed => serializer.serialize_i32(9),
1530 Self::EncryptionKeyPermissionDenied => serializer.serialize_i32(10),
1531 Self::EncryptionKeyCheckFailed => serializer.serialize_i32(11),
1532 Self::SecretsAccessCheckFailed => serializer.serialize_i32(12),
1533 Self::WaitingForOperation => serializer.serialize_i32(13),
1534 Self::ImmediateRetry => serializer.serialize_i32(14),
1535 Self::PostponedRetry => serializer.serialize_i32(15),
1536 Self::Internal => serializer.serialize_i32(16),
1537 Self::VpcNetworkNotFound => serializer.serialize_i32(17),
1538 Self::UnknownValue(u) => u.0.serialize(serializer),
1539 }
1540 }
1541 }
1542
1543 impl<'de> serde::de::Deserialize<'de> for CommonReason {
1544 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1545 where
1546 D: serde::Deserializer<'de>,
1547 {
1548 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommonReason>::new(
1549 ".google.cloud.run.v2.Condition.CommonReason",
1550 ))
1551 }
1552 }
1553
1554 /// Reasons specific to Revision resource.
1555 ///
1556 /// # Working with unknown values
1557 ///
1558 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1559 /// additional enum variants at any time. Adding new variants is not considered
1560 /// a breaking change. Applications should write their code in anticipation of:
1561 ///
1562 /// - New values appearing in future releases of the client library, **and**
1563 /// - New values received dynamically, without application changes.
1564 ///
1565 /// Please consult the [Working with enums] section in the user guide for some
1566 /// guidelines.
1567 ///
1568 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1569 #[derive(Clone, Debug, PartialEq)]
1570 #[non_exhaustive]
1571 pub enum RevisionReason {
1572 /// Default value.
1573 Undefined,
1574 /// Revision in Pending state.
1575 Pending,
1576 /// Revision is in Reserve state.
1577 Reserve,
1578 /// Revision is Retired.
1579 Retired,
1580 /// Revision is being retired.
1581 Retiring,
1582 /// Revision is being recreated.
1583 Recreating,
1584 /// There was a health check error.
1585 HealthCheckContainerError,
1586 /// Health check failed due to user error from customized path of the
1587 /// container. System will retry.
1588 CustomizedPathResponsePending,
1589 /// A revision with min_instance_count > 0 was created and is reserved, but
1590 /// it was not configured to serve traffic, so it's not live. This can also
1591 /// happen momentarily during traffic migration.
1592 MinInstancesNotProvisioned,
1593 /// The maximum allowed number of active revisions has been reached.
1594 ActiveRevisionLimitReached,
1595 /// There was no deployment defined.
1596 /// This value is no longer used, but Services created in older versions of
1597 /// the API might contain this value.
1598 NoDeployment,
1599 /// A revision's container has no port specified since the revision is of a
1600 /// manually scaled service with 0 instance count
1601 HealthCheckSkipped,
1602 /// A revision with min_instance_count > 0 was created and is waiting for
1603 /// enough instances to begin a traffic migration.
1604 MinInstancesWarming,
1605 /// If set, the enum was initialized with an unknown value.
1606 ///
1607 /// Applications can examine the value using [RevisionReason::value] or
1608 /// [RevisionReason::name].
1609 UnknownValue(revision_reason::UnknownValue),
1610 }
1611
1612 #[doc(hidden)]
1613 pub mod revision_reason {
1614 #[allow(unused_imports)]
1615 use super::*;
1616 #[derive(Clone, Debug, PartialEq)]
1617 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1618 }
1619
1620 impl RevisionReason {
1621 /// Gets the enum value.
1622 ///
1623 /// Returns `None` if the enum contains an unknown value deserialized from
1624 /// the string representation of enums.
1625 pub fn value(&self) -> std::option::Option<i32> {
1626 match self {
1627 Self::Undefined => std::option::Option::Some(0),
1628 Self::Pending => std::option::Option::Some(1),
1629 Self::Reserve => std::option::Option::Some(2),
1630 Self::Retired => std::option::Option::Some(3),
1631 Self::Retiring => std::option::Option::Some(4),
1632 Self::Recreating => std::option::Option::Some(5),
1633 Self::HealthCheckContainerError => std::option::Option::Some(6),
1634 Self::CustomizedPathResponsePending => std::option::Option::Some(7),
1635 Self::MinInstancesNotProvisioned => std::option::Option::Some(8),
1636 Self::ActiveRevisionLimitReached => std::option::Option::Some(9),
1637 Self::NoDeployment => std::option::Option::Some(10),
1638 Self::HealthCheckSkipped => std::option::Option::Some(11),
1639 Self::MinInstancesWarming => std::option::Option::Some(12),
1640 Self::UnknownValue(u) => u.0.value(),
1641 }
1642 }
1643
1644 /// Gets the enum value as a string.
1645 ///
1646 /// Returns `None` if the enum contains an unknown value deserialized from
1647 /// the integer representation of enums.
1648 pub fn name(&self) -> std::option::Option<&str> {
1649 match self {
1650 Self::Undefined => std::option::Option::Some("REVISION_REASON_UNDEFINED"),
1651 Self::Pending => std::option::Option::Some("PENDING"),
1652 Self::Reserve => std::option::Option::Some("RESERVE"),
1653 Self::Retired => std::option::Option::Some("RETIRED"),
1654 Self::Retiring => std::option::Option::Some("RETIRING"),
1655 Self::Recreating => std::option::Option::Some("RECREATING"),
1656 Self::HealthCheckContainerError => {
1657 std::option::Option::Some("HEALTH_CHECK_CONTAINER_ERROR")
1658 }
1659 Self::CustomizedPathResponsePending => {
1660 std::option::Option::Some("CUSTOMIZED_PATH_RESPONSE_PENDING")
1661 }
1662 Self::MinInstancesNotProvisioned => {
1663 std::option::Option::Some("MIN_INSTANCES_NOT_PROVISIONED")
1664 }
1665 Self::ActiveRevisionLimitReached => {
1666 std::option::Option::Some("ACTIVE_REVISION_LIMIT_REACHED")
1667 }
1668 Self::NoDeployment => std::option::Option::Some("NO_DEPLOYMENT"),
1669 Self::HealthCheckSkipped => std::option::Option::Some("HEALTH_CHECK_SKIPPED"),
1670 Self::MinInstancesWarming => std::option::Option::Some("MIN_INSTANCES_WARMING"),
1671 Self::UnknownValue(u) => u.0.name(),
1672 }
1673 }
1674 }
1675
1676 impl std::default::Default for RevisionReason {
1677 fn default() -> Self {
1678 use std::convert::From;
1679 Self::from(0)
1680 }
1681 }
1682
1683 impl std::fmt::Display for RevisionReason {
1684 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1685 wkt::internal::display_enum(f, self.name(), self.value())
1686 }
1687 }
1688
1689 impl std::convert::From<i32> for RevisionReason {
1690 fn from(value: i32) -> Self {
1691 match value {
1692 0 => Self::Undefined,
1693 1 => Self::Pending,
1694 2 => Self::Reserve,
1695 3 => Self::Retired,
1696 4 => Self::Retiring,
1697 5 => Self::Recreating,
1698 6 => Self::HealthCheckContainerError,
1699 7 => Self::CustomizedPathResponsePending,
1700 8 => Self::MinInstancesNotProvisioned,
1701 9 => Self::ActiveRevisionLimitReached,
1702 10 => Self::NoDeployment,
1703 11 => Self::HealthCheckSkipped,
1704 12 => Self::MinInstancesWarming,
1705 _ => Self::UnknownValue(revision_reason::UnknownValue(
1706 wkt::internal::UnknownEnumValue::Integer(value),
1707 )),
1708 }
1709 }
1710 }
1711
1712 impl std::convert::From<&str> for RevisionReason {
1713 fn from(value: &str) -> Self {
1714 use std::string::ToString;
1715 match value {
1716 "REVISION_REASON_UNDEFINED" => Self::Undefined,
1717 "PENDING" => Self::Pending,
1718 "RESERVE" => Self::Reserve,
1719 "RETIRED" => Self::Retired,
1720 "RETIRING" => Self::Retiring,
1721 "RECREATING" => Self::Recreating,
1722 "HEALTH_CHECK_CONTAINER_ERROR" => Self::HealthCheckContainerError,
1723 "CUSTOMIZED_PATH_RESPONSE_PENDING" => Self::CustomizedPathResponsePending,
1724 "MIN_INSTANCES_NOT_PROVISIONED" => Self::MinInstancesNotProvisioned,
1725 "ACTIVE_REVISION_LIMIT_REACHED" => Self::ActiveRevisionLimitReached,
1726 "NO_DEPLOYMENT" => Self::NoDeployment,
1727 "HEALTH_CHECK_SKIPPED" => Self::HealthCheckSkipped,
1728 "MIN_INSTANCES_WARMING" => Self::MinInstancesWarming,
1729 _ => Self::UnknownValue(revision_reason::UnknownValue(
1730 wkt::internal::UnknownEnumValue::String(value.to_string()),
1731 )),
1732 }
1733 }
1734 }
1735
1736 impl serde::ser::Serialize for RevisionReason {
1737 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1738 where
1739 S: serde::Serializer,
1740 {
1741 match self {
1742 Self::Undefined => serializer.serialize_i32(0),
1743 Self::Pending => serializer.serialize_i32(1),
1744 Self::Reserve => serializer.serialize_i32(2),
1745 Self::Retired => serializer.serialize_i32(3),
1746 Self::Retiring => serializer.serialize_i32(4),
1747 Self::Recreating => serializer.serialize_i32(5),
1748 Self::HealthCheckContainerError => serializer.serialize_i32(6),
1749 Self::CustomizedPathResponsePending => serializer.serialize_i32(7),
1750 Self::MinInstancesNotProvisioned => serializer.serialize_i32(8),
1751 Self::ActiveRevisionLimitReached => serializer.serialize_i32(9),
1752 Self::NoDeployment => serializer.serialize_i32(10),
1753 Self::HealthCheckSkipped => serializer.serialize_i32(11),
1754 Self::MinInstancesWarming => serializer.serialize_i32(12),
1755 Self::UnknownValue(u) => u.0.serialize(serializer),
1756 }
1757 }
1758 }
1759
1760 impl<'de> serde::de::Deserialize<'de> for RevisionReason {
1761 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1762 where
1763 D: serde::Deserializer<'de>,
1764 {
1765 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RevisionReason>::new(
1766 ".google.cloud.run.v2.Condition.RevisionReason",
1767 ))
1768 }
1769 }
1770
1771 /// Reasons specific to Execution resource.
1772 ///
1773 /// # Working with unknown values
1774 ///
1775 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1776 /// additional enum variants at any time. Adding new variants is not considered
1777 /// a breaking change. Applications should write their code in anticipation of:
1778 ///
1779 /// - New values appearing in future releases of the client library, **and**
1780 /// - New values received dynamically, without application changes.
1781 ///
1782 /// Please consult the [Working with enums] section in the user guide for some
1783 /// guidelines.
1784 ///
1785 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1786 #[derive(Clone, Debug, PartialEq)]
1787 #[non_exhaustive]
1788 pub enum ExecutionReason {
1789 /// Default value.
1790 Undefined,
1791 /// Internal system error getting execution status. System will retry.
1792 JobStatusServicePollingError,
1793 /// A task reached its retry limit and the last attempt failed due to the
1794 /// user container exiting with a non-zero exit code.
1795 NonZeroExitCode,
1796 /// The execution was cancelled by users.
1797 Cancelled,
1798 /// The execution is in the process of being cancelled.
1799 Cancelling,
1800 /// The execution was deleted.
1801 Deleted,
1802 /// A delayed execution is waiting for a start time.
1803 DelayedStartPending,
1804 /// If set, the enum was initialized with an unknown value.
1805 ///
1806 /// Applications can examine the value using [ExecutionReason::value] or
1807 /// [ExecutionReason::name].
1808 UnknownValue(execution_reason::UnknownValue),
1809 }
1810
1811 #[doc(hidden)]
1812 pub mod execution_reason {
1813 #[allow(unused_imports)]
1814 use super::*;
1815 #[derive(Clone, Debug, PartialEq)]
1816 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1817 }
1818
1819 impl ExecutionReason {
1820 /// Gets the enum value.
1821 ///
1822 /// Returns `None` if the enum contains an unknown value deserialized from
1823 /// the string representation of enums.
1824 pub fn value(&self) -> std::option::Option<i32> {
1825 match self {
1826 Self::Undefined => std::option::Option::Some(0),
1827 Self::JobStatusServicePollingError => std::option::Option::Some(1),
1828 Self::NonZeroExitCode => std::option::Option::Some(2),
1829 Self::Cancelled => std::option::Option::Some(3),
1830 Self::Cancelling => std::option::Option::Some(4),
1831 Self::Deleted => std::option::Option::Some(5),
1832 Self::DelayedStartPending => std::option::Option::Some(6),
1833 Self::UnknownValue(u) => u.0.value(),
1834 }
1835 }
1836
1837 /// Gets the enum value as a string.
1838 ///
1839 /// Returns `None` if the enum contains an unknown value deserialized from
1840 /// the integer representation of enums.
1841 pub fn name(&self) -> std::option::Option<&str> {
1842 match self {
1843 Self::Undefined => std::option::Option::Some("EXECUTION_REASON_UNDEFINED"),
1844 Self::JobStatusServicePollingError => {
1845 std::option::Option::Some("JOB_STATUS_SERVICE_POLLING_ERROR")
1846 }
1847 Self::NonZeroExitCode => std::option::Option::Some("NON_ZERO_EXIT_CODE"),
1848 Self::Cancelled => std::option::Option::Some("CANCELLED"),
1849 Self::Cancelling => std::option::Option::Some("CANCELLING"),
1850 Self::Deleted => std::option::Option::Some("DELETED"),
1851 Self::DelayedStartPending => std::option::Option::Some("DELAYED_START_PENDING"),
1852 Self::UnknownValue(u) => u.0.name(),
1853 }
1854 }
1855 }
1856
1857 impl std::default::Default for ExecutionReason {
1858 fn default() -> Self {
1859 use std::convert::From;
1860 Self::from(0)
1861 }
1862 }
1863
1864 impl std::fmt::Display for ExecutionReason {
1865 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1866 wkt::internal::display_enum(f, self.name(), self.value())
1867 }
1868 }
1869
1870 impl std::convert::From<i32> for ExecutionReason {
1871 fn from(value: i32) -> Self {
1872 match value {
1873 0 => Self::Undefined,
1874 1 => Self::JobStatusServicePollingError,
1875 2 => Self::NonZeroExitCode,
1876 3 => Self::Cancelled,
1877 4 => Self::Cancelling,
1878 5 => Self::Deleted,
1879 6 => Self::DelayedStartPending,
1880 _ => Self::UnknownValue(execution_reason::UnknownValue(
1881 wkt::internal::UnknownEnumValue::Integer(value),
1882 )),
1883 }
1884 }
1885 }
1886
1887 impl std::convert::From<&str> for ExecutionReason {
1888 fn from(value: &str) -> Self {
1889 use std::string::ToString;
1890 match value {
1891 "EXECUTION_REASON_UNDEFINED" => Self::Undefined,
1892 "JOB_STATUS_SERVICE_POLLING_ERROR" => Self::JobStatusServicePollingError,
1893 "NON_ZERO_EXIT_CODE" => Self::NonZeroExitCode,
1894 "CANCELLED" => Self::Cancelled,
1895 "CANCELLING" => Self::Cancelling,
1896 "DELETED" => Self::Deleted,
1897 "DELAYED_START_PENDING" => Self::DelayedStartPending,
1898 _ => Self::UnknownValue(execution_reason::UnknownValue(
1899 wkt::internal::UnknownEnumValue::String(value.to_string()),
1900 )),
1901 }
1902 }
1903 }
1904
1905 impl serde::ser::Serialize for ExecutionReason {
1906 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1907 where
1908 S: serde::Serializer,
1909 {
1910 match self {
1911 Self::Undefined => serializer.serialize_i32(0),
1912 Self::JobStatusServicePollingError => serializer.serialize_i32(1),
1913 Self::NonZeroExitCode => serializer.serialize_i32(2),
1914 Self::Cancelled => serializer.serialize_i32(3),
1915 Self::Cancelling => serializer.serialize_i32(4),
1916 Self::Deleted => serializer.serialize_i32(5),
1917 Self::DelayedStartPending => serializer.serialize_i32(6),
1918 Self::UnknownValue(u) => u.0.serialize(serializer),
1919 }
1920 }
1921 }
1922
1923 impl<'de> serde::de::Deserialize<'de> for ExecutionReason {
1924 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1925 where
1926 D: serde::Deserializer<'de>,
1927 {
1928 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionReason>::new(
1929 ".google.cloud.run.v2.Condition.ExecutionReason",
1930 ))
1931 }
1932 }
1933
1934 /// The reason for this condition. Depending on the condition type,
1935 /// it will populate one of these fields.
1936 /// Successful conditions cannot have a reason.
1937 #[derive(Clone, Debug, PartialEq)]
1938 #[non_exhaustive]
1939 pub enum Reasons {
1940 /// Output only. A common (service-level) reason for this condition.
1941 Reason(crate::model::condition::CommonReason),
1942 /// Output only. A reason for the revision condition.
1943 RevisionReason(crate::model::condition::RevisionReason),
1944 /// Output only. A reason for the execution condition.
1945 ExecutionReason(crate::model::condition::ExecutionReason),
1946 }
1947}
1948
1949/// ContainerStatus holds the information of container name and image digest
1950/// value.
1951#[derive(Clone, Default, PartialEq)]
1952#[non_exhaustive]
1953pub struct ContainerStatus {
1954 /// The name of the container, if specified.
1955 pub name: std::string::String,
1956
1957 /// ImageDigest holds the resolved digest for the image specified and resolved
1958 /// during the creation of Revision. This field holds the digest value
1959 /// regardless of whether a tag or digest was originally specified in the
1960 /// Container object.
1961 pub image_digest: std::string::String,
1962
1963 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1964}
1965
1966impl ContainerStatus {
1967 pub fn new() -> Self {
1968 std::default::Default::default()
1969 }
1970
1971 /// Sets the value of [name][crate::model::ContainerStatus::name].
1972 ///
1973 /// # Example
1974 /// ```ignore,no_run
1975 /// # use google_cloud_run_v2::model::ContainerStatus;
1976 /// let x = ContainerStatus::new().set_name("example");
1977 /// ```
1978 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1979 self.name = v.into();
1980 self
1981 }
1982
1983 /// Sets the value of [image_digest][crate::model::ContainerStatus::image_digest].
1984 ///
1985 /// # Example
1986 /// ```ignore,no_run
1987 /// # use google_cloud_run_v2::model::ContainerStatus;
1988 /// let x = ContainerStatus::new().set_image_digest("example");
1989 /// ```
1990 pub fn set_image_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1991 self.image_digest = v.into();
1992 self
1993 }
1994}
1995
1996impl wkt::message::Message for ContainerStatus {
1997 fn typename() -> &'static str {
1998 "type.googleapis.com/google.cloud.run.v2.ContainerStatus"
1999 }
2000}
2001
2002/// Request message for obtaining a Execution by its full name.
2003#[derive(Clone, Default, PartialEq)]
2004#[non_exhaustive]
2005pub struct GetExecutionRequest {
2006 /// Required. The full name of the Execution.
2007 /// Format:
2008 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2009 /// where `{project}` can be project id or number.
2010 pub name: std::string::String,
2011
2012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2013}
2014
2015impl GetExecutionRequest {
2016 pub fn new() -> Self {
2017 std::default::Default::default()
2018 }
2019
2020 /// Sets the value of [name][crate::model::GetExecutionRequest::name].
2021 ///
2022 /// # Example
2023 /// ```ignore,no_run
2024 /// # use google_cloud_run_v2::model::GetExecutionRequest;
2025 /// let x = GetExecutionRequest::new().set_name("example");
2026 /// ```
2027 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2028 self.name = v.into();
2029 self
2030 }
2031}
2032
2033impl wkt::message::Message for GetExecutionRequest {
2034 fn typename() -> &'static str {
2035 "type.googleapis.com/google.cloud.run.v2.GetExecutionRequest"
2036 }
2037}
2038
2039/// Request message for retrieving a list of Executions.
2040#[derive(Clone, Default, PartialEq)]
2041#[non_exhaustive]
2042pub struct ListExecutionsRequest {
2043 /// Required. The Execution from which the Executions should be listed.
2044 /// To list all Executions across Jobs, use "-" instead of Job name.
2045 /// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
2046 /// `{project}` can be project id or number.
2047 pub parent: std::string::String,
2048
2049 /// Maximum number of Executions to return in this call.
2050 pub page_size: i32,
2051
2052 /// A page token received from a previous call to ListExecutions.
2053 /// All other parameters must match.
2054 pub page_token: std::string::String,
2055
2056 /// If true, returns deleted (but unexpired) resources along with active ones.
2057 pub show_deleted: bool,
2058
2059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2060}
2061
2062impl ListExecutionsRequest {
2063 pub fn new() -> Self {
2064 std::default::Default::default()
2065 }
2066
2067 /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
2068 ///
2069 /// # Example
2070 /// ```ignore,no_run
2071 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2072 /// let x = ListExecutionsRequest::new().set_parent("example");
2073 /// ```
2074 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2075 self.parent = v.into();
2076 self
2077 }
2078
2079 /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
2080 ///
2081 /// # Example
2082 /// ```ignore,no_run
2083 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2084 /// let x = ListExecutionsRequest::new().set_page_size(42);
2085 /// ```
2086 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2087 self.page_size = v.into();
2088 self
2089 }
2090
2091 /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
2092 ///
2093 /// # Example
2094 /// ```ignore,no_run
2095 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2096 /// let x = ListExecutionsRequest::new().set_page_token("example");
2097 /// ```
2098 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2099 self.page_token = v.into();
2100 self
2101 }
2102
2103 /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
2104 ///
2105 /// # Example
2106 /// ```ignore,no_run
2107 /// # use google_cloud_run_v2::model::ListExecutionsRequest;
2108 /// let x = ListExecutionsRequest::new().set_show_deleted(true);
2109 /// ```
2110 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2111 self.show_deleted = v.into();
2112 self
2113 }
2114}
2115
2116impl wkt::message::Message for ListExecutionsRequest {
2117 fn typename() -> &'static str {
2118 "type.googleapis.com/google.cloud.run.v2.ListExecutionsRequest"
2119 }
2120}
2121
2122/// Response message containing a list of Executions.
2123#[derive(Clone, Default, PartialEq)]
2124#[non_exhaustive]
2125pub struct ListExecutionsResponse {
2126 /// The resulting list of Executions.
2127 pub executions: std::vec::Vec<crate::model::Execution>,
2128
2129 /// A token indicating there are more items than page_size. Use it in the next
2130 /// ListExecutions request to continue.
2131 pub next_page_token: std::string::String,
2132
2133 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2134}
2135
2136impl ListExecutionsResponse {
2137 pub fn new() -> Self {
2138 std::default::Default::default()
2139 }
2140
2141 /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
2142 ///
2143 /// # Example
2144 /// ```ignore,no_run
2145 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2146 /// use google_cloud_run_v2::model::Execution;
2147 /// let x = ListExecutionsResponse::new()
2148 /// .set_executions([
2149 /// Execution::default()/* use setters */,
2150 /// Execution::default()/* use (different) setters */,
2151 /// ]);
2152 /// ```
2153 pub fn set_executions<T, V>(mut self, v: T) -> Self
2154 where
2155 T: std::iter::IntoIterator<Item = V>,
2156 V: std::convert::Into<crate::model::Execution>,
2157 {
2158 use std::iter::Iterator;
2159 self.executions = v.into_iter().map(|i| i.into()).collect();
2160 self
2161 }
2162
2163 /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
2164 ///
2165 /// # Example
2166 /// ```ignore,no_run
2167 /// # use google_cloud_run_v2::model::ListExecutionsResponse;
2168 /// let x = ListExecutionsResponse::new().set_next_page_token("example");
2169 /// ```
2170 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2171 self.next_page_token = v.into();
2172 self
2173 }
2174}
2175
2176impl wkt::message::Message for ListExecutionsResponse {
2177 fn typename() -> &'static str {
2178 "type.googleapis.com/google.cloud.run.v2.ListExecutionsResponse"
2179 }
2180}
2181
2182#[doc(hidden)]
2183impl google_cloud_gax::paginator::internal::PageableResponse for ListExecutionsResponse {
2184 type PageItem = crate::model::Execution;
2185
2186 fn items(self) -> std::vec::Vec<Self::PageItem> {
2187 self.executions
2188 }
2189
2190 fn next_page_token(&self) -> std::string::String {
2191 use std::clone::Clone;
2192 self.next_page_token.clone()
2193 }
2194}
2195
2196/// Request message for deleting an Execution.
2197#[derive(Clone, Default, PartialEq)]
2198#[non_exhaustive]
2199pub struct DeleteExecutionRequest {
2200 /// Required. The name of the Execution to delete.
2201 /// Format:
2202 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2203 /// where `{project}` can be project id or number.
2204 pub name: std::string::String,
2205
2206 /// Indicates that the request should be validated without actually
2207 /// deleting any resources.
2208 pub validate_only: bool,
2209
2210 /// A system-generated fingerprint for this version of the resource.
2211 /// This may be used to detect modification conflict during updates.
2212 pub etag: std::string::String,
2213
2214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2215}
2216
2217impl DeleteExecutionRequest {
2218 pub fn new() -> Self {
2219 std::default::Default::default()
2220 }
2221
2222 /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
2223 ///
2224 /// # Example
2225 /// ```ignore,no_run
2226 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2227 /// let x = DeleteExecutionRequest::new().set_name("example");
2228 /// ```
2229 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2230 self.name = v.into();
2231 self
2232 }
2233
2234 /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
2235 ///
2236 /// # Example
2237 /// ```ignore,no_run
2238 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2239 /// let x = DeleteExecutionRequest::new().set_validate_only(true);
2240 /// ```
2241 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2242 self.validate_only = v.into();
2243 self
2244 }
2245
2246 /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
2247 ///
2248 /// # Example
2249 /// ```ignore,no_run
2250 /// # use google_cloud_run_v2::model::DeleteExecutionRequest;
2251 /// let x = DeleteExecutionRequest::new().set_etag("example");
2252 /// ```
2253 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2254 self.etag = v.into();
2255 self
2256 }
2257}
2258
2259impl wkt::message::Message for DeleteExecutionRequest {
2260 fn typename() -> &'static str {
2261 "type.googleapis.com/google.cloud.run.v2.DeleteExecutionRequest"
2262 }
2263}
2264
2265/// Request message for deleting an Execution.
2266#[derive(Clone, Default, PartialEq)]
2267#[non_exhaustive]
2268pub struct CancelExecutionRequest {
2269 /// Required. The name of the Execution to cancel.
2270 /// Format:
2271 /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2272 /// where `{project}` can be project id or number.
2273 pub name: std::string::String,
2274
2275 /// Indicates that the request should be validated without actually
2276 /// cancelling any resources.
2277 pub validate_only: bool,
2278
2279 /// A system-generated fingerprint for this version of the resource.
2280 /// This may be used to detect modification conflict during updates.
2281 pub etag: std::string::String,
2282
2283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2284}
2285
2286impl CancelExecutionRequest {
2287 pub fn new() -> Self {
2288 std::default::Default::default()
2289 }
2290
2291 /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
2292 ///
2293 /// # Example
2294 /// ```ignore,no_run
2295 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2296 /// let x = CancelExecutionRequest::new().set_name("example");
2297 /// ```
2298 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2299 self.name = v.into();
2300 self
2301 }
2302
2303 /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
2304 ///
2305 /// # Example
2306 /// ```ignore,no_run
2307 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2308 /// let x = CancelExecutionRequest::new().set_validate_only(true);
2309 /// ```
2310 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2311 self.validate_only = v.into();
2312 self
2313 }
2314
2315 /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
2316 ///
2317 /// # Example
2318 /// ```ignore,no_run
2319 /// # use google_cloud_run_v2::model::CancelExecutionRequest;
2320 /// let x = CancelExecutionRequest::new().set_etag("example");
2321 /// ```
2322 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2323 self.etag = v.into();
2324 self
2325 }
2326}
2327
2328impl wkt::message::Message for CancelExecutionRequest {
2329 fn typename() -> &'static str {
2330 "type.googleapis.com/google.cloud.run.v2.CancelExecutionRequest"
2331 }
2332}
2333
2334/// Execution represents the configuration of a single execution. A execution an
2335/// immutable resource that references a container image which is run to
2336/// completion.
2337#[derive(Clone, Default, PartialEq)]
2338#[non_exhaustive]
2339pub struct Execution {
2340 /// Output only. The unique name of this Execution.
2341 pub name: std::string::String,
2342
2343 /// Output only. Server assigned unique identifier for the Execution. The value
2344 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
2345 /// deleted.
2346 pub uid: std::string::String,
2347
2348 /// Output only. Email address of the authenticated creator.
2349 pub creator: std::string::String,
2350
2351 /// Output only. A number that monotonically increases every time the user
2352 /// modifies the desired state.
2353 pub generation: i64,
2354
2355 /// Output only. Unstructured key value map that can be used to organize and
2356 /// categorize objects. User-provided labels are shared with Google's billing
2357 /// system, so they can be used to filter, or break down billing charges by
2358 /// team, component, environment, state, etc. For more information, visit
2359 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
2360 /// <https://cloud.google.com/run/docs/configuring/labels>
2361 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2362
2363 /// Output only. Unstructured key value map that may
2364 /// be set by external tools to store and arbitrary metadata.
2365 /// They are not queryable and should be preserved
2366 /// when modifying objects.
2367 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2368
2369 /// Output only. Represents time when the execution was acknowledged by the
2370 /// execution controller. It is not guaranteed to be set in happens-before
2371 /// order across separate operations.
2372 pub create_time: std::option::Option<wkt::Timestamp>,
2373
2374 /// Output only. Represents time when the execution started to run.
2375 /// It is not guaranteed to be set in happens-before order across separate
2376 /// operations.
2377 pub start_time: std::option::Option<wkt::Timestamp>,
2378
2379 /// Output only. Represents time when the execution was completed. It is not
2380 /// guaranteed to be set in happens-before order across separate operations.
2381 pub completion_time: std::option::Option<wkt::Timestamp>,
2382
2383 /// Output only. The last-modified time.
2384 pub update_time: std::option::Option<wkt::Timestamp>,
2385
2386 /// Output only. For a deleted resource, the deletion time. It is only
2387 /// populated as a response to a Delete request.
2388 pub delete_time: std::option::Option<wkt::Timestamp>,
2389
2390 /// Output only. For a deleted resource, the time after which it will be
2391 /// permamently deleted. It is only populated as a response to a Delete
2392 /// request.
2393 pub expire_time: std::option::Option<wkt::Timestamp>,
2394
2395 /// The least stable launch stage needed to create this resource, as defined by
2396 /// [Google Cloud Platform Launch
2397 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
2398 /// `ALPHA`, `BETA`, and `GA`.
2399 ///
2400 /// Note that this value might not be what was used
2401 /// as input. For example, if ALPHA was provided as input in the parent
2402 /// resource, but only BETA and GA-level features are were, this field will be
2403 /// BETA.
2404 pub launch_stage: google_cloud_api::model::LaunchStage,
2405
2406 /// Output only. The name of the parent Job.
2407 pub job: std::string::String,
2408
2409 /// Output only. Specifies the maximum desired number of tasks the execution
2410 /// should run at any given time. Must be <= task_count. The actual number of
2411 /// tasks running in steady state will be less than this number when
2412 /// ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
2413 /// the work left to do is less than max parallelism.
2414 pub parallelism: i32,
2415
2416 /// Output only. Specifies the desired number of tasks the execution should
2417 /// run. Setting to 1 means that parallelism is limited to 1 and the success of
2418 /// that task signals the success of the execution.
2419 pub task_count: i32,
2420
2421 /// Output only. The template used to create tasks for this execution.
2422 pub template: std::option::Option<crate::model::TaskTemplate>,
2423
2424 /// Output only. Indicates whether the resource's reconciliation is still in
2425 /// progress. See comments in `Job.reconciling` for additional information on
2426 /// reconciliation process in Cloud Run.
2427 pub reconciling: bool,
2428
2429 /// Output only. The Condition of this Execution, containing its readiness
2430 /// status, and detailed error information in case it did not reach the desired
2431 /// state.
2432 pub conditions: std::vec::Vec<crate::model::Condition>,
2433
2434 /// Output only. The generation of this Execution. See comments in
2435 /// `reconciling` for additional information on reconciliation process in Cloud
2436 /// Run.
2437 pub observed_generation: i64,
2438
2439 /// Output only. The number of actively running tasks.
2440 pub running_count: i32,
2441
2442 /// Output only. The number of tasks which reached phase Succeeded.
2443 pub succeeded_count: i32,
2444
2445 /// Output only. The number of tasks which reached phase Failed.
2446 pub failed_count: i32,
2447
2448 /// Output only. The number of tasks which reached phase Cancelled.
2449 pub cancelled_count: i32,
2450
2451 /// Output only. The number of tasks which have retried at least once.
2452 pub retried_count: i32,
2453
2454 /// Output only. URI where logs for this execution can be found in Cloud
2455 /// Console.
2456 pub log_uri: std::string::String,
2457
2458 /// Output only. Reserved for future use.
2459 pub satisfies_pzs: bool,
2460
2461 /// Output only. A system-generated fingerprint for this version of the
2462 /// resource. May be used to detect modification conflict during updates.
2463 pub etag: std::string::String,
2464
2465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2466}
2467
2468impl Execution {
2469 pub fn new() -> Self {
2470 std::default::Default::default()
2471 }
2472
2473 /// Sets the value of [name][crate::model::Execution::name].
2474 ///
2475 /// # Example
2476 /// ```ignore,no_run
2477 /// # use google_cloud_run_v2::model::Execution;
2478 /// let x = Execution::new().set_name("example");
2479 /// ```
2480 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2481 self.name = v.into();
2482 self
2483 }
2484
2485 /// Sets the value of [uid][crate::model::Execution::uid].
2486 ///
2487 /// # Example
2488 /// ```ignore,no_run
2489 /// # use google_cloud_run_v2::model::Execution;
2490 /// let x = Execution::new().set_uid("example");
2491 /// ```
2492 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2493 self.uid = v.into();
2494 self
2495 }
2496
2497 /// Sets the value of [creator][crate::model::Execution::creator].
2498 ///
2499 /// # Example
2500 /// ```ignore,no_run
2501 /// # use google_cloud_run_v2::model::Execution;
2502 /// let x = Execution::new().set_creator("example");
2503 /// ```
2504 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2505 self.creator = v.into();
2506 self
2507 }
2508
2509 /// Sets the value of [generation][crate::model::Execution::generation].
2510 ///
2511 /// # Example
2512 /// ```ignore,no_run
2513 /// # use google_cloud_run_v2::model::Execution;
2514 /// let x = Execution::new().set_generation(42);
2515 /// ```
2516 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2517 self.generation = v.into();
2518 self
2519 }
2520
2521 /// Sets the value of [labels][crate::model::Execution::labels].
2522 ///
2523 /// # Example
2524 /// ```ignore,no_run
2525 /// # use google_cloud_run_v2::model::Execution;
2526 /// let x = Execution::new().set_labels([
2527 /// ("key0", "abc"),
2528 /// ("key1", "xyz"),
2529 /// ]);
2530 /// ```
2531 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2532 where
2533 T: std::iter::IntoIterator<Item = (K, V)>,
2534 K: std::convert::Into<std::string::String>,
2535 V: std::convert::Into<std::string::String>,
2536 {
2537 use std::iter::Iterator;
2538 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2539 self
2540 }
2541
2542 /// Sets the value of [annotations][crate::model::Execution::annotations].
2543 ///
2544 /// # Example
2545 /// ```ignore,no_run
2546 /// # use google_cloud_run_v2::model::Execution;
2547 /// let x = Execution::new().set_annotations([
2548 /// ("key0", "abc"),
2549 /// ("key1", "xyz"),
2550 /// ]);
2551 /// ```
2552 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2553 where
2554 T: std::iter::IntoIterator<Item = (K, V)>,
2555 K: std::convert::Into<std::string::String>,
2556 V: std::convert::Into<std::string::String>,
2557 {
2558 use std::iter::Iterator;
2559 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2560 self
2561 }
2562
2563 /// Sets the value of [create_time][crate::model::Execution::create_time].
2564 ///
2565 /// # Example
2566 /// ```ignore,no_run
2567 /// # use google_cloud_run_v2::model::Execution;
2568 /// use wkt::Timestamp;
2569 /// let x = Execution::new().set_create_time(Timestamp::default()/* use setters */);
2570 /// ```
2571 pub fn set_create_time<T>(mut self, v: T) -> Self
2572 where
2573 T: std::convert::Into<wkt::Timestamp>,
2574 {
2575 self.create_time = std::option::Option::Some(v.into());
2576 self
2577 }
2578
2579 /// Sets or clears the value of [create_time][crate::model::Execution::create_time].
2580 ///
2581 /// # Example
2582 /// ```ignore,no_run
2583 /// # use google_cloud_run_v2::model::Execution;
2584 /// use wkt::Timestamp;
2585 /// let x = Execution::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2586 /// let x = Execution::new().set_or_clear_create_time(None::<Timestamp>);
2587 /// ```
2588 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2589 where
2590 T: std::convert::Into<wkt::Timestamp>,
2591 {
2592 self.create_time = v.map(|x| x.into());
2593 self
2594 }
2595
2596 /// Sets the value of [start_time][crate::model::Execution::start_time].
2597 ///
2598 /// # Example
2599 /// ```ignore,no_run
2600 /// # use google_cloud_run_v2::model::Execution;
2601 /// use wkt::Timestamp;
2602 /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
2603 /// ```
2604 pub fn set_start_time<T>(mut self, v: T) -> Self
2605 where
2606 T: std::convert::Into<wkt::Timestamp>,
2607 {
2608 self.start_time = std::option::Option::Some(v.into());
2609 self
2610 }
2611
2612 /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
2613 ///
2614 /// # Example
2615 /// ```ignore,no_run
2616 /// # use google_cloud_run_v2::model::Execution;
2617 /// use wkt::Timestamp;
2618 /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2619 /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
2620 /// ```
2621 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2622 where
2623 T: std::convert::Into<wkt::Timestamp>,
2624 {
2625 self.start_time = v.map(|x| x.into());
2626 self
2627 }
2628
2629 /// Sets the value of [completion_time][crate::model::Execution::completion_time].
2630 ///
2631 /// # Example
2632 /// ```ignore,no_run
2633 /// # use google_cloud_run_v2::model::Execution;
2634 /// use wkt::Timestamp;
2635 /// let x = Execution::new().set_completion_time(Timestamp::default()/* use setters */);
2636 /// ```
2637 pub fn set_completion_time<T>(mut self, v: T) -> Self
2638 where
2639 T: std::convert::Into<wkt::Timestamp>,
2640 {
2641 self.completion_time = std::option::Option::Some(v.into());
2642 self
2643 }
2644
2645 /// Sets or clears the value of [completion_time][crate::model::Execution::completion_time].
2646 ///
2647 /// # Example
2648 /// ```ignore,no_run
2649 /// # use google_cloud_run_v2::model::Execution;
2650 /// use wkt::Timestamp;
2651 /// let x = Execution::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
2652 /// let x = Execution::new().set_or_clear_completion_time(None::<Timestamp>);
2653 /// ```
2654 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
2655 where
2656 T: std::convert::Into<wkt::Timestamp>,
2657 {
2658 self.completion_time = v.map(|x| x.into());
2659 self
2660 }
2661
2662 /// Sets the value of [update_time][crate::model::Execution::update_time].
2663 ///
2664 /// # Example
2665 /// ```ignore,no_run
2666 /// # use google_cloud_run_v2::model::Execution;
2667 /// use wkt::Timestamp;
2668 /// let x = Execution::new().set_update_time(Timestamp::default()/* use setters */);
2669 /// ```
2670 pub fn set_update_time<T>(mut self, v: T) -> Self
2671 where
2672 T: std::convert::Into<wkt::Timestamp>,
2673 {
2674 self.update_time = std::option::Option::Some(v.into());
2675 self
2676 }
2677
2678 /// Sets or clears the value of [update_time][crate::model::Execution::update_time].
2679 ///
2680 /// # Example
2681 /// ```ignore,no_run
2682 /// # use google_cloud_run_v2::model::Execution;
2683 /// use wkt::Timestamp;
2684 /// let x = Execution::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2685 /// let x = Execution::new().set_or_clear_update_time(None::<Timestamp>);
2686 /// ```
2687 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2688 where
2689 T: std::convert::Into<wkt::Timestamp>,
2690 {
2691 self.update_time = v.map(|x| x.into());
2692 self
2693 }
2694
2695 /// Sets the value of [delete_time][crate::model::Execution::delete_time].
2696 ///
2697 /// # Example
2698 /// ```ignore,no_run
2699 /// # use google_cloud_run_v2::model::Execution;
2700 /// use wkt::Timestamp;
2701 /// let x = Execution::new().set_delete_time(Timestamp::default()/* use setters */);
2702 /// ```
2703 pub fn set_delete_time<T>(mut self, v: T) -> Self
2704 where
2705 T: std::convert::Into<wkt::Timestamp>,
2706 {
2707 self.delete_time = std::option::Option::Some(v.into());
2708 self
2709 }
2710
2711 /// Sets or clears the value of [delete_time][crate::model::Execution::delete_time].
2712 ///
2713 /// # Example
2714 /// ```ignore,no_run
2715 /// # use google_cloud_run_v2::model::Execution;
2716 /// use wkt::Timestamp;
2717 /// let x = Execution::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2718 /// let x = Execution::new().set_or_clear_delete_time(None::<Timestamp>);
2719 /// ```
2720 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2721 where
2722 T: std::convert::Into<wkt::Timestamp>,
2723 {
2724 self.delete_time = v.map(|x| x.into());
2725 self
2726 }
2727
2728 /// Sets the value of [expire_time][crate::model::Execution::expire_time].
2729 ///
2730 /// # Example
2731 /// ```ignore,no_run
2732 /// # use google_cloud_run_v2::model::Execution;
2733 /// use wkt::Timestamp;
2734 /// let x = Execution::new().set_expire_time(Timestamp::default()/* use setters */);
2735 /// ```
2736 pub fn set_expire_time<T>(mut self, v: T) -> Self
2737 where
2738 T: std::convert::Into<wkt::Timestamp>,
2739 {
2740 self.expire_time = std::option::Option::Some(v.into());
2741 self
2742 }
2743
2744 /// Sets or clears the value of [expire_time][crate::model::Execution::expire_time].
2745 ///
2746 /// # Example
2747 /// ```ignore,no_run
2748 /// # use google_cloud_run_v2::model::Execution;
2749 /// use wkt::Timestamp;
2750 /// let x = Execution::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2751 /// let x = Execution::new().set_or_clear_expire_time(None::<Timestamp>);
2752 /// ```
2753 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2754 where
2755 T: std::convert::Into<wkt::Timestamp>,
2756 {
2757 self.expire_time = v.map(|x| x.into());
2758 self
2759 }
2760
2761 /// Sets the value of [launch_stage][crate::model::Execution::launch_stage].
2762 ///
2763 /// # Example
2764 /// ```ignore,no_run
2765 /// # use google_cloud_run_v2::model::Execution;
2766 /// use google_cloud_api::model::LaunchStage;
2767 /// let x0 = Execution::new().set_launch_stage(LaunchStage::Unimplemented);
2768 /// let x1 = Execution::new().set_launch_stage(LaunchStage::Prelaunch);
2769 /// let x2 = Execution::new().set_launch_stage(LaunchStage::EarlyAccess);
2770 /// ```
2771 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
2772 mut self,
2773 v: T,
2774 ) -> Self {
2775 self.launch_stage = v.into();
2776 self
2777 }
2778
2779 /// Sets the value of [job][crate::model::Execution::job].
2780 ///
2781 /// # Example
2782 /// ```ignore,no_run
2783 /// # use google_cloud_run_v2::model::Execution;
2784 /// let x = Execution::new().set_job("example");
2785 /// ```
2786 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2787 self.job = v.into();
2788 self
2789 }
2790
2791 /// Sets the value of [parallelism][crate::model::Execution::parallelism].
2792 ///
2793 /// # Example
2794 /// ```ignore,no_run
2795 /// # use google_cloud_run_v2::model::Execution;
2796 /// let x = Execution::new().set_parallelism(42);
2797 /// ```
2798 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2799 self.parallelism = v.into();
2800 self
2801 }
2802
2803 /// Sets the value of [task_count][crate::model::Execution::task_count].
2804 ///
2805 /// # Example
2806 /// ```ignore,no_run
2807 /// # use google_cloud_run_v2::model::Execution;
2808 /// let x = Execution::new().set_task_count(42);
2809 /// ```
2810 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2811 self.task_count = v.into();
2812 self
2813 }
2814
2815 /// Sets the value of [template][crate::model::Execution::template].
2816 ///
2817 /// # Example
2818 /// ```ignore,no_run
2819 /// # use google_cloud_run_v2::model::Execution;
2820 /// use google_cloud_run_v2::model::TaskTemplate;
2821 /// let x = Execution::new().set_template(TaskTemplate::default()/* use setters */);
2822 /// ```
2823 pub fn set_template<T>(mut self, v: T) -> Self
2824 where
2825 T: std::convert::Into<crate::model::TaskTemplate>,
2826 {
2827 self.template = std::option::Option::Some(v.into());
2828 self
2829 }
2830
2831 /// Sets or clears the value of [template][crate::model::Execution::template].
2832 ///
2833 /// # Example
2834 /// ```ignore,no_run
2835 /// # use google_cloud_run_v2::model::Execution;
2836 /// use google_cloud_run_v2::model::TaskTemplate;
2837 /// let x = Execution::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
2838 /// let x = Execution::new().set_or_clear_template(None::<TaskTemplate>);
2839 /// ```
2840 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
2841 where
2842 T: std::convert::Into<crate::model::TaskTemplate>,
2843 {
2844 self.template = v.map(|x| x.into());
2845 self
2846 }
2847
2848 /// Sets the value of [reconciling][crate::model::Execution::reconciling].
2849 ///
2850 /// # Example
2851 /// ```ignore,no_run
2852 /// # use google_cloud_run_v2::model::Execution;
2853 /// let x = Execution::new().set_reconciling(true);
2854 /// ```
2855 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2856 self.reconciling = v.into();
2857 self
2858 }
2859
2860 /// Sets the value of [conditions][crate::model::Execution::conditions].
2861 ///
2862 /// # Example
2863 /// ```ignore,no_run
2864 /// # use google_cloud_run_v2::model::Execution;
2865 /// use google_cloud_run_v2::model::Condition;
2866 /// let x = Execution::new()
2867 /// .set_conditions([
2868 /// Condition::default()/* use setters */,
2869 /// Condition::default()/* use (different) setters */,
2870 /// ]);
2871 /// ```
2872 pub fn set_conditions<T, V>(mut self, v: T) -> Self
2873 where
2874 T: std::iter::IntoIterator<Item = V>,
2875 V: std::convert::Into<crate::model::Condition>,
2876 {
2877 use std::iter::Iterator;
2878 self.conditions = v.into_iter().map(|i| i.into()).collect();
2879 self
2880 }
2881
2882 /// Sets the value of [observed_generation][crate::model::Execution::observed_generation].
2883 ///
2884 /// # Example
2885 /// ```ignore,no_run
2886 /// # use google_cloud_run_v2::model::Execution;
2887 /// let x = Execution::new().set_observed_generation(42);
2888 /// ```
2889 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2890 self.observed_generation = v.into();
2891 self
2892 }
2893
2894 /// Sets the value of [running_count][crate::model::Execution::running_count].
2895 ///
2896 /// # Example
2897 /// ```ignore,no_run
2898 /// # use google_cloud_run_v2::model::Execution;
2899 /// let x = Execution::new().set_running_count(42);
2900 /// ```
2901 pub fn set_running_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2902 self.running_count = v.into();
2903 self
2904 }
2905
2906 /// Sets the value of [succeeded_count][crate::model::Execution::succeeded_count].
2907 ///
2908 /// # Example
2909 /// ```ignore,no_run
2910 /// # use google_cloud_run_v2::model::Execution;
2911 /// let x = Execution::new().set_succeeded_count(42);
2912 /// ```
2913 pub fn set_succeeded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2914 self.succeeded_count = v.into();
2915 self
2916 }
2917
2918 /// Sets the value of [failed_count][crate::model::Execution::failed_count].
2919 ///
2920 /// # Example
2921 /// ```ignore,no_run
2922 /// # use google_cloud_run_v2::model::Execution;
2923 /// let x = Execution::new().set_failed_count(42);
2924 /// ```
2925 pub fn set_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2926 self.failed_count = v.into();
2927 self
2928 }
2929
2930 /// Sets the value of [cancelled_count][crate::model::Execution::cancelled_count].
2931 ///
2932 /// # Example
2933 /// ```ignore,no_run
2934 /// # use google_cloud_run_v2::model::Execution;
2935 /// let x = Execution::new().set_cancelled_count(42);
2936 /// ```
2937 pub fn set_cancelled_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2938 self.cancelled_count = v.into();
2939 self
2940 }
2941
2942 /// Sets the value of [retried_count][crate::model::Execution::retried_count].
2943 ///
2944 /// # Example
2945 /// ```ignore,no_run
2946 /// # use google_cloud_run_v2::model::Execution;
2947 /// let x = Execution::new().set_retried_count(42);
2948 /// ```
2949 pub fn set_retried_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2950 self.retried_count = v.into();
2951 self
2952 }
2953
2954 /// Sets the value of [log_uri][crate::model::Execution::log_uri].
2955 ///
2956 /// # Example
2957 /// ```ignore,no_run
2958 /// # use google_cloud_run_v2::model::Execution;
2959 /// let x = Execution::new().set_log_uri("example");
2960 /// ```
2961 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2962 self.log_uri = v.into();
2963 self
2964 }
2965
2966 /// Sets the value of [satisfies_pzs][crate::model::Execution::satisfies_pzs].
2967 ///
2968 /// # Example
2969 /// ```ignore,no_run
2970 /// # use google_cloud_run_v2::model::Execution;
2971 /// let x = Execution::new().set_satisfies_pzs(true);
2972 /// ```
2973 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2974 self.satisfies_pzs = v.into();
2975 self
2976 }
2977
2978 /// Sets the value of [etag][crate::model::Execution::etag].
2979 ///
2980 /// # Example
2981 /// ```ignore,no_run
2982 /// # use google_cloud_run_v2::model::Execution;
2983 /// let x = Execution::new().set_etag("example");
2984 /// ```
2985 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2986 self.etag = v.into();
2987 self
2988 }
2989}
2990
2991impl wkt::message::Message for Execution {
2992 fn typename() -> &'static str {
2993 "type.googleapis.com/google.cloud.run.v2.Execution"
2994 }
2995}
2996
2997/// ExecutionTemplate describes the data an execution should have when created
2998/// from a template.
2999#[derive(Clone, Default, PartialEq)]
3000#[non_exhaustive]
3001pub struct ExecutionTemplate {
3002 /// Unstructured key value map that can be used to organize and categorize
3003 /// objects.
3004 /// User-provided labels are shared with Google's billing system, so they can
3005 /// be used to filter, or break down billing charges by team, component,
3006 /// environment, state, etc. For more information, visit
3007 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
3008 /// <https://cloud.google.com/run/docs/configuring/labels>.
3009 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3010
3011 /// Unstructured key value map that may be set by external tools to store and
3012 /// arbitrary metadata. They are not queryable and should be preserved
3013 /// when modifying objects.
3014 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3015
3016 /// Optional. Specifies the maximum desired number of tasks the execution
3017 /// should run at given time. When the job is run, if this field is 0 or unset,
3018 /// the maximum possible value will be used for that execution. The actual
3019 /// number of tasks running in steady state will be less than this number when
3020 /// there are fewer tasks waiting to be completed remaining, i.e. when the work
3021 /// left to do is less than max parallelism.
3022 pub parallelism: i32,
3023
3024 /// Specifies the desired number of tasks the execution should run.
3025 /// Setting to 1 means that parallelism is limited to 1 and the success of
3026 /// that task signals the success of the execution. Defaults to 1.
3027 pub task_count: i32,
3028
3029 /// Required. Describes the task(s) that will be created when executing an
3030 /// execution.
3031 pub template: std::option::Option<crate::model::TaskTemplate>,
3032
3033 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3034}
3035
3036impl ExecutionTemplate {
3037 pub fn new() -> Self {
3038 std::default::Default::default()
3039 }
3040
3041 /// Sets the value of [labels][crate::model::ExecutionTemplate::labels].
3042 ///
3043 /// # Example
3044 /// ```ignore,no_run
3045 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3046 /// let x = ExecutionTemplate::new().set_labels([
3047 /// ("key0", "abc"),
3048 /// ("key1", "xyz"),
3049 /// ]);
3050 /// ```
3051 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3052 where
3053 T: std::iter::IntoIterator<Item = (K, V)>,
3054 K: std::convert::Into<std::string::String>,
3055 V: std::convert::Into<std::string::String>,
3056 {
3057 use std::iter::Iterator;
3058 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3059 self
3060 }
3061
3062 /// Sets the value of [annotations][crate::model::ExecutionTemplate::annotations].
3063 ///
3064 /// # Example
3065 /// ```ignore,no_run
3066 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3067 /// let x = ExecutionTemplate::new().set_annotations([
3068 /// ("key0", "abc"),
3069 /// ("key1", "xyz"),
3070 /// ]);
3071 /// ```
3072 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3073 where
3074 T: std::iter::IntoIterator<Item = (K, V)>,
3075 K: std::convert::Into<std::string::String>,
3076 V: std::convert::Into<std::string::String>,
3077 {
3078 use std::iter::Iterator;
3079 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3080 self
3081 }
3082
3083 /// Sets the value of [parallelism][crate::model::ExecutionTemplate::parallelism].
3084 ///
3085 /// # Example
3086 /// ```ignore,no_run
3087 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3088 /// let x = ExecutionTemplate::new().set_parallelism(42);
3089 /// ```
3090 pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3091 self.parallelism = v.into();
3092 self
3093 }
3094
3095 /// Sets the value of [task_count][crate::model::ExecutionTemplate::task_count].
3096 ///
3097 /// # Example
3098 /// ```ignore,no_run
3099 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3100 /// let x = ExecutionTemplate::new().set_task_count(42);
3101 /// ```
3102 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3103 self.task_count = v.into();
3104 self
3105 }
3106
3107 /// Sets the value of [template][crate::model::ExecutionTemplate::template].
3108 ///
3109 /// # Example
3110 /// ```ignore,no_run
3111 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3112 /// use google_cloud_run_v2::model::TaskTemplate;
3113 /// let x = ExecutionTemplate::new().set_template(TaskTemplate::default()/* use setters */);
3114 /// ```
3115 pub fn set_template<T>(mut self, v: T) -> Self
3116 where
3117 T: std::convert::Into<crate::model::TaskTemplate>,
3118 {
3119 self.template = std::option::Option::Some(v.into());
3120 self
3121 }
3122
3123 /// Sets or clears the value of [template][crate::model::ExecutionTemplate::template].
3124 ///
3125 /// # Example
3126 /// ```ignore,no_run
3127 /// # use google_cloud_run_v2::model::ExecutionTemplate;
3128 /// use google_cloud_run_v2::model::TaskTemplate;
3129 /// let x = ExecutionTemplate::new().set_or_clear_template(Some(TaskTemplate::default()/* use setters */));
3130 /// let x = ExecutionTemplate::new().set_or_clear_template(None::<TaskTemplate>);
3131 /// ```
3132 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
3133 where
3134 T: std::convert::Into<crate::model::TaskTemplate>,
3135 {
3136 self.template = v.map(|x| x.into());
3137 self
3138 }
3139}
3140
3141impl wkt::message::Message for ExecutionTemplate {
3142 fn typename() -> &'static str {
3143 "type.googleapis.com/google.cloud.run.v2.ExecutionTemplate"
3144 }
3145}
3146
3147#[derive(Clone, Default, PartialEq)]
3148#[non_exhaustive]
3149pub struct CreateInstanceRequest {
3150 pub parent: std::string::String,
3151
3152 pub instance: std::option::Option<crate::model::Instance>,
3153
3154 /// Required. The unique identifier for the Instance. It must begin with
3155 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
3156 /// The name of the instance becomes {parent}/instances/{instance_id}.
3157 pub instance_id: std::string::String,
3158
3159 /// Optional. Indicates that the request should be validated and default values
3160 /// populated, without persisting the request or creating any resources.
3161 pub validate_only: bool,
3162
3163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3164}
3165
3166impl CreateInstanceRequest {
3167 pub fn new() -> Self {
3168 std::default::Default::default()
3169 }
3170
3171 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3172 ///
3173 /// # Example
3174 /// ```ignore,no_run
3175 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3176 /// let x = CreateInstanceRequest::new().set_parent("example");
3177 /// ```
3178 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3179 self.parent = v.into();
3180 self
3181 }
3182
3183 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3184 ///
3185 /// # Example
3186 /// ```ignore,no_run
3187 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3188 /// use google_cloud_run_v2::model::Instance;
3189 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
3190 /// ```
3191 pub fn set_instance<T>(mut self, v: T) -> Self
3192 where
3193 T: std::convert::Into<crate::model::Instance>,
3194 {
3195 self.instance = std::option::Option::Some(v.into());
3196 self
3197 }
3198
3199 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3200 ///
3201 /// # Example
3202 /// ```ignore,no_run
3203 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3204 /// use google_cloud_run_v2::model::Instance;
3205 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
3206 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
3207 /// ```
3208 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3209 where
3210 T: std::convert::Into<crate::model::Instance>,
3211 {
3212 self.instance = v.map(|x| x.into());
3213 self
3214 }
3215
3216 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3217 ///
3218 /// # Example
3219 /// ```ignore,no_run
3220 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3221 /// let x = CreateInstanceRequest::new().set_instance_id("example");
3222 /// ```
3223 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3224 self.instance_id = v.into();
3225 self
3226 }
3227
3228 /// Sets the value of [validate_only][crate::model::CreateInstanceRequest::validate_only].
3229 ///
3230 /// # Example
3231 /// ```ignore,no_run
3232 /// # use google_cloud_run_v2::model::CreateInstanceRequest;
3233 /// let x = CreateInstanceRequest::new().set_validate_only(true);
3234 /// ```
3235 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3236 self.validate_only = v.into();
3237 self
3238 }
3239}
3240
3241impl wkt::message::Message for CreateInstanceRequest {
3242 fn typename() -> &'static str {
3243 "type.googleapis.com/google.cloud.run.v2.CreateInstanceRequest"
3244 }
3245}
3246
3247#[derive(Clone, Default, PartialEq)]
3248#[non_exhaustive]
3249pub struct GetInstanceRequest {
3250 pub name: std::string::String,
3251
3252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3253}
3254
3255impl GetInstanceRequest {
3256 pub fn new() -> Self {
3257 std::default::Default::default()
3258 }
3259
3260 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3261 ///
3262 /// # Example
3263 /// ```ignore,no_run
3264 /// # use google_cloud_run_v2::model::GetInstanceRequest;
3265 /// let x = GetInstanceRequest::new().set_name("example");
3266 /// ```
3267 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3268 self.name = v.into();
3269 self
3270 }
3271}
3272
3273impl wkt::message::Message for GetInstanceRequest {
3274 fn typename() -> &'static str {
3275 "type.googleapis.com/google.cloud.run.v2.GetInstanceRequest"
3276 }
3277}
3278
3279#[derive(Clone, Default, PartialEq)]
3280#[non_exhaustive]
3281pub struct DeleteInstanceRequest {
3282 pub name: std::string::String,
3283
3284 /// Optional. Indicates that the request should be validated without actually
3285 /// deleting any resources.
3286 pub validate_only: bool,
3287
3288 /// Optional. A system-generated fingerprint for this version of the
3289 /// resource. May be used to detect modification conflict during updates.
3290 pub etag: std::string::String,
3291
3292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3293}
3294
3295impl DeleteInstanceRequest {
3296 pub fn new() -> Self {
3297 std::default::Default::default()
3298 }
3299
3300 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3301 ///
3302 /// # Example
3303 /// ```ignore,no_run
3304 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3305 /// let x = DeleteInstanceRequest::new().set_name("example");
3306 /// ```
3307 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3308 self.name = v.into();
3309 self
3310 }
3311
3312 /// Sets the value of [validate_only][crate::model::DeleteInstanceRequest::validate_only].
3313 ///
3314 /// # Example
3315 /// ```ignore,no_run
3316 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3317 /// let x = DeleteInstanceRequest::new().set_validate_only(true);
3318 /// ```
3319 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3320 self.validate_only = v.into();
3321 self
3322 }
3323
3324 /// Sets the value of [etag][crate::model::DeleteInstanceRequest::etag].
3325 ///
3326 /// # Example
3327 /// ```ignore,no_run
3328 /// # use google_cloud_run_v2::model::DeleteInstanceRequest;
3329 /// let x = DeleteInstanceRequest::new().set_etag("example");
3330 /// ```
3331 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3332 self.etag = v.into();
3333 self
3334 }
3335}
3336
3337impl wkt::message::Message for DeleteInstanceRequest {
3338 fn typename() -> &'static str {
3339 "type.googleapis.com/google.cloud.run.v2.DeleteInstanceRequest"
3340 }
3341}
3342
3343/// Request message for retrieving a list of Instances.
3344#[derive(Clone, Default, PartialEq)]
3345#[non_exhaustive]
3346pub struct ListInstancesRequest {
3347 /// Required. The location and project to list resources on.
3348 /// Format: projects/{project}/locations/{location}, where {project} can be
3349 /// project id or number.
3350 pub parent: std::string::String,
3351
3352 /// Optional. Maximum number of Instances to return in this call.
3353 pub page_size: i32,
3354
3355 /// Optional. A page token received from a previous call to ListInstances.
3356 /// All other parameters must match.
3357 pub page_token: std::string::String,
3358
3359 /// Optional. If true, returns deleted (but unexpired) resources along with
3360 /// active ones.
3361 pub show_deleted: bool,
3362
3363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3364}
3365
3366impl ListInstancesRequest {
3367 pub fn new() -> Self {
3368 std::default::Default::default()
3369 }
3370
3371 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
3372 ///
3373 /// # Example
3374 /// ```ignore,no_run
3375 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3376 /// let x = ListInstancesRequest::new().set_parent("example");
3377 /// ```
3378 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3379 self.parent = v.into();
3380 self
3381 }
3382
3383 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
3384 ///
3385 /// # Example
3386 /// ```ignore,no_run
3387 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3388 /// let x = ListInstancesRequest::new().set_page_size(42);
3389 /// ```
3390 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3391 self.page_size = v.into();
3392 self
3393 }
3394
3395 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
3396 ///
3397 /// # Example
3398 /// ```ignore,no_run
3399 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3400 /// let x = ListInstancesRequest::new().set_page_token("example");
3401 /// ```
3402 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3403 self.page_token = v.into();
3404 self
3405 }
3406
3407 /// Sets the value of [show_deleted][crate::model::ListInstancesRequest::show_deleted].
3408 ///
3409 /// # Example
3410 /// ```ignore,no_run
3411 /// # use google_cloud_run_v2::model::ListInstancesRequest;
3412 /// let x = ListInstancesRequest::new().set_show_deleted(true);
3413 /// ```
3414 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3415 self.show_deleted = v.into();
3416 self
3417 }
3418}
3419
3420impl wkt::message::Message for ListInstancesRequest {
3421 fn typename() -> &'static str {
3422 "type.googleapis.com/google.cloud.run.v2.ListInstancesRequest"
3423 }
3424}
3425
3426/// Response message containing a list of Instances.
3427#[derive(Clone, Default, PartialEq)]
3428#[non_exhaustive]
3429pub struct ListInstancesResponse {
3430 /// The resulting list of Instances.
3431 pub instances: std::vec::Vec<crate::model::Instance>,
3432
3433 /// A token indicating there are more items than page_size. Use it in the next
3434 /// ListInstances request to continue.
3435 pub next_page_token: std::string::String,
3436
3437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3438}
3439
3440impl ListInstancesResponse {
3441 pub fn new() -> Self {
3442 std::default::Default::default()
3443 }
3444
3445 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
3446 ///
3447 /// # Example
3448 /// ```ignore,no_run
3449 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3450 /// use google_cloud_run_v2::model::Instance;
3451 /// let x = ListInstancesResponse::new()
3452 /// .set_instances([
3453 /// Instance::default()/* use setters */,
3454 /// Instance::default()/* use (different) setters */,
3455 /// ]);
3456 /// ```
3457 pub fn set_instances<T, V>(mut self, v: T) -> Self
3458 where
3459 T: std::iter::IntoIterator<Item = V>,
3460 V: std::convert::Into<crate::model::Instance>,
3461 {
3462 use std::iter::Iterator;
3463 self.instances = v.into_iter().map(|i| i.into()).collect();
3464 self
3465 }
3466
3467 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
3468 ///
3469 /// # Example
3470 /// ```ignore,no_run
3471 /// # use google_cloud_run_v2::model::ListInstancesResponse;
3472 /// let x = ListInstancesResponse::new().set_next_page_token("example");
3473 /// ```
3474 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3475 self.next_page_token = v.into();
3476 self
3477 }
3478}
3479
3480impl wkt::message::Message for ListInstancesResponse {
3481 fn typename() -> &'static str {
3482 "type.googleapis.com/google.cloud.run.v2.ListInstancesResponse"
3483 }
3484}
3485
3486#[doc(hidden)]
3487impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
3488 type PageItem = crate::model::Instance;
3489
3490 fn items(self) -> std::vec::Vec<Self::PageItem> {
3491 self.instances
3492 }
3493
3494 fn next_page_token(&self) -> std::string::String {
3495 use std::clone::Clone;
3496 self.next_page_token.clone()
3497 }
3498}
3499
3500/// Request message for deleting an Instance.
3501#[derive(Clone, Default, PartialEq)]
3502#[non_exhaustive]
3503pub struct StopInstanceRequest {
3504 /// Required. The name of the Instance to stop.
3505 /// Format:
3506 /// `projects/{project}/locations/{location}/instances/{instance}`,
3507 /// where `{project}` can be project id or number.
3508 pub name: std::string::String,
3509
3510 /// Optional. Indicates that the request should be validated without actually
3511 /// stopping any resources.
3512 pub validate_only: bool,
3513
3514 /// Optional. A system-generated fingerprint for this version of the resource.
3515 /// This may be used to detect modification conflict during updates.
3516 pub etag: std::string::String,
3517
3518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3519}
3520
3521impl StopInstanceRequest {
3522 pub fn new() -> Self {
3523 std::default::Default::default()
3524 }
3525
3526 /// Sets the value of [name][crate::model::StopInstanceRequest::name].
3527 ///
3528 /// # Example
3529 /// ```ignore,no_run
3530 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3531 /// let x = StopInstanceRequest::new().set_name("example");
3532 /// ```
3533 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3534 self.name = v.into();
3535 self
3536 }
3537
3538 /// Sets the value of [validate_only][crate::model::StopInstanceRequest::validate_only].
3539 ///
3540 /// # Example
3541 /// ```ignore,no_run
3542 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3543 /// let x = StopInstanceRequest::new().set_validate_only(true);
3544 /// ```
3545 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3546 self.validate_only = v.into();
3547 self
3548 }
3549
3550 /// Sets the value of [etag][crate::model::StopInstanceRequest::etag].
3551 ///
3552 /// # Example
3553 /// ```ignore,no_run
3554 /// # use google_cloud_run_v2::model::StopInstanceRequest;
3555 /// let x = StopInstanceRequest::new().set_etag("example");
3556 /// ```
3557 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3558 self.etag = v.into();
3559 self
3560 }
3561}
3562
3563impl wkt::message::Message for StopInstanceRequest {
3564 fn typename() -> &'static str {
3565 "type.googleapis.com/google.cloud.run.v2.StopInstanceRequest"
3566 }
3567}
3568
3569/// Request message for starting an Instance.
3570#[derive(Clone, Default, PartialEq)]
3571#[non_exhaustive]
3572pub struct StartInstanceRequest {
3573 /// Required. The name of the Instance to stop.
3574 /// Format:
3575 /// `projects/{project}/locations/{location}/instances/{instance}`,
3576 /// where `{project}` can be project id or number.
3577 pub name: std::string::String,
3578
3579 /// Optional. Indicates that the request should be validated without actually
3580 /// stopping any resources.
3581 pub validate_only: bool,
3582
3583 /// Optional. A system-generated fingerprint for this version of the resource.
3584 /// This may be used to detect modification conflict during updates.
3585 pub etag: std::string::String,
3586
3587 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3588}
3589
3590impl StartInstanceRequest {
3591 pub fn new() -> Self {
3592 std::default::Default::default()
3593 }
3594
3595 /// Sets the value of [name][crate::model::StartInstanceRequest::name].
3596 ///
3597 /// # Example
3598 /// ```ignore,no_run
3599 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3600 /// let x = StartInstanceRequest::new().set_name("example");
3601 /// ```
3602 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3603 self.name = v.into();
3604 self
3605 }
3606
3607 /// Sets the value of [validate_only][crate::model::StartInstanceRequest::validate_only].
3608 ///
3609 /// # Example
3610 /// ```ignore,no_run
3611 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3612 /// let x = StartInstanceRequest::new().set_validate_only(true);
3613 /// ```
3614 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3615 self.validate_only = v.into();
3616 self
3617 }
3618
3619 /// Sets the value of [etag][crate::model::StartInstanceRequest::etag].
3620 ///
3621 /// # Example
3622 /// ```ignore,no_run
3623 /// # use google_cloud_run_v2::model::StartInstanceRequest;
3624 /// let x = StartInstanceRequest::new().set_etag("example");
3625 /// ```
3626 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3627 self.etag = v.into();
3628 self
3629 }
3630}
3631
3632impl wkt::message::Message for StartInstanceRequest {
3633 fn typename() -> &'static str {
3634 "type.googleapis.com/google.cloud.run.v2.StartInstanceRequest"
3635 }
3636}
3637
3638/// A Cloud Run Instance represents a single group of containers running in a
3639/// region.
3640#[derive(Clone, Default, PartialEq)]
3641#[non_exhaustive]
3642pub struct Instance {
3643 /// The fully qualified name of this Instance. In CreateInstanceRequest, this
3644 /// field is ignored, and instead composed from CreateInstanceRequest.parent
3645 /// and CreateInstanceRequest.instance_id.
3646 ///
3647 /// Format:
3648 /// projects/{project}/locations/{location}/instances/{instance_id}
3649 pub name: std::string::String,
3650
3651 /// User-provided description of the Instance. This field currently has a
3652 /// 512-character limit.
3653 pub description: std::string::String,
3654
3655 /// Output only. Server assigned unique identifier for the trigger. The value
3656 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
3657 /// deleted.
3658 pub uid: std::string::String,
3659
3660 /// Output only. A number that monotonically increases every time the user
3661 /// modifies the desired state.
3662 /// Please note that unlike v1, this is an int64 value. As with most Google
3663 /// APIs, its JSON representation will be a `string` instead of an `integer`.
3664 pub generation: i64,
3665
3666 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3667
3668 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3669
3670 /// Output only. The creation time.
3671 pub create_time: std::option::Option<wkt::Timestamp>,
3672
3673 /// Output only. The last-modified time.
3674 pub update_time: std::option::Option<wkt::Timestamp>,
3675
3676 /// Output only. The deletion time.
3677 pub delete_time: std::option::Option<wkt::Timestamp>,
3678
3679 /// Output only. For a deleted resource, the time after which it will be
3680 /// permamently deleted.
3681 pub expire_time: std::option::Option<wkt::Timestamp>,
3682
3683 /// Output only. Email address of the authenticated creator.
3684 pub creator: std::string::String,
3685
3686 /// Output only. Email address of the last authenticated modifier.
3687 pub last_modifier: std::string::String,
3688
3689 /// Arbitrary identifier for the API client.
3690 pub client: std::string::String,
3691
3692 /// Arbitrary version identifier for the API client.
3693 pub client_version: std::string::String,
3694
3695 /// The launch stage as defined by [Google Cloud Platform
3696 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
3697 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
3698 /// is assumed.
3699 /// Set the launch stage to a preview stage on input to allow use of preview
3700 /// features in that stage. On read (or output), describes whether the
3701 /// resource uses preview features.
3702 pub launch_stage: google_cloud_api::model::LaunchStage,
3703
3704 /// Settings for the Binary Authorization feature.
3705 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
3706
3707 /// Optional. VPC Access configuration to use for this Revision. For more
3708 /// information, visit
3709 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
3710 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
3711
3712 pub service_account: std::string::String,
3713
3714 /// Required. Holds the single container that defines the unit of execution for
3715 /// this Instance.
3716 pub containers: std::vec::Vec<crate::model::Container>,
3717
3718 /// A list of Volumes to make available to containers.
3719 pub volumes: std::vec::Vec<crate::model::Volume>,
3720
3721 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
3722 /// this container image. For more information, go to
3723 /// <https://cloud.google.com/run/docs/securing/using-cmek>
3724 pub encryption_key: std::string::String,
3725
3726 /// The action to take if the encryption key is revoked.
3727 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
3728
3729 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
3730 /// shutting down all instances. The minimum increment is 1 hour.
3731 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
3732
3733 /// Optional. The node selector for the instance.
3734 pub node_selector: std::option::Option<crate::model::NodeSelector>,
3735
3736 /// Optional. True if GPU zonal redundancy is disabled on this instance.
3737 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
3738
3739 /// Optional. Provides the ingress settings for this Instance. On output,
3740 /// returns the currently observed ingress settings, or
3741 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
3742 pub ingress: crate::model::IngressTraffic,
3743
3744 /// Optional. Disables IAM permission check for run.routes.invoke for callers
3745 /// of this Instance. For more information, visit
3746 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
3747 pub invoker_iam_disabled: bool,
3748
3749 /// Optional. IAP settings on the Instance.
3750 pub iap_enabled: bool,
3751
3752 /// Output only. The generation of this Instance currently serving traffic. See
3753 /// comments in `reconciling` for additional information on reconciliation
3754 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
3755 /// As with most Google APIs, its JSON representation will be a `string`
3756 /// instead of an `integer`.
3757 pub observed_generation: i64,
3758
3759 /// Output only. The Google Console URI to obtain logs for the Instance.
3760 pub log_uri: std::string::String,
3761
3762 /// Output only. The Condition of this Instance, containing its readiness
3763 /// status, and detailed error information in case it did not reach a serving
3764 /// state. See comments in `reconciling` for additional information on
3765 /// reconciliation process in Cloud Run.
3766 pub terminal_condition: std::option::Option<crate::model::Condition>,
3767
3768 /// Output only. The Conditions of all other associated sub-resources. They
3769 /// contain additional diagnostics information in case the Instance does not
3770 /// reach its Serving state. See comments in `reconciling` for additional
3771 /// information on reconciliation process in Cloud Run.
3772 pub conditions: std::vec::Vec<crate::model::Condition>,
3773
3774 /// Output only. Status information for each of the specified containers. The
3775 /// status includes the resolved digest for specified images.
3776 pub container_statuses: std::vec::Vec<crate::model::ContainerStatus>,
3777
3778 /// Output only. Reserved for future use.
3779 pub satisfies_pzs: bool,
3780
3781 /// Output only. All URLs serving traffic for this Instance.
3782 pub urls: std::vec::Vec<std::string::String>,
3783
3784 /// Output only. Returns true if the Instance is currently being acted upon by
3785 /// the system to bring it into the desired state.
3786 ///
3787 /// When a new Instance is created, or an existing one is updated, Cloud Run
3788 /// will asynchronously perform all necessary steps to bring the Instance to
3789 /// the desired serving state. This process is called reconciliation. While
3790 /// reconciliation is in process, `observed_generation` will have a transient
3791 /// value that might mismatch the intended state.
3792 /// Once reconciliation is over (and this field is false), there are two
3793 /// possible outcomes: reconciliation succeeded and the serving state matches
3794 /// the Instance, or there was an error, and reconciliation failed. This state
3795 /// can be found in `terminal_condition.state`.
3796 pub reconciling: bool,
3797
3798 /// Optional. A system-generated fingerprint for this version of the
3799 /// resource. May be used to detect modification conflict during updates.
3800 pub etag: std::string::String,
3801
3802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3803}
3804
3805impl Instance {
3806 pub fn new() -> Self {
3807 std::default::Default::default()
3808 }
3809
3810 /// Sets the value of [name][crate::model::Instance::name].
3811 ///
3812 /// # Example
3813 /// ```ignore,no_run
3814 /// # use google_cloud_run_v2::model::Instance;
3815 /// let x = Instance::new().set_name("example");
3816 /// ```
3817 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3818 self.name = v.into();
3819 self
3820 }
3821
3822 /// Sets the value of [description][crate::model::Instance::description].
3823 ///
3824 /// # Example
3825 /// ```ignore,no_run
3826 /// # use google_cloud_run_v2::model::Instance;
3827 /// let x = Instance::new().set_description("example");
3828 /// ```
3829 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3830 self.description = v.into();
3831 self
3832 }
3833
3834 /// Sets the value of [uid][crate::model::Instance::uid].
3835 ///
3836 /// # Example
3837 /// ```ignore,no_run
3838 /// # use google_cloud_run_v2::model::Instance;
3839 /// let x = Instance::new().set_uid("example");
3840 /// ```
3841 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3842 self.uid = v.into();
3843 self
3844 }
3845
3846 /// Sets the value of [generation][crate::model::Instance::generation].
3847 ///
3848 /// # Example
3849 /// ```ignore,no_run
3850 /// # use google_cloud_run_v2::model::Instance;
3851 /// let x = Instance::new().set_generation(42);
3852 /// ```
3853 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3854 self.generation = v.into();
3855 self
3856 }
3857
3858 /// Sets the value of [labels][crate::model::Instance::labels].
3859 ///
3860 /// # Example
3861 /// ```ignore,no_run
3862 /// # use google_cloud_run_v2::model::Instance;
3863 /// let x = Instance::new().set_labels([
3864 /// ("key0", "abc"),
3865 /// ("key1", "xyz"),
3866 /// ]);
3867 /// ```
3868 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3869 where
3870 T: std::iter::IntoIterator<Item = (K, V)>,
3871 K: std::convert::Into<std::string::String>,
3872 V: std::convert::Into<std::string::String>,
3873 {
3874 use std::iter::Iterator;
3875 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3876 self
3877 }
3878
3879 /// Sets the value of [annotations][crate::model::Instance::annotations].
3880 ///
3881 /// # Example
3882 /// ```ignore,no_run
3883 /// # use google_cloud_run_v2::model::Instance;
3884 /// let x = Instance::new().set_annotations([
3885 /// ("key0", "abc"),
3886 /// ("key1", "xyz"),
3887 /// ]);
3888 /// ```
3889 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3890 where
3891 T: std::iter::IntoIterator<Item = (K, V)>,
3892 K: std::convert::Into<std::string::String>,
3893 V: std::convert::Into<std::string::String>,
3894 {
3895 use std::iter::Iterator;
3896 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3897 self
3898 }
3899
3900 /// Sets the value of [create_time][crate::model::Instance::create_time].
3901 ///
3902 /// # Example
3903 /// ```ignore,no_run
3904 /// # use google_cloud_run_v2::model::Instance;
3905 /// use wkt::Timestamp;
3906 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
3907 /// ```
3908 pub fn set_create_time<T>(mut self, v: T) -> Self
3909 where
3910 T: std::convert::Into<wkt::Timestamp>,
3911 {
3912 self.create_time = std::option::Option::Some(v.into());
3913 self
3914 }
3915
3916 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
3917 ///
3918 /// # Example
3919 /// ```ignore,no_run
3920 /// # use google_cloud_run_v2::model::Instance;
3921 /// use wkt::Timestamp;
3922 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3923 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
3924 /// ```
3925 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3926 where
3927 T: std::convert::Into<wkt::Timestamp>,
3928 {
3929 self.create_time = v.map(|x| x.into());
3930 self
3931 }
3932
3933 /// Sets the value of [update_time][crate::model::Instance::update_time].
3934 ///
3935 /// # Example
3936 /// ```ignore,no_run
3937 /// # use google_cloud_run_v2::model::Instance;
3938 /// use wkt::Timestamp;
3939 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
3940 /// ```
3941 pub fn set_update_time<T>(mut self, v: T) -> Self
3942 where
3943 T: std::convert::Into<wkt::Timestamp>,
3944 {
3945 self.update_time = std::option::Option::Some(v.into());
3946 self
3947 }
3948
3949 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
3950 ///
3951 /// # Example
3952 /// ```ignore,no_run
3953 /// # use google_cloud_run_v2::model::Instance;
3954 /// use wkt::Timestamp;
3955 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3956 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
3957 /// ```
3958 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3959 where
3960 T: std::convert::Into<wkt::Timestamp>,
3961 {
3962 self.update_time = v.map(|x| x.into());
3963 self
3964 }
3965
3966 /// Sets the value of [delete_time][crate::model::Instance::delete_time].
3967 ///
3968 /// # Example
3969 /// ```ignore,no_run
3970 /// # use google_cloud_run_v2::model::Instance;
3971 /// use wkt::Timestamp;
3972 /// let x = Instance::new().set_delete_time(Timestamp::default()/* use setters */);
3973 /// ```
3974 pub fn set_delete_time<T>(mut self, v: T) -> Self
3975 where
3976 T: std::convert::Into<wkt::Timestamp>,
3977 {
3978 self.delete_time = std::option::Option::Some(v.into());
3979 self
3980 }
3981
3982 /// Sets or clears the value of [delete_time][crate::model::Instance::delete_time].
3983 ///
3984 /// # Example
3985 /// ```ignore,no_run
3986 /// # use google_cloud_run_v2::model::Instance;
3987 /// use wkt::Timestamp;
3988 /// let x = Instance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3989 /// let x = Instance::new().set_or_clear_delete_time(None::<Timestamp>);
3990 /// ```
3991 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3992 where
3993 T: std::convert::Into<wkt::Timestamp>,
3994 {
3995 self.delete_time = v.map(|x| x.into());
3996 self
3997 }
3998
3999 /// Sets the value of [expire_time][crate::model::Instance::expire_time].
4000 ///
4001 /// # Example
4002 /// ```ignore,no_run
4003 /// # use google_cloud_run_v2::model::Instance;
4004 /// use wkt::Timestamp;
4005 /// let x = Instance::new().set_expire_time(Timestamp::default()/* use setters */);
4006 /// ```
4007 pub fn set_expire_time<T>(mut self, v: T) -> Self
4008 where
4009 T: std::convert::Into<wkt::Timestamp>,
4010 {
4011 self.expire_time = std::option::Option::Some(v.into());
4012 self
4013 }
4014
4015 /// Sets or clears the value of [expire_time][crate::model::Instance::expire_time].
4016 ///
4017 /// # Example
4018 /// ```ignore,no_run
4019 /// # use google_cloud_run_v2::model::Instance;
4020 /// use wkt::Timestamp;
4021 /// let x = Instance::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4022 /// let x = Instance::new().set_or_clear_expire_time(None::<Timestamp>);
4023 /// ```
4024 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4025 where
4026 T: std::convert::Into<wkt::Timestamp>,
4027 {
4028 self.expire_time = v.map(|x| x.into());
4029 self
4030 }
4031
4032 /// Sets the value of [creator][crate::model::Instance::creator].
4033 ///
4034 /// # Example
4035 /// ```ignore,no_run
4036 /// # use google_cloud_run_v2::model::Instance;
4037 /// let x = Instance::new().set_creator("example");
4038 /// ```
4039 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4040 self.creator = v.into();
4041 self
4042 }
4043
4044 /// Sets the value of [last_modifier][crate::model::Instance::last_modifier].
4045 ///
4046 /// # Example
4047 /// ```ignore,no_run
4048 /// # use google_cloud_run_v2::model::Instance;
4049 /// let x = Instance::new().set_last_modifier("example");
4050 /// ```
4051 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4052 self.last_modifier = v.into();
4053 self
4054 }
4055
4056 /// Sets the value of [client][crate::model::Instance::client].
4057 ///
4058 /// # Example
4059 /// ```ignore,no_run
4060 /// # use google_cloud_run_v2::model::Instance;
4061 /// let x = Instance::new().set_client("example");
4062 /// ```
4063 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4064 self.client = v.into();
4065 self
4066 }
4067
4068 /// Sets the value of [client_version][crate::model::Instance::client_version].
4069 ///
4070 /// # Example
4071 /// ```ignore,no_run
4072 /// # use google_cloud_run_v2::model::Instance;
4073 /// let x = Instance::new().set_client_version("example");
4074 /// ```
4075 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4076 self.client_version = v.into();
4077 self
4078 }
4079
4080 /// Sets the value of [launch_stage][crate::model::Instance::launch_stage].
4081 ///
4082 /// # Example
4083 /// ```ignore,no_run
4084 /// # use google_cloud_run_v2::model::Instance;
4085 /// use google_cloud_api::model::LaunchStage;
4086 /// let x0 = Instance::new().set_launch_stage(LaunchStage::Unimplemented);
4087 /// let x1 = Instance::new().set_launch_stage(LaunchStage::Prelaunch);
4088 /// let x2 = Instance::new().set_launch_stage(LaunchStage::EarlyAccess);
4089 /// ```
4090 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
4091 mut self,
4092 v: T,
4093 ) -> Self {
4094 self.launch_stage = v.into();
4095 self
4096 }
4097
4098 /// Sets the value of [binary_authorization][crate::model::Instance::binary_authorization].
4099 ///
4100 /// # Example
4101 /// ```ignore,no_run
4102 /// # use google_cloud_run_v2::model::Instance;
4103 /// use google_cloud_run_v2::model::BinaryAuthorization;
4104 /// let x = Instance::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
4105 /// ```
4106 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
4107 where
4108 T: std::convert::Into<crate::model::BinaryAuthorization>,
4109 {
4110 self.binary_authorization = std::option::Option::Some(v.into());
4111 self
4112 }
4113
4114 /// Sets or clears the value of [binary_authorization][crate::model::Instance::binary_authorization].
4115 ///
4116 /// # Example
4117 /// ```ignore,no_run
4118 /// # use google_cloud_run_v2::model::Instance;
4119 /// use google_cloud_run_v2::model::BinaryAuthorization;
4120 /// let x = Instance::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
4121 /// let x = Instance::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
4122 /// ```
4123 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
4124 where
4125 T: std::convert::Into<crate::model::BinaryAuthorization>,
4126 {
4127 self.binary_authorization = v.map(|x| x.into());
4128 self
4129 }
4130
4131 /// Sets the value of [vpc_access][crate::model::Instance::vpc_access].
4132 ///
4133 /// # Example
4134 /// ```ignore,no_run
4135 /// # use google_cloud_run_v2::model::Instance;
4136 /// use google_cloud_run_v2::model::VpcAccess;
4137 /// let x = Instance::new().set_vpc_access(VpcAccess::default()/* use setters */);
4138 /// ```
4139 pub fn set_vpc_access<T>(mut self, v: T) -> Self
4140 where
4141 T: std::convert::Into<crate::model::VpcAccess>,
4142 {
4143 self.vpc_access = std::option::Option::Some(v.into());
4144 self
4145 }
4146
4147 /// Sets or clears the value of [vpc_access][crate::model::Instance::vpc_access].
4148 ///
4149 /// # Example
4150 /// ```ignore,no_run
4151 /// # use google_cloud_run_v2::model::Instance;
4152 /// use google_cloud_run_v2::model::VpcAccess;
4153 /// let x = Instance::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
4154 /// let x = Instance::new().set_or_clear_vpc_access(None::<VpcAccess>);
4155 /// ```
4156 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
4157 where
4158 T: std::convert::Into<crate::model::VpcAccess>,
4159 {
4160 self.vpc_access = v.map(|x| x.into());
4161 self
4162 }
4163
4164 /// Sets the value of [service_account][crate::model::Instance::service_account].
4165 ///
4166 /// # Example
4167 /// ```ignore,no_run
4168 /// # use google_cloud_run_v2::model::Instance;
4169 /// let x = Instance::new().set_service_account("example");
4170 /// ```
4171 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4172 self.service_account = v.into();
4173 self
4174 }
4175
4176 /// Sets the value of [containers][crate::model::Instance::containers].
4177 ///
4178 /// # Example
4179 /// ```ignore,no_run
4180 /// # use google_cloud_run_v2::model::Instance;
4181 /// use google_cloud_run_v2::model::Container;
4182 /// let x = Instance::new()
4183 /// .set_containers([
4184 /// Container::default()/* use setters */,
4185 /// Container::default()/* use (different) setters */,
4186 /// ]);
4187 /// ```
4188 pub fn set_containers<T, V>(mut self, v: T) -> Self
4189 where
4190 T: std::iter::IntoIterator<Item = V>,
4191 V: std::convert::Into<crate::model::Container>,
4192 {
4193 use std::iter::Iterator;
4194 self.containers = v.into_iter().map(|i| i.into()).collect();
4195 self
4196 }
4197
4198 /// Sets the value of [volumes][crate::model::Instance::volumes].
4199 ///
4200 /// # Example
4201 /// ```ignore,no_run
4202 /// # use google_cloud_run_v2::model::Instance;
4203 /// use google_cloud_run_v2::model::Volume;
4204 /// let x = Instance::new()
4205 /// .set_volumes([
4206 /// Volume::default()/* use setters */,
4207 /// Volume::default()/* use (different) setters */,
4208 /// ]);
4209 /// ```
4210 pub fn set_volumes<T, V>(mut self, v: T) -> Self
4211 where
4212 T: std::iter::IntoIterator<Item = V>,
4213 V: std::convert::Into<crate::model::Volume>,
4214 {
4215 use std::iter::Iterator;
4216 self.volumes = v.into_iter().map(|i| i.into()).collect();
4217 self
4218 }
4219
4220 /// Sets the value of [encryption_key][crate::model::Instance::encryption_key].
4221 ///
4222 /// # Example
4223 /// ```ignore,no_run
4224 /// # use google_cloud_run_v2::model::Instance;
4225 /// let x = Instance::new().set_encryption_key("example");
4226 /// ```
4227 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4228 self.encryption_key = v.into();
4229 self
4230 }
4231
4232 /// Sets the value of [encryption_key_revocation_action][crate::model::Instance::encryption_key_revocation_action].
4233 ///
4234 /// # Example
4235 /// ```ignore,no_run
4236 /// # use google_cloud_run_v2::model::Instance;
4237 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
4238 /// let x0 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
4239 /// let x1 = Instance::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
4240 /// ```
4241 pub fn set_encryption_key_revocation_action<
4242 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
4243 >(
4244 mut self,
4245 v: T,
4246 ) -> Self {
4247 self.encryption_key_revocation_action = v.into();
4248 self
4249 }
4250
4251 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4252 ///
4253 /// # Example
4254 /// ```ignore,no_run
4255 /// # use google_cloud_run_v2::model::Instance;
4256 /// use wkt::Duration;
4257 /// let x = Instance::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
4258 /// ```
4259 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
4260 where
4261 T: std::convert::Into<wkt::Duration>,
4262 {
4263 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
4264 self
4265 }
4266
4267 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Instance::encryption_key_shutdown_duration].
4268 ///
4269 /// # Example
4270 /// ```ignore,no_run
4271 /// # use google_cloud_run_v2::model::Instance;
4272 /// use wkt::Duration;
4273 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
4274 /// let x = Instance::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
4275 /// ```
4276 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
4277 mut self,
4278 v: std::option::Option<T>,
4279 ) -> Self
4280 where
4281 T: std::convert::Into<wkt::Duration>,
4282 {
4283 self.encryption_key_shutdown_duration = v.map(|x| x.into());
4284 self
4285 }
4286
4287 /// Sets the value of [node_selector][crate::model::Instance::node_selector].
4288 ///
4289 /// # Example
4290 /// ```ignore,no_run
4291 /// # use google_cloud_run_v2::model::Instance;
4292 /// use google_cloud_run_v2::model::NodeSelector;
4293 /// let x = Instance::new().set_node_selector(NodeSelector::default()/* use setters */);
4294 /// ```
4295 pub fn set_node_selector<T>(mut self, v: T) -> Self
4296 where
4297 T: std::convert::Into<crate::model::NodeSelector>,
4298 {
4299 self.node_selector = std::option::Option::Some(v.into());
4300 self
4301 }
4302
4303 /// Sets or clears the value of [node_selector][crate::model::Instance::node_selector].
4304 ///
4305 /// # Example
4306 /// ```ignore,no_run
4307 /// # use google_cloud_run_v2::model::Instance;
4308 /// use google_cloud_run_v2::model::NodeSelector;
4309 /// let x = Instance::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
4310 /// let x = Instance::new().set_or_clear_node_selector(None::<NodeSelector>);
4311 /// ```
4312 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
4313 where
4314 T: std::convert::Into<crate::model::NodeSelector>,
4315 {
4316 self.node_selector = v.map(|x| x.into());
4317 self
4318 }
4319
4320 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4321 ///
4322 /// # Example
4323 /// ```ignore,no_run
4324 /// # use google_cloud_run_v2::model::Instance;
4325 /// let x = Instance::new().set_gpu_zonal_redundancy_disabled(true);
4326 /// ```
4327 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
4328 where
4329 T: std::convert::Into<bool>,
4330 {
4331 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
4332 self
4333 }
4334
4335 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Instance::gpu_zonal_redundancy_disabled].
4336 ///
4337 /// # Example
4338 /// ```ignore,no_run
4339 /// # use google_cloud_run_v2::model::Instance;
4340 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
4341 /// let x = Instance::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
4342 /// ```
4343 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
4344 mut self,
4345 v: std::option::Option<T>,
4346 ) -> Self
4347 where
4348 T: std::convert::Into<bool>,
4349 {
4350 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
4351 self
4352 }
4353
4354 /// Sets the value of [ingress][crate::model::Instance::ingress].
4355 ///
4356 /// # Example
4357 /// ```ignore,no_run
4358 /// # use google_cloud_run_v2::model::Instance;
4359 /// use google_cloud_run_v2::model::IngressTraffic;
4360 /// let x0 = Instance::new().set_ingress(IngressTraffic::All);
4361 /// let x1 = Instance::new().set_ingress(IngressTraffic::InternalOnly);
4362 /// let x2 = Instance::new().set_ingress(IngressTraffic::InternalLoadBalancer);
4363 /// ```
4364 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
4365 mut self,
4366 v: T,
4367 ) -> Self {
4368 self.ingress = v.into();
4369 self
4370 }
4371
4372 /// Sets the value of [invoker_iam_disabled][crate::model::Instance::invoker_iam_disabled].
4373 ///
4374 /// # Example
4375 /// ```ignore,no_run
4376 /// # use google_cloud_run_v2::model::Instance;
4377 /// let x = Instance::new().set_invoker_iam_disabled(true);
4378 /// ```
4379 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4380 self.invoker_iam_disabled = v.into();
4381 self
4382 }
4383
4384 /// Sets the value of [iap_enabled][crate::model::Instance::iap_enabled].
4385 ///
4386 /// # Example
4387 /// ```ignore,no_run
4388 /// # use google_cloud_run_v2::model::Instance;
4389 /// let x = Instance::new().set_iap_enabled(true);
4390 /// ```
4391 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4392 self.iap_enabled = v.into();
4393 self
4394 }
4395
4396 /// Sets the value of [observed_generation][crate::model::Instance::observed_generation].
4397 ///
4398 /// # Example
4399 /// ```ignore,no_run
4400 /// # use google_cloud_run_v2::model::Instance;
4401 /// let x = Instance::new().set_observed_generation(42);
4402 /// ```
4403 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4404 self.observed_generation = v.into();
4405 self
4406 }
4407
4408 /// Sets the value of [log_uri][crate::model::Instance::log_uri].
4409 ///
4410 /// # Example
4411 /// ```ignore,no_run
4412 /// # use google_cloud_run_v2::model::Instance;
4413 /// let x = Instance::new().set_log_uri("example");
4414 /// ```
4415 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4416 self.log_uri = v.into();
4417 self
4418 }
4419
4420 /// Sets the value of [terminal_condition][crate::model::Instance::terminal_condition].
4421 ///
4422 /// # Example
4423 /// ```ignore,no_run
4424 /// # use google_cloud_run_v2::model::Instance;
4425 /// use google_cloud_run_v2::model::Condition;
4426 /// let x = Instance::new().set_terminal_condition(Condition::default()/* use setters */);
4427 /// ```
4428 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
4429 where
4430 T: std::convert::Into<crate::model::Condition>,
4431 {
4432 self.terminal_condition = std::option::Option::Some(v.into());
4433 self
4434 }
4435
4436 /// Sets or clears the value of [terminal_condition][crate::model::Instance::terminal_condition].
4437 ///
4438 /// # Example
4439 /// ```ignore,no_run
4440 /// # use google_cloud_run_v2::model::Instance;
4441 /// use google_cloud_run_v2::model::Condition;
4442 /// let x = Instance::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
4443 /// let x = Instance::new().set_or_clear_terminal_condition(None::<Condition>);
4444 /// ```
4445 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
4446 where
4447 T: std::convert::Into<crate::model::Condition>,
4448 {
4449 self.terminal_condition = v.map(|x| x.into());
4450 self
4451 }
4452
4453 /// Sets the value of [conditions][crate::model::Instance::conditions].
4454 ///
4455 /// # Example
4456 /// ```ignore,no_run
4457 /// # use google_cloud_run_v2::model::Instance;
4458 /// use google_cloud_run_v2::model::Condition;
4459 /// let x = Instance::new()
4460 /// .set_conditions([
4461 /// Condition::default()/* use setters */,
4462 /// Condition::default()/* use (different) setters */,
4463 /// ]);
4464 /// ```
4465 pub fn set_conditions<T, V>(mut self, v: T) -> Self
4466 where
4467 T: std::iter::IntoIterator<Item = V>,
4468 V: std::convert::Into<crate::model::Condition>,
4469 {
4470 use std::iter::Iterator;
4471 self.conditions = v.into_iter().map(|i| i.into()).collect();
4472 self
4473 }
4474
4475 /// Sets the value of [container_statuses][crate::model::Instance::container_statuses].
4476 ///
4477 /// # Example
4478 /// ```ignore,no_run
4479 /// # use google_cloud_run_v2::model::Instance;
4480 /// use google_cloud_run_v2::model::ContainerStatus;
4481 /// let x = Instance::new()
4482 /// .set_container_statuses([
4483 /// ContainerStatus::default()/* use setters */,
4484 /// ContainerStatus::default()/* use (different) setters */,
4485 /// ]);
4486 /// ```
4487 pub fn set_container_statuses<T, V>(mut self, v: T) -> Self
4488 where
4489 T: std::iter::IntoIterator<Item = V>,
4490 V: std::convert::Into<crate::model::ContainerStatus>,
4491 {
4492 use std::iter::Iterator;
4493 self.container_statuses = v.into_iter().map(|i| i.into()).collect();
4494 self
4495 }
4496
4497 /// Sets the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
4498 ///
4499 /// # Example
4500 /// ```ignore,no_run
4501 /// # use google_cloud_run_v2::model::Instance;
4502 /// let x = Instance::new().set_satisfies_pzs(true);
4503 /// ```
4504 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4505 self.satisfies_pzs = v.into();
4506 self
4507 }
4508
4509 /// Sets the value of [urls][crate::model::Instance::urls].
4510 ///
4511 /// # Example
4512 /// ```ignore,no_run
4513 /// # use google_cloud_run_v2::model::Instance;
4514 /// let x = Instance::new().set_urls(["a", "b", "c"]);
4515 /// ```
4516 pub fn set_urls<T, V>(mut self, v: T) -> Self
4517 where
4518 T: std::iter::IntoIterator<Item = V>,
4519 V: std::convert::Into<std::string::String>,
4520 {
4521 use std::iter::Iterator;
4522 self.urls = v.into_iter().map(|i| i.into()).collect();
4523 self
4524 }
4525
4526 /// Sets the value of [reconciling][crate::model::Instance::reconciling].
4527 ///
4528 /// # Example
4529 /// ```ignore,no_run
4530 /// # use google_cloud_run_v2::model::Instance;
4531 /// let x = Instance::new().set_reconciling(true);
4532 /// ```
4533 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4534 self.reconciling = v.into();
4535 self
4536 }
4537
4538 /// Sets the value of [etag][crate::model::Instance::etag].
4539 ///
4540 /// # Example
4541 /// ```ignore,no_run
4542 /// # use google_cloud_run_v2::model::Instance;
4543 /// let x = Instance::new().set_etag("example");
4544 /// ```
4545 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4546 self.etag = v.into();
4547 self
4548 }
4549}
4550
4551impl wkt::message::Message for Instance {
4552 fn typename() -> &'static str {
4553 "type.googleapis.com/google.cloud.run.v2.Instance"
4554 }
4555}
4556
4557/// Holds a single instance split entry for the Worker. Allocations can be done
4558/// to a specific Revision name, or pointing to the latest Ready Revision.
4559#[derive(Clone, Default, PartialEq)]
4560#[non_exhaustive]
4561pub struct InstanceSplit {
4562 /// The allocation type for this instance split.
4563 pub r#type: crate::model::InstanceSplitAllocationType,
4564
4565 /// Revision to which to assign this portion of instances, if split allocation
4566 /// is by revision.
4567 pub revision: std::string::String,
4568
4569 /// Specifies percent of the instance split to this Revision.
4570 /// This defaults to zero if unspecified.
4571 pub percent: i32,
4572
4573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4574}
4575
4576impl InstanceSplit {
4577 pub fn new() -> Self {
4578 std::default::Default::default()
4579 }
4580
4581 /// Sets the value of [r#type][crate::model::InstanceSplit::type].
4582 ///
4583 /// # Example
4584 /// ```ignore,no_run
4585 /// # use google_cloud_run_v2::model::InstanceSplit;
4586 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4587 /// let x0 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Latest);
4588 /// let x1 = InstanceSplit::new().set_type(InstanceSplitAllocationType::Revision);
4589 /// ```
4590 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4591 mut self,
4592 v: T,
4593 ) -> Self {
4594 self.r#type = v.into();
4595 self
4596 }
4597
4598 /// Sets the value of [revision][crate::model::InstanceSplit::revision].
4599 ///
4600 /// # Example
4601 /// ```ignore,no_run
4602 /// # use google_cloud_run_v2::model::InstanceSplit;
4603 /// let x = InstanceSplit::new().set_revision("example");
4604 /// ```
4605 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4606 self.revision = v.into();
4607 self
4608 }
4609
4610 /// Sets the value of [percent][crate::model::InstanceSplit::percent].
4611 ///
4612 /// # Example
4613 /// ```ignore,no_run
4614 /// # use google_cloud_run_v2::model::InstanceSplit;
4615 /// let x = InstanceSplit::new().set_percent(42);
4616 /// ```
4617 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4618 self.percent = v.into();
4619 self
4620 }
4621}
4622
4623impl wkt::message::Message for InstanceSplit {
4624 fn typename() -> &'static str {
4625 "type.googleapis.com/google.cloud.run.v2.InstanceSplit"
4626 }
4627}
4628
4629/// Represents the observed state of a single `InstanceSplit` entry.
4630#[derive(Clone, Default, PartialEq)]
4631#[non_exhaustive]
4632pub struct InstanceSplitStatus {
4633 /// The allocation type for this instance split.
4634 pub r#type: crate::model::InstanceSplitAllocationType,
4635
4636 /// Revision to which this instance split is assigned.
4637 pub revision: std::string::String,
4638
4639 /// Specifies percent of the instance split to this Revision.
4640 pub percent: i32,
4641
4642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4643}
4644
4645impl InstanceSplitStatus {
4646 pub fn new() -> Self {
4647 std::default::Default::default()
4648 }
4649
4650 /// Sets the value of [r#type][crate::model::InstanceSplitStatus::type].
4651 ///
4652 /// # Example
4653 /// ```ignore,no_run
4654 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4655 /// use google_cloud_run_v2::model::InstanceSplitAllocationType;
4656 /// let x0 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Latest);
4657 /// let x1 = InstanceSplitStatus::new().set_type(InstanceSplitAllocationType::Revision);
4658 /// ```
4659 pub fn set_type<T: std::convert::Into<crate::model::InstanceSplitAllocationType>>(
4660 mut self,
4661 v: T,
4662 ) -> Self {
4663 self.r#type = v.into();
4664 self
4665 }
4666
4667 /// Sets the value of [revision][crate::model::InstanceSplitStatus::revision].
4668 ///
4669 /// # Example
4670 /// ```ignore,no_run
4671 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4672 /// let x = InstanceSplitStatus::new().set_revision("example");
4673 /// ```
4674 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4675 self.revision = v.into();
4676 self
4677 }
4678
4679 /// Sets the value of [percent][crate::model::InstanceSplitStatus::percent].
4680 ///
4681 /// # Example
4682 /// ```ignore,no_run
4683 /// # use google_cloud_run_v2::model::InstanceSplitStatus;
4684 /// let x = InstanceSplitStatus::new().set_percent(42);
4685 /// ```
4686 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4687 self.percent = v.into();
4688 self
4689 }
4690}
4691
4692impl wkt::message::Message for InstanceSplitStatus {
4693 fn typename() -> &'static str {
4694 "type.googleapis.com/google.cloud.run.v2.InstanceSplitStatus"
4695 }
4696}
4697
4698/// Request message for creating a Job.
4699#[derive(Clone, Default, PartialEq)]
4700#[non_exhaustive]
4701pub struct CreateJobRequest {
4702 /// Required. The location and project in which this Job should be created.
4703 /// Format: projects/{project}/locations/{location}, where {project} can be
4704 /// project id or number.
4705 pub parent: std::string::String,
4706
4707 /// Required. The Job instance to create.
4708 pub job: std::option::Option<crate::model::Job>,
4709
4710 /// Required. The unique identifier for the Job. The name of the job becomes
4711 /// {parent}/jobs/{job_id}.
4712 pub job_id: std::string::String,
4713
4714 /// Indicates that the request should be validated and default values
4715 /// populated, without persisting the request or creating any resources.
4716 pub validate_only: bool,
4717
4718 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4719}
4720
4721impl CreateJobRequest {
4722 pub fn new() -> Self {
4723 std::default::Default::default()
4724 }
4725
4726 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
4727 ///
4728 /// # Example
4729 /// ```ignore,no_run
4730 /// # use google_cloud_run_v2::model::CreateJobRequest;
4731 /// let x = CreateJobRequest::new().set_parent("example");
4732 /// ```
4733 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4734 self.parent = v.into();
4735 self
4736 }
4737
4738 /// Sets the value of [job][crate::model::CreateJobRequest::job].
4739 ///
4740 /// # Example
4741 /// ```ignore,no_run
4742 /// # use google_cloud_run_v2::model::CreateJobRequest;
4743 /// use google_cloud_run_v2::model::Job;
4744 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
4745 /// ```
4746 pub fn set_job<T>(mut self, v: T) -> Self
4747 where
4748 T: std::convert::Into<crate::model::Job>,
4749 {
4750 self.job = std::option::Option::Some(v.into());
4751 self
4752 }
4753
4754 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
4755 ///
4756 /// # Example
4757 /// ```ignore,no_run
4758 /// # use google_cloud_run_v2::model::CreateJobRequest;
4759 /// use google_cloud_run_v2::model::Job;
4760 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4761 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
4762 /// ```
4763 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4764 where
4765 T: std::convert::Into<crate::model::Job>,
4766 {
4767 self.job = v.map(|x| x.into());
4768 self
4769 }
4770
4771 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
4772 ///
4773 /// # Example
4774 /// ```ignore,no_run
4775 /// # use google_cloud_run_v2::model::CreateJobRequest;
4776 /// let x = CreateJobRequest::new().set_job_id("example");
4777 /// ```
4778 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4779 self.job_id = v.into();
4780 self
4781 }
4782
4783 /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
4784 ///
4785 /// # Example
4786 /// ```ignore,no_run
4787 /// # use google_cloud_run_v2::model::CreateJobRequest;
4788 /// let x = CreateJobRequest::new().set_validate_only(true);
4789 /// ```
4790 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4791 self.validate_only = v.into();
4792 self
4793 }
4794}
4795
4796impl wkt::message::Message for CreateJobRequest {
4797 fn typename() -> &'static str {
4798 "type.googleapis.com/google.cloud.run.v2.CreateJobRequest"
4799 }
4800}
4801
4802/// Request message for obtaining a Job by its full name.
4803#[derive(Clone, Default, PartialEq)]
4804#[non_exhaustive]
4805pub struct GetJobRequest {
4806 /// Required. The full name of the Job.
4807 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
4808 /// can be project id or number.
4809 pub name: std::string::String,
4810
4811 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4812}
4813
4814impl GetJobRequest {
4815 pub fn new() -> Self {
4816 std::default::Default::default()
4817 }
4818
4819 /// Sets the value of [name][crate::model::GetJobRequest::name].
4820 ///
4821 /// # Example
4822 /// ```ignore,no_run
4823 /// # use google_cloud_run_v2::model::GetJobRequest;
4824 /// let x = GetJobRequest::new().set_name("example");
4825 /// ```
4826 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4827 self.name = v.into();
4828 self
4829 }
4830}
4831
4832impl wkt::message::Message for GetJobRequest {
4833 fn typename() -> &'static str {
4834 "type.googleapis.com/google.cloud.run.v2.GetJobRequest"
4835 }
4836}
4837
4838/// Request message for updating a Job.
4839#[derive(Clone, Default, PartialEq)]
4840#[non_exhaustive]
4841pub struct UpdateJobRequest {
4842 /// Required. The Job to be updated.
4843 pub job: std::option::Option<crate::model::Job>,
4844
4845 /// Indicates that the request should be validated and default values
4846 /// populated, without persisting the request or updating any resources.
4847 pub validate_only: bool,
4848
4849 /// Optional. If set to true, and if the Job does not exist, it will create a
4850 /// new one. Caller must have both create and update permissions for this call
4851 /// if this is set to true.
4852 pub allow_missing: bool,
4853
4854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4855}
4856
4857impl UpdateJobRequest {
4858 pub fn new() -> Self {
4859 std::default::Default::default()
4860 }
4861
4862 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
4863 ///
4864 /// # Example
4865 /// ```ignore,no_run
4866 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4867 /// use google_cloud_run_v2::model::Job;
4868 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
4869 /// ```
4870 pub fn set_job<T>(mut self, v: T) -> Self
4871 where
4872 T: std::convert::Into<crate::model::Job>,
4873 {
4874 self.job = std::option::Option::Some(v.into());
4875 self
4876 }
4877
4878 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
4879 ///
4880 /// # Example
4881 /// ```ignore,no_run
4882 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4883 /// use google_cloud_run_v2::model::Job;
4884 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
4885 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
4886 /// ```
4887 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4888 where
4889 T: std::convert::Into<crate::model::Job>,
4890 {
4891 self.job = v.map(|x| x.into());
4892 self
4893 }
4894
4895 /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
4896 ///
4897 /// # Example
4898 /// ```ignore,no_run
4899 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4900 /// let x = UpdateJobRequest::new().set_validate_only(true);
4901 /// ```
4902 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4903 self.validate_only = v.into();
4904 self
4905 }
4906
4907 /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
4908 ///
4909 /// # Example
4910 /// ```ignore,no_run
4911 /// # use google_cloud_run_v2::model::UpdateJobRequest;
4912 /// let x = UpdateJobRequest::new().set_allow_missing(true);
4913 /// ```
4914 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4915 self.allow_missing = v.into();
4916 self
4917 }
4918}
4919
4920impl wkt::message::Message for UpdateJobRequest {
4921 fn typename() -> &'static str {
4922 "type.googleapis.com/google.cloud.run.v2.UpdateJobRequest"
4923 }
4924}
4925
4926/// Request message for retrieving a list of Jobs.
4927#[derive(Clone, Default, PartialEq)]
4928#[non_exhaustive]
4929pub struct ListJobsRequest {
4930 /// Required. The location and project to list resources on.
4931 /// Format: projects/{project}/locations/{location}, where {project} can be
4932 /// project id or number.
4933 pub parent: std::string::String,
4934
4935 /// Maximum number of Jobs to return in this call.
4936 pub page_size: i32,
4937
4938 /// A page token received from a previous call to ListJobs.
4939 /// All other parameters must match.
4940 pub page_token: std::string::String,
4941
4942 /// If true, returns deleted (but unexpired) resources along with active ones.
4943 pub show_deleted: bool,
4944
4945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4946}
4947
4948impl ListJobsRequest {
4949 pub fn new() -> Self {
4950 std::default::Default::default()
4951 }
4952
4953 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
4954 ///
4955 /// # Example
4956 /// ```ignore,no_run
4957 /// # use google_cloud_run_v2::model::ListJobsRequest;
4958 /// let x = ListJobsRequest::new().set_parent("example");
4959 /// ```
4960 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4961 self.parent = v.into();
4962 self
4963 }
4964
4965 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
4966 ///
4967 /// # Example
4968 /// ```ignore,no_run
4969 /// # use google_cloud_run_v2::model::ListJobsRequest;
4970 /// let x = ListJobsRequest::new().set_page_size(42);
4971 /// ```
4972 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4973 self.page_size = v.into();
4974 self
4975 }
4976
4977 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
4978 ///
4979 /// # Example
4980 /// ```ignore,no_run
4981 /// # use google_cloud_run_v2::model::ListJobsRequest;
4982 /// let x = ListJobsRequest::new().set_page_token("example");
4983 /// ```
4984 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4985 self.page_token = v.into();
4986 self
4987 }
4988
4989 /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
4990 ///
4991 /// # Example
4992 /// ```ignore,no_run
4993 /// # use google_cloud_run_v2::model::ListJobsRequest;
4994 /// let x = ListJobsRequest::new().set_show_deleted(true);
4995 /// ```
4996 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4997 self.show_deleted = v.into();
4998 self
4999 }
5000}
5001
5002impl wkt::message::Message for ListJobsRequest {
5003 fn typename() -> &'static str {
5004 "type.googleapis.com/google.cloud.run.v2.ListJobsRequest"
5005 }
5006}
5007
5008/// Response message containing a list of Jobs.
5009#[derive(Clone, Default, PartialEq)]
5010#[non_exhaustive]
5011pub struct ListJobsResponse {
5012 /// The resulting list of Jobs.
5013 pub jobs: std::vec::Vec<crate::model::Job>,
5014
5015 /// A token indicating there are more items than page_size. Use it in the next
5016 /// ListJobs request to continue.
5017 pub next_page_token: std::string::String,
5018
5019 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5020}
5021
5022impl ListJobsResponse {
5023 pub fn new() -> Self {
5024 std::default::Default::default()
5025 }
5026
5027 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
5028 ///
5029 /// # Example
5030 /// ```ignore,no_run
5031 /// # use google_cloud_run_v2::model::ListJobsResponse;
5032 /// use google_cloud_run_v2::model::Job;
5033 /// let x = ListJobsResponse::new()
5034 /// .set_jobs([
5035 /// Job::default()/* use setters */,
5036 /// Job::default()/* use (different) setters */,
5037 /// ]);
5038 /// ```
5039 pub fn set_jobs<T, V>(mut self, v: T) -> Self
5040 where
5041 T: std::iter::IntoIterator<Item = V>,
5042 V: std::convert::Into<crate::model::Job>,
5043 {
5044 use std::iter::Iterator;
5045 self.jobs = v.into_iter().map(|i| i.into()).collect();
5046 self
5047 }
5048
5049 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
5050 ///
5051 /// # Example
5052 /// ```ignore,no_run
5053 /// # use google_cloud_run_v2::model::ListJobsResponse;
5054 /// let x = ListJobsResponse::new().set_next_page_token("example");
5055 /// ```
5056 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5057 self.next_page_token = v.into();
5058 self
5059 }
5060}
5061
5062impl wkt::message::Message for ListJobsResponse {
5063 fn typename() -> &'static str {
5064 "type.googleapis.com/google.cloud.run.v2.ListJobsResponse"
5065 }
5066}
5067
5068#[doc(hidden)]
5069impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
5070 type PageItem = crate::model::Job;
5071
5072 fn items(self) -> std::vec::Vec<Self::PageItem> {
5073 self.jobs
5074 }
5075
5076 fn next_page_token(&self) -> std::string::String {
5077 use std::clone::Clone;
5078 self.next_page_token.clone()
5079 }
5080}
5081
5082/// Request message to delete a Job by its full name.
5083#[derive(Clone, Default, PartialEq)]
5084#[non_exhaustive]
5085pub struct DeleteJobRequest {
5086 /// Required. The full name of the Job.
5087 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5088 /// can be project id or number.
5089 pub name: std::string::String,
5090
5091 /// Indicates that the request should be validated without actually
5092 /// deleting any resources.
5093 pub validate_only: bool,
5094
5095 /// A system-generated fingerprint for this version of the
5096 /// resource. May be used to detect modification conflict during updates.
5097 pub etag: std::string::String,
5098
5099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5100}
5101
5102impl DeleteJobRequest {
5103 pub fn new() -> Self {
5104 std::default::Default::default()
5105 }
5106
5107 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
5108 ///
5109 /// # Example
5110 /// ```ignore,no_run
5111 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5112 /// let x = DeleteJobRequest::new().set_name("example");
5113 /// ```
5114 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5115 self.name = v.into();
5116 self
5117 }
5118
5119 /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
5120 ///
5121 /// # Example
5122 /// ```ignore,no_run
5123 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5124 /// let x = DeleteJobRequest::new().set_validate_only(true);
5125 /// ```
5126 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5127 self.validate_only = v.into();
5128 self
5129 }
5130
5131 /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
5132 ///
5133 /// # Example
5134 /// ```ignore,no_run
5135 /// # use google_cloud_run_v2::model::DeleteJobRequest;
5136 /// let x = DeleteJobRequest::new().set_etag("example");
5137 /// ```
5138 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5139 self.etag = v.into();
5140 self
5141 }
5142}
5143
5144impl wkt::message::Message for DeleteJobRequest {
5145 fn typename() -> &'static str {
5146 "type.googleapis.com/google.cloud.run.v2.DeleteJobRequest"
5147 }
5148}
5149
5150/// Request message to create a new Execution of a Job.
5151#[derive(Clone, Default, PartialEq)]
5152#[non_exhaustive]
5153pub struct RunJobRequest {
5154 /// Required. The full name of the Job.
5155 /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5156 /// can be project id or number.
5157 pub name: std::string::String,
5158
5159 /// Indicates that the request should be validated without actually
5160 /// deleting any resources.
5161 pub validate_only: bool,
5162
5163 /// A system-generated fingerprint for this version of the
5164 /// resource. May be used to detect modification conflict during updates.
5165 pub etag: std::string::String,
5166
5167 /// Overrides specification for a given execution of a job. If provided,
5168 /// overrides will be applied to update the execution or task spec.
5169 pub overrides: std::option::Option<crate::model::run_job_request::Overrides>,
5170
5171 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5172}
5173
5174impl RunJobRequest {
5175 pub fn new() -> Self {
5176 std::default::Default::default()
5177 }
5178
5179 /// Sets the value of [name][crate::model::RunJobRequest::name].
5180 ///
5181 /// # Example
5182 /// ```ignore,no_run
5183 /// # use google_cloud_run_v2::model::RunJobRequest;
5184 /// let x = RunJobRequest::new().set_name("example");
5185 /// ```
5186 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5187 self.name = v.into();
5188 self
5189 }
5190
5191 /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
5192 ///
5193 /// # Example
5194 /// ```ignore,no_run
5195 /// # use google_cloud_run_v2::model::RunJobRequest;
5196 /// let x = RunJobRequest::new().set_validate_only(true);
5197 /// ```
5198 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5199 self.validate_only = v.into();
5200 self
5201 }
5202
5203 /// Sets the value of [etag][crate::model::RunJobRequest::etag].
5204 ///
5205 /// # Example
5206 /// ```ignore,no_run
5207 /// # use google_cloud_run_v2::model::RunJobRequest;
5208 /// let x = RunJobRequest::new().set_etag("example");
5209 /// ```
5210 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5211 self.etag = v.into();
5212 self
5213 }
5214
5215 /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
5216 ///
5217 /// # Example
5218 /// ```ignore,no_run
5219 /// # use google_cloud_run_v2::model::RunJobRequest;
5220 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5221 /// let x = RunJobRequest::new().set_overrides(Overrides::default()/* use setters */);
5222 /// ```
5223 pub fn set_overrides<T>(mut self, v: T) -> Self
5224 where
5225 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5226 {
5227 self.overrides = std::option::Option::Some(v.into());
5228 self
5229 }
5230
5231 /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
5232 ///
5233 /// # Example
5234 /// ```ignore,no_run
5235 /// # use google_cloud_run_v2::model::RunJobRequest;
5236 /// use google_cloud_run_v2::model::run_job_request::Overrides;
5237 /// let x = RunJobRequest::new().set_or_clear_overrides(Some(Overrides::default()/* use setters */));
5238 /// let x = RunJobRequest::new().set_or_clear_overrides(None::<Overrides>);
5239 /// ```
5240 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
5241 where
5242 T: std::convert::Into<crate::model::run_job_request::Overrides>,
5243 {
5244 self.overrides = v.map(|x| x.into());
5245 self
5246 }
5247}
5248
5249impl wkt::message::Message for RunJobRequest {
5250 fn typename() -> &'static str {
5251 "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
5252 }
5253}
5254
5255/// Defines additional types related to [RunJobRequest].
5256pub mod run_job_request {
5257 #[allow(unused_imports)]
5258 use super::*;
5259
5260 /// RunJob Overrides that contains Execution fields to be overridden.
5261 #[derive(Clone, Default, PartialEq)]
5262 #[non_exhaustive]
5263 pub struct Overrides {
5264 /// Per container override specification.
5265 pub container_overrides:
5266 std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>,
5267
5268 /// Optional. The desired number of tasks the execution should run. Will
5269 /// replace existing task_count value.
5270 pub task_count: i32,
5271
5272 /// Duration in seconds the task may be active before the system will
5273 /// actively try to mark it failed and kill associated containers. Will
5274 /// replace existing timeout_seconds value.
5275 pub timeout: std::option::Option<wkt::Duration>,
5276
5277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5278 }
5279
5280 impl Overrides {
5281 pub fn new() -> Self {
5282 std::default::Default::default()
5283 }
5284
5285 /// Sets the value of [container_overrides][crate::model::run_job_request::Overrides::container_overrides].
5286 ///
5287 /// # Example
5288 /// ```ignore,no_run
5289 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5290 /// use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5291 /// let x = Overrides::new()
5292 /// .set_container_overrides([
5293 /// ContainerOverride::default()/* use setters */,
5294 /// ContainerOverride::default()/* use (different) setters */,
5295 /// ]);
5296 /// ```
5297 pub fn set_container_overrides<T, V>(mut self, v: T) -> Self
5298 where
5299 T: std::iter::IntoIterator<Item = V>,
5300 V: std::convert::Into<crate::model::run_job_request::overrides::ContainerOverride>,
5301 {
5302 use std::iter::Iterator;
5303 self.container_overrides = v.into_iter().map(|i| i.into()).collect();
5304 self
5305 }
5306
5307 /// Sets the value of [task_count][crate::model::run_job_request::Overrides::task_count].
5308 ///
5309 /// # Example
5310 /// ```ignore,no_run
5311 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5312 /// let x = Overrides::new().set_task_count(42);
5313 /// ```
5314 pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5315 self.task_count = v.into();
5316 self
5317 }
5318
5319 /// Sets the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5320 ///
5321 /// # Example
5322 /// ```ignore,no_run
5323 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5324 /// use wkt::Duration;
5325 /// let x = Overrides::new().set_timeout(Duration::default()/* use setters */);
5326 /// ```
5327 pub fn set_timeout<T>(mut self, v: T) -> Self
5328 where
5329 T: std::convert::Into<wkt::Duration>,
5330 {
5331 self.timeout = std::option::Option::Some(v.into());
5332 self
5333 }
5334
5335 /// Sets or clears the value of [timeout][crate::model::run_job_request::Overrides::timeout].
5336 ///
5337 /// # Example
5338 /// ```ignore,no_run
5339 /// # use google_cloud_run_v2::model::run_job_request::Overrides;
5340 /// use wkt::Duration;
5341 /// let x = Overrides::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
5342 /// let x = Overrides::new().set_or_clear_timeout(None::<Duration>);
5343 /// ```
5344 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5345 where
5346 T: std::convert::Into<wkt::Duration>,
5347 {
5348 self.timeout = v.map(|x| x.into());
5349 self
5350 }
5351 }
5352
5353 impl wkt::message::Message for Overrides {
5354 fn typename() -> &'static str {
5355 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
5356 }
5357 }
5358
5359 /// Defines additional types related to [Overrides].
5360 pub mod overrides {
5361 #[allow(unused_imports)]
5362 use super::*;
5363
5364 /// Per-container override specification.
5365 #[derive(Clone, Default, PartialEq)]
5366 #[non_exhaustive]
5367 pub struct ContainerOverride {
5368 /// The name of the container specified as a DNS_LABEL.
5369 pub name: std::string::String,
5370
5371 /// Optional. Arguments to the entrypoint. Will replace existing args for
5372 /// override.
5373 pub args: std::vec::Vec<std::string::String>,
5374
5375 /// List of environment variables to set in the container. Will be merged
5376 /// with existing env for override.
5377 pub env: std::vec::Vec<crate::model::EnvVar>,
5378
5379 /// Optional. True if the intention is to clear out existing args list.
5380 pub clear_args: bool,
5381
5382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5383 }
5384
5385 impl ContainerOverride {
5386 pub fn new() -> Self {
5387 std::default::Default::default()
5388 }
5389
5390 /// Sets the value of [name][crate::model::run_job_request::overrides::ContainerOverride::name].
5391 ///
5392 /// # Example
5393 /// ```ignore,no_run
5394 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5395 /// let x = ContainerOverride::new().set_name("example");
5396 /// ```
5397 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5398 self.name = v.into();
5399 self
5400 }
5401
5402 /// Sets the value of [args][crate::model::run_job_request::overrides::ContainerOverride::args].
5403 ///
5404 /// # Example
5405 /// ```ignore,no_run
5406 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5407 /// let x = ContainerOverride::new().set_args(["a", "b", "c"]);
5408 /// ```
5409 pub fn set_args<T, V>(mut self, v: T) -> Self
5410 where
5411 T: std::iter::IntoIterator<Item = V>,
5412 V: std::convert::Into<std::string::String>,
5413 {
5414 use std::iter::Iterator;
5415 self.args = v.into_iter().map(|i| i.into()).collect();
5416 self
5417 }
5418
5419 /// Sets the value of [env][crate::model::run_job_request::overrides::ContainerOverride::env].
5420 ///
5421 /// # Example
5422 /// ```ignore,no_run
5423 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5424 /// use google_cloud_run_v2::model::EnvVar;
5425 /// let x = ContainerOverride::new()
5426 /// .set_env([
5427 /// EnvVar::default()/* use setters */,
5428 /// EnvVar::default()/* use (different) setters */,
5429 /// ]);
5430 /// ```
5431 pub fn set_env<T, V>(mut self, v: T) -> Self
5432 where
5433 T: std::iter::IntoIterator<Item = V>,
5434 V: std::convert::Into<crate::model::EnvVar>,
5435 {
5436 use std::iter::Iterator;
5437 self.env = v.into_iter().map(|i| i.into()).collect();
5438 self
5439 }
5440
5441 /// Sets the value of [clear_args][crate::model::run_job_request::overrides::ContainerOverride::clear_args].
5442 ///
5443 /// # Example
5444 /// ```ignore,no_run
5445 /// # use google_cloud_run_v2::model::run_job_request::overrides::ContainerOverride;
5446 /// let x = ContainerOverride::new().set_clear_args(true);
5447 /// ```
5448 pub fn set_clear_args<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5449 self.clear_args = v.into();
5450 self
5451 }
5452 }
5453
5454 impl wkt::message::Message for ContainerOverride {
5455 fn typename() -> &'static str {
5456 "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
5457 }
5458 }
5459 }
5460}
5461
5462/// Job represents the configuration of a single job, which references a
5463/// container image that is run to completion.
5464#[derive(Clone, Default, PartialEq)]
5465#[non_exhaustive]
5466pub struct Job {
5467 /// The fully qualified name of this Job.
5468 ///
5469 /// Format:
5470 /// projects/{project}/locations/{location}/jobs/{job}
5471 pub name: std::string::String,
5472
5473 /// Output only. Server assigned unique identifier for the Execution. The value
5474 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
5475 /// deleted.
5476 pub uid: std::string::String,
5477
5478 /// Output only. A number that monotonically increases every time the user
5479 /// modifies the desired state.
5480 pub generation: i64,
5481
5482 /// Unstructured key value map that can be used to organize and categorize
5483 /// objects.
5484 /// User-provided labels are shared with Google's billing system, so they can
5485 /// be used to filter, or break down billing charges by team, component,
5486 /// environment, state, etc. For more information, visit
5487 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
5488 /// <https://cloud.google.com/run/docs/configuring/labels>.
5489 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5490
5491 /// Unstructured key value map that may
5492 /// be set by external tools to store and arbitrary metadata.
5493 /// They are not queryable and should be preserved
5494 /// when modifying objects.
5495 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
5496
5497 /// Output only. The creation time.
5498 pub create_time: std::option::Option<wkt::Timestamp>,
5499
5500 /// Output only. The last-modified time.
5501 pub update_time: std::option::Option<wkt::Timestamp>,
5502
5503 /// Output only. The deletion time. It is only populated as a response to a
5504 /// Delete request.
5505 pub delete_time: std::option::Option<wkt::Timestamp>,
5506
5507 /// Output only. For a deleted resource, the time after which it will be
5508 /// permamently deleted.
5509 pub expire_time: std::option::Option<wkt::Timestamp>,
5510
5511 /// Output only. Email address of the authenticated creator.
5512 pub creator: std::string::String,
5513
5514 /// Output only. Email address of the last authenticated modifier.
5515 pub last_modifier: std::string::String,
5516
5517 /// Arbitrary identifier for the API client.
5518 pub client: std::string::String,
5519
5520 /// Arbitrary version identifier for the API client.
5521 pub client_version: std::string::String,
5522
5523 /// The launch stage as defined by [Google Cloud Platform
5524 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
5525 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
5526 /// is assumed.
5527 /// Set the launch stage to a preview stage on input to allow use of preview
5528 /// features in that stage. On read (or output), describes whether the resource
5529 /// uses preview features.
5530 ///
5531 /// For example, if ALPHA is provided as input, but only BETA and GA-level
5532 /// features are used, this field will be BETA on output.
5533 pub launch_stage: google_cloud_api::model::LaunchStage,
5534
5535 /// Settings for the Binary Authorization feature.
5536 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
5537
5538 /// Required. The template used to create executions for this Job.
5539 pub template: std::option::Option<crate::model::ExecutionTemplate>,
5540
5541 /// Output only. The generation of this Job. See comments in `reconciling` for
5542 /// additional information on reconciliation process in Cloud Run.
5543 pub observed_generation: i64,
5544
5545 /// Output only. The Condition of this Job, containing its readiness status,
5546 /// and detailed error information in case it did not reach the desired state.
5547 pub terminal_condition: std::option::Option<crate::model::Condition>,
5548
5549 /// Output only. The Conditions of all other associated sub-resources. They
5550 /// contain additional diagnostics information in case the Job does not reach
5551 /// its desired state. See comments in `reconciling` for additional information
5552 /// on reconciliation process in Cloud Run.
5553 pub conditions: std::vec::Vec<crate::model::Condition>,
5554
5555 /// Output only. Number of executions created for this job.
5556 pub execution_count: i32,
5557
5558 /// Output only. Name of the last created execution.
5559 pub latest_created_execution: std::option::Option<crate::model::ExecutionReference>,
5560
5561 /// Output only. Returns true if the Job is currently being acted upon by the
5562 /// system to bring it into the desired state.
5563 ///
5564 /// When a new Job is created, or an existing one is updated, Cloud Run
5565 /// will asynchronously perform all necessary steps to bring the Job to the
5566 /// desired state. This process is called reconciliation.
5567 /// While reconciliation is in process, `observed_generation` and
5568 /// `latest_succeeded_execution`, will have transient values that might
5569 /// mismatch the intended state: Once reconciliation is over (and this field is
5570 /// false), there are two possible outcomes: reconciliation succeeded and the
5571 /// state matches the Job, or there was an error, and reconciliation failed.
5572 /// This state can be found in `terminal_condition.state`.
5573 ///
5574 /// If reconciliation succeeded, the following fields will match:
5575 /// `observed_generation` and `generation`, `latest_succeeded_execution` and
5576 /// `latest_created_execution`.
5577 ///
5578 /// If reconciliation failed, `observed_generation` and
5579 /// `latest_succeeded_execution` will have the state of the last succeeded
5580 /// execution or empty for newly created Job. Additional information on the
5581 /// failure can be found in `terminal_condition` and `conditions`.
5582 pub reconciling: bool,
5583
5584 /// Output only. Reserved for future use.
5585 pub satisfies_pzs: bool,
5586
5587 /// Optional. A system-generated fingerprint for this version of the
5588 /// resource. May be used to detect modification conflict during updates.
5589 pub etag: std::string::String,
5590
5591 pub create_execution: std::option::Option<crate::model::job::CreateExecution>,
5592
5593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5594}
5595
5596impl Job {
5597 pub fn new() -> Self {
5598 std::default::Default::default()
5599 }
5600
5601 /// Sets the value of [name][crate::model::Job::name].
5602 ///
5603 /// # Example
5604 /// ```ignore,no_run
5605 /// # use google_cloud_run_v2::model::Job;
5606 /// let x = Job::new().set_name("example");
5607 /// ```
5608 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5609 self.name = v.into();
5610 self
5611 }
5612
5613 /// Sets the value of [uid][crate::model::Job::uid].
5614 ///
5615 /// # Example
5616 /// ```ignore,no_run
5617 /// # use google_cloud_run_v2::model::Job;
5618 /// let x = Job::new().set_uid("example");
5619 /// ```
5620 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5621 self.uid = v.into();
5622 self
5623 }
5624
5625 /// Sets the value of [generation][crate::model::Job::generation].
5626 ///
5627 /// # Example
5628 /// ```ignore,no_run
5629 /// # use google_cloud_run_v2::model::Job;
5630 /// let x = Job::new().set_generation(42);
5631 /// ```
5632 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5633 self.generation = v.into();
5634 self
5635 }
5636
5637 /// Sets the value of [labels][crate::model::Job::labels].
5638 ///
5639 /// # Example
5640 /// ```ignore,no_run
5641 /// # use google_cloud_run_v2::model::Job;
5642 /// let x = Job::new().set_labels([
5643 /// ("key0", "abc"),
5644 /// ("key1", "xyz"),
5645 /// ]);
5646 /// ```
5647 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5648 where
5649 T: std::iter::IntoIterator<Item = (K, V)>,
5650 K: std::convert::Into<std::string::String>,
5651 V: std::convert::Into<std::string::String>,
5652 {
5653 use std::iter::Iterator;
5654 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5655 self
5656 }
5657
5658 /// Sets the value of [annotations][crate::model::Job::annotations].
5659 ///
5660 /// # Example
5661 /// ```ignore,no_run
5662 /// # use google_cloud_run_v2::model::Job;
5663 /// let x = Job::new().set_annotations([
5664 /// ("key0", "abc"),
5665 /// ("key1", "xyz"),
5666 /// ]);
5667 /// ```
5668 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5669 where
5670 T: std::iter::IntoIterator<Item = (K, V)>,
5671 K: std::convert::Into<std::string::String>,
5672 V: std::convert::Into<std::string::String>,
5673 {
5674 use std::iter::Iterator;
5675 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5676 self
5677 }
5678
5679 /// Sets the value of [create_time][crate::model::Job::create_time].
5680 ///
5681 /// # Example
5682 /// ```ignore,no_run
5683 /// # use google_cloud_run_v2::model::Job;
5684 /// use wkt::Timestamp;
5685 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
5686 /// ```
5687 pub fn set_create_time<T>(mut self, v: T) -> Self
5688 where
5689 T: std::convert::Into<wkt::Timestamp>,
5690 {
5691 self.create_time = std::option::Option::Some(v.into());
5692 self
5693 }
5694
5695 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
5696 ///
5697 /// # Example
5698 /// ```ignore,no_run
5699 /// # use google_cloud_run_v2::model::Job;
5700 /// use wkt::Timestamp;
5701 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5702 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
5703 /// ```
5704 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5705 where
5706 T: std::convert::Into<wkt::Timestamp>,
5707 {
5708 self.create_time = v.map(|x| x.into());
5709 self
5710 }
5711
5712 /// Sets the value of [update_time][crate::model::Job::update_time].
5713 ///
5714 /// # Example
5715 /// ```ignore,no_run
5716 /// # use google_cloud_run_v2::model::Job;
5717 /// use wkt::Timestamp;
5718 /// let x = Job::new().set_update_time(Timestamp::default()/* use setters */);
5719 /// ```
5720 pub fn set_update_time<T>(mut self, v: T) -> Self
5721 where
5722 T: std::convert::Into<wkt::Timestamp>,
5723 {
5724 self.update_time = std::option::Option::Some(v.into());
5725 self
5726 }
5727
5728 /// Sets or clears the value of [update_time][crate::model::Job::update_time].
5729 ///
5730 /// # Example
5731 /// ```ignore,no_run
5732 /// # use google_cloud_run_v2::model::Job;
5733 /// use wkt::Timestamp;
5734 /// let x = Job::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5735 /// let x = Job::new().set_or_clear_update_time(None::<Timestamp>);
5736 /// ```
5737 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5738 where
5739 T: std::convert::Into<wkt::Timestamp>,
5740 {
5741 self.update_time = v.map(|x| x.into());
5742 self
5743 }
5744
5745 /// Sets the value of [delete_time][crate::model::Job::delete_time].
5746 ///
5747 /// # Example
5748 /// ```ignore,no_run
5749 /// # use google_cloud_run_v2::model::Job;
5750 /// use wkt::Timestamp;
5751 /// let x = Job::new().set_delete_time(Timestamp::default()/* use setters */);
5752 /// ```
5753 pub fn set_delete_time<T>(mut self, v: T) -> Self
5754 where
5755 T: std::convert::Into<wkt::Timestamp>,
5756 {
5757 self.delete_time = std::option::Option::Some(v.into());
5758 self
5759 }
5760
5761 /// Sets or clears the value of [delete_time][crate::model::Job::delete_time].
5762 ///
5763 /// # Example
5764 /// ```ignore,no_run
5765 /// # use google_cloud_run_v2::model::Job;
5766 /// use wkt::Timestamp;
5767 /// let x = Job::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
5768 /// let x = Job::new().set_or_clear_delete_time(None::<Timestamp>);
5769 /// ```
5770 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
5771 where
5772 T: std::convert::Into<wkt::Timestamp>,
5773 {
5774 self.delete_time = v.map(|x| x.into());
5775 self
5776 }
5777
5778 /// Sets the value of [expire_time][crate::model::Job::expire_time].
5779 ///
5780 /// # Example
5781 /// ```ignore,no_run
5782 /// # use google_cloud_run_v2::model::Job;
5783 /// use wkt::Timestamp;
5784 /// let x = Job::new().set_expire_time(Timestamp::default()/* use setters */);
5785 /// ```
5786 pub fn set_expire_time<T>(mut self, v: T) -> Self
5787 where
5788 T: std::convert::Into<wkt::Timestamp>,
5789 {
5790 self.expire_time = std::option::Option::Some(v.into());
5791 self
5792 }
5793
5794 /// Sets or clears the value of [expire_time][crate::model::Job::expire_time].
5795 ///
5796 /// # Example
5797 /// ```ignore,no_run
5798 /// # use google_cloud_run_v2::model::Job;
5799 /// use wkt::Timestamp;
5800 /// let x = Job::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
5801 /// let x = Job::new().set_or_clear_expire_time(None::<Timestamp>);
5802 /// ```
5803 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
5804 where
5805 T: std::convert::Into<wkt::Timestamp>,
5806 {
5807 self.expire_time = v.map(|x| x.into());
5808 self
5809 }
5810
5811 /// Sets the value of [creator][crate::model::Job::creator].
5812 ///
5813 /// # Example
5814 /// ```ignore,no_run
5815 /// # use google_cloud_run_v2::model::Job;
5816 /// let x = Job::new().set_creator("example");
5817 /// ```
5818 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5819 self.creator = v.into();
5820 self
5821 }
5822
5823 /// Sets the value of [last_modifier][crate::model::Job::last_modifier].
5824 ///
5825 /// # Example
5826 /// ```ignore,no_run
5827 /// # use google_cloud_run_v2::model::Job;
5828 /// let x = Job::new().set_last_modifier("example");
5829 /// ```
5830 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5831 self.last_modifier = v.into();
5832 self
5833 }
5834
5835 /// Sets the value of [client][crate::model::Job::client].
5836 ///
5837 /// # Example
5838 /// ```ignore,no_run
5839 /// # use google_cloud_run_v2::model::Job;
5840 /// let x = Job::new().set_client("example");
5841 /// ```
5842 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5843 self.client = v.into();
5844 self
5845 }
5846
5847 /// Sets the value of [client_version][crate::model::Job::client_version].
5848 ///
5849 /// # Example
5850 /// ```ignore,no_run
5851 /// # use google_cloud_run_v2::model::Job;
5852 /// let x = Job::new().set_client_version("example");
5853 /// ```
5854 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5855 self.client_version = v.into();
5856 self
5857 }
5858
5859 /// Sets the value of [launch_stage][crate::model::Job::launch_stage].
5860 ///
5861 /// # Example
5862 /// ```ignore,no_run
5863 /// # use google_cloud_run_v2::model::Job;
5864 /// use google_cloud_api::model::LaunchStage;
5865 /// let x0 = Job::new().set_launch_stage(LaunchStage::Unimplemented);
5866 /// let x1 = Job::new().set_launch_stage(LaunchStage::Prelaunch);
5867 /// let x2 = Job::new().set_launch_stage(LaunchStage::EarlyAccess);
5868 /// ```
5869 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
5870 mut self,
5871 v: T,
5872 ) -> Self {
5873 self.launch_stage = v.into();
5874 self
5875 }
5876
5877 /// Sets the value of [binary_authorization][crate::model::Job::binary_authorization].
5878 ///
5879 /// # Example
5880 /// ```ignore,no_run
5881 /// # use google_cloud_run_v2::model::Job;
5882 /// use google_cloud_run_v2::model::BinaryAuthorization;
5883 /// let x = Job::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
5884 /// ```
5885 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
5886 where
5887 T: std::convert::Into<crate::model::BinaryAuthorization>,
5888 {
5889 self.binary_authorization = std::option::Option::Some(v.into());
5890 self
5891 }
5892
5893 /// Sets or clears the value of [binary_authorization][crate::model::Job::binary_authorization].
5894 ///
5895 /// # Example
5896 /// ```ignore,no_run
5897 /// # use google_cloud_run_v2::model::Job;
5898 /// use google_cloud_run_v2::model::BinaryAuthorization;
5899 /// let x = Job::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
5900 /// let x = Job::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
5901 /// ```
5902 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
5903 where
5904 T: std::convert::Into<crate::model::BinaryAuthorization>,
5905 {
5906 self.binary_authorization = v.map(|x| x.into());
5907 self
5908 }
5909
5910 /// Sets the value of [template][crate::model::Job::template].
5911 ///
5912 /// # Example
5913 /// ```ignore,no_run
5914 /// # use google_cloud_run_v2::model::Job;
5915 /// use google_cloud_run_v2::model::ExecutionTemplate;
5916 /// let x = Job::new().set_template(ExecutionTemplate::default()/* use setters */);
5917 /// ```
5918 pub fn set_template<T>(mut self, v: T) -> Self
5919 where
5920 T: std::convert::Into<crate::model::ExecutionTemplate>,
5921 {
5922 self.template = std::option::Option::Some(v.into());
5923 self
5924 }
5925
5926 /// Sets or clears the value of [template][crate::model::Job::template].
5927 ///
5928 /// # Example
5929 /// ```ignore,no_run
5930 /// # use google_cloud_run_v2::model::Job;
5931 /// use google_cloud_run_v2::model::ExecutionTemplate;
5932 /// let x = Job::new().set_or_clear_template(Some(ExecutionTemplate::default()/* use setters */));
5933 /// let x = Job::new().set_or_clear_template(None::<ExecutionTemplate>);
5934 /// ```
5935 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
5936 where
5937 T: std::convert::Into<crate::model::ExecutionTemplate>,
5938 {
5939 self.template = v.map(|x| x.into());
5940 self
5941 }
5942
5943 /// Sets the value of [observed_generation][crate::model::Job::observed_generation].
5944 ///
5945 /// # Example
5946 /// ```ignore,no_run
5947 /// # use google_cloud_run_v2::model::Job;
5948 /// let x = Job::new().set_observed_generation(42);
5949 /// ```
5950 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5951 self.observed_generation = v.into();
5952 self
5953 }
5954
5955 /// Sets the value of [terminal_condition][crate::model::Job::terminal_condition].
5956 ///
5957 /// # Example
5958 /// ```ignore,no_run
5959 /// # use google_cloud_run_v2::model::Job;
5960 /// use google_cloud_run_v2::model::Condition;
5961 /// let x = Job::new().set_terminal_condition(Condition::default()/* use setters */);
5962 /// ```
5963 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
5964 where
5965 T: std::convert::Into<crate::model::Condition>,
5966 {
5967 self.terminal_condition = std::option::Option::Some(v.into());
5968 self
5969 }
5970
5971 /// Sets or clears the value of [terminal_condition][crate::model::Job::terminal_condition].
5972 ///
5973 /// # Example
5974 /// ```ignore,no_run
5975 /// # use google_cloud_run_v2::model::Job;
5976 /// use google_cloud_run_v2::model::Condition;
5977 /// let x = Job::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
5978 /// let x = Job::new().set_or_clear_terminal_condition(None::<Condition>);
5979 /// ```
5980 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
5981 where
5982 T: std::convert::Into<crate::model::Condition>,
5983 {
5984 self.terminal_condition = v.map(|x| x.into());
5985 self
5986 }
5987
5988 /// Sets the value of [conditions][crate::model::Job::conditions].
5989 ///
5990 /// # Example
5991 /// ```ignore,no_run
5992 /// # use google_cloud_run_v2::model::Job;
5993 /// use google_cloud_run_v2::model::Condition;
5994 /// let x = Job::new()
5995 /// .set_conditions([
5996 /// Condition::default()/* use setters */,
5997 /// Condition::default()/* use (different) setters */,
5998 /// ]);
5999 /// ```
6000 pub fn set_conditions<T, V>(mut self, v: T) -> Self
6001 where
6002 T: std::iter::IntoIterator<Item = V>,
6003 V: std::convert::Into<crate::model::Condition>,
6004 {
6005 use std::iter::Iterator;
6006 self.conditions = v.into_iter().map(|i| i.into()).collect();
6007 self
6008 }
6009
6010 /// Sets the value of [execution_count][crate::model::Job::execution_count].
6011 ///
6012 /// # Example
6013 /// ```ignore,no_run
6014 /// # use google_cloud_run_v2::model::Job;
6015 /// let x = Job::new().set_execution_count(42);
6016 /// ```
6017 pub fn set_execution_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6018 self.execution_count = v.into();
6019 self
6020 }
6021
6022 /// Sets the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6023 ///
6024 /// # Example
6025 /// ```ignore,no_run
6026 /// # use google_cloud_run_v2::model::Job;
6027 /// use google_cloud_run_v2::model::ExecutionReference;
6028 /// let x = Job::new().set_latest_created_execution(ExecutionReference::default()/* use setters */);
6029 /// ```
6030 pub fn set_latest_created_execution<T>(mut self, v: T) -> Self
6031 where
6032 T: std::convert::Into<crate::model::ExecutionReference>,
6033 {
6034 self.latest_created_execution = std::option::Option::Some(v.into());
6035 self
6036 }
6037
6038 /// Sets or clears the value of [latest_created_execution][crate::model::Job::latest_created_execution].
6039 ///
6040 /// # Example
6041 /// ```ignore,no_run
6042 /// # use google_cloud_run_v2::model::Job;
6043 /// use google_cloud_run_v2::model::ExecutionReference;
6044 /// let x = Job::new().set_or_clear_latest_created_execution(Some(ExecutionReference::default()/* use setters */));
6045 /// let x = Job::new().set_or_clear_latest_created_execution(None::<ExecutionReference>);
6046 /// ```
6047 pub fn set_or_clear_latest_created_execution<T>(mut self, v: std::option::Option<T>) -> Self
6048 where
6049 T: std::convert::Into<crate::model::ExecutionReference>,
6050 {
6051 self.latest_created_execution = v.map(|x| x.into());
6052 self
6053 }
6054
6055 /// Sets the value of [reconciling][crate::model::Job::reconciling].
6056 ///
6057 /// # Example
6058 /// ```ignore,no_run
6059 /// # use google_cloud_run_v2::model::Job;
6060 /// let x = Job::new().set_reconciling(true);
6061 /// ```
6062 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6063 self.reconciling = v.into();
6064 self
6065 }
6066
6067 /// Sets the value of [satisfies_pzs][crate::model::Job::satisfies_pzs].
6068 ///
6069 /// # Example
6070 /// ```ignore,no_run
6071 /// # use google_cloud_run_v2::model::Job;
6072 /// let x = Job::new().set_satisfies_pzs(true);
6073 /// ```
6074 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6075 self.satisfies_pzs = v.into();
6076 self
6077 }
6078
6079 /// Sets the value of [etag][crate::model::Job::etag].
6080 ///
6081 /// # Example
6082 /// ```ignore,no_run
6083 /// # use google_cloud_run_v2::model::Job;
6084 /// let x = Job::new().set_etag("example");
6085 /// ```
6086 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6087 self.etag = v.into();
6088 self
6089 }
6090
6091 /// Sets the value of [create_execution][crate::model::Job::create_execution].
6092 ///
6093 /// Note that all the setters affecting `create_execution` are mutually
6094 /// exclusive.
6095 ///
6096 /// # Example
6097 /// ```ignore,no_run
6098 /// # use google_cloud_run_v2::model::Job;
6099 /// use google_cloud_run_v2::model::job::CreateExecution;
6100 /// let x = Job::new().set_create_execution(Some(CreateExecution::StartExecutionToken("example".to_string())));
6101 /// ```
6102 pub fn set_create_execution<
6103 T: std::convert::Into<std::option::Option<crate::model::job::CreateExecution>>,
6104 >(
6105 mut self,
6106 v: T,
6107 ) -> Self {
6108 self.create_execution = v.into();
6109 self
6110 }
6111
6112 /// The value of [create_execution][crate::model::Job::create_execution]
6113 /// if it holds a `StartExecutionToken`, `None` if the field is not set or
6114 /// holds a different branch.
6115 pub fn start_execution_token(&self) -> std::option::Option<&std::string::String> {
6116 #[allow(unreachable_patterns)]
6117 self.create_execution.as_ref().and_then(|v| match v {
6118 crate::model::job::CreateExecution::StartExecutionToken(v) => {
6119 std::option::Option::Some(v)
6120 }
6121 _ => std::option::Option::None,
6122 })
6123 }
6124
6125 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6126 /// to hold a `StartExecutionToken`.
6127 ///
6128 /// Note that all the setters affecting `create_execution` are
6129 /// mutually exclusive.
6130 ///
6131 /// # Example
6132 /// ```ignore,no_run
6133 /// # use google_cloud_run_v2::model::Job;
6134 /// let x = Job::new().set_start_execution_token("example");
6135 /// assert!(x.start_execution_token().is_some());
6136 /// assert!(x.run_execution_token().is_none());
6137 /// ```
6138 pub fn set_start_execution_token<T: std::convert::Into<std::string::String>>(
6139 mut self,
6140 v: T,
6141 ) -> Self {
6142 self.create_execution = std::option::Option::Some(
6143 crate::model::job::CreateExecution::StartExecutionToken(v.into()),
6144 );
6145 self
6146 }
6147
6148 /// The value of [create_execution][crate::model::Job::create_execution]
6149 /// if it holds a `RunExecutionToken`, `None` if the field is not set or
6150 /// holds a different branch.
6151 pub fn run_execution_token(&self) -> std::option::Option<&std::string::String> {
6152 #[allow(unreachable_patterns)]
6153 self.create_execution.as_ref().and_then(|v| match v {
6154 crate::model::job::CreateExecution::RunExecutionToken(v) => {
6155 std::option::Option::Some(v)
6156 }
6157 _ => std::option::Option::None,
6158 })
6159 }
6160
6161 /// Sets the value of [create_execution][crate::model::Job::create_execution]
6162 /// to hold a `RunExecutionToken`.
6163 ///
6164 /// Note that all the setters affecting `create_execution` are
6165 /// mutually exclusive.
6166 ///
6167 /// # Example
6168 /// ```ignore,no_run
6169 /// # use google_cloud_run_v2::model::Job;
6170 /// let x = Job::new().set_run_execution_token("example");
6171 /// assert!(x.run_execution_token().is_some());
6172 /// assert!(x.start_execution_token().is_none());
6173 /// ```
6174 pub fn set_run_execution_token<T: std::convert::Into<std::string::String>>(
6175 mut self,
6176 v: T,
6177 ) -> Self {
6178 self.create_execution = std::option::Option::Some(
6179 crate::model::job::CreateExecution::RunExecutionToken(v.into()),
6180 );
6181 self
6182 }
6183}
6184
6185impl wkt::message::Message for Job {
6186 fn typename() -> &'static str {
6187 "type.googleapis.com/google.cloud.run.v2.Job"
6188 }
6189}
6190
6191/// Defines additional types related to [Job].
6192pub mod job {
6193 #[allow(unused_imports)]
6194 use super::*;
6195
6196 #[derive(Clone, Debug, PartialEq)]
6197 #[non_exhaustive]
6198 pub enum CreateExecution {
6199 /// A unique string used as a suffix creating a new execution. The Job will
6200 /// become ready when the execution is successfully started.
6201 /// The sum of job name and token length must be fewer than 63 characters.
6202 StartExecutionToken(std::string::String),
6203 /// A unique string used as a suffix for creating a new execution. The Job
6204 /// will become ready when the execution is successfully completed.
6205 /// The sum of job name and token length must be fewer than 63 characters.
6206 RunExecutionToken(std::string::String),
6207 }
6208}
6209
6210/// Reference to an Execution. Use /Executions.GetExecution with the given name
6211/// to get full execution including the latest status.
6212#[derive(Clone, Default, PartialEq)]
6213#[non_exhaustive]
6214pub struct ExecutionReference {
6215 /// Name of the execution.
6216 pub name: std::string::String,
6217
6218 /// Creation timestamp of the execution.
6219 pub create_time: std::option::Option<wkt::Timestamp>,
6220
6221 /// Creation timestamp of the execution.
6222 pub completion_time: std::option::Option<wkt::Timestamp>,
6223
6224 /// The deletion time of the execution. It is only
6225 /// populated as a response to a Delete request.
6226 pub delete_time: std::option::Option<wkt::Timestamp>,
6227
6228 /// Status for the execution completion.
6229 pub completion_status: crate::model::execution_reference::CompletionStatus,
6230
6231 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6232}
6233
6234impl ExecutionReference {
6235 pub fn new() -> Self {
6236 std::default::Default::default()
6237 }
6238
6239 /// Sets the value of [name][crate::model::ExecutionReference::name].
6240 ///
6241 /// # Example
6242 /// ```ignore,no_run
6243 /// # use google_cloud_run_v2::model::ExecutionReference;
6244 /// let x = ExecutionReference::new().set_name("example");
6245 /// ```
6246 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6247 self.name = v.into();
6248 self
6249 }
6250
6251 /// Sets the value of [create_time][crate::model::ExecutionReference::create_time].
6252 ///
6253 /// # Example
6254 /// ```ignore,no_run
6255 /// # use google_cloud_run_v2::model::ExecutionReference;
6256 /// use wkt::Timestamp;
6257 /// let x = ExecutionReference::new().set_create_time(Timestamp::default()/* use setters */);
6258 /// ```
6259 pub fn set_create_time<T>(mut self, v: T) -> Self
6260 where
6261 T: std::convert::Into<wkt::Timestamp>,
6262 {
6263 self.create_time = std::option::Option::Some(v.into());
6264 self
6265 }
6266
6267 /// Sets or clears the value of [create_time][crate::model::ExecutionReference::create_time].
6268 ///
6269 /// # Example
6270 /// ```ignore,no_run
6271 /// # use google_cloud_run_v2::model::ExecutionReference;
6272 /// use wkt::Timestamp;
6273 /// let x = ExecutionReference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6274 /// let x = ExecutionReference::new().set_or_clear_create_time(None::<Timestamp>);
6275 /// ```
6276 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6277 where
6278 T: std::convert::Into<wkt::Timestamp>,
6279 {
6280 self.create_time = v.map(|x| x.into());
6281 self
6282 }
6283
6284 /// Sets the value of [completion_time][crate::model::ExecutionReference::completion_time].
6285 ///
6286 /// # Example
6287 /// ```ignore,no_run
6288 /// # use google_cloud_run_v2::model::ExecutionReference;
6289 /// use wkt::Timestamp;
6290 /// let x = ExecutionReference::new().set_completion_time(Timestamp::default()/* use setters */);
6291 /// ```
6292 pub fn set_completion_time<T>(mut self, v: T) -> Self
6293 where
6294 T: std::convert::Into<wkt::Timestamp>,
6295 {
6296 self.completion_time = std::option::Option::Some(v.into());
6297 self
6298 }
6299
6300 /// Sets or clears the value of [completion_time][crate::model::ExecutionReference::completion_time].
6301 ///
6302 /// # Example
6303 /// ```ignore,no_run
6304 /// # use google_cloud_run_v2::model::ExecutionReference;
6305 /// use wkt::Timestamp;
6306 /// let x = ExecutionReference::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
6307 /// let x = ExecutionReference::new().set_or_clear_completion_time(None::<Timestamp>);
6308 /// ```
6309 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
6310 where
6311 T: std::convert::Into<wkt::Timestamp>,
6312 {
6313 self.completion_time = v.map(|x| x.into());
6314 self
6315 }
6316
6317 /// Sets the value of [delete_time][crate::model::ExecutionReference::delete_time].
6318 ///
6319 /// # Example
6320 /// ```ignore,no_run
6321 /// # use google_cloud_run_v2::model::ExecutionReference;
6322 /// use wkt::Timestamp;
6323 /// let x = ExecutionReference::new().set_delete_time(Timestamp::default()/* use setters */);
6324 /// ```
6325 pub fn set_delete_time<T>(mut self, v: T) -> Self
6326 where
6327 T: std::convert::Into<wkt::Timestamp>,
6328 {
6329 self.delete_time = std::option::Option::Some(v.into());
6330 self
6331 }
6332
6333 /// Sets or clears the value of [delete_time][crate::model::ExecutionReference::delete_time].
6334 ///
6335 /// # Example
6336 /// ```ignore,no_run
6337 /// # use google_cloud_run_v2::model::ExecutionReference;
6338 /// use wkt::Timestamp;
6339 /// let x = ExecutionReference::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
6340 /// let x = ExecutionReference::new().set_or_clear_delete_time(None::<Timestamp>);
6341 /// ```
6342 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
6343 where
6344 T: std::convert::Into<wkt::Timestamp>,
6345 {
6346 self.delete_time = v.map(|x| x.into());
6347 self
6348 }
6349
6350 /// Sets the value of [completion_status][crate::model::ExecutionReference::completion_status].
6351 ///
6352 /// # Example
6353 /// ```ignore,no_run
6354 /// # use google_cloud_run_v2::model::ExecutionReference;
6355 /// use google_cloud_run_v2::model::execution_reference::CompletionStatus;
6356 /// let x0 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionSucceeded);
6357 /// let x1 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionFailed);
6358 /// let x2 = ExecutionReference::new().set_completion_status(CompletionStatus::ExecutionRunning);
6359 /// ```
6360 pub fn set_completion_status<
6361 T: std::convert::Into<crate::model::execution_reference::CompletionStatus>,
6362 >(
6363 mut self,
6364 v: T,
6365 ) -> Self {
6366 self.completion_status = v.into();
6367 self
6368 }
6369}
6370
6371impl wkt::message::Message for ExecutionReference {
6372 fn typename() -> &'static str {
6373 "type.googleapis.com/google.cloud.run.v2.ExecutionReference"
6374 }
6375}
6376
6377/// Defines additional types related to [ExecutionReference].
6378pub mod execution_reference {
6379 #[allow(unused_imports)]
6380 use super::*;
6381
6382 /// Possible execution completion status.
6383 ///
6384 /// # Working with unknown values
6385 ///
6386 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6387 /// additional enum variants at any time. Adding new variants is not considered
6388 /// a breaking change. Applications should write their code in anticipation of:
6389 ///
6390 /// - New values appearing in future releases of the client library, **and**
6391 /// - New values received dynamically, without application changes.
6392 ///
6393 /// Please consult the [Working with enums] section in the user guide for some
6394 /// guidelines.
6395 ///
6396 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6397 #[derive(Clone, Debug, PartialEq)]
6398 #[non_exhaustive]
6399 pub enum CompletionStatus {
6400 /// The default value. This value is used if the state is omitted.
6401 Unspecified,
6402 /// Job execution has succeeded.
6403 ExecutionSucceeded,
6404 /// Job execution has failed.
6405 ExecutionFailed,
6406 /// Job execution is running normally.
6407 ExecutionRunning,
6408 /// Waiting for backing resources to be provisioned.
6409 ExecutionPending,
6410 /// Job execution has been cancelled by the user.
6411 ExecutionCancelled,
6412 /// If set, the enum was initialized with an unknown value.
6413 ///
6414 /// Applications can examine the value using [CompletionStatus::value] or
6415 /// [CompletionStatus::name].
6416 UnknownValue(completion_status::UnknownValue),
6417 }
6418
6419 #[doc(hidden)]
6420 pub mod completion_status {
6421 #[allow(unused_imports)]
6422 use super::*;
6423 #[derive(Clone, Debug, PartialEq)]
6424 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6425 }
6426
6427 impl CompletionStatus {
6428 /// Gets the enum value.
6429 ///
6430 /// Returns `None` if the enum contains an unknown value deserialized from
6431 /// the string representation of enums.
6432 pub fn value(&self) -> std::option::Option<i32> {
6433 match self {
6434 Self::Unspecified => std::option::Option::Some(0),
6435 Self::ExecutionSucceeded => std::option::Option::Some(1),
6436 Self::ExecutionFailed => std::option::Option::Some(2),
6437 Self::ExecutionRunning => std::option::Option::Some(3),
6438 Self::ExecutionPending => std::option::Option::Some(4),
6439 Self::ExecutionCancelled => std::option::Option::Some(5),
6440 Self::UnknownValue(u) => u.0.value(),
6441 }
6442 }
6443
6444 /// Gets the enum value as a string.
6445 ///
6446 /// Returns `None` if the enum contains an unknown value deserialized from
6447 /// the integer representation of enums.
6448 pub fn name(&self) -> std::option::Option<&str> {
6449 match self {
6450 Self::Unspecified => std::option::Option::Some("COMPLETION_STATUS_UNSPECIFIED"),
6451 Self::ExecutionSucceeded => std::option::Option::Some("EXECUTION_SUCCEEDED"),
6452 Self::ExecutionFailed => std::option::Option::Some("EXECUTION_FAILED"),
6453 Self::ExecutionRunning => std::option::Option::Some("EXECUTION_RUNNING"),
6454 Self::ExecutionPending => std::option::Option::Some("EXECUTION_PENDING"),
6455 Self::ExecutionCancelled => std::option::Option::Some("EXECUTION_CANCELLED"),
6456 Self::UnknownValue(u) => u.0.name(),
6457 }
6458 }
6459 }
6460
6461 impl std::default::Default for CompletionStatus {
6462 fn default() -> Self {
6463 use std::convert::From;
6464 Self::from(0)
6465 }
6466 }
6467
6468 impl std::fmt::Display for CompletionStatus {
6469 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6470 wkt::internal::display_enum(f, self.name(), self.value())
6471 }
6472 }
6473
6474 impl std::convert::From<i32> for CompletionStatus {
6475 fn from(value: i32) -> Self {
6476 match value {
6477 0 => Self::Unspecified,
6478 1 => Self::ExecutionSucceeded,
6479 2 => Self::ExecutionFailed,
6480 3 => Self::ExecutionRunning,
6481 4 => Self::ExecutionPending,
6482 5 => Self::ExecutionCancelled,
6483 _ => Self::UnknownValue(completion_status::UnknownValue(
6484 wkt::internal::UnknownEnumValue::Integer(value),
6485 )),
6486 }
6487 }
6488 }
6489
6490 impl std::convert::From<&str> for CompletionStatus {
6491 fn from(value: &str) -> Self {
6492 use std::string::ToString;
6493 match value {
6494 "COMPLETION_STATUS_UNSPECIFIED" => Self::Unspecified,
6495 "EXECUTION_SUCCEEDED" => Self::ExecutionSucceeded,
6496 "EXECUTION_FAILED" => Self::ExecutionFailed,
6497 "EXECUTION_RUNNING" => Self::ExecutionRunning,
6498 "EXECUTION_PENDING" => Self::ExecutionPending,
6499 "EXECUTION_CANCELLED" => Self::ExecutionCancelled,
6500 _ => Self::UnknownValue(completion_status::UnknownValue(
6501 wkt::internal::UnknownEnumValue::String(value.to_string()),
6502 )),
6503 }
6504 }
6505 }
6506
6507 impl serde::ser::Serialize for CompletionStatus {
6508 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6509 where
6510 S: serde::Serializer,
6511 {
6512 match self {
6513 Self::Unspecified => serializer.serialize_i32(0),
6514 Self::ExecutionSucceeded => serializer.serialize_i32(1),
6515 Self::ExecutionFailed => serializer.serialize_i32(2),
6516 Self::ExecutionRunning => serializer.serialize_i32(3),
6517 Self::ExecutionPending => serializer.serialize_i32(4),
6518 Self::ExecutionCancelled => serializer.serialize_i32(5),
6519 Self::UnknownValue(u) => u.0.serialize(serializer),
6520 }
6521 }
6522 }
6523
6524 impl<'de> serde::de::Deserialize<'de> for CompletionStatus {
6525 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6526 where
6527 D: serde::Deserializer<'de>,
6528 {
6529 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionStatus>::new(
6530 ".google.cloud.run.v2.ExecutionReference.CompletionStatus",
6531 ))
6532 }
6533 }
6534}
6535
6536/// A single application container.
6537/// This specifies both the container to run, the command to run in the container
6538/// and the arguments to supply to it.
6539/// Note that additional arguments can be supplied by the system to the container
6540/// at runtime.
6541#[derive(Clone, Default, PartialEq)]
6542#[non_exhaustive]
6543pub struct Container {
6544 /// Name of the container specified as a DNS_LABEL (RFC 1123).
6545 pub name: std::string::String,
6546
6547 /// Required. Name of the container image in Dockerhub, Google Artifact
6548 /// Registry, or Google Container Registry. If the host is not provided,
6549 /// Dockerhub is assumed.
6550 pub image: std::string::String,
6551
6552 /// Optional. Location of the source.
6553 pub source_code: std::option::Option<crate::model::SourceCode>,
6554
6555 /// Entrypoint array. Not executed within a shell.
6556 /// The docker image's ENTRYPOINT is used if this is not provided.
6557 pub command: std::vec::Vec<std::string::String>,
6558
6559 /// Arguments to the entrypoint.
6560 /// The docker image's CMD is used if this is not provided.
6561 pub args: std::vec::Vec<std::string::String>,
6562
6563 /// List of environment variables to set in the container.
6564 pub env: std::vec::Vec<crate::model::EnvVar>,
6565
6566 /// Compute Resource requirements by this container.
6567 pub resources: std::option::Option<crate::model::ResourceRequirements>,
6568
6569 /// List of ports to expose from the container. Only a single port can be
6570 /// specified. The specified ports must be listening on all interfaces
6571 /// (0.0.0.0) within the container to be accessible.
6572 ///
6573 /// If omitted, a port number will be chosen and passed to the container
6574 /// through the PORT environment variable for the container to listen on.
6575 pub ports: std::vec::Vec<crate::model::ContainerPort>,
6576
6577 /// Volume to mount into the container's filesystem.
6578 pub volume_mounts: std::vec::Vec<crate::model::VolumeMount>,
6579
6580 /// Container's working directory.
6581 /// If not specified, the container runtime's default will be used, which
6582 /// might be configured in the container image.
6583 pub working_dir: std::string::String,
6584
6585 /// Periodic probe of container liveness.
6586 /// Container will be restarted if the probe fails.
6587 pub liveness_probe: std::option::Option<crate::model::Probe>,
6588
6589 /// Startup probe of application within the container.
6590 /// All other probes are disabled if a startup probe is provided, until it
6591 /// succeeds. Container will not be added to service endpoints if the probe
6592 /// fails.
6593 pub startup_probe: std::option::Option<crate::model::Probe>,
6594
6595 /// Readiness probe to be used for health checks.
6596 pub readiness_probe: std::option::Option<crate::model::Probe>,
6597
6598 /// Names of the containers that must start before this container.
6599 pub depends_on: std::vec::Vec<std::string::String>,
6600
6601 /// Base image for this container. Only supported for services. If set, it
6602 /// indicates that the service is enrolled into automatic base image update.
6603 pub base_image_uri: std::string::String,
6604
6605 /// Output only. The build info of the container image.
6606 pub build_info: std::option::Option<crate::model::BuildInfo>,
6607
6608 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6609}
6610
6611impl Container {
6612 pub fn new() -> Self {
6613 std::default::Default::default()
6614 }
6615
6616 /// Sets the value of [name][crate::model::Container::name].
6617 ///
6618 /// # Example
6619 /// ```ignore,no_run
6620 /// # use google_cloud_run_v2::model::Container;
6621 /// let x = Container::new().set_name("example");
6622 /// ```
6623 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6624 self.name = v.into();
6625 self
6626 }
6627
6628 /// Sets the value of [image][crate::model::Container::image].
6629 ///
6630 /// # Example
6631 /// ```ignore,no_run
6632 /// # use google_cloud_run_v2::model::Container;
6633 /// let x = Container::new().set_image("example");
6634 /// ```
6635 pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6636 self.image = v.into();
6637 self
6638 }
6639
6640 /// Sets the value of [source_code][crate::model::Container::source_code].
6641 ///
6642 /// # Example
6643 /// ```ignore,no_run
6644 /// # use google_cloud_run_v2::model::Container;
6645 /// use google_cloud_run_v2::model::SourceCode;
6646 /// let x = Container::new().set_source_code(SourceCode::default()/* use setters */);
6647 /// ```
6648 pub fn set_source_code<T>(mut self, v: T) -> Self
6649 where
6650 T: std::convert::Into<crate::model::SourceCode>,
6651 {
6652 self.source_code = std::option::Option::Some(v.into());
6653 self
6654 }
6655
6656 /// Sets or clears the value of [source_code][crate::model::Container::source_code].
6657 ///
6658 /// # Example
6659 /// ```ignore,no_run
6660 /// # use google_cloud_run_v2::model::Container;
6661 /// use google_cloud_run_v2::model::SourceCode;
6662 /// let x = Container::new().set_or_clear_source_code(Some(SourceCode::default()/* use setters */));
6663 /// let x = Container::new().set_or_clear_source_code(None::<SourceCode>);
6664 /// ```
6665 pub fn set_or_clear_source_code<T>(mut self, v: std::option::Option<T>) -> Self
6666 where
6667 T: std::convert::Into<crate::model::SourceCode>,
6668 {
6669 self.source_code = v.map(|x| x.into());
6670 self
6671 }
6672
6673 /// Sets the value of [command][crate::model::Container::command].
6674 ///
6675 /// # Example
6676 /// ```ignore,no_run
6677 /// # use google_cloud_run_v2::model::Container;
6678 /// let x = Container::new().set_command(["a", "b", "c"]);
6679 /// ```
6680 pub fn set_command<T, V>(mut self, v: T) -> Self
6681 where
6682 T: std::iter::IntoIterator<Item = V>,
6683 V: std::convert::Into<std::string::String>,
6684 {
6685 use std::iter::Iterator;
6686 self.command = v.into_iter().map(|i| i.into()).collect();
6687 self
6688 }
6689
6690 /// Sets the value of [args][crate::model::Container::args].
6691 ///
6692 /// # Example
6693 /// ```ignore,no_run
6694 /// # use google_cloud_run_v2::model::Container;
6695 /// let x = Container::new().set_args(["a", "b", "c"]);
6696 /// ```
6697 pub fn set_args<T, V>(mut self, v: T) -> Self
6698 where
6699 T: std::iter::IntoIterator<Item = V>,
6700 V: std::convert::Into<std::string::String>,
6701 {
6702 use std::iter::Iterator;
6703 self.args = v.into_iter().map(|i| i.into()).collect();
6704 self
6705 }
6706
6707 /// Sets the value of [env][crate::model::Container::env].
6708 ///
6709 /// # Example
6710 /// ```ignore,no_run
6711 /// # use google_cloud_run_v2::model::Container;
6712 /// use google_cloud_run_v2::model::EnvVar;
6713 /// let x = Container::new()
6714 /// .set_env([
6715 /// EnvVar::default()/* use setters */,
6716 /// EnvVar::default()/* use (different) setters */,
6717 /// ]);
6718 /// ```
6719 pub fn set_env<T, V>(mut self, v: T) -> Self
6720 where
6721 T: std::iter::IntoIterator<Item = V>,
6722 V: std::convert::Into<crate::model::EnvVar>,
6723 {
6724 use std::iter::Iterator;
6725 self.env = v.into_iter().map(|i| i.into()).collect();
6726 self
6727 }
6728
6729 /// Sets the value of [resources][crate::model::Container::resources].
6730 ///
6731 /// # Example
6732 /// ```ignore,no_run
6733 /// # use google_cloud_run_v2::model::Container;
6734 /// use google_cloud_run_v2::model::ResourceRequirements;
6735 /// let x = Container::new().set_resources(ResourceRequirements::default()/* use setters */);
6736 /// ```
6737 pub fn set_resources<T>(mut self, v: T) -> Self
6738 where
6739 T: std::convert::Into<crate::model::ResourceRequirements>,
6740 {
6741 self.resources = std::option::Option::Some(v.into());
6742 self
6743 }
6744
6745 /// Sets or clears the value of [resources][crate::model::Container::resources].
6746 ///
6747 /// # Example
6748 /// ```ignore,no_run
6749 /// # use google_cloud_run_v2::model::Container;
6750 /// use google_cloud_run_v2::model::ResourceRequirements;
6751 /// let x = Container::new().set_or_clear_resources(Some(ResourceRequirements::default()/* use setters */));
6752 /// let x = Container::new().set_or_clear_resources(None::<ResourceRequirements>);
6753 /// ```
6754 pub fn set_or_clear_resources<T>(mut self, v: std::option::Option<T>) -> Self
6755 where
6756 T: std::convert::Into<crate::model::ResourceRequirements>,
6757 {
6758 self.resources = v.map(|x| x.into());
6759 self
6760 }
6761
6762 /// Sets the value of [ports][crate::model::Container::ports].
6763 ///
6764 /// # Example
6765 /// ```ignore,no_run
6766 /// # use google_cloud_run_v2::model::Container;
6767 /// use google_cloud_run_v2::model::ContainerPort;
6768 /// let x = Container::new()
6769 /// .set_ports([
6770 /// ContainerPort::default()/* use setters */,
6771 /// ContainerPort::default()/* use (different) setters */,
6772 /// ]);
6773 /// ```
6774 pub fn set_ports<T, V>(mut self, v: T) -> Self
6775 where
6776 T: std::iter::IntoIterator<Item = V>,
6777 V: std::convert::Into<crate::model::ContainerPort>,
6778 {
6779 use std::iter::Iterator;
6780 self.ports = v.into_iter().map(|i| i.into()).collect();
6781 self
6782 }
6783
6784 /// Sets the value of [volume_mounts][crate::model::Container::volume_mounts].
6785 ///
6786 /// # Example
6787 /// ```ignore,no_run
6788 /// # use google_cloud_run_v2::model::Container;
6789 /// use google_cloud_run_v2::model::VolumeMount;
6790 /// let x = Container::new()
6791 /// .set_volume_mounts([
6792 /// VolumeMount::default()/* use setters */,
6793 /// VolumeMount::default()/* use (different) setters */,
6794 /// ]);
6795 /// ```
6796 pub fn set_volume_mounts<T, V>(mut self, v: T) -> Self
6797 where
6798 T: std::iter::IntoIterator<Item = V>,
6799 V: std::convert::Into<crate::model::VolumeMount>,
6800 {
6801 use std::iter::Iterator;
6802 self.volume_mounts = v.into_iter().map(|i| i.into()).collect();
6803 self
6804 }
6805
6806 /// Sets the value of [working_dir][crate::model::Container::working_dir].
6807 ///
6808 /// # Example
6809 /// ```ignore,no_run
6810 /// # use google_cloud_run_v2::model::Container;
6811 /// let x = Container::new().set_working_dir("example");
6812 /// ```
6813 pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6814 self.working_dir = v.into();
6815 self
6816 }
6817
6818 /// Sets the value of [liveness_probe][crate::model::Container::liveness_probe].
6819 ///
6820 /// # Example
6821 /// ```ignore,no_run
6822 /// # use google_cloud_run_v2::model::Container;
6823 /// use google_cloud_run_v2::model::Probe;
6824 /// let x = Container::new().set_liveness_probe(Probe::default()/* use setters */);
6825 /// ```
6826 pub fn set_liveness_probe<T>(mut self, v: T) -> Self
6827 where
6828 T: std::convert::Into<crate::model::Probe>,
6829 {
6830 self.liveness_probe = std::option::Option::Some(v.into());
6831 self
6832 }
6833
6834 /// Sets or clears the value of [liveness_probe][crate::model::Container::liveness_probe].
6835 ///
6836 /// # Example
6837 /// ```ignore,no_run
6838 /// # use google_cloud_run_v2::model::Container;
6839 /// use google_cloud_run_v2::model::Probe;
6840 /// let x = Container::new().set_or_clear_liveness_probe(Some(Probe::default()/* use setters */));
6841 /// let x = Container::new().set_or_clear_liveness_probe(None::<Probe>);
6842 /// ```
6843 pub fn set_or_clear_liveness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6844 where
6845 T: std::convert::Into<crate::model::Probe>,
6846 {
6847 self.liveness_probe = v.map(|x| x.into());
6848 self
6849 }
6850
6851 /// Sets the value of [startup_probe][crate::model::Container::startup_probe].
6852 ///
6853 /// # Example
6854 /// ```ignore,no_run
6855 /// # use google_cloud_run_v2::model::Container;
6856 /// use google_cloud_run_v2::model::Probe;
6857 /// let x = Container::new().set_startup_probe(Probe::default()/* use setters */);
6858 /// ```
6859 pub fn set_startup_probe<T>(mut self, v: T) -> Self
6860 where
6861 T: std::convert::Into<crate::model::Probe>,
6862 {
6863 self.startup_probe = std::option::Option::Some(v.into());
6864 self
6865 }
6866
6867 /// Sets or clears the value of [startup_probe][crate::model::Container::startup_probe].
6868 ///
6869 /// # Example
6870 /// ```ignore,no_run
6871 /// # use google_cloud_run_v2::model::Container;
6872 /// use google_cloud_run_v2::model::Probe;
6873 /// let x = Container::new().set_or_clear_startup_probe(Some(Probe::default()/* use setters */));
6874 /// let x = Container::new().set_or_clear_startup_probe(None::<Probe>);
6875 /// ```
6876 pub fn set_or_clear_startup_probe<T>(mut self, v: std::option::Option<T>) -> Self
6877 where
6878 T: std::convert::Into<crate::model::Probe>,
6879 {
6880 self.startup_probe = v.map(|x| x.into());
6881 self
6882 }
6883
6884 /// Sets the value of [readiness_probe][crate::model::Container::readiness_probe].
6885 ///
6886 /// # Example
6887 /// ```ignore,no_run
6888 /// # use google_cloud_run_v2::model::Container;
6889 /// use google_cloud_run_v2::model::Probe;
6890 /// let x = Container::new().set_readiness_probe(Probe::default()/* use setters */);
6891 /// ```
6892 pub fn set_readiness_probe<T>(mut self, v: T) -> Self
6893 where
6894 T: std::convert::Into<crate::model::Probe>,
6895 {
6896 self.readiness_probe = std::option::Option::Some(v.into());
6897 self
6898 }
6899
6900 /// Sets or clears the value of [readiness_probe][crate::model::Container::readiness_probe].
6901 ///
6902 /// # Example
6903 /// ```ignore,no_run
6904 /// # use google_cloud_run_v2::model::Container;
6905 /// use google_cloud_run_v2::model::Probe;
6906 /// let x = Container::new().set_or_clear_readiness_probe(Some(Probe::default()/* use setters */));
6907 /// let x = Container::new().set_or_clear_readiness_probe(None::<Probe>);
6908 /// ```
6909 pub fn set_or_clear_readiness_probe<T>(mut self, v: std::option::Option<T>) -> Self
6910 where
6911 T: std::convert::Into<crate::model::Probe>,
6912 {
6913 self.readiness_probe = v.map(|x| x.into());
6914 self
6915 }
6916
6917 /// Sets the value of [depends_on][crate::model::Container::depends_on].
6918 ///
6919 /// # Example
6920 /// ```ignore,no_run
6921 /// # use google_cloud_run_v2::model::Container;
6922 /// let x = Container::new().set_depends_on(["a", "b", "c"]);
6923 /// ```
6924 pub fn set_depends_on<T, V>(mut self, v: T) -> Self
6925 where
6926 T: std::iter::IntoIterator<Item = V>,
6927 V: std::convert::Into<std::string::String>,
6928 {
6929 use std::iter::Iterator;
6930 self.depends_on = v.into_iter().map(|i| i.into()).collect();
6931 self
6932 }
6933
6934 /// Sets the value of [base_image_uri][crate::model::Container::base_image_uri].
6935 ///
6936 /// # Example
6937 /// ```ignore,no_run
6938 /// # use google_cloud_run_v2::model::Container;
6939 /// let x = Container::new().set_base_image_uri("example");
6940 /// ```
6941 pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6942 self.base_image_uri = v.into();
6943 self
6944 }
6945
6946 /// Sets the value of [build_info][crate::model::Container::build_info].
6947 ///
6948 /// # Example
6949 /// ```ignore,no_run
6950 /// # use google_cloud_run_v2::model::Container;
6951 /// use google_cloud_run_v2::model::BuildInfo;
6952 /// let x = Container::new().set_build_info(BuildInfo::default()/* use setters */);
6953 /// ```
6954 pub fn set_build_info<T>(mut self, v: T) -> Self
6955 where
6956 T: std::convert::Into<crate::model::BuildInfo>,
6957 {
6958 self.build_info = std::option::Option::Some(v.into());
6959 self
6960 }
6961
6962 /// Sets or clears the value of [build_info][crate::model::Container::build_info].
6963 ///
6964 /// # Example
6965 /// ```ignore,no_run
6966 /// # use google_cloud_run_v2::model::Container;
6967 /// use google_cloud_run_v2::model::BuildInfo;
6968 /// let x = Container::new().set_or_clear_build_info(Some(BuildInfo::default()/* use setters */));
6969 /// let x = Container::new().set_or_clear_build_info(None::<BuildInfo>);
6970 /// ```
6971 pub fn set_or_clear_build_info<T>(mut self, v: std::option::Option<T>) -> Self
6972 where
6973 T: std::convert::Into<crate::model::BuildInfo>,
6974 {
6975 self.build_info = v.map(|x| x.into());
6976 self
6977 }
6978}
6979
6980impl wkt::message::Message for Container {
6981 fn typename() -> &'static str {
6982 "type.googleapis.com/google.cloud.run.v2.Container"
6983 }
6984}
6985
6986/// ResourceRequirements describes the compute resource requirements.
6987#[derive(Clone, Default, PartialEq)]
6988#[non_exhaustive]
6989pub struct ResourceRequirements {
6990 /// Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.
6991 pub limits: std::collections::HashMap<std::string::String, std::string::String>,
6992
6993 /// Determines whether CPU is only allocated during requests (true by default).
6994 /// However, if ResourceRequirements is set, the caller must explicitly
6995 /// set this field to true to preserve the default behavior.
6996 pub cpu_idle: bool,
6997
6998 /// Determines whether CPU should be boosted on startup of a new container
6999 /// instance above the requested CPU threshold, this can help reduce cold-start
7000 /// latency.
7001 pub startup_cpu_boost: bool,
7002
7003 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7004}
7005
7006impl ResourceRequirements {
7007 pub fn new() -> Self {
7008 std::default::Default::default()
7009 }
7010
7011 /// Sets the value of [limits][crate::model::ResourceRequirements::limits].
7012 ///
7013 /// # Example
7014 /// ```ignore,no_run
7015 /// # use google_cloud_run_v2::model::ResourceRequirements;
7016 /// let x = ResourceRequirements::new().set_limits([
7017 /// ("key0", "abc"),
7018 /// ("key1", "xyz"),
7019 /// ]);
7020 /// ```
7021 pub fn set_limits<T, K, V>(mut self, v: T) -> Self
7022 where
7023 T: std::iter::IntoIterator<Item = (K, V)>,
7024 K: std::convert::Into<std::string::String>,
7025 V: std::convert::Into<std::string::String>,
7026 {
7027 use std::iter::Iterator;
7028 self.limits = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7029 self
7030 }
7031
7032 /// Sets the value of [cpu_idle][crate::model::ResourceRequirements::cpu_idle].
7033 ///
7034 /// # Example
7035 /// ```ignore,no_run
7036 /// # use google_cloud_run_v2::model::ResourceRequirements;
7037 /// let x = ResourceRequirements::new().set_cpu_idle(true);
7038 /// ```
7039 pub fn set_cpu_idle<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7040 self.cpu_idle = v.into();
7041 self
7042 }
7043
7044 /// Sets the value of [startup_cpu_boost][crate::model::ResourceRequirements::startup_cpu_boost].
7045 ///
7046 /// # Example
7047 /// ```ignore,no_run
7048 /// # use google_cloud_run_v2::model::ResourceRequirements;
7049 /// let x = ResourceRequirements::new().set_startup_cpu_boost(true);
7050 /// ```
7051 pub fn set_startup_cpu_boost<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7052 self.startup_cpu_boost = v.into();
7053 self
7054 }
7055}
7056
7057impl wkt::message::Message for ResourceRequirements {
7058 fn typename() -> &'static str {
7059 "type.googleapis.com/google.cloud.run.v2.ResourceRequirements"
7060 }
7061}
7062
7063/// EnvVar represents an environment variable present in a Container.
7064#[derive(Clone, Default, PartialEq)]
7065#[non_exhaustive]
7066pub struct EnvVar {
7067 /// Required. Name of the environment variable. Must not exceed 32768
7068 /// characters.
7069 pub name: std::string::String,
7070
7071 pub values: std::option::Option<crate::model::env_var::Values>,
7072
7073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7074}
7075
7076impl EnvVar {
7077 pub fn new() -> Self {
7078 std::default::Default::default()
7079 }
7080
7081 /// Sets the value of [name][crate::model::EnvVar::name].
7082 ///
7083 /// # Example
7084 /// ```ignore,no_run
7085 /// # use google_cloud_run_v2::model::EnvVar;
7086 /// let x = EnvVar::new().set_name("example");
7087 /// ```
7088 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7089 self.name = v.into();
7090 self
7091 }
7092
7093 /// Sets the value of [values][crate::model::EnvVar::values].
7094 ///
7095 /// Note that all the setters affecting `values` are mutually
7096 /// exclusive.
7097 ///
7098 /// # Example
7099 /// ```ignore,no_run
7100 /// # use google_cloud_run_v2::model::EnvVar;
7101 /// use google_cloud_run_v2::model::env_var::Values;
7102 /// let x = EnvVar::new().set_values(Some(Values::Value("example".to_string())));
7103 /// ```
7104 pub fn set_values<T: std::convert::Into<std::option::Option<crate::model::env_var::Values>>>(
7105 mut self,
7106 v: T,
7107 ) -> Self {
7108 self.values = v.into();
7109 self
7110 }
7111
7112 /// The value of [values][crate::model::EnvVar::values]
7113 /// if it holds a `Value`, `None` if the field is not set or
7114 /// holds a different branch.
7115 pub fn value(&self) -> std::option::Option<&std::string::String> {
7116 #[allow(unreachable_patterns)]
7117 self.values.as_ref().and_then(|v| match v {
7118 crate::model::env_var::Values::Value(v) => std::option::Option::Some(v),
7119 _ => std::option::Option::None,
7120 })
7121 }
7122
7123 /// Sets the value of [values][crate::model::EnvVar::values]
7124 /// to hold a `Value`.
7125 ///
7126 /// Note that all the setters affecting `values` are
7127 /// mutually exclusive.
7128 ///
7129 /// # Example
7130 /// ```ignore,no_run
7131 /// # use google_cloud_run_v2::model::EnvVar;
7132 /// let x = EnvVar::new().set_value("example");
7133 /// assert!(x.value().is_some());
7134 /// assert!(x.value_source().is_none());
7135 /// ```
7136 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7137 self.values = std::option::Option::Some(crate::model::env_var::Values::Value(v.into()));
7138 self
7139 }
7140
7141 /// The value of [values][crate::model::EnvVar::values]
7142 /// if it holds a `ValueSource`, `None` if the field is not set or
7143 /// holds a different branch.
7144 pub fn value_source(
7145 &self,
7146 ) -> std::option::Option<&std::boxed::Box<crate::model::EnvVarSource>> {
7147 #[allow(unreachable_patterns)]
7148 self.values.as_ref().and_then(|v| match v {
7149 crate::model::env_var::Values::ValueSource(v) => std::option::Option::Some(v),
7150 _ => std::option::Option::None,
7151 })
7152 }
7153
7154 /// Sets the value of [values][crate::model::EnvVar::values]
7155 /// to hold a `ValueSource`.
7156 ///
7157 /// Note that all the setters affecting `values` are
7158 /// mutually exclusive.
7159 ///
7160 /// # Example
7161 /// ```ignore,no_run
7162 /// # use google_cloud_run_v2::model::EnvVar;
7163 /// use google_cloud_run_v2::model::EnvVarSource;
7164 /// let x = EnvVar::new().set_value_source(EnvVarSource::default()/* use setters */);
7165 /// assert!(x.value_source().is_some());
7166 /// assert!(x.value().is_none());
7167 /// ```
7168 pub fn set_value_source<T: std::convert::Into<std::boxed::Box<crate::model::EnvVarSource>>>(
7169 mut self,
7170 v: T,
7171 ) -> Self {
7172 self.values =
7173 std::option::Option::Some(crate::model::env_var::Values::ValueSource(v.into()));
7174 self
7175 }
7176}
7177
7178impl wkt::message::Message for EnvVar {
7179 fn typename() -> &'static str {
7180 "type.googleapis.com/google.cloud.run.v2.EnvVar"
7181 }
7182}
7183
7184/// Defines additional types related to [EnvVar].
7185pub mod env_var {
7186 #[allow(unused_imports)]
7187 use super::*;
7188
7189 #[derive(Clone, Debug, PartialEq)]
7190 #[non_exhaustive]
7191 pub enum Values {
7192 /// Literal value of the environment variable.
7193 /// Defaults to "", and the maximum length is 32768 bytes.
7194 /// Variable references are not supported in Cloud Run.
7195 Value(std::string::String),
7196 /// Source for the environment variable's value.
7197 ValueSource(std::boxed::Box<crate::model::EnvVarSource>),
7198 }
7199}
7200
7201/// EnvVarSource represents a source for the value of an EnvVar.
7202#[derive(Clone, Default, PartialEq)]
7203#[non_exhaustive]
7204pub struct EnvVarSource {
7205 /// Selects a secret and a specific version from Cloud Secret Manager.
7206 pub secret_key_ref: std::option::Option<crate::model::SecretKeySelector>,
7207
7208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7209}
7210
7211impl EnvVarSource {
7212 pub fn new() -> Self {
7213 std::default::Default::default()
7214 }
7215
7216 /// Sets the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7217 ///
7218 /// # Example
7219 /// ```ignore,no_run
7220 /// # use google_cloud_run_v2::model::EnvVarSource;
7221 /// use google_cloud_run_v2::model::SecretKeySelector;
7222 /// let x = EnvVarSource::new().set_secret_key_ref(SecretKeySelector::default()/* use setters */);
7223 /// ```
7224 pub fn set_secret_key_ref<T>(mut self, v: T) -> Self
7225 where
7226 T: std::convert::Into<crate::model::SecretKeySelector>,
7227 {
7228 self.secret_key_ref = std::option::Option::Some(v.into());
7229 self
7230 }
7231
7232 /// Sets or clears the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
7233 ///
7234 /// # Example
7235 /// ```ignore,no_run
7236 /// # use google_cloud_run_v2::model::EnvVarSource;
7237 /// use google_cloud_run_v2::model::SecretKeySelector;
7238 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(Some(SecretKeySelector::default()/* use setters */));
7239 /// let x = EnvVarSource::new().set_or_clear_secret_key_ref(None::<SecretKeySelector>);
7240 /// ```
7241 pub fn set_or_clear_secret_key_ref<T>(mut self, v: std::option::Option<T>) -> Self
7242 where
7243 T: std::convert::Into<crate::model::SecretKeySelector>,
7244 {
7245 self.secret_key_ref = v.map(|x| x.into());
7246 self
7247 }
7248}
7249
7250impl wkt::message::Message for EnvVarSource {
7251 fn typename() -> &'static str {
7252 "type.googleapis.com/google.cloud.run.v2.EnvVarSource"
7253 }
7254}
7255
7256/// SecretEnvVarSource represents a source for the value of an EnvVar.
7257#[derive(Clone, Default, PartialEq)]
7258#[non_exhaustive]
7259pub struct SecretKeySelector {
7260 /// Required. The name of the secret in Cloud Secret Manager.
7261 /// Format: {secret_name} if the secret is in the same project.
7262 /// projects/{project}/secrets/{secret_name} if the secret is
7263 /// in a different project.
7264 pub secret: std::string::String,
7265
7266 /// The Cloud Secret Manager secret version.
7267 /// Can be 'latest' for the latest version, an integer for a specific version,
7268 /// or a version alias.
7269 pub version: std::string::String,
7270
7271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7272}
7273
7274impl SecretKeySelector {
7275 pub fn new() -> Self {
7276 std::default::Default::default()
7277 }
7278
7279 /// Sets the value of [secret][crate::model::SecretKeySelector::secret].
7280 ///
7281 /// # Example
7282 /// ```ignore,no_run
7283 /// # use google_cloud_run_v2::model::SecretKeySelector;
7284 /// let x = SecretKeySelector::new().set_secret("example");
7285 /// ```
7286 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7287 self.secret = v.into();
7288 self
7289 }
7290
7291 /// Sets the value of [version][crate::model::SecretKeySelector::version].
7292 ///
7293 /// # Example
7294 /// ```ignore,no_run
7295 /// # use google_cloud_run_v2::model::SecretKeySelector;
7296 /// let x = SecretKeySelector::new().set_version("example");
7297 /// ```
7298 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7299 self.version = v.into();
7300 self
7301 }
7302}
7303
7304impl wkt::message::Message for SecretKeySelector {
7305 fn typename() -> &'static str {
7306 "type.googleapis.com/google.cloud.run.v2.SecretKeySelector"
7307 }
7308}
7309
7310/// ContainerPort represents a network port in a single container.
7311#[derive(Clone, Default, PartialEq)]
7312#[non_exhaustive]
7313pub struct ContainerPort {
7314 /// If specified, used to specify which protocol to use.
7315 /// Allowed values are "http1" and "h2c".
7316 pub name: std::string::String,
7317
7318 /// Port number the container listens on.
7319 /// This must be a valid TCP port number, 0 < container_port < 65536.
7320 pub container_port: i32,
7321
7322 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7323}
7324
7325impl ContainerPort {
7326 pub fn new() -> Self {
7327 std::default::Default::default()
7328 }
7329
7330 /// Sets the value of [name][crate::model::ContainerPort::name].
7331 ///
7332 /// # Example
7333 /// ```ignore,no_run
7334 /// # use google_cloud_run_v2::model::ContainerPort;
7335 /// let x = ContainerPort::new().set_name("example");
7336 /// ```
7337 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7338 self.name = v.into();
7339 self
7340 }
7341
7342 /// Sets the value of [container_port][crate::model::ContainerPort::container_port].
7343 ///
7344 /// # Example
7345 /// ```ignore,no_run
7346 /// # use google_cloud_run_v2::model::ContainerPort;
7347 /// let x = ContainerPort::new().set_container_port(42);
7348 /// ```
7349 pub fn set_container_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7350 self.container_port = v.into();
7351 self
7352 }
7353}
7354
7355impl wkt::message::Message for ContainerPort {
7356 fn typename() -> &'static str {
7357 "type.googleapis.com/google.cloud.run.v2.ContainerPort"
7358 }
7359}
7360
7361/// VolumeMount describes a mounting of a Volume within a container.
7362#[derive(Clone, Default, PartialEq)]
7363#[non_exhaustive]
7364pub struct VolumeMount {
7365 /// Required. This must match the Name of a Volume.
7366 pub name: std::string::String,
7367
7368 /// Required. Path within the container at which the volume should be mounted.
7369 /// Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must
7370 /// otherwise be `/cloudsql`. All instances defined in the Volume will be
7371 /// available as `/cloudsql/[instance]`. For more information on Cloud SQL
7372 /// volumes, visit <https://cloud.google.com/sql/docs/mysql/connect-run>
7373 pub mount_path: std::string::String,
7374
7375 /// Optional. Path within the volume from which the container's volume should
7376 /// be mounted. Defaults to "" (volume's root).
7377 pub sub_path: std::string::String,
7378
7379 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7380}
7381
7382impl VolumeMount {
7383 pub fn new() -> Self {
7384 std::default::Default::default()
7385 }
7386
7387 /// Sets the value of [name][crate::model::VolumeMount::name].
7388 ///
7389 /// # Example
7390 /// ```ignore,no_run
7391 /// # use google_cloud_run_v2::model::VolumeMount;
7392 /// let x = VolumeMount::new().set_name("example");
7393 /// ```
7394 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7395 self.name = v.into();
7396 self
7397 }
7398
7399 /// Sets the value of [mount_path][crate::model::VolumeMount::mount_path].
7400 ///
7401 /// # Example
7402 /// ```ignore,no_run
7403 /// # use google_cloud_run_v2::model::VolumeMount;
7404 /// let x = VolumeMount::new().set_mount_path("example");
7405 /// ```
7406 pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7407 self.mount_path = v.into();
7408 self
7409 }
7410
7411 /// Sets the value of [sub_path][crate::model::VolumeMount::sub_path].
7412 ///
7413 /// # Example
7414 /// ```ignore,no_run
7415 /// # use google_cloud_run_v2::model::VolumeMount;
7416 /// let x = VolumeMount::new().set_sub_path("example");
7417 /// ```
7418 pub fn set_sub_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7419 self.sub_path = v.into();
7420 self
7421 }
7422}
7423
7424impl wkt::message::Message for VolumeMount {
7425 fn typename() -> &'static str {
7426 "type.googleapis.com/google.cloud.run.v2.VolumeMount"
7427 }
7428}
7429
7430/// Volume represents a named volume in a container.
7431#[derive(Clone, Default, PartialEq)]
7432#[non_exhaustive]
7433pub struct Volume {
7434 /// Required. Volume's name.
7435 pub name: std::string::String,
7436
7437 pub volume_type: std::option::Option<crate::model::volume::VolumeType>,
7438
7439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7440}
7441
7442impl Volume {
7443 pub fn new() -> Self {
7444 std::default::Default::default()
7445 }
7446
7447 /// Sets the value of [name][crate::model::Volume::name].
7448 ///
7449 /// # Example
7450 /// ```ignore,no_run
7451 /// # use google_cloud_run_v2::model::Volume;
7452 /// let x = Volume::new().set_name("example");
7453 /// ```
7454 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7455 self.name = v.into();
7456 self
7457 }
7458
7459 /// Sets the value of [volume_type][crate::model::Volume::volume_type].
7460 ///
7461 /// Note that all the setters affecting `volume_type` are mutually
7462 /// exclusive.
7463 ///
7464 /// # Example
7465 /// ```ignore,no_run
7466 /// # use google_cloud_run_v2::model::Volume;
7467 /// use google_cloud_run_v2::model::SecretVolumeSource;
7468 /// let x = Volume::new().set_volume_type(Some(
7469 /// google_cloud_run_v2::model::volume::VolumeType::Secret(SecretVolumeSource::default().into())));
7470 /// ```
7471 pub fn set_volume_type<
7472 T: std::convert::Into<std::option::Option<crate::model::volume::VolumeType>>,
7473 >(
7474 mut self,
7475 v: T,
7476 ) -> Self {
7477 self.volume_type = v.into();
7478 self
7479 }
7480
7481 /// The value of [volume_type][crate::model::Volume::volume_type]
7482 /// if it holds a `Secret`, `None` if the field is not set or
7483 /// holds a different branch.
7484 pub fn secret(
7485 &self,
7486 ) -> std::option::Option<&std::boxed::Box<crate::model::SecretVolumeSource>> {
7487 #[allow(unreachable_patterns)]
7488 self.volume_type.as_ref().and_then(|v| match v {
7489 crate::model::volume::VolumeType::Secret(v) => std::option::Option::Some(v),
7490 _ => std::option::Option::None,
7491 })
7492 }
7493
7494 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7495 /// to hold a `Secret`.
7496 ///
7497 /// Note that all the setters affecting `volume_type` are
7498 /// mutually exclusive.
7499 ///
7500 /// # Example
7501 /// ```ignore,no_run
7502 /// # use google_cloud_run_v2::model::Volume;
7503 /// use google_cloud_run_v2::model::SecretVolumeSource;
7504 /// let x = Volume::new().set_secret(SecretVolumeSource::default()/* use setters */);
7505 /// assert!(x.secret().is_some());
7506 /// assert!(x.cloud_sql_instance().is_none());
7507 /// assert!(x.empty_dir().is_none());
7508 /// assert!(x.nfs().is_none());
7509 /// assert!(x.gcs().is_none());
7510 /// ```
7511 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretVolumeSource>>>(
7512 mut self,
7513 v: T,
7514 ) -> Self {
7515 self.volume_type =
7516 std::option::Option::Some(crate::model::volume::VolumeType::Secret(v.into()));
7517 self
7518 }
7519
7520 /// The value of [volume_type][crate::model::Volume::volume_type]
7521 /// if it holds a `CloudSqlInstance`, `None` if the field is not set or
7522 /// holds a different branch.
7523 pub fn cloud_sql_instance(
7524 &self,
7525 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSqlInstance>> {
7526 #[allow(unreachable_patterns)]
7527 self.volume_type.as_ref().and_then(|v| match v {
7528 crate::model::volume::VolumeType::CloudSqlInstance(v) => std::option::Option::Some(v),
7529 _ => std::option::Option::None,
7530 })
7531 }
7532
7533 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7534 /// to hold a `CloudSqlInstance`.
7535 ///
7536 /// Note that all the setters affecting `volume_type` are
7537 /// mutually exclusive.
7538 ///
7539 /// # Example
7540 /// ```ignore,no_run
7541 /// # use google_cloud_run_v2::model::Volume;
7542 /// use google_cloud_run_v2::model::CloudSqlInstance;
7543 /// let x = Volume::new().set_cloud_sql_instance(CloudSqlInstance::default()/* use setters */);
7544 /// assert!(x.cloud_sql_instance().is_some());
7545 /// assert!(x.secret().is_none());
7546 /// assert!(x.empty_dir().is_none());
7547 /// assert!(x.nfs().is_none());
7548 /// assert!(x.gcs().is_none());
7549 /// ```
7550 pub fn set_cloud_sql_instance<
7551 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlInstance>>,
7552 >(
7553 mut self,
7554 v: T,
7555 ) -> Self {
7556 self.volume_type =
7557 std::option::Option::Some(crate::model::volume::VolumeType::CloudSqlInstance(v.into()));
7558 self
7559 }
7560
7561 /// The value of [volume_type][crate::model::Volume::volume_type]
7562 /// if it holds a `EmptyDir`, `None` if the field is not set or
7563 /// holds a different branch.
7564 pub fn empty_dir(
7565 &self,
7566 ) -> std::option::Option<&std::boxed::Box<crate::model::EmptyDirVolumeSource>> {
7567 #[allow(unreachable_patterns)]
7568 self.volume_type.as_ref().and_then(|v| match v {
7569 crate::model::volume::VolumeType::EmptyDir(v) => std::option::Option::Some(v),
7570 _ => std::option::Option::None,
7571 })
7572 }
7573
7574 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7575 /// to hold a `EmptyDir`.
7576 ///
7577 /// Note that all the setters affecting `volume_type` are
7578 /// mutually exclusive.
7579 ///
7580 /// # Example
7581 /// ```ignore,no_run
7582 /// # use google_cloud_run_v2::model::Volume;
7583 /// use google_cloud_run_v2::model::EmptyDirVolumeSource;
7584 /// let x = Volume::new().set_empty_dir(EmptyDirVolumeSource::default()/* use setters */);
7585 /// assert!(x.empty_dir().is_some());
7586 /// assert!(x.secret().is_none());
7587 /// assert!(x.cloud_sql_instance().is_none());
7588 /// assert!(x.nfs().is_none());
7589 /// assert!(x.gcs().is_none());
7590 /// ```
7591 pub fn set_empty_dir<
7592 T: std::convert::Into<std::boxed::Box<crate::model::EmptyDirVolumeSource>>,
7593 >(
7594 mut self,
7595 v: T,
7596 ) -> Self {
7597 self.volume_type =
7598 std::option::Option::Some(crate::model::volume::VolumeType::EmptyDir(v.into()));
7599 self
7600 }
7601
7602 /// The value of [volume_type][crate::model::Volume::volume_type]
7603 /// if it holds a `Nfs`, `None` if the field is not set or
7604 /// holds a different branch.
7605 pub fn nfs(&self) -> std::option::Option<&std::boxed::Box<crate::model::NFSVolumeSource>> {
7606 #[allow(unreachable_patterns)]
7607 self.volume_type.as_ref().and_then(|v| match v {
7608 crate::model::volume::VolumeType::Nfs(v) => std::option::Option::Some(v),
7609 _ => std::option::Option::None,
7610 })
7611 }
7612
7613 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7614 /// to hold a `Nfs`.
7615 ///
7616 /// Note that all the setters affecting `volume_type` are
7617 /// mutually exclusive.
7618 ///
7619 /// # Example
7620 /// ```ignore,no_run
7621 /// # use google_cloud_run_v2::model::Volume;
7622 /// use google_cloud_run_v2::model::NFSVolumeSource;
7623 /// let x = Volume::new().set_nfs(NFSVolumeSource::default()/* use setters */);
7624 /// assert!(x.nfs().is_some());
7625 /// assert!(x.secret().is_none());
7626 /// assert!(x.cloud_sql_instance().is_none());
7627 /// assert!(x.empty_dir().is_none());
7628 /// assert!(x.gcs().is_none());
7629 /// ```
7630 pub fn set_nfs<T: std::convert::Into<std::boxed::Box<crate::model::NFSVolumeSource>>>(
7631 mut self,
7632 v: T,
7633 ) -> Self {
7634 self.volume_type =
7635 std::option::Option::Some(crate::model::volume::VolumeType::Nfs(v.into()));
7636 self
7637 }
7638
7639 /// The value of [volume_type][crate::model::Volume::volume_type]
7640 /// if it holds a `Gcs`, `None` if the field is not set or
7641 /// holds a different branch.
7642 pub fn gcs(&self) -> std::option::Option<&std::boxed::Box<crate::model::GCSVolumeSource>> {
7643 #[allow(unreachable_patterns)]
7644 self.volume_type.as_ref().and_then(|v| match v {
7645 crate::model::volume::VolumeType::Gcs(v) => std::option::Option::Some(v),
7646 _ => std::option::Option::None,
7647 })
7648 }
7649
7650 /// Sets the value of [volume_type][crate::model::Volume::volume_type]
7651 /// to hold a `Gcs`.
7652 ///
7653 /// Note that all the setters affecting `volume_type` are
7654 /// mutually exclusive.
7655 ///
7656 /// # Example
7657 /// ```ignore,no_run
7658 /// # use google_cloud_run_v2::model::Volume;
7659 /// use google_cloud_run_v2::model::GCSVolumeSource;
7660 /// let x = Volume::new().set_gcs(GCSVolumeSource::default()/* use setters */);
7661 /// assert!(x.gcs().is_some());
7662 /// assert!(x.secret().is_none());
7663 /// assert!(x.cloud_sql_instance().is_none());
7664 /// assert!(x.empty_dir().is_none());
7665 /// assert!(x.nfs().is_none());
7666 /// ```
7667 pub fn set_gcs<T: std::convert::Into<std::boxed::Box<crate::model::GCSVolumeSource>>>(
7668 mut self,
7669 v: T,
7670 ) -> Self {
7671 self.volume_type =
7672 std::option::Option::Some(crate::model::volume::VolumeType::Gcs(v.into()));
7673 self
7674 }
7675}
7676
7677impl wkt::message::Message for Volume {
7678 fn typename() -> &'static str {
7679 "type.googleapis.com/google.cloud.run.v2.Volume"
7680 }
7681}
7682
7683/// Defines additional types related to [Volume].
7684pub mod volume {
7685 #[allow(unused_imports)]
7686 use super::*;
7687
7688 #[derive(Clone, Debug, PartialEq)]
7689 #[non_exhaustive]
7690 pub enum VolumeType {
7691 /// Secret represents a secret that should populate this volume.
7692 Secret(std::boxed::Box<crate::model::SecretVolumeSource>),
7693 /// For Cloud SQL volumes, contains the specific instances that should be
7694 /// mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
7695 /// more information on how to connect Cloud SQL and Cloud Run.
7696 CloudSqlInstance(std::boxed::Box<crate::model::CloudSqlInstance>),
7697 /// Ephemeral storage used as a shared volume.
7698 EmptyDir(std::boxed::Box<crate::model::EmptyDirVolumeSource>),
7699 /// For NFS Voumes, contains the path to the nfs Volume
7700 Nfs(std::boxed::Box<crate::model::NFSVolumeSource>),
7701 /// Persistent storage backed by a Google Cloud Storage bucket.
7702 Gcs(std::boxed::Box<crate::model::GCSVolumeSource>),
7703 }
7704}
7705
7706/// The secret's value will be presented as the content of a file whose
7707/// name is defined in the item path. If no items are defined, the name of
7708/// the file is the secret.
7709#[derive(Clone, Default, PartialEq)]
7710#[non_exhaustive]
7711pub struct SecretVolumeSource {
7712 /// Required. The name of the secret in Cloud Secret Manager.
7713 /// Format: {secret} if the secret is in the same project.
7714 /// projects/{project}/secrets/{secret} if the secret is
7715 /// in a different project.
7716 pub secret: std::string::String,
7717
7718 /// If unspecified, the volume will expose a file whose name is the
7719 /// secret, relative to VolumeMount.mount_path + VolumeMount.sub_path.
7720 /// If specified, the key will be used as the version to fetch from Cloud
7721 /// Secret Manager and the path will be the name of the file exposed in the
7722 /// volume. When items are defined, they must specify a path and a version.
7723 pub items: std::vec::Vec<crate::model::VersionToPath>,
7724
7725 /// Integer representation of mode bits to use on created files by default.
7726 /// Must be a value between 0000 and 0777 (octal), defaulting to 0444.
7727 /// Directories within the path are not affected by this setting.
7728 ///
7729 /// Notes
7730 ///
7731 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7732 /// * This is an integer representation of the mode bits. So, the octal
7733 /// integer value should look exactly as the chmod numeric notation with a
7734 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7735 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7736 /// 493 (base-10).
7737 /// * This might be in conflict with other options that affect the
7738 /// file mode, like fsGroup, and the result can be other mode bits set.
7739 ///
7740 /// This might be in conflict with other options that affect the
7741 /// file mode, like fsGroup, and as a result, other mode bits could be set.
7742 pub default_mode: i32,
7743
7744 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7745}
7746
7747impl SecretVolumeSource {
7748 pub fn new() -> Self {
7749 std::default::Default::default()
7750 }
7751
7752 /// Sets the value of [secret][crate::model::SecretVolumeSource::secret].
7753 ///
7754 /// # Example
7755 /// ```ignore,no_run
7756 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7757 /// let x = SecretVolumeSource::new().set_secret("example");
7758 /// ```
7759 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7760 self.secret = v.into();
7761 self
7762 }
7763
7764 /// Sets the value of [items][crate::model::SecretVolumeSource::items].
7765 ///
7766 /// # Example
7767 /// ```ignore,no_run
7768 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7769 /// use google_cloud_run_v2::model::VersionToPath;
7770 /// let x = SecretVolumeSource::new()
7771 /// .set_items([
7772 /// VersionToPath::default()/* use setters */,
7773 /// VersionToPath::default()/* use (different) setters */,
7774 /// ]);
7775 /// ```
7776 pub fn set_items<T, V>(mut self, v: T) -> Self
7777 where
7778 T: std::iter::IntoIterator<Item = V>,
7779 V: std::convert::Into<crate::model::VersionToPath>,
7780 {
7781 use std::iter::Iterator;
7782 self.items = v.into_iter().map(|i| i.into()).collect();
7783 self
7784 }
7785
7786 /// Sets the value of [default_mode][crate::model::SecretVolumeSource::default_mode].
7787 ///
7788 /// # Example
7789 /// ```ignore,no_run
7790 /// # use google_cloud_run_v2::model::SecretVolumeSource;
7791 /// let x = SecretVolumeSource::new().set_default_mode(42);
7792 /// ```
7793 pub fn set_default_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7794 self.default_mode = v.into();
7795 self
7796 }
7797}
7798
7799impl wkt::message::Message for SecretVolumeSource {
7800 fn typename() -> &'static str {
7801 "type.googleapis.com/google.cloud.run.v2.SecretVolumeSource"
7802 }
7803}
7804
7805/// VersionToPath maps a specific version of a secret to a relative file to mount
7806/// to, relative to VolumeMount's mount_path.
7807#[derive(Clone, Default, PartialEq)]
7808#[non_exhaustive]
7809pub struct VersionToPath {
7810 /// Required. The relative path of the secret in the container.
7811 pub path: std::string::String,
7812
7813 /// The Cloud Secret Manager secret version.
7814 /// Can be 'latest' for the latest value, or an integer or a secret alias for a
7815 /// specific version.
7816 pub version: std::string::String,
7817
7818 /// Integer octal mode bits to use on this file, must be a value between
7819 /// 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
7820 /// used.
7821 ///
7822 /// Notes
7823 ///
7824 /// * Internally, a umask of 0222 will be applied to any non-zero value.
7825 /// * This is an integer representation of the mode bits. So, the octal
7826 /// integer value should look exactly as the chmod numeric notation with a
7827 /// leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
7828 /// or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
7829 /// 493 (base-10).
7830 /// * This might be in conflict with other options that affect the
7831 /// file mode, like fsGroup, and the result can be other mode bits set.
7832 pub mode: i32,
7833
7834 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7835}
7836
7837impl VersionToPath {
7838 pub fn new() -> Self {
7839 std::default::Default::default()
7840 }
7841
7842 /// Sets the value of [path][crate::model::VersionToPath::path].
7843 ///
7844 /// # Example
7845 /// ```ignore,no_run
7846 /// # use google_cloud_run_v2::model::VersionToPath;
7847 /// let x = VersionToPath::new().set_path("example");
7848 /// ```
7849 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7850 self.path = v.into();
7851 self
7852 }
7853
7854 /// Sets the value of [version][crate::model::VersionToPath::version].
7855 ///
7856 /// # Example
7857 /// ```ignore,no_run
7858 /// # use google_cloud_run_v2::model::VersionToPath;
7859 /// let x = VersionToPath::new().set_version("example");
7860 /// ```
7861 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7862 self.version = v.into();
7863 self
7864 }
7865
7866 /// Sets the value of [mode][crate::model::VersionToPath::mode].
7867 ///
7868 /// # Example
7869 /// ```ignore,no_run
7870 /// # use google_cloud_run_v2::model::VersionToPath;
7871 /// let x = VersionToPath::new().set_mode(42);
7872 /// ```
7873 pub fn set_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7874 self.mode = v.into();
7875 self
7876 }
7877}
7878
7879impl wkt::message::Message for VersionToPath {
7880 fn typename() -> &'static str {
7881 "type.googleapis.com/google.cloud.run.v2.VersionToPath"
7882 }
7883}
7884
7885/// Represents a set of Cloud SQL instances. Each one will be available under
7886/// /cloudsql/[instance]. Visit
7887/// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
7888/// how to connect Cloud SQL and Cloud Run.
7889#[derive(Clone, Default, PartialEq)]
7890#[non_exhaustive]
7891pub struct CloudSqlInstance {
7892 /// The Cloud SQL instance connection names, as can be found in
7893 /// <https://console.cloud.google.com/sql/instances>. Visit
7894 /// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
7895 /// how to connect Cloud SQL and Cloud Run. Format:
7896 /// {project}:{location}:{instance}
7897 pub instances: std::vec::Vec<std::string::String>,
7898
7899 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7900}
7901
7902impl CloudSqlInstance {
7903 pub fn new() -> Self {
7904 std::default::Default::default()
7905 }
7906
7907 /// Sets the value of [instances][crate::model::CloudSqlInstance::instances].
7908 ///
7909 /// # Example
7910 /// ```ignore,no_run
7911 /// # use google_cloud_run_v2::model::CloudSqlInstance;
7912 /// let x = CloudSqlInstance::new().set_instances(["a", "b", "c"]);
7913 /// ```
7914 pub fn set_instances<T, V>(mut self, v: T) -> Self
7915 where
7916 T: std::iter::IntoIterator<Item = V>,
7917 V: std::convert::Into<std::string::String>,
7918 {
7919 use std::iter::Iterator;
7920 self.instances = v.into_iter().map(|i| i.into()).collect();
7921 self
7922 }
7923}
7924
7925impl wkt::message::Message for CloudSqlInstance {
7926 fn typename() -> &'static str {
7927 "type.googleapis.com/google.cloud.run.v2.CloudSqlInstance"
7928 }
7929}
7930
7931/// In memory (tmpfs) ephemeral storage.
7932/// It is ephemeral in the sense that when the sandbox is taken down, the data is
7933/// destroyed with it (it does not persist across sandbox runs).
7934#[derive(Clone, Default, PartialEq)]
7935#[non_exhaustive]
7936pub struct EmptyDirVolumeSource {
7937 /// The medium on which the data is stored. Acceptable values today is only
7938 /// MEMORY or none. When none, the default will currently be backed by memory
7939 /// but could change over time. +optional
7940 pub medium: crate::model::empty_dir_volume_source::Medium,
7941
7942 /// Limit on the storage usable by this EmptyDir volume.
7943 /// The size limit is also applicable for memory medium.
7944 /// The maximum usage on memory medium EmptyDir would be the minimum value
7945 /// between the SizeLimit specified here and the sum of memory limits of all
7946 /// containers. The default is nil which means that the limit is undefined.
7947 /// More info:
7948 /// <https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume>.
7949 /// Info in Kubernetes:
7950 /// <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir>
7951 pub size_limit: std::string::String,
7952
7953 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7954}
7955
7956impl EmptyDirVolumeSource {
7957 pub fn new() -> Self {
7958 std::default::Default::default()
7959 }
7960
7961 /// Sets the value of [medium][crate::model::EmptyDirVolumeSource::medium].
7962 ///
7963 /// # Example
7964 /// ```ignore,no_run
7965 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
7966 /// use google_cloud_run_v2::model::empty_dir_volume_source::Medium;
7967 /// let x0 = EmptyDirVolumeSource::new().set_medium(Medium::Memory);
7968 /// ```
7969 pub fn set_medium<T: std::convert::Into<crate::model::empty_dir_volume_source::Medium>>(
7970 mut self,
7971 v: T,
7972 ) -> Self {
7973 self.medium = v.into();
7974 self
7975 }
7976
7977 /// Sets the value of [size_limit][crate::model::EmptyDirVolumeSource::size_limit].
7978 ///
7979 /// # Example
7980 /// ```ignore,no_run
7981 /// # use google_cloud_run_v2::model::EmptyDirVolumeSource;
7982 /// let x = EmptyDirVolumeSource::new().set_size_limit("example");
7983 /// ```
7984 pub fn set_size_limit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7985 self.size_limit = v.into();
7986 self
7987 }
7988}
7989
7990impl wkt::message::Message for EmptyDirVolumeSource {
7991 fn typename() -> &'static str {
7992 "type.googleapis.com/google.cloud.run.v2.EmptyDirVolumeSource"
7993 }
7994}
7995
7996/// Defines additional types related to [EmptyDirVolumeSource].
7997pub mod empty_dir_volume_source {
7998 #[allow(unused_imports)]
7999 use super::*;
8000
8001 /// The different types of medium supported for EmptyDir.
8002 ///
8003 /// # Working with unknown values
8004 ///
8005 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8006 /// additional enum variants at any time. Adding new variants is not considered
8007 /// a breaking change. Applications should write their code in anticipation of:
8008 ///
8009 /// - New values appearing in future releases of the client library, **and**
8010 /// - New values received dynamically, without application changes.
8011 ///
8012 /// Please consult the [Working with enums] section in the user guide for some
8013 /// guidelines.
8014 ///
8015 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8016 #[derive(Clone, Debug, PartialEq)]
8017 #[non_exhaustive]
8018 pub enum Medium {
8019 /// When not specified, falls back to the default implementation which
8020 /// is currently in memory (this may change over time).
8021 Unspecified,
8022 /// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
8023 Memory,
8024 /// If set, the enum was initialized with an unknown value.
8025 ///
8026 /// Applications can examine the value using [Medium::value] or
8027 /// [Medium::name].
8028 UnknownValue(medium::UnknownValue),
8029 }
8030
8031 #[doc(hidden)]
8032 pub mod medium {
8033 #[allow(unused_imports)]
8034 use super::*;
8035 #[derive(Clone, Debug, PartialEq)]
8036 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8037 }
8038
8039 impl Medium {
8040 /// Gets the enum value.
8041 ///
8042 /// Returns `None` if the enum contains an unknown value deserialized from
8043 /// the string representation of enums.
8044 pub fn value(&self) -> std::option::Option<i32> {
8045 match self {
8046 Self::Unspecified => std::option::Option::Some(0),
8047 Self::Memory => std::option::Option::Some(1),
8048 Self::UnknownValue(u) => u.0.value(),
8049 }
8050 }
8051
8052 /// Gets the enum value as a string.
8053 ///
8054 /// Returns `None` if the enum contains an unknown value deserialized from
8055 /// the integer representation of enums.
8056 pub fn name(&self) -> std::option::Option<&str> {
8057 match self {
8058 Self::Unspecified => std::option::Option::Some("MEDIUM_UNSPECIFIED"),
8059 Self::Memory => std::option::Option::Some("MEMORY"),
8060 Self::UnknownValue(u) => u.0.name(),
8061 }
8062 }
8063 }
8064
8065 impl std::default::Default for Medium {
8066 fn default() -> Self {
8067 use std::convert::From;
8068 Self::from(0)
8069 }
8070 }
8071
8072 impl std::fmt::Display for Medium {
8073 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8074 wkt::internal::display_enum(f, self.name(), self.value())
8075 }
8076 }
8077
8078 impl std::convert::From<i32> for Medium {
8079 fn from(value: i32) -> Self {
8080 match value {
8081 0 => Self::Unspecified,
8082 1 => Self::Memory,
8083 _ => Self::UnknownValue(medium::UnknownValue(
8084 wkt::internal::UnknownEnumValue::Integer(value),
8085 )),
8086 }
8087 }
8088 }
8089
8090 impl std::convert::From<&str> for Medium {
8091 fn from(value: &str) -> Self {
8092 use std::string::ToString;
8093 match value {
8094 "MEDIUM_UNSPECIFIED" => Self::Unspecified,
8095 "MEMORY" => Self::Memory,
8096 _ => Self::UnknownValue(medium::UnknownValue(
8097 wkt::internal::UnknownEnumValue::String(value.to_string()),
8098 )),
8099 }
8100 }
8101 }
8102
8103 impl serde::ser::Serialize for Medium {
8104 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8105 where
8106 S: serde::Serializer,
8107 {
8108 match self {
8109 Self::Unspecified => serializer.serialize_i32(0),
8110 Self::Memory => serializer.serialize_i32(1),
8111 Self::UnknownValue(u) => u.0.serialize(serializer),
8112 }
8113 }
8114 }
8115
8116 impl<'de> serde::de::Deserialize<'de> for Medium {
8117 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8118 where
8119 D: serde::Deserializer<'de>,
8120 {
8121 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Medium>::new(
8122 ".google.cloud.run.v2.EmptyDirVolumeSource.Medium",
8123 ))
8124 }
8125 }
8126}
8127
8128/// Represents an NFS mount.
8129#[derive(Clone, Default, PartialEq)]
8130#[non_exhaustive]
8131pub struct NFSVolumeSource {
8132 /// Hostname or IP address of the NFS server
8133 pub server: std::string::String,
8134
8135 /// Path that is exported by the NFS server.
8136 pub path: std::string::String,
8137
8138 /// If true, the volume will be mounted as read only for all mounts.
8139 pub read_only: bool,
8140
8141 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8142}
8143
8144impl NFSVolumeSource {
8145 pub fn new() -> Self {
8146 std::default::Default::default()
8147 }
8148
8149 /// Sets the value of [server][crate::model::NFSVolumeSource::server].
8150 ///
8151 /// # Example
8152 /// ```ignore,no_run
8153 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8154 /// let x = NFSVolumeSource::new().set_server("example");
8155 /// ```
8156 pub fn set_server<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8157 self.server = v.into();
8158 self
8159 }
8160
8161 /// Sets the value of [path][crate::model::NFSVolumeSource::path].
8162 ///
8163 /// # Example
8164 /// ```ignore,no_run
8165 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8166 /// let x = NFSVolumeSource::new().set_path("example");
8167 /// ```
8168 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8169 self.path = v.into();
8170 self
8171 }
8172
8173 /// Sets the value of [read_only][crate::model::NFSVolumeSource::read_only].
8174 ///
8175 /// # Example
8176 /// ```ignore,no_run
8177 /// # use google_cloud_run_v2::model::NFSVolumeSource;
8178 /// let x = NFSVolumeSource::new().set_read_only(true);
8179 /// ```
8180 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8181 self.read_only = v.into();
8182 self
8183 }
8184}
8185
8186impl wkt::message::Message for NFSVolumeSource {
8187 fn typename() -> &'static str {
8188 "type.googleapis.com/google.cloud.run.v2.NFSVolumeSource"
8189 }
8190}
8191
8192/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage
8193/// FUSE.
8194#[derive(Clone, Default, PartialEq)]
8195#[non_exhaustive]
8196pub struct GCSVolumeSource {
8197 /// Cloud Storage Bucket name.
8198 pub bucket: std::string::String,
8199
8200 /// If true, the volume will be mounted as read only for all mounts.
8201 pub read_only: bool,
8202
8203 /// A list of additional flags to pass to the gcsfuse CLI.
8204 /// Options should be specified without the leading "--".
8205 pub mount_options: std::vec::Vec<std::string::String>,
8206
8207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8208}
8209
8210impl GCSVolumeSource {
8211 pub fn new() -> Self {
8212 std::default::Default::default()
8213 }
8214
8215 /// Sets the value of [bucket][crate::model::GCSVolumeSource::bucket].
8216 ///
8217 /// # Example
8218 /// ```ignore,no_run
8219 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8220 /// let x = GCSVolumeSource::new().set_bucket("example");
8221 /// ```
8222 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8223 self.bucket = v.into();
8224 self
8225 }
8226
8227 /// Sets the value of [read_only][crate::model::GCSVolumeSource::read_only].
8228 ///
8229 /// # Example
8230 /// ```ignore,no_run
8231 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8232 /// let x = GCSVolumeSource::new().set_read_only(true);
8233 /// ```
8234 pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8235 self.read_only = v.into();
8236 self
8237 }
8238
8239 /// Sets the value of [mount_options][crate::model::GCSVolumeSource::mount_options].
8240 ///
8241 /// # Example
8242 /// ```ignore,no_run
8243 /// # use google_cloud_run_v2::model::GCSVolumeSource;
8244 /// let x = GCSVolumeSource::new().set_mount_options(["a", "b", "c"]);
8245 /// ```
8246 pub fn set_mount_options<T, V>(mut self, v: T) -> Self
8247 where
8248 T: std::iter::IntoIterator<Item = V>,
8249 V: std::convert::Into<std::string::String>,
8250 {
8251 use std::iter::Iterator;
8252 self.mount_options = v.into_iter().map(|i| i.into()).collect();
8253 self
8254 }
8255}
8256
8257impl wkt::message::Message for GCSVolumeSource {
8258 fn typename() -> &'static str {
8259 "type.googleapis.com/google.cloud.run.v2.GCSVolumeSource"
8260 }
8261}
8262
8263/// Probe describes a health check to be performed against a container to
8264/// determine whether it is alive or ready to receive traffic.
8265#[derive(Clone, Default, PartialEq)]
8266#[non_exhaustive]
8267pub struct Probe {
8268 /// Optional. Number of seconds after the container has started before the
8269 /// probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum
8270 /// value for liveness probe is 3600. Maximum value for startup probe is 240.
8271 pub initial_delay_seconds: i32,
8272
8273 /// Optional. Number of seconds after which the probe times out.
8274 /// Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
8275 /// Must be smaller than period_seconds.
8276 pub timeout_seconds: i32,
8277
8278 /// Optional. How often (in seconds) to perform the probe.
8279 /// Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
8280 /// is 3600. Maximum value for startup probe is 240.
8281 /// Must be greater or equal than timeout_seconds.
8282 pub period_seconds: i32,
8283
8284 /// Optional. Minimum consecutive failures for the probe to be considered
8285 /// failed after having succeeded. Defaults to 3. Minimum value is 1.
8286 pub failure_threshold: i32,
8287
8288 pub probe_type: std::option::Option<crate::model::probe::ProbeType>,
8289
8290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8291}
8292
8293impl Probe {
8294 pub fn new() -> Self {
8295 std::default::Default::default()
8296 }
8297
8298 /// Sets the value of [initial_delay_seconds][crate::model::Probe::initial_delay_seconds].
8299 ///
8300 /// # Example
8301 /// ```ignore,no_run
8302 /// # use google_cloud_run_v2::model::Probe;
8303 /// let x = Probe::new().set_initial_delay_seconds(42);
8304 /// ```
8305 pub fn set_initial_delay_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8306 self.initial_delay_seconds = v.into();
8307 self
8308 }
8309
8310 /// Sets the value of [timeout_seconds][crate::model::Probe::timeout_seconds].
8311 ///
8312 /// # Example
8313 /// ```ignore,no_run
8314 /// # use google_cloud_run_v2::model::Probe;
8315 /// let x = Probe::new().set_timeout_seconds(42);
8316 /// ```
8317 pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8318 self.timeout_seconds = v.into();
8319 self
8320 }
8321
8322 /// Sets the value of [period_seconds][crate::model::Probe::period_seconds].
8323 ///
8324 /// # Example
8325 /// ```ignore,no_run
8326 /// # use google_cloud_run_v2::model::Probe;
8327 /// let x = Probe::new().set_period_seconds(42);
8328 /// ```
8329 pub fn set_period_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8330 self.period_seconds = v.into();
8331 self
8332 }
8333
8334 /// Sets the value of [failure_threshold][crate::model::Probe::failure_threshold].
8335 ///
8336 /// # Example
8337 /// ```ignore,no_run
8338 /// # use google_cloud_run_v2::model::Probe;
8339 /// let x = Probe::new().set_failure_threshold(42);
8340 /// ```
8341 pub fn set_failure_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8342 self.failure_threshold = v.into();
8343 self
8344 }
8345
8346 /// Sets the value of [probe_type][crate::model::Probe::probe_type].
8347 ///
8348 /// Note that all the setters affecting `probe_type` are mutually
8349 /// exclusive.
8350 ///
8351 /// # Example
8352 /// ```ignore,no_run
8353 /// # use google_cloud_run_v2::model::Probe;
8354 /// use google_cloud_run_v2::model::HTTPGetAction;
8355 /// let x = Probe::new().set_probe_type(Some(
8356 /// google_cloud_run_v2::model::probe::ProbeType::HttpGet(HTTPGetAction::default().into())));
8357 /// ```
8358 pub fn set_probe_type<
8359 T: std::convert::Into<std::option::Option<crate::model::probe::ProbeType>>,
8360 >(
8361 mut self,
8362 v: T,
8363 ) -> Self {
8364 self.probe_type = v.into();
8365 self
8366 }
8367
8368 /// The value of [probe_type][crate::model::Probe::probe_type]
8369 /// if it holds a `HttpGet`, `None` if the field is not set or
8370 /// holds a different branch.
8371 pub fn http_get(&self) -> std::option::Option<&std::boxed::Box<crate::model::HTTPGetAction>> {
8372 #[allow(unreachable_patterns)]
8373 self.probe_type.as_ref().and_then(|v| match v {
8374 crate::model::probe::ProbeType::HttpGet(v) => std::option::Option::Some(v),
8375 _ => std::option::Option::None,
8376 })
8377 }
8378
8379 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8380 /// to hold a `HttpGet`.
8381 ///
8382 /// Note that all the setters affecting `probe_type` are
8383 /// mutually exclusive.
8384 ///
8385 /// # Example
8386 /// ```ignore,no_run
8387 /// # use google_cloud_run_v2::model::Probe;
8388 /// use google_cloud_run_v2::model::HTTPGetAction;
8389 /// let x = Probe::new().set_http_get(HTTPGetAction::default()/* use setters */);
8390 /// assert!(x.http_get().is_some());
8391 /// assert!(x.tcp_socket().is_none());
8392 /// assert!(x.grpc().is_none());
8393 /// ```
8394 pub fn set_http_get<T: std::convert::Into<std::boxed::Box<crate::model::HTTPGetAction>>>(
8395 mut self,
8396 v: T,
8397 ) -> Self {
8398 self.probe_type =
8399 std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(v.into()));
8400 self
8401 }
8402
8403 /// The value of [probe_type][crate::model::Probe::probe_type]
8404 /// if it holds a `TcpSocket`, `None` if the field is not set or
8405 /// holds a different branch.
8406 pub fn tcp_socket(
8407 &self,
8408 ) -> std::option::Option<&std::boxed::Box<crate::model::TCPSocketAction>> {
8409 #[allow(unreachable_patterns)]
8410 self.probe_type.as_ref().and_then(|v| match v {
8411 crate::model::probe::ProbeType::TcpSocket(v) => std::option::Option::Some(v),
8412 _ => std::option::Option::None,
8413 })
8414 }
8415
8416 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8417 /// to hold a `TcpSocket`.
8418 ///
8419 /// Note that all the setters affecting `probe_type` are
8420 /// mutually exclusive.
8421 ///
8422 /// # Example
8423 /// ```ignore,no_run
8424 /// # use google_cloud_run_v2::model::Probe;
8425 /// use google_cloud_run_v2::model::TCPSocketAction;
8426 /// let x = Probe::new().set_tcp_socket(TCPSocketAction::default()/* use setters */);
8427 /// assert!(x.tcp_socket().is_some());
8428 /// assert!(x.http_get().is_none());
8429 /// assert!(x.grpc().is_none());
8430 /// ```
8431 pub fn set_tcp_socket<T: std::convert::Into<std::boxed::Box<crate::model::TCPSocketAction>>>(
8432 mut self,
8433 v: T,
8434 ) -> Self {
8435 self.probe_type =
8436 std::option::Option::Some(crate::model::probe::ProbeType::TcpSocket(v.into()));
8437 self
8438 }
8439
8440 /// The value of [probe_type][crate::model::Probe::probe_type]
8441 /// if it holds a `Grpc`, `None` if the field is not set or
8442 /// holds a different branch.
8443 pub fn grpc(&self) -> std::option::Option<&std::boxed::Box<crate::model::GRPCAction>> {
8444 #[allow(unreachable_patterns)]
8445 self.probe_type.as_ref().and_then(|v| match v {
8446 crate::model::probe::ProbeType::Grpc(v) => std::option::Option::Some(v),
8447 _ => std::option::Option::None,
8448 })
8449 }
8450
8451 /// Sets the value of [probe_type][crate::model::Probe::probe_type]
8452 /// to hold a `Grpc`.
8453 ///
8454 /// Note that all the setters affecting `probe_type` are
8455 /// mutually exclusive.
8456 ///
8457 /// # Example
8458 /// ```ignore,no_run
8459 /// # use google_cloud_run_v2::model::Probe;
8460 /// use google_cloud_run_v2::model::GRPCAction;
8461 /// let x = Probe::new().set_grpc(GRPCAction::default()/* use setters */);
8462 /// assert!(x.grpc().is_some());
8463 /// assert!(x.http_get().is_none());
8464 /// assert!(x.tcp_socket().is_none());
8465 /// ```
8466 pub fn set_grpc<T: std::convert::Into<std::boxed::Box<crate::model::GRPCAction>>>(
8467 mut self,
8468 v: T,
8469 ) -> Self {
8470 self.probe_type = std::option::Option::Some(crate::model::probe::ProbeType::Grpc(v.into()));
8471 self
8472 }
8473}
8474
8475impl wkt::message::Message for Probe {
8476 fn typename() -> &'static str {
8477 "type.googleapis.com/google.cloud.run.v2.Probe"
8478 }
8479}
8480
8481/// Defines additional types related to [Probe].
8482pub mod probe {
8483 #[allow(unused_imports)]
8484 use super::*;
8485
8486 #[derive(Clone, Debug, PartialEq)]
8487 #[non_exhaustive]
8488 pub enum ProbeType {
8489 /// Optional. HTTPGet specifies the http request to perform.
8490 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8491 HttpGet(std::boxed::Box<crate::model::HTTPGetAction>),
8492 /// Optional. TCPSocket specifies an action involving a TCP port.
8493 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8494 TcpSocket(std::boxed::Box<crate::model::TCPSocketAction>),
8495 /// Optional. GRPC specifies an action involving a gRPC port.
8496 /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
8497 Grpc(std::boxed::Box<crate::model::GRPCAction>),
8498 }
8499}
8500
8501/// HTTPGetAction describes an action based on HTTP Get requests.
8502#[derive(Clone, Default, PartialEq)]
8503#[non_exhaustive]
8504pub struct HTTPGetAction {
8505 /// Optional. Path to access on the HTTP server. Defaults to '/'.
8506 pub path: std::string::String,
8507
8508 /// Optional. Custom headers to set in the request. HTTP allows repeated
8509 /// headers.
8510 pub http_headers: std::vec::Vec<crate::model::HTTPHeader>,
8511
8512 /// Optional. Port number to access on the container. Must be in the range 1 to
8513 /// 65535. If not specified, defaults to the exposed port of the container,
8514 /// which is the value of container.ports[0].containerPort.
8515 pub port: i32,
8516
8517 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8518}
8519
8520impl HTTPGetAction {
8521 pub fn new() -> Self {
8522 std::default::Default::default()
8523 }
8524
8525 /// Sets the value of [path][crate::model::HTTPGetAction::path].
8526 ///
8527 /// # Example
8528 /// ```ignore,no_run
8529 /// # use google_cloud_run_v2::model::HTTPGetAction;
8530 /// let x = HTTPGetAction::new().set_path("example");
8531 /// ```
8532 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8533 self.path = v.into();
8534 self
8535 }
8536
8537 /// Sets the value of [http_headers][crate::model::HTTPGetAction::http_headers].
8538 ///
8539 /// # Example
8540 /// ```ignore,no_run
8541 /// # use google_cloud_run_v2::model::HTTPGetAction;
8542 /// use google_cloud_run_v2::model::HTTPHeader;
8543 /// let x = HTTPGetAction::new()
8544 /// .set_http_headers([
8545 /// HTTPHeader::default()/* use setters */,
8546 /// HTTPHeader::default()/* use (different) setters */,
8547 /// ]);
8548 /// ```
8549 pub fn set_http_headers<T, V>(mut self, v: T) -> Self
8550 where
8551 T: std::iter::IntoIterator<Item = V>,
8552 V: std::convert::Into<crate::model::HTTPHeader>,
8553 {
8554 use std::iter::Iterator;
8555 self.http_headers = v.into_iter().map(|i| i.into()).collect();
8556 self
8557 }
8558
8559 /// Sets the value of [port][crate::model::HTTPGetAction::port].
8560 ///
8561 /// # Example
8562 /// ```ignore,no_run
8563 /// # use google_cloud_run_v2::model::HTTPGetAction;
8564 /// let x = HTTPGetAction::new().set_port(42);
8565 /// ```
8566 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8567 self.port = v.into();
8568 self
8569 }
8570}
8571
8572impl wkt::message::Message for HTTPGetAction {
8573 fn typename() -> &'static str {
8574 "type.googleapis.com/google.cloud.run.v2.HTTPGetAction"
8575 }
8576}
8577
8578/// HTTPHeader describes a custom header to be used in HTTP probes
8579#[derive(Clone, Default, PartialEq)]
8580#[non_exhaustive]
8581pub struct HTTPHeader {
8582 /// Required. The header field name
8583 pub name: std::string::String,
8584
8585 /// Optional. The header field value
8586 pub value: std::string::String,
8587
8588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8589}
8590
8591impl HTTPHeader {
8592 pub fn new() -> Self {
8593 std::default::Default::default()
8594 }
8595
8596 /// Sets the value of [name][crate::model::HTTPHeader::name].
8597 ///
8598 /// # Example
8599 /// ```ignore,no_run
8600 /// # use google_cloud_run_v2::model::HTTPHeader;
8601 /// let x = HTTPHeader::new().set_name("example");
8602 /// ```
8603 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8604 self.name = v.into();
8605 self
8606 }
8607
8608 /// Sets the value of [value][crate::model::HTTPHeader::value].
8609 ///
8610 /// # Example
8611 /// ```ignore,no_run
8612 /// # use google_cloud_run_v2::model::HTTPHeader;
8613 /// let x = HTTPHeader::new().set_value("example");
8614 /// ```
8615 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8616 self.value = v.into();
8617 self
8618 }
8619}
8620
8621impl wkt::message::Message for HTTPHeader {
8622 fn typename() -> &'static str {
8623 "type.googleapis.com/google.cloud.run.v2.HTTPHeader"
8624 }
8625}
8626
8627/// TCPSocketAction describes an action based on opening a socket
8628#[derive(Clone, Default, PartialEq)]
8629#[non_exhaustive]
8630pub struct TCPSocketAction {
8631 /// Optional. Port number to access on the container. Must be in the range 1 to
8632 /// 65535. If not specified, defaults to the exposed port of the container,
8633 /// which is the value of container.ports[0].containerPort.
8634 pub port: i32,
8635
8636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8637}
8638
8639impl TCPSocketAction {
8640 pub fn new() -> Self {
8641 std::default::Default::default()
8642 }
8643
8644 /// Sets the value of [port][crate::model::TCPSocketAction::port].
8645 ///
8646 /// # Example
8647 /// ```ignore,no_run
8648 /// # use google_cloud_run_v2::model::TCPSocketAction;
8649 /// let x = TCPSocketAction::new().set_port(42);
8650 /// ```
8651 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8652 self.port = v.into();
8653 self
8654 }
8655}
8656
8657impl wkt::message::Message for TCPSocketAction {
8658 fn typename() -> &'static str {
8659 "type.googleapis.com/google.cloud.run.v2.TCPSocketAction"
8660 }
8661}
8662
8663/// GRPCAction describes an action involving a GRPC port.
8664#[derive(Clone, Default, PartialEq)]
8665#[non_exhaustive]
8666pub struct GRPCAction {
8667 /// Optional. Port number of the gRPC service. Number must be in the range 1 to
8668 /// 65535. If not specified, defaults to the exposed port of the container,
8669 /// which is the value of container.ports[0].containerPort.
8670 pub port: i32,
8671
8672 /// Optional. Service is the name of the service to place in the gRPC
8673 /// HealthCheckRequest (see
8674 /// <https://github.com/grpc/grpc/blob/master/doc/health-checking.md> ). If this
8675 /// is not specified, the default behavior is defined by gRPC.
8676 pub service: std::string::String,
8677
8678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8679}
8680
8681impl GRPCAction {
8682 pub fn new() -> Self {
8683 std::default::Default::default()
8684 }
8685
8686 /// Sets the value of [port][crate::model::GRPCAction::port].
8687 ///
8688 /// # Example
8689 /// ```ignore,no_run
8690 /// # use google_cloud_run_v2::model::GRPCAction;
8691 /// let x = GRPCAction::new().set_port(42);
8692 /// ```
8693 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8694 self.port = v.into();
8695 self
8696 }
8697
8698 /// Sets the value of [service][crate::model::GRPCAction::service].
8699 ///
8700 /// # Example
8701 /// ```ignore,no_run
8702 /// # use google_cloud_run_v2::model::GRPCAction;
8703 /// let x = GRPCAction::new().set_service("example");
8704 /// ```
8705 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8706 self.service = v.into();
8707 self
8708 }
8709}
8710
8711impl wkt::message::Message for GRPCAction {
8712 fn typename() -> &'static str {
8713 "type.googleapis.com/google.cloud.run.v2.GRPCAction"
8714 }
8715}
8716
8717/// Build information of the image.
8718#[derive(Clone, Default, PartialEq)]
8719#[non_exhaustive]
8720pub struct BuildInfo {
8721 /// Output only. Entry point of the function when the image is a Cloud Run
8722 /// function.
8723 pub function_target: std::string::String,
8724
8725 /// Output only. Source code location of the image.
8726 pub source_location: std::string::String,
8727
8728 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8729}
8730
8731impl BuildInfo {
8732 pub fn new() -> Self {
8733 std::default::Default::default()
8734 }
8735
8736 /// Sets the value of [function_target][crate::model::BuildInfo::function_target].
8737 ///
8738 /// # Example
8739 /// ```ignore,no_run
8740 /// # use google_cloud_run_v2::model::BuildInfo;
8741 /// let x = BuildInfo::new().set_function_target("example");
8742 /// ```
8743 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8744 self.function_target = v.into();
8745 self
8746 }
8747
8748 /// Sets the value of [source_location][crate::model::BuildInfo::source_location].
8749 ///
8750 /// # Example
8751 /// ```ignore,no_run
8752 /// # use google_cloud_run_v2::model::BuildInfo;
8753 /// let x = BuildInfo::new().set_source_location("example");
8754 /// ```
8755 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8756 self.source_location = v.into();
8757 self
8758 }
8759}
8760
8761impl wkt::message::Message for BuildInfo {
8762 fn typename() -> &'static str {
8763 "type.googleapis.com/google.cloud.run.v2.BuildInfo"
8764 }
8765}
8766
8767/// Source type for the container.
8768#[derive(Clone, Default, PartialEq)]
8769#[non_exhaustive]
8770pub struct SourceCode {
8771 /// The source type.
8772 pub source_type: std::option::Option<crate::model::source_code::SourceType>,
8773
8774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8775}
8776
8777impl SourceCode {
8778 pub fn new() -> Self {
8779 std::default::Default::default()
8780 }
8781
8782 /// Sets the value of [source_type][crate::model::SourceCode::source_type].
8783 ///
8784 /// Note that all the setters affecting `source_type` are mutually
8785 /// exclusive.
8786 ///
8787 /// # Example
8788 /// ```ignore,no_run
8789 /// # use google_cloud_run_v2::model::SourceCode;
8790 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8791 /// let x = SourceCode::new().set_source_type(Some(
8792 /// google_cloud_run_v2::model::source_code::SourceType::CloudStorageSource(CloudStorageSource::default().into())));
8793 /// ```
8794 pub fn set_source_type<
8795 T: std::convert::Into<std::option::Option<crate::model::source_code::SourceType>>,
8796 >(
8797 mut self,
8798 v: T,
8799 ) -> Self {
8800 self.source_type = v.into();
8801 self
8802 }
8803
8804 /// The value of [source_type][crate::model::SourceCode::source_type]
8805 /// if it holds a `CloudStorageSource`, `None` if the field is not set or
8806 /// holds a different branch.
8807 pub fn cloud_storage_source(
8808 &self,
8809 ) -> std::option::Option<&std::boxed::Box<crate::model::source_code::CloudStorageSource>> {
8810 #[allow(unreachable_patterns)]
8811 self.source_type.as_ref().and_then(|v| match v {
8812 crate::model::source_code::SourceType::CloudStorageSource(v) => {
8813 std::option::Option::Some(v)
8814 }
8815 _ => std::option::Option::None,
8816 })
8817 }
8818
8819 /// Sets the value of [source_type][crate::model::SourceCode::source_type]
8820 /// to hold a `CloudStorageSource`.
8821 ///
8822 /// Note that all the setters affecting `source_type` are
8823 /// mutually exclusive.
8824 ///
8825 /// # Example
8826 /// ```ignore,no_run
8827 /// # use google_cloud_run_v2::model::SourceCode;
8828 /// use google_cloud_run_v2::model::source_code::CloudStorageSource;
8829 /// let x = SourceCode::new().set_cloud_storage_source(CloudStorageSource::default()/* use setters */);
8830 /// assert!(x.cloud_storage_source().is_some());
8831 /// ```
8832 pub fn set_cloud_storage_source<
8833 T: std::convert::Into<std::boxed::Box<crate::model::source_code::CloudStorageSource>>,
8834 >(
8835 mut self,
8836 v: T,
8837 ) -> Self {
8838 self.source_type = std::option::Option::Some(
8839 crate::model::source_code::SourceType::CloudStorageSource(v.into()),
8840 );
8841 self
8842 }
8843}
8844
8845impl wkt::message::Message for SourceCode {
8846 fn typename() -> &'static str {
8847 "type.googleapis.com/google.cloud.run.v2.SourceCode"
8848 }
8849}
8850
8851/// Defines additional types related to [SourceCode].
8852pub mod source_code {
8853 #[allow(unused_imports)]
8854 use super::*;
8855
8856 /// Cloud Storage source.
8857 #[derive(Clone, Default, PartialEq)]
8858 #[non_exhaustive]
8859 pub struct CloudStorageSource {
8860 /// Required. The Cloud Storage bucket name.
8861 pub bucket: std::string::String,
8862
8863 /// Required. The Cloud Storage object name.
8864 pub object: std::string::String,
8865
8866 /// Optional. The Cloud Storage object generation.
8867 pub generation: i64,
8868
8869 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8870 }
8871
8872 impl CloudStorageSource {
8873 pub fn new() -> Self {
8874 std::default::Default::default()
8875 }
8876
8877 /// Sets the value of [bucket][crate::model::source_code::CloudStorageSource::bucket].
8878 ///
8879 /// # Example
8880 /// ```ignore,no_run
8881 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8882 /// let x = CloudStorageSource::new().set_bucket("example");
8883 /// ```
8884 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8885 self.bucket = v.into();
8886 self
8887 }
8888
8889 /// Sets the value of [object][crate::model::source_code::CloudStorageSource::object].
8890 ///
8891 /// # Example
8892 /// ```ignore,no_run
8893 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8894 /// let x = CloudStorageSource::new().set_object("example");
8895 /// ```
8896 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8897 self.object = v.into();
8898 self
8899 }
8900
8901 /// Sets the value of [generation][crate::model::source_code::CloudStorageSource::generation].
8902 ///
8903 /// # Example
8904 /// ```ignore,no_run
8905 /// # use google_cloud_run_v2::model::source_code::CloudStorageSource;
8906 /// let x = CloudStorageSource::new().set_generation(42);
8907 /// ```
8908 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8909 self.generation = v.into();
8910 self
8911 }
8912 }
8913
8914 impl wkt::message::Message for CloudStorageSource {
8915 fn typename() -> &'static str {
8916 "type.googleapis.com/google.cloud.run.v2.SourceCode.CloudStorageSource"
8917 }
8918 }
8919
8920 /// The source type.
8921 #[derive(Clone, Debug, PartialEq)]
8922 #[non_exhaustive]
8923 pub enum SourceType {
8924 /// The source is a Cloud Storage bucket.
8925 CloudStorageSource(std::boxed::Box<crate::model::source_code::CloudStorageSource>),
8926 }
8927}
8928
8929/// Request message for obtaining a Revision by its full name.
8930#[derive(Clone, Default, PartialEq)]
8931#[non_exhaustive]
8932pub struct GetRevisionRequest {
8933 /// Required. The full name of the Revision.
8934 /// Format:
8935 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
8936 pub name: std::string::String,
8937
8938 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8939}
8940
8941impl GetRevisionRequest {
8942 pub fn new() -> Self {
8943 std::default::Default::default()
8944 }
8945
8946 /// Sets the value of [name][crate::model::GetRevisionRequest::name].
8947 ///
8948 /// # Example
8949 /// ```ignore,no_run
8950 /// # use google_cloud_run_v2::model::GetRevisionRequest;
8951 /// let x = GetRevisionRequest::new().set_name("example");
8952 /// ```
8953 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8954 self.name = v.into();
8955 self
8956 }
8957}
8958
8959impl wkt::message::Message for GetRevisionRequest {
8960 fn typename() -> &'static str {
8961 "type.googleapis.com/google.cloud.run.v2.GetRevisionRequest"
8962 }
8963}
8964
8965/// Request message for retrieving a list of Revisions.
8966#[derive(Clone, Default, PartialEq)]
8967#[non_exhaustive]
8968pub struct ListRevisionsRequest {
8969 /// Required. The Service from which the Revisions should be listed.
8970 /// To list all Revisions across Services, use "-" instead of Service name.
8971 /// Format:
8972 /// projects/{project}/locations/{location}/services/{service}
8973 pub parent: std::string::String,
8974
8975 /// Maximum number of revisions to return in this call.
8976 pub page_size: i32,
8977
8978 /// A page token received from a previous call to ListRevisions.
8979 /// All other parameters must match.
8980 pub page_token: std::string::String,
8981
8982 /// If true, returns deleted (but unexpired) resources along with active ones.
8983 pub show_deleted: bool,
8984
8985 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8986}
8987
8988impl ListRevisionsRequest {
8989 pub fn new() -> Self {
8990 std::default::Default::default()
8991 }
8992
8993 /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
8994 ///
8995 /// # Example
8996 /// ```ignore,no_run
8997 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
8998 /// let x = ListRevisionsRequest::new().set_parent("example");
8999 /// ```
9000 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9001 self.parent = v.into();
9002 self
9003 }
9004
9005 /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
9006 ///
9007 /// # Example
9008 /// ```ignore,no_run
9009 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9010 /// let x = ListRevisionsRequest::new().set_page_size(42);
9011 /// ```
9012 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9013 self.page_size = v.into();
9014 self
9015 }
9016
9017 /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
9018 ///
9019 /// # Example
9020 /// ```ignore,no_run
9021 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9022 /// let x = ListRevisionsRequest::new().set_page_token("example");
9023 /// ```
9024 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9025 self.page_token = v.into();
9026 self
9027 }
9028
9029 /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
9030 ///
9031 /// # Example
9032 /// ```ignore,no_run
9033 /// # use google_cloud_run_v2::model::ListRevisionsRequest;
9034 /// let x = ListRevisionsRequest::new().set_show_deleted(true);
9035 /// ```
9036 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9037 self.show_deleted = v.into();
9038 self
9039 }
9040}
9041
9042impl wkt::message::Message for ListRevisionsRequest {
9043 fn typename() -> &'static str {
9044 "type.googleapis.com/google.cloud.run.v2.ListRevisionsRequest"
9045 }
9046}
9047
9048/// Response message containing a list of Revisions.
9049#[derive(Clone, Default, PartialEq)]
9050#[non_exhaustive]
9051pub struct ListRevisionsResponse {
9052 /// The resulting list of Revisions.
9053 pub revisions: std::vec::Vec<crate::model::Revision>,
9054
9055 /// A token indicating there are more items than page_size. Use it in the next
9056 /// ListRevisions request to continue.
9057 pub next_page_token: std::string::String,
9058
9059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9060}
9061
9062impl ListRevisionsResponse {
9063 pub fn new() -> Self {
9064 std::default::Default::default()
9065 }
9066
9067 /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
9068 ///
9069 /// # Example
9070 /// ```ignore,no_run
9071 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9072 /// use google_cloud_run_v2::model::Revision;
9073 /// let x = ListRevisionsResponse::new()
9074 /// .set_revisions([
9075 /// Revision::default()/* use setters */,
9076 /// Revision::default()/* use (different) setters */,
9077 /// ]);
9078 /// ```
9079 pub fn set_revisions<T, V>(mut self, v: T) -> Self
9080 where
9081 T: std::iter::IntoIterator<Item = V>,
9082 V: std::convert::Into<crate::model::Revision>,
9083 {
9084 use std::iter::Iterator;
9085 self.revisions = v.into_iter().map(|i| i.into()).collect();
9086 self
9087 }
9088
9089 /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
9090 ///
9091 /// # Example
9092 /// ```ignore,no_run
9093 /// # use google_cloud_run_v2::model::ListRevisionsResponse;
9094 /// let x = ListRevisionsResponse::new().set_next_page_token("example");
9095 /// ```
9096 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9097 self.next_page_token = v.into();
9098 self
9099 }
9100}
9101
9102impl wkt::message::Message for ListRevisionsResponse {
9103 fn typename() -> &'static str {
9104 "type.googleapis.com/google.cloud.run.v2.ListRevisionsResponse"
9105 }
9106}
9107
9108#[doc(hidden)]
9109impl google_cloud_gax::paginator::internal::PageableResponse for ListRevisionsResponse {
9110 type PageItem = crate::model::Revision;
9111
9112 fn items(self) -> std::vec::Vec<Self::PageItem> {
9113 self.revisions
9114 }
9115
9116 fn next_page_token(&self) -> std::string::String {
9117 use std::clone::Clone;
9118 self.next_page_token.clone()
9119 }
9120}
9121
9122/// Request message for deleting a retired Revision.
9123/// Revision lifecycle is usually managed by making changes to the parent
9124/// Service. Only retired revisions can be deleted with this API.
9125#[derive(Clone, Default, PartialEq)]
9126#[non_exhaustive]
9127pub struct DeleteRevisionRequest {
9128 /// Required. The name of the Revision to delete.
9129 /// Format:
9130 /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
9131 pub name: std::string::String,
9132
9133 /// Indicates that the request should be validated without actually
9134 /// deleting any resources.
9135 pub validate_only: bool,
9136
9137 /// A system-generated fingerprint for this version of the
9138 /// resource. This may be used to detect modification conflict during updates.
9139 pub etag: std::string::String,
9140
9141 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9142}
9143
9144impl DeleteRevisionRequest {
9145 pub fn new() -> Self {
9146 std::default::Default::default()
9147 }
9148
9149 /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
9150 ///
9151 /// # Example
9152 /// ```ignore,no_run
9153 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9154 /// let x = DeleteRevisionRequest::new().set_name("example");
9155 /// ```
9156 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9157 self.name = v.into();
9158 self
9159 }
9160
9161 /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
9162 ///
9163 /// # Example
9164 /// ```ignore,no_run
9165 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9166 /// let x = DeleteRevisionRequest::new().set_validate_only(true);
9167 /// ```
9168 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9169 self.validate_only = v.into();
9170 self
9171 }
9172
9173 /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
9174 ///
9175 /// # Example
9176 /// ```ignore,no_run
9177 /// # use google_cloud_run_v2::model::DeleteRevisionRequest;
9178 /// let x = DeleteRevisionRequest::new().set_etag("example");
9179 /// ```
9180 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9181 self.etag = v.into();
9182 self
9183 }
9184}
9185
9186impl wkt::message::Message for DeleteRevisionRequest {
9187 fn typename() -> &'static str {
9188 "type.googleapis.com/google.cloud.run.v2.DeleteRevisionRequest"
9189 }
9190}
9191
9192/// A Revision is an immutable snapshot of code and configuration. A Revision
9193/// references a container image. Revisions are only created by updates to its
9194/// parent Service.
9195#[derive(Clone, Default, PartialEq)]
9196#[non_exhaustive]
9197pub struct Revision {
9198 /// Output only. The unique name of this Revision.
9199 pub name: std::string::String,
9200
9201 /// Output only. Server assigned unique identifier for the Revision. The value
9202 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
9203 /// deleted.
9204 pub uid: std::string::String,
9205
9206 /// Output only. A number that monotonically increases every time the user
9207 /// modifies the desired state.
9208 pub generation: i64,
9209
9210 /// Output only. Unstructured key value map that can be used to organize and
9211 /// categorize objects. User-provided labels are shared with Google's billing
9212 /// system, so they can be used to filter, or break down billing charges by
9213 /// team, component, environment, state, etc. For more information, visit
9214 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
9215 /// <https://cloud.google.com/run/docs/configuring/labels>.
9216 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9217
9218 /// Output only. Unstructured key value map that may
9219 /// be set by external tools to store and arbitrary metadata.
9220 /// They are not queryable and should be preserved
9221 /// when modifying objects.
9222 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
9223
9224 /// Output only. The creation time.
9225 pub create_time: std::option::Option<wkt::Timestamp>,
9226
9227 /// Output only. The last-modified time.
9228 pub update_time: std::option::Option<wkt::Timestamp>,
9229
9230 /// Output only. For a deleted resource, the deletion time. It is only
9231 /// populated as a response to a Delete request.
9232 pub delete_time: std::option::Option<wkt::Timestamp>,
9233
9234 /// Output only. For a deleted resource, the time after which it will be
9235 /// permamently deleted. It is only populated as a response to a Delete
9236 /// request.
9237 pub expire_time: std::option::Option<wkt::Timestamp>,
9238
9239 /// The least stable launch stage needed to create this resource, as defined by
9240 /// [Google Cloud Platform Launch
9241 /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
9242 /// `ALPHA`, `BETA`, and `GA`.
9243 ///
9244 /// Note that this value might not be what was used
9245 /// as input. For example, if ALPHA was provided as input in the parent
9246 /// resource, but only BETA and GA-level features are were, this field will be
9247 /// BETA.
9248 pub launch_stage: google_cloud_api::model::LaunchStage,
9249
9250 /// Output only. The name of the parent service.
9251 pub service: std::string::String,
9252
9253 /// Scaling settings for this revision.
9254 pub scaling: std::option::Option<crate::model::RevisionScaling>,
9255
9256 /// VPC Access configuration for this Revision. For more information, visit
9257 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
9258 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
9259
9260 /// Sets the maximum number of requests that each serving instance can receive.
9261 pub max_instance_request_concurrency: i32,
9262
9263 /// Max allowed time for an instance to respond to a request.
9264 pub timeout: std::option::Option<wkt::Duration>,
9265
9266 /// Email address of the IAM service account associated with the revision of
9267 /// the service. The service account represents the identity of the running
9268 /// revision, and determines what permissions the revision has.
9269 pub service_account: std::string::String,
9270
9271 /// Holds the single container that defines the unit of execution for this
9272 /// Revision.
9273 pub containers: std::vec::Vec<crate::model::Container>,
9274
9275 /// A list of Volumes to make available to containers.
9276 pub volumes: std::vec::Vec<crate::model::Volume>,
9277
9278 /// The execution environment being used to host this Revision.
9279 pub execution_environment: crate::model::ExecutionEnvironment,
9280
9281 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
9282 /// this container image. For more information, go to
9283 /// <https://cloud.google.com/run/docs/securing/using-cmek>
9284 pub encryption_key: std::string::String,
9285
9286 /// Enables service mesh connectivity.
9287 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
9288
9289 /// The action to take if the encryption key is revoked.
9290 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
9291
9292 /// If encryption_key_revocation_action is SHUTDOWN, the duration before
9293 /// shutting down all instances. The minimum increment is 1 hour.
9294 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
9295
9296 /// Output only. Indicates whether the resource's reconciliation is still in
9297 /// progress. See comments in `Service.reconciling` for additional information
9298 /// on reconciliation process in Cloud Run.
9299 pub reconciling: bool,
9300
9301 /// Output only. The Condition of this Revision, containing its readiness
9302 /// status, and detailed error information in case it did not reach a serving
9303 /// state.
9304 pub conditions: std::vec::Vec<crate::model::Condition>,
9305
9306 /// Output only. The generation of this Revision currently serving traffic. See
9307 /// comments in `reconciling` for additional information on reconciliation
9308 /// process in Cloud Run.
9309 pub observed_generation: i64,
9310
9311 /// Output only. The Google Console URI to obtain logs for the Revision.
9312 pub log_uri: std::string::String,
9313
9314 /// Output only. Reserved for future use.
9315 pub satisfies_pzs: bool,
9316
9317 /// Enable session affinity.
9318 pub session_affinity: bool,
9319
9320 /// Output only. The current effective scaling settings for the revision.
9321 pub scaling_status: std::option::Option<crate::model::RevisionScalingStatus>,
9322
9323 /// The node selector for the revision.
9324 pub node_selector: std::option::Option<crate::model::NodeSelector>,
9325
9326 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
9327 /// revision.
9328 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
9329
9330 /// Output only. Email address of the authenticated creator.
9331 pub creator: std::string::String,
9332
9333 /// Output only. A system-generated fingerprint for this version of the
9334 /// resource. May be used to detect modification conflict during updates.
9335 pub etag: std::string::String,
9336
9337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9338}
9339
9340impl Revision {
9341 pub fn new() -> Self {
9342 std::default::Default::default()
9343 }
9344
9345 /// Sets the value of [name][crate::model::Revision::name].
9346 ///
9347 /// # Example
9348 /// ```ignore,no_run
9349 /// # use google_cloud_run_v2::model::Revision;
9350 /// let x = Revision::new().set_name("example");
9351 /// ```
9352 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9353 self.name = v.into();
9354 self
9355 }
9356
9357 /// Sets the value of [uid][crate::model::Revision::uid].
9358 ///
9359 /// # Example
9360 /// ```ignore,no_run
9361 /// # use google_cloud_run_v2::model::Revision;
9362 /// let x = Revision::new().set_uid("example");
9363 /// ```
9364 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9365 self.uid = v.into();
9366 self
9367 }
9368
9369 /// Sets the value of [generation][crate::model::Revision::generation].
9370 ///
9371 /// # Example
9372 /// ```ignore,no_run
9373 /// # use google_cloud_run_v2::model::Revision;
9374 /// let x = Revision::new().set_generation(42);
9375 /// ```
9376 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9377 self.generation = v.into();
9378 self
9379 }
9380
9381 /// Sets the value of [labels][crate::model::Revision::labels].
9382 ///
9383 /// # Example
9384 /// ```ignore,no_run
9385 /// # use google_cloud_run_v2::model::Revision;
9386 /// let x = Revision::new().set_labels([
9387 /// ("key0", "abc"),
9388 /// ("key1", "xyz"),
9389 /// ]);
9390 /// ```
9391 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9392 where
9393 T: std::iter::IntoIterator<Item = (K, V)>,
9394 K: std::convert::Into<std::string::String>,
9395 V: std::convert::Into<std::string::String>,
9396 {
9397 use std::iter::Iterator;
9398 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9399 self
9400 }
9401
9402 /// Sets the value of [annotations][crate::model::Revision::annotations].
9403 ///
9404 /// # Example
9405 /// ```ignore,no_run
9406 /// # use google_cloud_run_v2::model::Revision;
9407 /// let x = Revision::new().set_annotations([
9408 /// ("key0", "abc"),
9409 /// ("key1", "xyz"),
9410 /// ]);
9411 /// ```
9412 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
9413 where
9414 T: std::iter::IntoIterator<Item = (K, V)>,
9415 K: std::convert::Into<std::string::String>,
9416 V: std::convert::Into<std::string::String>,
9417 {
9418 use std::iter::Iterator;
9419 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9420 self
9421 }
9422
9423 /// Sets the value of [create_time][crate::model::Revision::create_time].
9424 ///
9425 /// # Example
9426 /// ```ignore,no_run
9427 /// # use google_cloud_run_v2::model::Revision;
9428 /// use wkt::Timestamp;
9429 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
9430 /// ```
9431 pub fn set_create_time<T>(mut self, v: T) -> Self
9432 where
9433 T: std::convert::Into<wkt::Timestamp>,
9434 {
9435 self.create_time = std::option::Option::Some(v.into());
9436 self
9437 }
9438
9439 /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
9440 ///
9441 /// # Example
9442 /// ```ignore,no_run
9443 /// # use google_cloud_run_v2::model::Revision;
9444 /// use wkt::Timestamp;
9445 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9446 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
9447 /// ```
9448 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9449 where
9450 T: std::convert::Into<wkt::Timestamp>,
9451 {
9452 self.create_time = v.map(|x| x.into());
9453 self
9454 }
9455
9456 /// Sets the value of [update_time][crate::model::Revision::update_time].
9457 ///
9458 /// # Example
9459 /// ```ignore,no_run
9460 /// # use google_cloud_run_v2::model::Revision;
9461 /// use wkt::Timestamp;
9462 /// let x = Revision::new().set_update_time(Timestamp::default()/* use setters */);
9463 /// ```
9464 pub fn set_update_time<T>(mut self, v: T) -> Self
9465 where
9466 T: std::convert::Into<wkt::Timestamp>,
9467 {
9468 self.update_time = std::option::Option::Some(v.into());
9469 self
9470 }
9471
9472 /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
9473 ///
9474 /// # Example
9475 /// ```ignore,no_run
9476 /// # use google_cloud_run_v2::model::Revision;
9477 /// use wkt::Timestamp;
9478 /// let x = Revision::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9479 /// let x = Revision::new().set_or_clear_update_time(None::<Timestamp>);
9480 /// ```
9481 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9482 where
9483 T: std::convert::Into<wkt::Timestamp>,
9484 {
9485 self.update_time = v.map(|x| x.into());
9486 self
9487 }
9488
9489 /// Sets the value of [delete_time][crate::model::Revision::delete_time].
9490 ///
9491 /// # Example
9492 /// ```ignore,no_run
9493 /// # use google_cloud_run_v2::model::Revision;
9494 /// use wkt::Timestamp;
9495 /// let x = Revision::new().set_delete_time(Timestamp::default()/* use setters */);
9496 /// ```
9497 pub fn set_delete_time<T>(mut self, v: T) -> Self
9498 where
9499 T: std::convert::Into<wkt::Timestamp>,
9500 {
9501 self.delete_time = std::option::Option::Some(v.into());
9502 self
9503 }
9504
9505 /// Sets or clears the value of [delete_time][crate::model::Revision::delete_time].
9506 ///
9507 /// # Example
9508 /// ```ignore,no_run
9509 /// # use google_cloud_run_v2::model::Revision;
9510 /// use wkt::Timestamp;
9511 /// let x = Revision::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
9512 /// let x = Revision::new().set_or_clear_delete_time(None::<Timestamp>);
9513 /// ```
9514 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
9515 where
9516 T: std::convert::Into<wkt::Timestamp>,
9517 {
9518 self.delete_time = v.map(|x| x.into());
9519 self
9520 }
9521
9522 /// Sets the value of [expire_time][crate::model::Revision::expire_time].
9523 ///
9524 /// # Example
9525 /// ```ignore,no_run
9526 /// # use google_cloud_run_v2::model::Revision;
9527 /// use wkt::Timestamp;
9528 /// let x = Revision::new().set_expire_time(Timestamp::default()/* use setters */);
9529 /// ```
9530 pub fn set_expire_time<T>(mut self, v: T) -> Self
9531 where
9532 T: std::convert::Into<wkt::Timestamp>,
9533 {
9534 self.expire_time = std::option::Option::Some(v.into());
9535 self
9536 }
9537
9538 /// Sets or clears the value of [expire_time][crate::model::Revision::expire_time].
9539 ///
9540 /// # Example
9541 /// ```ignore,no_run
9542 /// # use google_cloud_run_v2::model::Revision;
9543 /// use wkt::Timestamp;
9544 /// let x = Revision::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9545 /// let x = Revision::new().set_or_clear_expire_time(None::<Timestamp>);
9546 /// ```
9547 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9548 where
9549 T: std::convert::Into<wkt::Timestamp>,
9550 {
9551 self.expire_time = v.map(|x| x.into());
9552 self
9553 }
9554
9555 /// Sets the value of [launch_stage][crate::model::Revision::launch_stage].
9556 ///
9557 /// # Example
9558 /// ```ignore,no_run
9559 /// # use google_cloud_run_v2::model::Revision;
9560 /// use google_cloud_api::model::LaunchStage;
9561 /// let x0 = Revision::new().set_launch_stage(LaunchStage::Unimplemented);
9562 /// let x1 = Revision::new().set_launch_stage(LaunchStage::Prelaunch);
9563 /// let x2 = Revision::new().set_launch_stage(LaunchStage::EarlyAccess);
9564 /// ```
9565 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
9566 mut self,
9567 v: T,
9568 ) -> Self {
9569 self.launch_stage = v.into();
9570 self
9571 }
9572
9573 /// Sets the value of [service][crate::model::Revision::service].
9574 ///
9575 /// # Example
9576 /// ```ignore,no_run
9577 /// # use google_cloud_run_v2::model::Revision;
9578 /// let x = Revision::new().set_service("example");
9579 /// ```
9580 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9581 self.service = v.into();
9582 self
9583 }
9584
9585 /// Sets the value of [scaling][crate::model::Revision::scaling].
9586 ///
9587 /// # Example
9588 /// ```ignore,no_run
9589 /// # use google_cloud_run_v2::model::Revision;
9590 /// use google_cloud_run_v2::model::RevisionScaling;
9591 /// let x = Revision::new().set_scaling(RevisionScaling::default()/* use setters */);
9592 /// ```
9593 pub fn set_scaling<T>(mut self, v: T) -> Self
9594 where
9595 T: std::convert::Into<crate::model::RevisionScaling>,
9596 {
9597 self.scaling = std::option::Option::Some(v.into());
9598 self
9599 }
9600
9601 /// Sets or clears the value of [scaling][crate::model::Revision::scaling].
9602 ///
9603 /// # Example
9604 /// ```ignore,no_run
9605 /// # use google_cloud_run_v2::model::Revision;
9606 /// use google_cloud_run_v2::model::RevisionScaling;
9607 /// let x = Revision::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
9608 /// let x = Revision::new().set_or_clear_scaling(None::<RevisionScaling>);
9609 /// ```
9610 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
9611 where
9612 T: std::convert::Into<crate::model::RevisionScaling>,
9613 {
9614 self.scaling = v.map(|x| x.into());
9615 self
9616 }
9617
9618 /// Sets the value of [vpc_access][crate::model::Revision::vpc_access].
9619 ///
9620 /// # Example
9621 /// ```ignore,no_run
9622 /// # use google_cloud_run_v2::model::Revision;
9623 /// use google_cloud_run_v2::model::VpcAccess;
9624 /// let x = Revision::new().set_vpc_access(VpcAccess::default()/* use setters */);
9625 /// ```
9626 pub fn set_vpc_access<T>(mut self, v: T) -> Self
9627 where
9628 T: std::convert::Into<crate::model::VpcAccess>,
9629 {
9630 self.vpc_access = std::option::Option::Some(v.into());
9631 self
9632 }
9633
9634 /// Sets or clears the value of [vpc_access][crate::model::Revision::vpc_access].
9635 ///
9636 /// # Example
9637 /// ```ignore,no_run
9638 /// # use google_cloud_run_v2::model::Revision;
9639 /// use google_cloud_run_v2::model::VpcAccess;
9640 /// let x = Revision::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
9641 /// let x = Revision::new().set_or_clear_vpc_access(None::<VpcAccess>);
9642 /// ```
9643 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
9644 where
9645 T: std::convert::Into<crate::model::VpcAccess>,
9646 {
9647 self.vpc_access = v.map(|x| x.into());
9648 self
9649 }
9650
9651 /// Sets the value of [max_instance_request_concurrency][crate::model::Revision::max_instance_request_concurrency].
9652 ///
9653 /// # Example
9654 /// ```ignore,no_run
9655 /// # use google_cloud_run_v2::model::Revision;
9656 /// let x = Revision::new().set_max_instance_request_concurrency(42);
9657 /// ```
9658 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
9659 mut self,
9660 v: T,
9661 ) -> Self {
9662 self.max_instance_request_concurrency = v.into();
9663 self
9664 }
9665
9666 /// Sets the value of [timeout][crate::model::Revision::timeout].
9667 ///
9668 /// # Example
9669 /// ```ignore,no_run
9670 /// # use google_cloud_run_v2::model::Revision;
9671 /// use wkt::Duration;
9672 /// let x = Revision::new().set_timeout(Duration::default()/* use setters */);
9673 /// ```
9674 pub fn set_timeout<T>(mut self, v: T) -> Self
9675 where
9676 T: std::convert::Into<wkt::Duration>,
9677 {
9678 self.timeout = std::option::Option::Some(v.into());
9679 self
9680 }
9681
9682 /// Sets or clears the value of [timeout][crate::model::Revision::timeout].
9683 ///
9684 /// # Example
9685 /// ```ignore,no_run
9686 /// # use google_cloud_run_v2::model::Revision;
9687 /// use wkt::Duration;
9688 /// let x = Revision::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
9689 /// let x = Revision::new().set_or_clear_timeout(None::<Duration>);
9690 /// ```
9691 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
9692 where
9693 T: std::convert::Into<wkt::Duration>,
9694 {
9695 self.timeout = v.map(|x| x.into());
9696 self
9697 }
9698
9699 /// Sets the value of [service_account][crate::model::Revision::service_account].
9700 ///
9701 /// # Example
9702 /// ```ignore,no_run
9703 /// # use google_cloud_run_v2::model::Revision;
9704 /// let x = Revision::new().set_service_account("example");
9705 /// ```
9706 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9707 self.service_account = v.into();
9708 self
9709 }
9710
9711 /// Sets the value of [containers][crate::model::Revision::containers].
9712 ///
9713 /// # Example
9714 /// ```ignore,no_run
9715 /// # use google_cloud_run_v2::model::Revision;
9716 /// use google_cloud_run_v2::model::Container;
9717 /// let x = Revision::new()
9718 /// .set_containers([
9719 /// Container::default()/* use setters */,
9720 /// Container::default()/* use (different) setters */,
9721 /// ]);
9722 /// ```
9723 pub fn set_containers<T, V>(mut self, v: T) -> Self
9724 where
9725 T: std::iter::IntoIterator<Item = V>,
9726 V: std::convert::Into<crate::model::Container>,
9727 {
9728 use std::iter::Iterator;
9729 self.containers = v.into_iter().map(|i| i.into()).collect();
9730 self
9731 }
9732
9733 /// Sets the value of [volumes][crate::model::Revision::volumes].
9734 ///
9735 /// # Example
9736 /// ```ignore,no_run
9737 /// # use google_cloud_run_v2::model::Revision;
9738 /// use google_cloud_run_v2::model::Volume;
9739 /// let x = Revision::new()
9740 /// .set_volumes([
9741 /// Volume::default()/* use setters */,
9742 /// Volume::default()/* use (different) setters */,
9743 /// ]);
9744 /// ```
9745 pub fn set_volumes<T, V>(mut self, v: T) -> Self
9746 where
9747 T: std::iter::IntoIterator<Item = V>,
9748 V: std::convert::Into<crate::model::Volume>,
9749 {
9750 use std::iter::Iterator;
9751 self.volumes = v.into_iter().map(|i| i.into()).collect();
9752 self
9753 }
9754
9755 /// Sets the value of [execution_environment][crate::model::Revision::execution_environment].
9756 ///
9757 /// # Example
9758 /// ```ignore,no_run
9759 /// # use google_cloud_run_v2::model::Revision;
9760 /// use google_cloud_run_v2::model::ExecutionEnvironment;
9761 /// let x0 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen1);
9762 /// let x1 = Revision::new().set_execution_environment(ExecutionEnvironment::Gen2);
9763 /// ```
9764 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
9765 mut self,
9766 v: T,
9767 ) -> Self {
9768 self.execution_environment = v.into();
9769 self
9770 }
9771
9772 /// Sets the value of [encryption_key][crate::model::Revision::encryption_key].
9773 ///
9774 /// # Example
9775 /// ```ignore,no_run
9776 /// # use google_cloud_run_v2::model::Revision;
9777 /// let x = Revision::new().set_encryption_key("example");
9778 /// ```
9779 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9780 self.encryption_key = v.into();
9781 self
9782 }
9783
9784 /// Sets the value of [service_mesh][crate::model::Revision::service_mesh].
9785 ///
9786 /// # Example
9787 /// ```ignore,no_run
9788 /// # use google_cloud_run_v2::model::Revision;
9789 /// use google_cloud_run_v2::model::ServiceMesh;
9790 /// let x = Revision::new().set_service_mesh(ServiceMesh::default()/* use setters */);
9791 /// ```
9792 pub fn set_service_mesh<T>(mut self, v: T) -> Self
9793 where
9794 T: std::convert::Into<crate::model::ServiceMesh>,
9795 {
9796 self.service_mesh = std::option::Option::Some(v.into());
9797 self
9798 }
9799
9800 /// Sets or clears the value of [service_mesh][crate::model::Revision::service_mesh].
9801 ///
9802 /// # Example
9803 /// ```ignore,no_run
9804 /// # use google_cloud_run_v2::model::Revision;
9805 /// use google_cloud_run_v2::model::ServiceMesh;
9806 /// let x = Revision::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
9807 /// let x = Revision::new().set_or_clear_service_mesh(None::<ServiceMesh>);
9808 /// ```
9809 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
9810 where
9811 T: std::convert::Into<crate::model::ServiceMesh>,
9812 {
9813 self.service_mesh = v.map(|x| x.into());
9814 self
9815 }
9816
9817 /// Sets the value of [encryption_key_revocation_action][crate::model::Revision::encryption_key_revocation_action].
9818 ///
9819 /// # Example
9820 /// ```ignore,no_run
9821 /// # use google_cloud_run_v2::model::Revision;
9822 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
9823 /// let x0 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
9824 /// let x1 = Revision::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
9825 /// ```
9826 pub fn set_encryption_key_revocation_action<
9827 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
9828 >(
9829 mut self,
9830 v: T,
9831 ) -> Self {
9832 self.encryption_key_revocation_action = v.into();
9833 self
9834 }
9835
9836 /// Sets the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
9837 ///
9838 /// # Example
9839 /// ```ignore,no_run
9840 /// # use google_cloud_run_v2::model::Revision;
9841 /// use wkt::Duration;
9842 /// let x = Revision::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
9843 /// ```
9844 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
9845 where
9846 T: std::convert::Into<wkt::Duration>,
9847 {
9848 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
9849 self
9850 }
9851
9852 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
9853 ///
9854 /// # Example
9855 /// ```ignore,no_run
9856 /// # use google_cloud_run_v2::model::Revision;
9857 /// use wkt::Duration;
9858 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
9859 /// let x = Revision::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
9860 /// ```
9861 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
9862 mut self,
9863 v: std::option::Option<T>,
9864 ) -> Self
9865 where
9866 T: std::convert::Into<wkt::Duration>,
9867 {
9868 self.encryption_key_shutdown_duration = v.map(|x| x.into());
9869 self
9870 }
9871
9872 /// Sets the value of [reconciling][crate::model::Revision::reconciling].
9873 ///
9874 /// # Example
9875 /// ```ignore,no_run
9876 /// # use google_cloud_run_v2::model::Revision;
9877 /// let x = Revision::new().set_reconciling(true);
9878 /// ```
9879 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9880 self.reconciling = v.into();
9881 self
9882 }
9883
9884 /// Sets the value of [conditions][crate::model::Revision::conditions].
9885 ///
9886 /// # Example
9887 /// ```ignore,no_run
9888 /// # use google_cloud_run_v2::model::Revision;
9889 /// use google_cloud_run_v2::model::Condition;
9890 /// let x = Revision::new()
9891 /// .set_conditions([
9892 /// Condition::default()/* use setters */,
9893 /// Condition::default()/* use (different) setters */,
9894 /// ]);
9895 /// ```
9896 pub fn set_conditions<T, V>(mut self, v: T) -> Self
9897 where
9898 T: std::iter::IntoIterator<Item = V>,
9899 V: std::convert::Into<crate::model::Condition>,
9900 {
9901 use std::iter::Iterator;
9902 self.conditions = v.into_iter().map(|i| i.into()).collect();
9903 self
9904 }
9905
9906 /// Sets the value of [observed_generation][crate::model::Revision::observed_generation].
9907 ///
9908 /// # Example
9909 /// ```ignore,no_run
9910 /// # use google_cloud_run_v2::model::Revision;
9911 /// let x = Revision::new().set_observed_generation(42);
9912 /// ```
9913 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9914 self.observed_generation = v.into();
9915 self
9916 }
9917
9918 /// Sets the value of [log_uri][crate::model::Revision::log_uri].
9919 ///
9920 /// # Example
9921 /// ```ignore,no_run
9922 /// # use google_cloud_run_v2::model::Revision;
9923 /// let x = Revision::new().set_log_uri("example");
9924 /// ```
9925 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9926 self.log_uri = v.into();
9927 self
9928 }
9929
9930 /// Sets the value of [satisfies_pzs][crate::model::Revision::satisfies_pzs].
9931 ///
9932 /// # Example
9933 /// ```ignore,no_run
9934 /// # use google_cloud_run_v2::model::Revision;
9935 /// let x = Revision::new().set_satisfies_pzs(true);
9936 /// ```
9937 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9938 self.satisfies_pzs = v.into();
9939 self
9940 }
9941
9942 /// Sets the value of [session_affinity][crate::model::Revision::session_affinity].
9943 ///
9944 /// # Example
9945 /// ```ignore,no_run
9946 /// # use google_cloud_run_v2::model::Revision;
9947 /// let x = Revision::new().set_session_affinity(true);
9948 /// ```
9949 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9950 self.session_affinity = v.into();
9951 self
9952 }
9953
9954 /// Sets the value of [scaling_status][crate::model::Revision::scaling_status].
9955 ///
9956 /// # Example
9957 /// ```ignore,no_run
9958 /// # use google_cloud_run_v2::model::Revision;
9959 /// use google_cloud_run_v2::model::RevisionScalingStatus;
9960 /// let x = Revision::new().set_scaling_status(RevisionScalingStatus::default()/* use setters */);
9961 /// ```
9962 pub fn set_scaling_status<T>(mut self, v: T) -> Self
9963 where
9964 T: std::convert::Into<crate::model::RevisionScalingStatus>,
9965 {
9966 self.scaling_status = std::option::Option::Some(v.into());
9967 self
9968 }
9969
9970 /// Sets or clears the value of [scaling_status][crate::model::Revision::scaling_status].
9971 ///
9972 /// # Example
9973 /// ```ignore,no_run
9974 /// # use google_cloud_run_v2::model::Revision;
9975 /// use google_cloud_run_v2::model::RevisionScalingStatus;
9976 /// let x = Revision::new().set_or_clear_scaling_status(Some(RevisionScalingStatus::default()/* use setters */));
9977 /// let x = Revision::new().set_or_clear_scaling_status(None::<RevisionScalingStatus>);
9978 /// ```
9979 pub fn set_or_clear_scaling_status<T>(mut self, v: std::option::Option<T>) -> Self
9980 where
9981 T: std::convert::Into<crate::model::RevisionScalingStatus>,
9982 {
9983 self.scaling_status = v.map(|x| x.into());
9984 self
9985 }
9986
9987 /// Sets the value of [node_selector][crate::model::Revision::node_selector].
9988 ///
9989 /// # Example
9990 /// ```ignore,no_run
9991 /// # use google_cloud_run_v2::model::Revision;
9992 /// use google_cloud_run_v2::model::NodeSelector;
9993 /// let x = Revision::new().set_node_selector(NodeSelector::default()/* use setters */);
9994 /// ```
9995 pub fn set_node_selector<T>(mut self, v: T) -> Self
9996 where
9997 T: std::convert::Into<crate::model::NodeSelector>,
9998 {
9999 self.node_selector = std::option::Option::Some(v.into());
10000 self
10001 }
10002
10003 /// Sets or clears the value of [node_selector][crate::model::Revision::node_selector].
10004 ///
10005 /// # Example
10006 /// ```ignore,no_run
10007 /// # use google_cloud_run_v2::model::Revision;
10008 /// use google_cloud_run_v2::model::NodeSelector;
10009 /// let x = Revision::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10010 /// let x = Revision::new().set_or_clear_node_selector(None::<NodeSelector>);
10011 /// ```
10012 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10013 where
10014 T: std::convert::Into<crate::model::NodeSelector>,
10015 {
10016 self.node_selector = v.map(|x| x.into());
10017 self
10018 }
10019
10020 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10021 ///
10022 /// # Example
10023 /// ```ignore,no_run
10024 /// # use google_cloud_run_v2::model::Revision;
10025 /// let x = Revision::new().set_gpu_zonal_redundancy_disabled(true);
10026 /// ```
10027 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10028 where
10029 T: std::convert::Into<bool>,
10030 {
10031 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10032 self
10033 }
10034
10035 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
10036 ///
10037 /// # Example
10038 /// ```ignore,no_run
10039 /// # use google_cloud_run_v2::model::Revision;
10040 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10041 /// let x = Revision::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10042 /// ```
10043 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10044 mut self,
10045 v: std::option::Option<T>,
10046 ) -> Self
10047 where
10048 T: std::convert::Into<bool>,
10049 {
10050 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10051 self
10052 }
10053
10054 /// Sets the value of [creator][crate::model::Revision::creator].
10055 ///
10056 /// # Example
10057 /// ```ignore,no_run
10058 /// # use google_cloud_run_v2::model::Revision;
10059 /// let x = Revision::new().set_creator("example");
10060 /// ```
10061 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10062 self.creator = v.into();
10063 self
10064 }
10065
10066 /// Sets the value of [etag][crate::model::Revision::etag].
10067 ///
10068 /// # Example
10069 /// ```ignore,no_run
10070 /// # use google_cloud_run_v2::model::Revision;
10071 /// let x = Revision::new().set_etag("example");
10072 /// ```
10073 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10074 self.etag = v.into();
10075 self
10076 }
10077}
10078
10079impl wkt::message::Message for Revision {
10080 fn typename() -> &'static str {
10081 "type.googleapis.com/google.cloud.run.v2.Revision"
10082 }
10083}
10084
10085/// RevisionTemplate describes the data a revision should have when created from
10086/// a template.
10087#[derive(Clone, Default, PartialEq)]
10088#[non_exhaustive]
10089pub struct RevisionTemplate {
10090 /// Optional. The unique name for the revision. If this field is omitted, it
10091 /// will be automatically generated based on the Service name.
10092 pub revision: std::string::String,
10093
10094 /// Optional. Unstructured key value map that can be used to organize and
10095 /// categorize objects. User-provided labels are shared with Google's billing
10096 /// system, so they can be used to filter, or break down billing charges by
10097 /// team, component, environment, state, etc. For more information, visit
10098 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
10099 /// <https://cloud.google.com/run/docs/configuring/labels>.
10100 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10101
10102 /// Optional. Unstructured key value map that may be set by external tools to
10103 /// store and arbitrary metadata. They are not queryable and should be
10104 /// preserved when modifying objects.
10105 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
10106
10107 /// Optional. Scaling settings for this Revision.
10108 pub scaling: std::option::Option<crate::model::RevisionScaling>,
10109
10110 /// Optional. VPC Access configuration to use for this Revision. For more
10111 /// information, visit
10112 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
10113 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
10114
10115 /// Optional. Max allowed time for an instance to respond to a request.
10116 pub timeout: std::option::Option<wkt::Duration>,
10117
10118 /// Optional. Email address of the IAM service account associated with the
10119 /// revision of the service. The service account represents the identity of the
10120 /// running revision, and determines what permissions the revision has. If not
10121 /// provided, the revision will use the project's default service account.
10122 pub service_account: std::string::String,
10123
10124 /// Holds the single container that defines the unit of execution for this
10125 /// Revision.
10126 pub containers: std::vec::Vec<crate::model::Container>,
10127
10128 /// Optional. A list of Volumes to make available to containers.
10129 pub volumes: std::vec::Vec<crate::model::Volume>,
10130
10131 /// Optional. The sandbox environment to host this Revision.
10132 pub execution_environment: crate::model::ExecutionEnvironment,
10133
10134 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
10135 /// this container image. For more information, go to
10136 /// <https://cloud.google.com/run/docs/securing/using-cmek>
10137 pub encryption_key: std::string::String,
10138
10139 /// Optional. Sets the maximum number of requests that each serving instance
10140 /// can receive. If not specified or 0, concurrency defaults to 80 when
10141 /// requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
10142 pub max_instance_request_concurrency: i32,
10143
10144 /// Optional. Enables service mesh connectivity.
10145 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
10146
10147 /// Optional. The action to take if the encryption key is revoked.
10148 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
10149
10150 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
10151 /// before shutting down all instances. The minimum increment is 1 hour.
10152 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
10153
10154 /// Optional. Enable session affinity.
10155 pub session_affinity: bool,
10156
10157 /// Optional. Disables health checking containers during deployment.
10158 pub health_check_disabled: bool,
10159
10160 /// Optional. The node selector for the revision template.
10161 pub node_selector: std::option::Option<crate::model::NodeSelector>,
10162
10163 /// Optional. True if GPU zonal redundancy is disabled on this revision.
10164 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
10165
10166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10167}
10168
10169impl RevisionTemplate {
10170 pub fn new() -> Self {
10171 std::default::Default::default()
10172 }
10173
10174 /// Sets the value of [revision][crate::model::RevisionTemplate::revision].
10175 ///
10176 /// # Example
10177 /// ```ignore,no_run
10178 /// # use google_cloud_run_v2::model::RevisionTemplate;
10179 /// let x = RevisionTemplate::new().set_revision("example");
10180 /// ```
10181 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10182 self.revision = v.into();
10183 self
10184 }
10185
10186 /// Sets the value of [labels][crate::model::RevisionTemplate::labels].
10187 ///
10188 /// # Example
10189 /// ```ignore,no_run
10190 /// # use google_cloud_run_v2::model::RevisionTemplate;
10191 /// let x = RevisionTemplate::new().set_labels([
10192 /// ("key0", "abc"),
10193 /// ("key1", "xyz"),
10194 /// ]);
10195 /// ```
10196 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10197 where
10198 T: std::iter::IntoIterator<Item = (K, V)>,
10199 K: std::convert::Into<std::string::String>,
10200 V: std::convert::Into<std::string::String>,
10201 {
10202 use std::iter::Iterator;
10203 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10204 self
10205 }
10206
10207 /// Sets the value of [annotations][crate::model::RevisionTemplate::annotations].
10208 ///
10209 /// # Example
10210 /// ```ignore,no_run
10211 /// # use google_cloud_run_v2::model::RevisionTemplate;
10212 /// let x = RevisionTemplate::new().set_annotations([
10213 /// ("key0", "abc"),
10214 /// ("key1", "xyz"),
10215 /// ]);
10216 /// ```
10217 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
10218 where
10219 T: std::iter::IntoIterator<Item = (K, V)>,
10220 K: std::convert::Into<std::string::String>,
10221 V: std::convert::Into<std::string::String>,
10222 {
10223 use std::iter::Iterator;
10224 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10225 self
10226 }
10227
10228 /// Sets the value of [scaling][crate::model::RevisionTemplate::scaling].
10229 ///
10230 /// # Example
10231 /// ```ignore,no_run
10232 /// # use google_cloud_run_v2::model::RevisionTemplate;
10233 /// use google_cloud_run_v2::model::RevisionScaling;
10234 /// let x = RevisionTemplate::new().set_scaling(RevisionScaling::default()/* use setters */);
10235 /// ```
10236 pub fn set_scaling<T>(mut self, v: T) -> Self
10237 where
10238 T: std::convert::Into<crate::model::RevisionScaling>,
10239 {
10240 self.scaling = std::option::Option::Some(v.into());
10241 self
10242 }
10243
10244 /// Sets or clears the value of [scaling][crate::model::RevisionTemplate::scaling].
10245 ///
10246 /// # Example
10247 /// ```ignore,no_run
10248 /// # use google_cloud_run_v2::model::RevisionTemplate;
10249 /// use google_cloud_run_v2::model::RevisionScaling;
10250 /// let x = RevisionTemplate::new().set_or_clear_scaling(Some(RevisionScaling::default()/* use setters */));
10251 /// let x = RevisionTemplate::new().set_or_clear_scaling(None::<RevisionScaling>);
10252 /// ```
10253 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
10254 where
10255 T: std::convert::Into<crate::model::RevisionScaling>,
10256 {
10257 self.scaling = v.map(|x| x.into());
10258 self
10259 }
10260
10261 /// Sets the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10262 ///
10263 /// # Example
10264 /// ```ignore,no_run
10265 /// # use google_cloud_run_v2::model::RevisionTemplate;
10266 /// use google_cloud_run_v2::model::VpcAccess;
10267 /// let x = RevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
10268 /// ```
10269 pub fn set_vpc_access<T>(mut self, v: T) -> Self
10270 where
10271 T: std::convert::Into<crate::model::VpcAccess>,
10272 {
10273 self.vpc_access = std::option::Option::Some(v.into());
10274 self
10275 }
10276
10277 /// Sets or clears the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
10278 ///
10279 /// # Example
10280 /// ```ignore,no_run
10281 /// # use google_cloud_run_v2::model::RevisionTemplate;
10282 /// use google_cloud_run_v2::model::VpcAccess;
10283 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
10284 /// let x = RevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
10285 /// ```
10286 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
10287 where
10288 T: std::convert::Into<crate::model::VpcAccess>,
10289 {
10290 self.vpc_access = v.map(|x| x.into());
10291 self
10292 }
10293
10294 /// Sets the value of [timeout][crate::model::RevisionTemplate::timeout].
10295 ///
10296 /// # Example
10297 /// ```ignore,no_run
10298 /// # use google_cloud_run_v2::model::RevisionTemplate;
10299 /// use wkt::Duration;
10300 /// let x = RevisionTemplate::new().set_timeout(Duration::default()/* use setters */);
10301 /// ```
10302 pub fn set_timeout<T>(mut self, v: T) -> Self
10303 where
10304 T: std::convert::Into<wkt::Duration>,
10305 {
10306 self.timeout = std::option::Option::Some(v.into());
10307 self
10308 }
10309
10310 /// Sets or clears the value of [timeout][crate::model::RevisionTemplate::timeout].
10311 ///
10312 /// # Example
10313 /// ```ignore,no_run
10314 /// # use google_cloud_run_v2::model::RevisionTemplate;
10315 /// use wkt::Duration;
10316 /// let x = RevisionTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
10317 /// let x = RevisionTemplate::new().set_or_clear_timeout(None::<Duration>);
10318 /// ```
10319 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
10320 where
10321 T: std::convert::Into<wkt::Duration>,
10322 {
10323 self.timeout = v.map(|x| x.into());
10324 self
10325 }
10326
10327 /// Sets the value of [service_account][crate::model::RevisionTemplate::service_account].
10328 ///
10329 /// # Example
10330 /// ```ignore,no_run
10331 /// # use google_cloud_run_v2::model::RevisionTemplate;
10332 /// let x = RevisionTemplate::new().set_service_account("example");
10333 /// ```
10334 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10335 self.service_account = v.into();
10336 self
10337 }
10338
10339 /// Sets the value of [containers][crate::model::RevisionTemplate::containers].
10340 ///
10341 /// # Example
10342 /// ```ignore,no_run
10343 /// # use google_cloud_run_v2::model::RevisionTemplate;
10344 /// use google_cloud_run_v2::model::Container;
10345 /// let x = RevisionTemplate::new()
10346 /// .set_containers([
10347 /// Container::default()/* use setters */,
10348 /// Container::default()/* use (different) setters */,
10349 /// ]);
10350 /// ```
10351 pub fn set_containers<T, V>(mut self, v: T) -> Self
10352 where
10353 T: std::iter::IntoIterator<Item = V>,
10354 V: std::convert::Into<crate::model::Container>,
10355 {
10356 use std::iter::Iterator;
10357 self.containers = v.into_iter().map(|i| i.into()).collect();
10358 self
10359 }
10360
10361 /// Sets the value of [volumes][crate::model::RevisionTemplate::volumes].
10362 ///
10363 /// # Example
10364 /// ```ignore,no_run
10365 /// # use google_cloud_run_v2::model::RevisionTemplate;
10366 /// use google_cloud_run_v2::model::Volume;
10367 /// let x = RevisionTemplate::new()
10368 /// .set_volumes([
10369 /// Volume::default()/* use setters */,
10370 /// Volume::default()/* use (different) setters */,
10371 /// ]);
10372 /// ```
10373 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10374 where
10375 T: std::iter::IntoIterator<Item = V>,
10376 V: std::convert::Into<crate::model::Volume>,
10377 {
10378 use std::iter::Iterator;
10379 self.volumes = v.into_iter().map(|i| i.into()).collect();
10380 self
10381 }
10382
10383 /// Sets the value of [execution_environment][crate::model::RevisionTemplate::execution_environment].
10384 ///
10385 /// # Example
10386 /// ```ignore,no_run
10387 /// # use google_cloud_run_v2::model::RevisionTemplate;
10388 /// use google_cloud_run_v2::model::ExecutionEnvironment;
10389 /// let x0 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
10390 /// let x1 = RevisionTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
10391 /// ```
10392 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
10393 mut self,
10394 v: T,
10395 ) -> Self {
10396 self.execution_environment = v.into();
10397 self
10398 }
10399
10400 /// Sets the value of [encryption_key][crate::model::RevisionTemplate::encryption_key].
10401 ///
10402 /// # Example
10403 /// ```ignore,no_run
10404 /// # use google_cloud_run_v2::model::RevisionTemplate;
10405 /// let x = RevisionTemplate::new().set_encryption_key("example");
10406 /// ```
10407 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10408 self.encryption_key = v.into();
10409 self
10410 }
10411
10412 /// Sets the value of [max_instance_request_concurrency][crate::model::RevisionTemplate::max_instance_request_concurrency].
10413 ///
10414 /// # Example
10415 /// ```ignore,no_run
10416 /// # use google_cloud_run_v2::model::RevisionTemplate;
10417 /// let x = RevisionTemplate::new().set_max_instance_request_concurrency(42);
10418 /// ```
10419 pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
10420 mut self,
10421 v: T,
10422 ) -> Self {
10423 self.max_instance_request_concurrency = v.into();
10424 self
10425 }
10426
10427 /// Sets the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10428 ///
10429 /// # Example
10430 /// ```ignore,no_run
10431 /// # use google_cloud_run_v2::model::RevisionTemplate;
10432 /// use google_cloud_run_v2::model::ServiceMesh;
10433 /// let x = RevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
10434 /// ```
10435 pub fn set_service_mesh<T>(mut self, v: T) -> Self
10436 where
10437 T: std::convert::Into<crate::model::ServiceMesh>,
10438 {
10439 self.service_mesh = std::option::Option::Some(v.into());
10440 self
10441 }
10442
10443 /// Sets or clears the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
10444 ///
10445 /// # Example
10446 /// ```ignore,no_run
10447 /// # use google_cloud_run_v2::model::RevisionTemplate;
10448 /// use google_cloud_run_v2::model::ServiceMesh;
10449 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
10450 /// let x = RevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
10451 /// ```
10452 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
10453 where
10454 T: std::convert::Into<crate::model::ServiceMesh>,
10455 {
10456 self.service_mesh = v.map(|x| x.into());
10457 self
10458 }
10459
10460 /// Sets the value of [encryption_key_revocation_action][crate::model::RevisionTemplate::encryption_key_revocation_action].
10461 ///
10462 /// # Example
10463 /// ```ignore,no_run
10464 /// # use google_cloud_run_v2::model::RevisionTemplate;
10465 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
10466 /// let x0 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
10467 /// let x1 = RevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
10468 /// ```
10469 pub fn set_encryption_key_revocation_action<
10470 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
10471 >(
10472 mut self,
10473 v: T,
10474 ) -> Self {
10475 self.encryption_key_revocation_action = v.into();
10476 self
10477 }
10478
10479 /// Sets the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10480 ///
10481 /// # Example
10482 /// ```ignore,no_run
10483 /// # use google_cloud_run_v2::model::RevisionTemplate;
10484 /// use wkt::Duration;
10485 /// let x = RevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
10486 /// ```
10487 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
10488 where
10489 T: std::convert::Into<wkt::Duration>,
10490 {
10491 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
10492 self
10493 }
10494
10495 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
10496 ///
10497 /// # Example
10498 /// ```ignore,no_run
10499 /// # use google_cloud_run_v2::model::RevisionTemplate;
10500 /// use wkt::Duration;
10501 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
10502 /// let x = RevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
10503 /// ```
10504 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
10505 mut self,
10506 v: std::option::Option<T>,
10507 ) -> Self
10508 where
10509 T: std::convert::Into<wkt::Duration>,
10510 {
10511 self.encryption_key_shutdown_duration = v.map(|x| x.into());
10512 self
10513 }
10514
10515 /// Sets the value of [session_affinity][crate::model::RevisionTemplate::session_affinity].
10516 ///
10517 /// # Example
10518 /// ```ignore,no_run
10519 /// # use google_cloud_run_v2::model::RevisionTemplate;
10520 /// let x = RevisionTemplate::new().set_session_affinity(true);
10521 /// ```
10522 pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10523 self.session_affinity = v.into();
10524 self
10525 }
10526
10527 /// Sets the value of [health_check_disabled][crate::model::RevisionTemplate::health_check_disabled].
10528 ///
10529 /// # Example
10530 /// ```ignore,no_run
10531 /// # use google_cloud_run_v2::model::RevisionTemplate;
10532 /// let x = RevisionTemplate::new().set_health_check_disabled(true);
10533 /// ```
10534 pub fn set_health_check_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10535 self.health_check_disabled = v.into();
10536 self
10537 }
10538
10539 /// Sets the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10540 ///
10541 /// # Example
10542 /// ```ignore,no_run
10543 /// # use google_cloud_run_v2::model::RevisionTemplate;
10544 /// use google_cloud_run_v2::model::NodeSelector;
10545 /// let x = RevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
10546 /// ```
10547 pub fn set_node_selector<T>(mut self, v: T) -> Self
10548 where
10549 T: std::convert::Into<crate::model::NodeSelector>,
10550 {
10551 self.node_selector = std::option::Option::Some(v.into());
10552 self
10553 }
10554
10555 /// Sets or clears the value of [node_selector][crate::model::RevisionTemplate::node_selector].
10556 ///
10557 /// # Example
10558 /// ```ignore,no_run
10559 /// # use google_cloud_run_v2::model::RevisionTemplate;
10560 /// use google_cloud_run_v2::model::NodeSelector;
10561 /// let x = RevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
10562 /// let x = RevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
10563 /// ```
10564 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
10565 where
10566 T: std::convert::Into<crate::model::NodeSelector>,
10567 {
10568 self.node_selector = v.map(|x| x.into());
10569 self
10570 }
10571
10572 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10573 ///
10574 /// # Example
10575 /// ```ignore,no_run
10576 /// # use google_cloud_run_v2::model::RevisionTemplate;
10577 /// let x = RevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
10578 /// ```
10579 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
10580 where
10581 T: std::convert::Into<bool>,
10582 {
10583 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
10584 self
10585 }
10586
10587 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
10588 ///
10589 /// # Example
10590 /// ```ignore,no_run
10591 /// # use google_cloud_run_v2::model::RevisionTemplate;
10592 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
10593 /// let x = RevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
10594 /// ```
10595 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
10596 mut self,
10597 v: std::option::Option<T>,
10598 ) -> Self
10599 where
10600 T: std::convert::Into<bool>,
10601 {
10602 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
10603 self
10604 }
10605}
10606
10607impl wkt::message::Message for RevisionTemplate {
10608 fn typename() -> &'static str {
10609 "type.googleapis.com/google.cloud.run.v2.RevisionTemplate"
10610 }
10611}
10612
10613/// Request message for creating a Service.
10614#[derive(Clone, Default, PartialEq)]
10615#[non_exhaustive]
10616pub struct CreateServiceRequest {
10617 /// Required. The location and project in which this service should be created.
10618 /// Format: projects/{project}/locations/{location}, where {project} can be
10619 /// project id or number. Only lowercase characters, digits, and hyphens.
10620 pub parent: std::string::String,
10621
10622 /// Required. The Service instance to create.
10623 pub service: std::option::Option<crate::model::Service>,
10624
10625 /// Required. The unique identifier for the Service. It must begin with letter,
10626 /// and cannot end with hyphen; must contain fewer than 50 characters.
10627 /// The name of the service becomes {parent}/services/{service_id}.
10628 pub service_id: std::string::String,
10629
10630 /// Indicates that the request should be validated and default values
10631 /// populated, without persisting the request or creating any resources.
10632 pub validate_only: bool,
10633
10634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10635}
10636
10637impl CreateServiceRequest {
10638 pub fn new() -> Self {
10639 std::default::Default::default()
10640 }
10641
10642 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
10643 ///
10644 /// # Example
10645 /// ```ignore,no_run
10646 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10647 /// let x = CreateServiceRequest::new().set_parent("example");
10648 /// ```
10649 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10650 self.parent = v.into();
10651 self
10652 }
10653
10654 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
10655 ///
10656 /// # Example
10657 /// ```ignore,no_run
10658 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10659 /// use google_cloud_run_v2::model::Service;
10660 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
10661 /// ```
10662 pub fn set_service<T>(mut self, v: T) -> Self
10663 where
10664 T: std::convert::Into<crate::model::Service>,
10665 {
10666 self.service = std::option::Option::Some(v.into());
10667 self
10668 }
10669
10670 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
10671 ///
10672 /// # Example
10673 /// ```ignore,no_run
10674 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10675 /// use google_cloud_run_v2::model::Service;
10676 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10677 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
10678 /// ```
10679 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10680 where
10681 T: std::convert::Into<crate::model::Service>,
10682 {
10683 self.service = v.map(|x| x.into());
10684 self
10685 }
10686
10687 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
10688 ///
10689 /// # Example
10690 /// ```ignore,no_run
10691 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10692 /// let x = CreateServiceRequest::new().set_service_id("example");
10693 /// ```
10694 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10695 self.service_id = v.into();
10696 self
10697 }
10698
10699 /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
10700 ///
10701 /// # Example
10702 /// ```ignore,no_run
10703 /// # use google_cloud_run_v2::model::CreateServiceRequest;
10704 /// let x = CreateServiceRequest::new().set_validate_only(true);
10705 /// ```
10706 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10707 self.validate_only = v.into();
10708 self
10709 }
10710}
10711
10712impl wkt::message::Message for CreateServiceRequest {
10713 fn typename() -> &'static str {
10714 "type.googleapis.com/google.cloud.run.v2.CreateServiceRequest"
10715 }
10716}
10717
10718/// Request message for updating a service.
10719#[derive(Clone, Default, PartialEq)]
10720#[non_exhaustive]
10721pub struct UpdateServiceRequest {
10722 /// Optional. The list of fields to be updated.
10723 pub update_mask: std::option::Option<wkt::FieldMask>,
10724
10725 /// Required. The Service to be updated.
10726 pub service: std::option::Option<crate::model::Service>,
10727
10728 /// Indicates that the request should be validated and default values
10729 /// populated, without persisting the request or updating any resources.
10730 pub validate_only: bool,
10731
10732 /// Optional. If set to true, and if the Service does not exist, it will create
10733 /// a new one. The caller must have 'run.services.create' permissions if this
10734 /// is set to true and the Service does not exist.
10735 pub allow_missing: bool,
10736
10737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10738}
10739
10740impl UpdateServiceRequest {
10741 pub fn new() -> Self {
10742 std::default::Default::default()
10743 }
10744
10745 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10746 ///
10747 /// # Example
10748 /// ```ignore,no_run
10749 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10750 /// use wkt::FieldMask;
10751 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10752 /// ```
10753 pub fn set_update_mask<T>(mut self, v: T) -> Self
10754 where
10755 T: std::convert::Into<wkt::FieldMask>,
10756 {
10757 self.update_mask = std::option::Option::Some(v.into());
10758 self
10759 }
10760
10761 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
10762 ///
10763 /// # Example
10764 /// ```ignore,no_run
10765 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10766 /// use wkt::FieldMask;
10767 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10768 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10769 /// ```
10770 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10771 where
10772 T: std::convert::Into<wkt::FieldMask>,
10773 {
10774 self.update_mask = v.map(|x| x.into());
10775 self
10776 }
10777
10778 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
10779 ///
10780 /// # Example
10781 /// ```ignore,no_run
10782 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10783 /// use google_cloud_run_v2::model::Service;
10784 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
10785 /// ```
10786 pub fn set_service<T>(mut self, v: T) -> Self
10787 where
10788 T: std::convert::Into<crate::model::Service>,
10789 {
10790 self.service = std::option::Option::Some(v.into());
10791 self
10792 }
10793
10794 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
10795 ///
10796 /// # Example
10797 /// ```ignore,no_run
10798 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10799 /// use google_cloud_run_v2::model::Service;
10800 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
10801 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
10802 /// ```
10803 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
10804 where
10805 T: std::convert::Into<crate::model::Service>,
10806 {
10807 self.service = v.map(|x| x.into());
10808 self
10809 }
10810
10811 /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
10812 ///
10813 /// # Example
10814 /// ```ignore,no_run
10815 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10816 /// let x = UpdateServiceRequest::new().set_validate_only(true);
10817 /// ```
10818 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10819 self.validate_only = v.into();
10820 self
10821 }
10822
10823 /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
10824 ///
10825 /// # Example
10826 /// ```ignore,no_run
10827 /// # use google_cloud_run_v2::model::UpdateServiceRequest;
10828 /// let x = UpdateServiceRequest::new().set_allow_missing(true);
10829 /// ```
10830 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10831 self.allow_missing = v.into();
10832 self
10833 }
10834}
10835
10836impl wkt::message::Message for UpdateServiceRequest {
10837 fn typename() -> &'static str {
10838 "type.googleapis.com/google.cloud.run.v2.UpdateServiceRequest"
10839 }
10840}
10841
10842/// Request message for retrieving a list of Services.
10843#[derive(Clone, Default, PartialEq)]
10844#[non_exhaustive]
10845pub struct ListServicesRequest {
10846 /// Required. The location and project to list resources on.
10847 /// Location must be a valid Google Cloud region, and cannot be the "-"
10848 /// wildcard. Format: projects/{project}/locations/{location}, where {project}
10849 /// can be project id or number.
10850 pub parent: std::string::String,
10851
10852 /// Maximum number of Services to return in this call.
10853 pub page_size: i32,
10854
10855 /// A page token received from a previous call to ListServices.
10856 /// All other parameters must match.
10857 pub page_token: std::string::String,
10858
10859 /// If true, returns deleted (but unexpired) resources along with active ones.
10860 pub show_deleted: bool,
10861
10862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10863}
10864
10865impl ListServicesRequest {
10866 pub fn new() -> Self {
10867 std::default::Default::default()
10868 }
10869
10870 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
10871 ///
10872 /// # Example
10873 /// ```ignore,no_run
10874 /// # use google_cloud_run_v2::model::ListServicesRequest;
10875 /// let x = ListServicesRequest::new().set_parent("example");
10876 /// ```
10877 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10878 self.parent = v.into();
10879 self
10880 }
10881
10882 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
10883 ///
10884 /// # Example
10885 /// ```ignore,no_run
10886 /// # use google_cloud_run_v2::model::ListServicesRequest;
10887 /// let x = ListServicesRequest::new().set_page_size(42);
10888 /// ```
10889 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10890 self.page_size = v.into();
10891 self
10892 }
10893
10894 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
10895 ///
10896 /// # Example
10897 /// ```ignore,no_run
10898 /// # use google_cloud_run_v2::model::ListServicesRequest;
10899 /// let x = ListServicesRequest::new().set_page_token("example");
10900 /// ```
10901 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10902 self.page_token = v.into();
10903 self
10904 }
10905
10906 /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
10907 ///
10908 /// # Example
10909 /// ```ignore,no_run
10910 /// # use google_cloud_run_v2::model::ListServicesRequest;
10911 /// let x = ListServicesRequest::new().set_show_deleted(true);
10912 /// ```
10913 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10914 self.show_deleted = v.into();
10915 self
10916 }
10917}
10918
10919impl wkt::message::Message for ListServicesRequest {
10920 fn typename() -> &'static str {
10921 "type.googleapis.com/google.cloud.run.v2.ListServicesRequest"
10922 }
10923}
10924
10925/// Response message containing a list of Services.
10926#[derive(Clone, Default, PartialEq)]
10927#[non_exhaustive]
10928pub struct ListServicesResponse {
10929 /// The resulting list of Services.
10930 pub services: std::vec::Vec<crate::model::Service>,
10931
10932 /// A token indicating there are more items than page_size. Use it in the next
10933 /// ListServices request to continue.
10934 pub next_page_token: std::string::String,
10935
10936 /// Output only. For global requests, returns the list of regions that could
10937 /// not be reached within the deadline.
10938 pub unreachable: std::vec::Vec<std::string::String>,
10939
10940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10941}
10942
10943impl ListServicesResponse {
10944 pub fn new() -> Self {
10945 std::default::Default::default()
10946 }
10947
10948 /// Sets the value of [services][crate::model::ListServicesResponse::services].
10949 ///
10950 /// # Example
10951 /// ```ignore,no_run
10952 /// # use google_cloud_run_v2::model::ListServicesResponse;
10953 /// use google_cloud_run_v2::model::Service;
10954 /// let x = ListServicesResponse::new()
10955 /// .set_services([
10956 /// Service::default()/* use setters */,
10957 /// Service::default()/* use (different) setters */,
10958 /// ]);
10959 /// ```
10960 pub fn set_services<T, V>(mut self, v: T) -> Self
10961 where
10962 T: std::iter::IntoIterator<Item = V>,
10963 V: std::convert::Into<crate::model::Service>,
10964 {
10965 use std::iter::Iterator;
10966 self.services = v.into_iter().map(|i| i.into()).collect();
10967 self
10968 }
10969
10970 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
10971 ///
10972 /// # Example
10973 /// ```ignore,no_run
10974 /// # use google_cloud_run_v2::model::ListServicesResponse;
10975 /// let x = ListServicesResponse::new().set_next_page_token("example");
10976 /// ```
10977 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10978 self.next_page_token = v.into();
10979 self
10980 }
10981
10982 /// Sets the value of [unreachable][crate::model::ListServicesResponse::unreachable].
10983 ///
10984 /// # Example
10985 /// ```ignore,no_run
10986 /// # use google_cloud_run_v2::model::ListServicesResponse;
10987 /// let x = ListServicesResponse::new().set_unreachable(["a", "b", "c"]);
10988 /// ```
10989 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
10990 where
10991 T: std::iter::IntoIterator<Item = V>,
10992 V: std::convert::Into<std::string::String>,
10993 {
10994 use std::iter::Iterator;
10995 self.unreachable = v.into_iter().map(|i| i.into()).collect();
10996 self
10997 }
10998}
10999
11000impl wkt::message::Message for ListServicesResponse {
11001 fn typename() -> &'static str {
11002 "type.googleapis.com/google.cloud.run.v2.ListServicesResponse"
11003 }
11004}
11005
11006#[doc(hidden)]
11007impl google_cloud_gax::paginator::internal::PageableResponse for ListServicesResponse {
11008 type PageItem = crate::model::Service;
11009
11010 fn items(self) -> std::vec::Vec<Self::PageItem> {
11011 self.services
11012 }
11013
11014 fn next_page_token(&self) -> std::string::String {
11015 use std::clone::Clone;
11016 self.next_page_token.clone()
11017 }
11018}
11019
11020/// Request message for obtaining a Service by its full name.
11021#[derive(Clone, Default, PartialEq)]
11022#[non_exhaustive]
11023pub struct GetServiceRequest {
11024 /// Required. The full name of the Service.
11025 /// Format: projects/{project}/locations/{location}/services/{service}, where
11026 /// {project} can be project id or number.
11027 pub name: std::string::String,
11028
11029 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11030}
11031
11032impl GetServiceRequest {
11033 pub fn new() -> Self {
11034 std::default::Default::default()
11035 }
11036
11037 /// Sets the value of [name][crate::model::GetServiceRequest::name].
11038 ///
11039 /// # Example
11040 /// ```ignore,no_run
11041 /// # use google_cloud_run_v2::model::GetServiceRequest;
11042 /// let x = GetServiceRequest::new().set_name("example");
11043 /// ```
11044 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11045 self.name = v.into();
11046 self
11047 }
11048}
11049
11050impl wkt::message::Message for GetServiceRequest {
11051 fn typename() -> &'static str {
11052 "type.googleapis.com/google.cloud.run.v2.GetServiceRequest"
11053 }
11054}
11055
11056/// Request message to delete a Service by its full name.
11057#[derive(Clone, Default, PartialEq)]
11058#[non_exhaustive]
11059pub struct DeleteServiceRequest {
11060 /// Required. The full name of the Service.
11061 /// Format: projects/{project}/locations/{location}/services/{service}, where
11062 /// {project} can be project id or number.
11063 pub name: std::string::String,
11064
11065 /// Indicates that the request should be validated without actually
11066 /// deleting any resources.
11067 pub validate_only: bool,
11068
11069 /// A system-generated fingerprint for this version of the
11070 /// resource. May be used to detect modification conflict during updates.
11071 pub etag: std::string::String,
11072
11073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11074}
11075
11076impl DeleteServiceRequest {
11077 pub fn new() -> Self {
11078 std::default::Default::default()
11079 }
11080
11081 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
11082 ///
11083 /// # Example
11084 /// ```ignore,no_run
11085 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11086 /// let x = DeleteServiceRequest::new().set_name("example");
11087 /// ```
11088 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11089 self.name = v.into();
11090 self
11091 }
11092
11093 /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
11094 ///
11095 /// # Example
11096 /// ```ignore,no_run
11097 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11098 /// let x = DeleteServiceRequest::new().set_validate_only(true);
11099 /// ```
11100 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11101 self.validate_only = v.into();
11102 self
11103 }
11104
11105 /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
11106 ///
11107 /// # Example
11108 /// ```ignore,no_run
11109 /// # use google_cloud_run_v2::model::DeleteServiceRequest;
11110 /// let x = DeleteServiceRequest::new().set_etag("example");
11111 /// ```
11112 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11113 self.etag = v.into();
11114 self
11115 }
11116}
11117
11118impl wkt::message::Message for DeleteServiceRequest {
11119 fn typename() -> &'static str {
11120 "type.googleapis.com/google.cloud.run.v2.DeleteServiceRequest"
11121 }
11122}
11123
11124/// Service acts as a top-level container that manages a set of
11125/// configurations and revision templates which implement a network service.
11126/// Service exists to provide a singular abstraction which can be access
11127/// controlled, reasoned about, and which encapsulates software lifecycle
11128/// decisions such as rollout policy and team resource ownership.
11129#[derive(Clone, Default, PartialEq)]
11130#[non_exhaustive]
11131pub struct Service {
11132 /// Identifier. The fully qualified name of this Service. In
11133 /// CreateServiceRequest, this field is ignored, and instead composed from
11134 /// CreateServiceRequest.parent and CreateServiceRequest.service_id.
11135 ///
11136 /// Format:
11137 /// projects/{project}/locations/{location}/services/{service_id}
11138 pub name: std::string::String,
11139
11140 /// User-provided description of the Service. This field currently has a
11141 /// 512-character limit.
11142 pub description: std::string::String,
11143
11144 /// Output only. Server assigned unique identifier for the trigger. The value
11145 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
11146 /// deleted.
11147 pub uid: std::string::String,
11148
11149 /// Output only. A number that monotonically increases every time the user
11150 /// modifies the desired state.
11151 /// Please note that unlike v1, this is an int64 value. As with most Google
11152 /// APIs, its JSON representation will be a `string` instead of an `integer`.
11153 pub generation: i64,
11154
11155 /// Optional. Unstructured key value map that can be used to organize and
11156 /// categorize objects. User-provided labels are shared with Google's billing
11157 /// system, so they can be used to filter, or break down billing charges by
11158 /// team, component, environment, state, etc. For more information, visit
11159 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
11160 /// <https://cloud.google.com/run/docs/configuring/labels>.
11161 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11162
11163 /// Optional. Unstructured key value map that may be set by external tools to
11164 /// store and arbitrary metadata. They are not queryable and should be
11165 /// preserved when modifying objects.
11166 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
11167
11168 /// Output only. The creation time.
11169 pub create_time: std::option::Option<wkt::Timestamp>,
11170
11171 /// Output only. The last-modified time.
11172 pub update_time: std::option::Option<wkt::Timestamp>,
11173
11174 /// Output only. The deletion time. It is only populated as a response to a
11175 /// Delete request.
11176 pub delete_time: std::option::Option<wkt::Timestamp>,
11177
11178 /// Output only. For a deleted resource, the time after which it will be
11179 /// permanently deleted.
11180 pub expire_time: std::option::Option<wkt::Timestamp>,
11181
11182 /// Output only. Email address of the authenticated creator.
11183 pub creator: std::string::String,
11184
11185 /// Output only. Email address of the last authenticated modifier.
11186 pub last_modifier: std::string::String,
11187
11188 /// Arbitrary identifier for the API client.
11189 pub client: std::string::String,
11190
11191 /// Arbitrary version identifier for the API client.
11192 pub client_version: std::string::String,
11193
11194 /// Optional. Provides the ingress settings for this Service. On output,
11195 /// returns the currently observed ingress settings, or
11196 /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
11197 pub ingress: crate::model::IngressTraffic,
11198
11199 /// Optional. The launch stage as defined by [Google Cloud Platform
11200 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
11201 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
11202 /// is assumed.
11203 /// Set the launch stage to a preview stage on input to allow use of preview
11204 /// features in that stage. On read (or output), describes whether the resource
11205 /// uses preview features.
11206 ///
11207 /// For example, if ALPHA is provided as input, but only BETA and GA-level
11208 /// features are used, this field will be BETA on output.
11209 pub launch_stage: google_cloud_api::model::LaunchStage,
11210
11211 /// Optional. Settings for the Binary Authorization feature.
11212 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
11213
11214 /// Required. The template used to create revisions for this Service.
11215 pub template: std::option::Option<crate::model::RevisionTemplate>,
11216
11217 /// Optional. Specifies how to distribute traffic over a collection of
11218 /// Revisions belonging to the Service. If traffic is empty or not provided,
11219 /// defaults to 100% traffic to the latest `Ready` Revision.
11220 pub traffic: std::vec::Vec<crate::model::TrafficTarget>,
11221
11222 /// Optional. Specifies service-level scaling settings
11223 pub scaling: std::option::Option<crate::model::ServiceScaling>,
11224
11225 /// Optional. Disables IAM permission check for run.routes.invoke for callers
11226 /// of this service. For more information, visit
11227 /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
11228 pub invoker_iam_disabled: bool,
11229
11230 /// Optional. Disables public resolution of the default URI of this service.
11231 pub default_uri_disabled: bool,
11232
11233 /// Output only. All URLs serving traffic for this Service.
11234 pub urls: std::vec::Vec<std::string::String>,
11235
11236 /// Optional. IAP settings on the Service.
11237 pub iap_enabled: bool,
11238
11239 /// Optional. Settings for multi-region deployment.
11240 pub multi_region_settings: std::option::Option<crate::model::service::MultiRegionSettings>,
11241
11242 /// One or more custom audiences that you want this service to support. Specify
11243 /// each custom audience as the full URL in a string. The custom audiences are
11244 /// encoded in the token and used to authenticate requests. For more
11245 /// information, see
11246 /// <https://cloud.google.com/run/docs/configuring/custom-audiences>.
11247 pub custom_audiences: std::vec::Vec<std::string::String>,
11248
11249 /// Output only. The generation of this Service currently serving traffic. See
11250 /// comments in `reconciling` for additional information on reconciliation
11251 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
11252 /// As with most Google APIs, its JSON representation will be a `string`
11253 /// instead of an `integer`.
11254 pub observed_generation: i64,
11255
11256 /// Output only. The Condition of this Service, containing its readiness
11257 /// status, and detailed error information in case it did not reach a serving
11258 /// state. See comments in `reconciling` for additional information on
11259 /// reconciliation process in Cloud Run.
11260 pub terminal_condition: std::option::Option<crate::model::Condition>,
11261
11262 /// Output only. The Conditions of all other associated sub-resources. They
11263 /// contain additional diagnostics information in case the Service does not
11264 /// reach its Serving state. See comments in `reconciling` for additional
11265 /// information on reconciliation process in Cloud Run.
11266 pub conditions: std::vec::Vec<crate::model::Condition>,
11267
11268 /// Output only. Name of the latest revision that is serving traffic. See
11269 /// comments in `reconciling` for additional information on reconciliation
11270 /// process in Cloud Run.
11271 pub latest_ready_revision: std::string::String,
11272
11273 /// Output only. Name of the last created revision. See comments in
11274 /// `reconciling` for additional information on reconciliation process in Cloud
11275 /// Run.
11276 pub latest_created_revision: std::string::String,
11277
11278 /// Output only. Detailed status information for corresponding traffic targets.
11279 /// See comments in `reconciling` for additional information on reconciliation
11280 /// process in Cloud Run.
11281 pub traffic_statuses: std::vec::Vec<crate::model::TrafficTargetStatus>,
11282
11283 /// Output only. The main URI in which this Service is serving traffic.
11284 pub uri: std::string::String,
11285
11286 /// Output only. Reserved for future use.
11287 pub satisfies_pzs: bool,
11288
11289 /// Output only. True if Cloud Run Threat Detection monitoring is enabled for
11290 /// the parent project of this Service.
11291 pub threat_detection_enabled: bool,
11292
11293 /// Optional. Configuration for building a Cloud Run function.
11294 pub build_config: std::option::Option<crate::model::BuildConfig>,
11295
11296 /// Output only. Returns true if the Service is currently being acted upon by
11297 /// the system to bring it into the desired state.
11298 ///
11299 /// When a new Service is created, or an existing one is updated, Cloud Run
11300 /// will asynchronously perform all necessary steps to bring the Service to the
11301 /// desired serving state. This process is called reconciliation.
11302 /// While reconciliation is in process, `observed_generation`,
11303 /// `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient
11304 /// values that might mismatch the intended state: Once reconciliation is over
11305 /// (and this field is false), there are two possible outcomes: reconciliation
11306 /// succeeded and the serving state matches the Service, or there was an error,
11307 /// and reconciliation failed. This state can be found in
11308 /// `terminal_condition.state`.
11309 ///
11310 /// If reconciliation succeeded, the following fields will match: `traffic` and
11311 /// `traffic_statuses`, `observed_generation` and `generation`,
11312 /// `latest_ready_revision` and `latest_created_revision`.
11313 ///
11314 /// If reconciliation failed, `traffic_statuses`, `observed_generation`, and
11315 /// `latest_ready_revision` will have the state of the last serving revision,
11316 /// or empty for newly created Services. Additional information on the failure
11317 /// can be found in `terminal_condition` and `conditions`.
11318 pub reconciling: bool,
11319
11320 /// Optional. A system-generated fingerprint for this version of the
11321 /// resource. May be used to detect modification conflict during updates.
11322 pub etag: std::string::String,
11323
11324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11325}
11326
11327impl Service {
11328 pub fn new() -> Self {
11329 std::default::Default::default()
11330 }
11331
11332 /// Sets the value of [name][crate::model::Service::name].
11333 ///
11334 /// # Example
11335 /// ```ignore,no_run
11336 /// # use google_cloud_run_v2::model::Service;
11337 /// let x = Service::new().set_name("example");
11338 /// ```
11339 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11340 self.name = v.into();
11341 self
11342 }
11343
11344 /// Sets the value of [description][crate::model::Service::description].
11345 ///
11346 /// # Example
11347 /// ```ignore,no_run
11348 /// # use google_cloud_run_v2::model::Service;
11349 /// let x = Service::new().set_description("example");
11350 /// ```
11351 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11352 self.description = v.into();
11353 self
11354 }
11355
11356 /// Sets the value of [uid][crate::model::Service::uid].
11357 ///
11358 /// # Example
11359 /// ```ignore,no_run
11360 /// # use google_cloud_run_v2::model::Service;
11361 /// let x = Service::new().set_uid("example");
11362 /// ```
11363 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11364 self.uid = v.into();
11365 self
11366 }
11367
11368 /// Sets the value of [generation][crate::model::Service::generation].
11369 ///
11370 /// # Example
11371 /// ```ignore,no_run
11372 /// # use google_cloud_run_v2::model::Service;
11373 /// let x = Service::new().set_generation(42);
11374 /// ```
11375 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11376 self.generation = v.into();
11377 self
11378 }
11379
11380 /// Sets the value of [labels][crate::model::Service::labels].
11381 ///
11382 /// # Example
11383 /// ```ignore,no_run
11384 /// # use google_cloud_run_v2::model::Service;
11385 /// let x = Service::new().set_labels([
11386 /// ("key0", "abc"),
11387 /// ("key1", "xyz"),
11388 /// ]);
11389 /// ```
11390 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11391 where
11392 T: std::iter::IntoIterator<Item = (K, V)>,
11393 K: std::convert::Into<std::string::String>,
11394 V: std::convert::Into<std::string::String>,
11395 {
11396 use std::iter::Iterator;
11397 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11398 self
11399 }
11400
11401 /// Sets the value of [annotations][crate::model::Service::annotations].
11402 ///
11403 /// # Example
11404 /// ```ignore,no_run
11405 /// # use google_cloud_run_v2::model::Service;
11406 /// let x = Service::new().set_annotations([
11407 /// ("key0", "abc"),
11408 /// ("key1", "xyz"),
11409 /// ]);
11410 /// ```
11411 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
11412 where
11413 T: std::iter::IntoIterator<Item = (K, V)>,
11414 K: std::convert::Into<std::string::String>,
11415 V: std::convert::Into<std::string::String>,
11416 {
11417 use std::iter::Iterator;
11418 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11419 self
11420 }
11421
11422 /// Sets the value of [create_time][crate::model::Service::create_time].
11423 ///
11424 /// # Example
11425 /// ```ignore,no_run
11426 /// # use google_cloud_run_v2::model::Service;
11427 /// use wkt::Timestamp;
11428 /// let x = Service::new().set_create_time(Timestamp::default()/* use setters */);
11429 /// ```
11430 pub fn set_create_time<T>(mut self, v: T) -> Self
11431 where
11432 T: std::convert::Into<wkt::Timestamp>,
11433 {
11434 self.create_time = std::option::Option::Some(v.into());
11435 self
11436 }
11437
11438 /// Sets or clears the value of [create_time][crate::model::Service::create_time].
11439 ///
11440 /// # Example
11441 /// ```ignore,no_run
11442 /// # use google_cloud_run_v2::model::Service;
11443 /// use wkt::Timestamp;
11444 /// let x = Service::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11445 /// let x = Service::new().set_or_clear_create_time(None::<Timestamp>);
11446 /// ```
11447 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11448 where
11449 T: std::convert::Into<wkt::Timestamp>,
11450 {
11451 self.create_time = v.map(|x| x.into());
11452 self
11453 }
11454
11455 /// Sets the value of [update_time][crate::model::Service::update_time].
11456 ///
11457 /// # Example
11458 /// ```ignore,no_run
11459 /// # use google_cloud_run_v2::model::Service;
11460 /// use wkt::Timestamp;
11461 /// let x = Service::new().set_update_time(Timestamp::default()/* use setters */);
11462 /// ```
11463 pub fn set_update_time<T>(mut self, v: T) -> Self
11464 where
11465 T: std::convert::Into<wkt::Timestamp>,
11466 {
11467 self.update_time = std::option::Option::Some(v.into());
11468 self
11469 }
11470
11471 /// Sets or clears the value of [update_time][crate::model::Service::update_time].
11472 ///
11473 /// # Example
11474 /// ```ignore,no_run
11475 /// # use google_cloud_run_v2::model::Service;
11476 /// use wkt::Timestamp;
11477 /// let x = Service::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11478 /// let x = Service::new().set_or_clear_update_time(None::<Timestamp>);
11479 /// ```
11480 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11481 where
11482 T: std::convert::Into<wkt::Timestamp>,
11483 {
11484 self.update_time = v.map(|x| x.into());
11485 self
11486 }
11487
11488 /// Sets the value of [delete_time][crate::model::Service::delete_time].
11489 ///
11490 /// # Example
11491 /// ```ignore,no_run
11492 /// # use google_cloud_run_v2::model::Service;
11493 /// use wkt::Timestamp;
11494 /// let x = Service::new().set_delete_time(Timestamp::default()/* use setters */);
11495 /// ```
11496 pub fn set_delete_time<T>(mut self, v: T) -> Self
11497 where
11498 T: std::convert::Into<wkt::Timestamp>,
11499 {
11500 self.delete_time = std::option::Option::Some(v.into());
11501 self
11502 }
11503
11504 /// Sets or clears the value of [delete_time][crate::model::Service::delete_time].
11505 ///
11506 /// # Example
11507 /// ```ignore,no_run
11508 /// # use google_cloud_run_v2::model::Service;
11509 /// use wkt::Timestamp;
11510 /// let x = Service::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
11511 /// let x = Service::new().set_or_clear_delete_time(None::<Timestamp>);
11512 /// ```
11513 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
11514 where
11515 T: std::convert::Into<wkt::Timestamp>,
11516 {
11517 self.delete_time = v.map(|x| x.into());
11518 self
11519 }
11520
11521 /// Sets the value of [expire_time][crate::model::Service::expire_time].
11522 ///
11523 /// # Example
11524 /// ```ignore,no_run
11525 /// # use google_cloud_run_v2::model::Service;
11526 /// use wkt::Timestamp;
11527 /// let x = Service::new().set_expire_time(Timestamp::default()/* use setters */);
11528 /// ```
11529 pub fn set_expire_time<T>(mut self, v: T) -> Self
11530 where
11531 T: std::convert::Into<wkt::Timestamp>,
11532 {
11533 self.expire_time = std::option::Option::Some(v.into());
11534 self
11535 }
11536
11537 /// Sets or clears the value of [expire_time][crate::model::Service::expire_time].
11538 ///
11539 /// # Example
11540 /// ```ignore,no_run
11541 /// # use google_cloud_run_v2::model::Service;
11542 /// use wkt::Timestamp;
11543 /// let x = Service::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
11544 /// let x = Service::new().set_or_clear_expire_time(None::<Timestamp>);
11545 /// ```
11546 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
11547 where
11548 T: std::convert::Into<wkt::Timestamp>,
11549 {
11550 self.expire_time = v.map(|x| x.into());
11551 self
11552 }
11553
11554 /// Sets the value of [creator][crate::model::Service::creator].
11555 ///
11556 /// # Example
11557 /// ```ignore,no_run
11558 /// # use google_cloud_run_v2::model::Service;
11559 /// let x = Service::new().set_creator("example");
11560 /// ```
11561 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11562 self.creator = v.into();
11563 self
11564 }
11565
11566 /// Sets the value of [last_modifier][crate::model::Service::last_modifier].
11567 ///
11568 /// # Example
11569 /// ```ignore,no_run
11570 /// # use google_cloud_run_v2::model::Service;
11571 /// let x = Service::new().set_last_modifier("example");
11572 /// ```
11573 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11574 self.last_modifier = v.into();
11575 self
11576 }
11577
11578 /// Sets the value of [client][crate::model::Service::client].
11579 ///
11580 /// # Example
11581 /// ```ignore,no_run
11582 /// # use google_cloud_run_v2::model::Service;
11583 /// let x = Service::new().set_client("example");
11584 /// ```
11585 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11586 self.client = v.into();
11587 self
11588 }
11589
11590 /// Sets the value of [client_version][crate::model::Service::client_version].
11591 ///
11592 /// # Example
11593 /// ```ignore,no_run
11594 /// # use google_cloud_run_v2::model::Service;
11595 /// let x = Service::new().set_client_version("example");
11596 /// ```
11597 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11598 self.client_version = v.into();
11599 self
11600 }
11601
11602 /// Sets the value of [ingress][crate::model::Service::ingress].
11603 ///
11604 /// # Example
11605 /// ```ignore,no_run
11606 /// # use google_cloud_run_v2::model::Service;
11607 /// use google_cloud_run_v2::model::IngressTraffic;
11608 /// let x0 = Service::new().set_ingress(IngressTraffic::All);
11609 /// let x1 = Service::new().set_ingress(IngressTraffic::InternalOnly);
11610 /// let x2 = Service::new().set_ingress(IngressTraffic::InternalLoadBalancer);
11611 /// ```
11612 pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
11613 mut self,
11614 v: T,
11615 ) -> Self {
11616 self.ingress = v.into();
11617 self
11618 }
11619
11620 /// Sets the value of [launch_stage][crate::model::Service::launch_stage].
11621 ///
11622 /// # Example
11623 /// ```ignore,no_run
11624 /// # use google_cloud_run_v2::model::Service;
11625 /// use google_cloud_api::model::LaunchStage;
11626 /// let x0 = Service::new().set_launch_stage(LaunchStage::Unimplemented);
11627 /// let x1 = Service::new().set_launch_stage(LaunchStage::Prelaunch);
11628 /// let x2 = Service::new().set_launch_stage(LaunchStage::EarlyAccess);
11629 /// ```
11630 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
11631 mut self,
11632 v: T,
11633 ) -> Self {
11634 self.launch_stage = v.into();
11635 self
11636 }
11637
11638 /// Sets the value of [binary_authorization][crate::model::Service::binary_authorization].
11639 ///
11640 /// # Example
11641 /// ```ignore,no_run
11642 /// # use google_cloud_run_v2::model::Service;
11643 /// use google_cloud_run_v2::model::BinaryAuthorization;
11644 /// let x = Service::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
11645 /// ```
11646 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
11647 where
11648 T: std::convert::Into<crate::model::BinaryAuthorization>,
11649 {
11650 self.binary_authorization = std::option::Option::Some(v.into());
11651 self
11652 }
11653
11654 /// Sets or clears the value of [binary_authorization][crate::model::Service::binary_authorization].
11655 ///
11656 /// # Example
11657 /// ```ignore,no_run
11658 /// # use google_cloud_run_v2::model::Service;
11659 /// use google_cloud_run_v2::model::BinaryAuthorization;
11660 /// let x = Service::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
11661 /// let x = Service::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
11662 /// ```
11663 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
11664 where
11665 T: std::convert::Into<crate::model::BinaryAuthorization>,
11666 {
11667 self.binary_authorization = v.map(|x| x.into());
11668 self
11669 }
11670
11671 /// Sets the value of [template][crate::model::Service::template].
11672 ///
11673 /// # Example
11674 /// ```ignore,no_run
11675 /// # use google_cloud_run_v2::model::Service;
11676 /// use google_cloud_run_v2::model::RevisionTemplate;
11677 /// let x = Service::new().set_template(RevisionTemplate::default()/* use setters */);
11678 /// ```
11679 pub fn set_template<T>(mut self, v: T) -> Self
11680 where
11681 T: std::convert::Into<crate::model::RevisionTemplate>,
11682 {
11683 self.template = std::option::Option::Some(v.into());
11684 self
11685 }
11686
11687 /// Sets or clears the value of [template][crate::model::Service::template].
11688 ///
11689 /// # Example
11690 /// ```ignore,no_run
11691 /// # use google_cloud_run_v2::model::Service;
11692 /// use google_cloud_run_v2::model::RevisionTemplate;
11693 /// let x = Service::new().set_or_clear_template(Some(RevisionTemplate::default()/* use setters */));
11694 /// let x = Service::new().set_or_clear_template(None::<RevisionTemplate>);
11695 /// ```
11696 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
11697 where
11698 T: std::convert::Into<crate::model::RevisionTemplate>,
11699 {
11700 self.template = v.map(|x| x.into());
11701 self
11702 }
11703
11704 /// Sets the value of [traffic][crate::model::Service::traffic].
11705 ///
11706 /// # Example
11707 /// ```ignore,no_run
11708 /// # use google_cloud_run_v2::model::Service;
11709 /// use google_cloud_run_v2::model::TrafficTarget;
11710 /// let x = Service::new()
11711 /// .set_traffic([
11712 /// TrafficTarget::default()/* use setters */,
11713 /// TrafficTarget::default()/* use (different) setters */,
11714 /// ]);
11715 /// ```
11716 pub fn set_traffic<T, V>(mut self, v: T) -> Self
11717 where
11718 T: std::iter::IntoIterator<Item = V>,
11719 V: std::convert::Into<crate::model::TrafficTarget>,
11720 {
11721 use std::iter::Iterator;
11722 self.traffic = v.into_iter().map(|i| i.into()).collect();
11723 self
11724 }
11725
11726 /// Sets the value of [scaling][crate::model::Service::scaling].
11727 ///
11728 /// # Example
11729 /// ```ignore,no_run
11730 /// # use google_cloud_run_v2::model::Service;
11731 /// use google_cloud_run_v2::model::ServiceScaling;
11732 /// let x = Service::new().set_scaling(ServiceScaling::default()/* use setters */);
11733 /// ```
11734 pub fn set_scaling<T>(mut self, v: T) -> Self
11735 where
11736 T: std::convert::Into<crate::model::ServiceScaling>,
11737 {
11738 self.scaling = std::option::Option::Some(v.into());
11739 self
11740 }
11741
11742 /// Sets or clears the value of [scaling][crate::model::Service::scaling].
11743 ///
11744 /// # Example
11745 /// ```ignore,no_run
11746 /// # use google_cloud_run_v2::model::Service;
11747 /// use google_cloud_run_v2::model::ServiceScaling;
11748 /// let x = Service::new().set_or_clear_scaling(Some(ServiceScaling::default()/* use setters */));
11749 /// let x = Service::new().set_or_clear_scaling(None::<ServiceScaling>);
11750 /// ```
11751 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
11752 where
11753 T: std::convert::Into<crate::model::ServiceScaling>,
11754 {
11755 self.scaling = v.map(|x| x.into());
11756 self
11757 }
11758
11759 /// Sets the value of [invoker_iam_disabled][crate::model::Service::invoker_iam_disabled].
11760 ///
11761 /// # Example
11762 /// ```ignore,no_run
11763 /// # use google_cloud_run_v2::model::Service;
11764 /// let x = Service::new().set_invoker_iam_disabled(true);
11765 /// ```
11766 pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11767 self.invoker_iam_disabled = v.into();
11768 self
11769 }
11770
11771 /// Sets the value of [default_uri_disabled][crate::model::Service::default_uri_disabled].
11772 ///
11773 /// # Example
11774 /// ```ignore,no_run
11775 /// # use google_cloud_run_v2::model::Service;
11776 /// let x = Service::new().set_default_uri_disabled(true);
11777 /// ```
11778 pub fn set_default_uri_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11779 self.default_uri_disabled = v.into();
11780 self
11781 }
11782
11783 /// Sets the value of [urls][crate::model::Service::urls].
11784 ///
11785 /// # Example
11786 /// ```ignore,no_run
11787 /// # use google_cloud_run_v2::model::Service;
11788 /// let x = Service::new().set_urls(["a", "b", "c"]);
11789 /// ```
11790 pub fn set_urls<T, V>(mut self, v: T) -> Self
11791 where
11792 T: std::iter::IntoIterator<Item = V>,
11793 V: std::convert::Into<std::string::String>,
11794 {
11795 use std::iter::Iterator;
11796 self.urls = v.into_iter().map(|i| i.into()).collect();
11797 self
11798 }
11799
11800 /// Sets the value of [iap_enabled][crate::model::Service::iap_enabled].
11801 ///
11802 /// # Example
11803 /// ```ignore,no_run
11804 /// # use google_cloud_run_v2::model::Service;
11805 /// let x = Service::new().set_iap_enabled(true);
11806 /// ```
11807 pub fn set_iap_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11808 self.iap_enabled = v.into();
11809 self
11810 }
11811
11812 /// Sets the value of [multi_region_settings][crate::model::Service::multi_region_settings].
11813 ///
11814 /// # Example
11815 /// ```ignore,no_run
11816 /// # use google_cloud_run_v2::model::Service;
11817 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
11818 /// let x = Service::new().set_multi_region_settings(MultiRegionSettings::default()/* use setters */);
11819 /// ```
11820 pub fn set_multi_region_settings<T>(mut self, v: T) -> Self
11821 where
11822 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
11823 {
11824 self.multi_region_settings = std::option::Option::Some(v.into());
11825 self
11826 }
11827
11828 /// Sets or clears the value of [multi_region_settings][crate::model::Service::multi_region_settings].
11829 ///
11830 /// # Example
11831 /// ```ignore,no_run
11832 /// # use google_cloud_run_v2::model::Service;
11833 /// use google_cloud_run_v2::model::service::MultiRegionSettings;
11834 /// let x = Service::new().set_or_clear_multi_region_settings(Some(MultiRegionSettings::default()/* use setters */));
11835 /// let x = Service::new().set_or_clear_multi_region_settings(None::<MultiRegionSettings>);
11836 /// ```
11837 pub fn set_or_clear_multi_region_settings<T>(mut self, v: std::option::Option<T>) -> Self
11838 where
11839 T: std::convert::Into<crate::model::service::MultiRegionSettings>,
11840 {
11841 self.multi_region_settings = v.map(|x| x.into());
11842 self
11843 }
11844
11845 /// Sets the value of [custom_audiences][crate::model::Service::custom_audiences].
11846 ///
11847 /// # Example
11848 /// ```ignore,no_run
11849 /// # use google_cloud_run_v2::model::Service;
11850 /// let x = Service::new().set_custom_audiences(["a", "b", "c"]);
11851 /// ```
11852 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
11853 where
11854 T: std::iter::IntoIterator<Item = V>,
11855 V: std::convert::Into<std::string::String>,
11856 {
11857 use std::iter::Iterator;
11858 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
11859 self
11860 }
11861
11862 /// Sets the value of [observed_generation][crate::model::Service::observed_generation].
11863 ///
11864 /// # Example
11865 /// ```ignore,no_run
11866 /// # use google_cloud_run_v2::model::Service;
11867 /// let x = Service::new().set_observed_generation(42);
11868 /// ```
11869 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11870 self.observed_generation = v.into();
11871 self
11872 }
11873
11874 /// Sets the value of [terminal_condition][crate::model::Service::terminal_condition].
11875 ///
11876 /// # Example
11877 /// ```ignore,no_run
11878 /// # use google_cloud_run_v2::model::Service;
11879 /// use google_cloud_run_v2::model::Condition;
11880 /// let x = Service::new().set_terminal_condition(Condition::default()/* use setters */);
11881 /// ```
11882 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
11883 where
11884 T: std::convert::Into<crate::model::Condition>,
11885 {
11886 self.terminal_condition = std::option::Option::Some(v.into());
11887 self
11888 }
11889
11890 /// Sets or clears the value of [terminal_condition][crate::model::Service::terminal_condition].
11891 ///
11892 /// # Example
11893 /// ```ignore,no_run
11894 /// # use google_cloud_run_v2::model::Service;
11895 /// use google_cloud_run_v2::model::Condition;
11896 /// let x = Service::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
11897 /// let x = Service::new().set_or_clear_terminal_condition(None::<Condition>);
11898 /// ```
11899 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
11900 where
11901 T: std::convert::Into<crate::model::Condition>,
11902 {
11903 self.terminal_condition = v.map(|x| x.into());
11904 self
11905 }
11906
11907 /// Sets the value of [conditions][crate::model::Service::conditions].
11908 ///
11909 /// # Example
11910 /// ```ignore,no_run
11911 /// # use google_cloud_run_v2::model::Service;
11912 /// use google_cloud_run_v2::model::Condition;
11913 /// let x = Service::new()
11914 /// .set_conditions([
11915 /// Condition::default()/* use setters */,
11916 /// Condition::default()/* use (different) setters */,
11917 /// ]);
11918 /// ```
11919 pub fn set_conditions<T, V>(mut self, v: T) -> Self
11920 where
11921 T: std::iter::IntoIterator<Item = V>,
11922 V: std::convert::Into<crate::model::Condition>,
11923 {
11924 use std::iter::Iterator;
11925 self.conditions = v.into_iter().map(|i| i.into()).collect();
11926 self
11927 }
11928
11929 /// Sets the value of [latest_ready_revision][crate::model::Service::latest_ready_revision].
11930 ///
11931 /// # Example
11932 /// ```ignore,no_run
11933 /// # use google_cloud_run_v2::model::Service;
11934 /// let x = Service::new().set_latest_ready_revision("example");
11935 /// ```
11936 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
11937 mut self,
11938 v: T,
11939 ) -> Self {
11940 self.latest_ready_revision = v.into();
11941 self
11942 }
11943
11944 /// Sets the value of [latest_created_revision][crate::model::Service::latest_created_revision].
11945 ///
11946 /// # Example
11947 /// ```ignore,no_run
11948 /// # use google_cloud_run_v2::model::Service;
11949 /// let x = Service::new().set_latest_created_revision("example");
11950 /// ```
11951 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
11952 mut self,
11953 v: T,
11954 ) -> Self {
11955 self.latest_created_revision = v.into();
11956 self
11957 }
11958
11959 /// Sets the value of [traffic_statuses][crate::model::Service::traffic_statuses].
11960 ///
11961 /// # Example
11962 /// ```ignore,no_run
11963 /// # use google_cloud_run_v2::model::Service;
11964 /// use google_cloud_run_v2::model::TrafficTargetStatus;
11965 /// let x = Service::new()
11966 /// .set_traffic_statuses([
11967 /// TrafficTargetStatus::default()/* use setters */,
11968 /// TrafficTargetStatus::default()/* use (different) setters */,
11969 /// ]);
11970 /// ```
11971 pub fn set_traffic_statuses<T, V>(mut self, v: T) -> Self
11972 where
11973 T: std::iter::IntoIterator<Item = V>,
11974 V: std::convert::Into<crate::model::TrafficTargetStatus>,
11975 {
11976 use std::iter::Iterator;
11977 self.traffic_statuses = v.into_iter().map(|i| i.into()).collect();
11978 self
11979 }
11980
11981 /// Sets the value of [uri][crate::model::Service::uri].
11982 ///
11983 /// # Example
11984 /// ```ignore,no_run
11985 /// # use google_cloud_run_v2::model::Service;
11986 /// let x = Service::new().set_uri("example");
11987 /// ```
11988 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11989 self.uri = v.into();
11990 self
11991 }
11992
11993 /// Sets the value of [satisfies_pzs][crate::model::Service::satisfies_pzs].
11994 ///
11995 /// # Example
11996 /// ```ignore,no_run
11997 /// # use google_cloud_run_v2::model::Service;
11998 /// let x = Service::new().set_satisfies_pzs(true);
11999 /// ```
12000 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12001 self.satisfies_pzs = v.into();
12002 self
12003 }
12004
12005 /// Sets the value of [threat_detection_enabled][crate::model::Service::threat_detection_enabled].
12006 ///
12007 /// # Example
12008 /// ```ignore,no_run
12009 /// # use google_cloud_run_v2::model::Service;
12010 /// let x = Service::new().set_threat_detection_enabled(true);
12011 /// ```
12012 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12013 self.threat_detection_enabled = v.into();
12014 self
12015 }
12016
12017 /// Sets the value of [build_config][crate::model::Service::build_config].
12018 ///
12019 /// # Example
12020 /// ```ignore,no_run
12021 /// # use google_cloud_run_v2::model::Service;
12022 /// use google_cloud_run_v2::model::BuildConfig;
12023 /// let x = Service::new().set_build_config(BuildConfig::default()/* use setters */);
12024 /// ```
12025 pub fn set_build_config<T>(mut self, v: T) -> Self
12026 where
12027 T: std::convert::Into<crate::model::BuildConfig>,
12028 {
12029 self.build_config = std::option::Option::Some(v.into());
12030 self
12031 }
12032
12033 /// Sets or clears the value of [build_config][crate::model::Service::build_config].
12034 ///
12035 /// # Example
12036 /// ```ignore,no_run
12037 /// # use google_cloud_run_v2::model::Service;
12038 /// use google_cloud_run_v2::model::BuildConfig;
12039 /// let x = Service::new().set_or_clear_build_config(Some(BuildConfig::default()/* use setters */));
12040 /// let x = Service::new().set_or_clear_build_config(None::<BuildConfig>);
12041 /// ```
12042 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
12043 where
12044 T: std::convert::Into<crate::model::BuildConfig>,
12045 {
12046 self.build_config = v.map(|x| x.into());
12047 self
12048 }
12049
12050 /// Sets the value of [reconciling][crate::model::Service::reconciling].
12051 ///
12052 /// # Example
12053 /// ```ignore,no_run
12054 /// # use google_cloud_run_v2::model::Service;
12055 /// let x = Service::new().set_reconciling(true);
12056 /// ```
12057 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12058 self.reconciling = v.into();
12059 self
12060 }
12061
12062 /// Sets the value of [etag][crate::model::Service::etag].
12063 ///
12064 /// # Example
12065 /// ```ignore,no_run
12066 /// # use google_cloud_run_v2::model::Service;
12067 /// let x = Service::new().set_etag("example");
12068 /// ```
12069 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12070 self.etag = v.into();
12071 self
12072 }
12073}
12074
12075impl wkt::message::Message for Service {
12076 fn typename() -> &'static str {
12077 "type.googleapis.com/google.cloud.run.v2.Service"
12078 }
12079}
12080
12081/// Defines additional types related to [Service].
12082pub mod service {
12083 #[allow(unused_imports)]
12084 use super::*;
12085
12086 /// Settings for multi-region deployment.
12087 #[derive(Clone, Default, PartialEq)]
12088 #[non_exhaustive]
12089 pub struct MultiRegionSettings {
12090 /// Required. List of regions to deploy to, including primary region.
12091 pub regions: std::vec::Vec<std::string::String>,
12092
12093 /// Optional. System-generated unique id for the multi-region Service.
12094 pub multi_region_id: std::string::String,
12095
12096 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12097 }
12098
12099 impl MultiRegionSettings {
12100 pub fn new() -> Self {
12101 std::default::Default::default()
12102 }
12103
12104 /// Sets the value of [regions][crate::model::service::MultiRegionSettings::regions].
12105 ///
12106 /// # Example
12107 /// ```ignore,no_run
12108 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12109 /// let x = MultiRegionSettings::new().set_regions(["a", "b", "c"]);
12110 /// ```
12111 pub fn set_regions<T, V>(mut self, v: T) -> Self
12112 where
12113 T: std::iter::IntoIterator<Item = V>,
12114 V: std::convert::Into<std::string::String>,
12115 {
12116 use std::iter::Iterator;
12117 self.regions = v.into_iter().map(|i| i.into()).collect();
12118 self
12119 }
12120
12121 /// Sets the value of [multi_region_id][crate::model::service::MultiRegionSettings::multi_region_id].
12122 ///
12123 /// # Example
12124 /// ```ignore,no_run
12125 /// # use google_cloud_run_v2::model::service::MultiRegionSettings;
12126 /// let x = MultiRegionSettings::new().set_multi_region_id("example");
12127 /// ```
12128 pub fn set_multi_region_id<T: std::convert::Into<std::string::String>>(
12129 mut self,
12130 v: T,
12131 ) -> Self {
12132 self.multi_region_id = v.into();
12133 self
12134 }
12135 }
12136
12137 impl wkt::message::Message for MultiRegionSettings {
12138 fn typename() -> &'static str {
12139 "type.googleapis.com/google.cloud.run.v2.Service.MultiRegionSettings"
12140 }
12141 }
12142}
12143
12144/// Effective settings for the current revision
12145#[derive(Clone, Default, PartialEq)]
12146#[non_exhaustive]
12147pub struct RevisionScalingStatus {
12148 /// The current number of min instances provisioned for this revision.
12149 pub desired_min_instance_count: i32,
12150
12151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12152}
12153
12154impl RevisionScalingStatus {
12155 pub fn new() -> Self {
12156 std::default::Default::default()
12157 }
12158
12159 /// Sets the value of [desired_min_instance_count][crate::model::RevisionScalingStatus::desired_min_instance_count].
12160 ///
12161 /// # Example
12162 /// ```ignore,no_run
12163 /// # use google_cloud_run_v2::model::RevisionScalingStatus;
12164 /// let x = RevisionScalingStatus::new().set_desired_min_instance_count(42);
12165 /// ```
12166 pub fn set_desired_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12167 self.desired_min_instance_count = v.into();
12168 self
12169 }
12170}
12171
12172impl wkt::message::Message for RevisionScalingStatus {
12173 fn typename() -> &'static str {
12174 "type.googleapis.com/google.cloud.run.v2.RevisionScalingStatus"
12175 }
12176}
12177
12178/// Request message for obtaining a Task by its full name.
12179#[derive(Clone, Default, PartialEq)]
12180#[non_exhaustive]
12181pub struct GetTaskRequest {
12182 /// Required. The full name of the Task.
12183 /// Format:
12184 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
12185 pub name: std::string::String,
12186
12187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12188}
12189
12190impl GetTaskRequest {
12191 pub fn new() -> Self {
12192 std::default::Default::default()
12193 }
12194
12195 /// Sets the value of [name][crate::model::GetTaskRequest::name].
12196 ///
12197 /// # Example
12198 /// ```ignore,no_run
12199 /// # use google_cloud_run_v2::model::GetTaskRequest;
12200 /// let x = GetTaskRequest::new().set_name("example");
12201 /// ```
12202 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12203 self.name = v.into();
12204 self
12205 }
12206}
12207
12208impl wkt::message::Message for GetTaskRequest {
12209 fn typename() -> &'static str {
12210 "type.googleapis.com/google.cloud.run.v2.GetTaskRequest"
12211 }
12212}
12213
12214/// Request message for retrieving a list of Tasks.
12215#[derive(Clone, Default, PartialEq)]
12216#[non_exhaustive]
12217pub struct ListTasksRequest {
12218 /// Required. The Execution from which the Tasks should be listed.
12219 /// To list all Tasks across Executions of a Job, use "-" instead of Execution
12220 /// name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
12221 /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
12222 pub parent: std::string::String,
12223
12224 /// Maximum number of Tasks to return in this call.
12225 pub page_size: i32,
12226
12227 /// A page token received from a previous call to ListTasks.
12228 /// All other parameters must match.
12229 pub page_token: std::string::String,
12230
12231 /// If true, returns deleted (but unexpired) resources along with active ones.
12232 pub show_deleted: bool,
12233
12234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12235}
12236
12237impl ListTasksRequest {
12238 pub fn new() -> Self {
12239 std::default::Default::default()
12240 }
12241
12242 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
12243 ///
12244 /// # Example
12245 /// ```ignore,no_run
12246 /// # use google_cloud_run_v2::model::ListTasksRequest;
12247 /// let x = ListTasksRequest::new().set_parent("example");
12248 /// ```
12249 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12250 self.parent = v.into();
12251 self
12252 }
12253
12254 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
12255 ///
12256 /// # Example
12257 /// ```ignore,no_run
12258 /// # use google_cloud_run_v2::model::ListTasksRequest;
12259 /// let x = ListTasksRequest::new().set_page_size(42);
12260 /// ```
12261 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12262 self.page_size = v.into();
12263 self
12264 }
12265
12266 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
12267 ///
12268 /// # Example
12269 /// ```ignore,no_run
12270 /// # use google_cloud_run_v2::model::ListTasksRequest;
12271 /// let x = ListTasksRequest::new().set_page_token("example");
12272 /// ```
12273 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12274 self.page_token = v.into();
12275 self
12276 }
12277
12278 /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
12279 ///
12280 /// # Example
12281 /// ```ignore,no_run
12282 /// # use google_cloud_run_v2::model::ListTasksRequest;
12283 /// let x = ListTasksRequest::new().set_show_deleted(true);
12284 /// ```
12285 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12286 self.show_deleted = v.into();
12287 self
12288 }
12289}
12290
12291impl wkt::message::Message for ListTasksRequest {
12292 fn typename() -> &'static str {
12293 "type.googleapis.com/google.cloud.run.v2.ListTasksRequest"
12294 }
12295}
12296
12297/// Response message containing a list of Tasks.
12298#[derive(Clone, Default, PartialEq)]
12299#[non_exhaustive]
12300pub struct ListTasksResponse {
12301 /// The resulting list of Tasks.
12302 pub tasks: std::vec::Vec<crate::model::Task>,
12303
12304 /// A token indicating there are more items than page_size. Use it in the next
12305 /// ListTasks request to continue.
12306 pub next_page_token: std::string::String,
12307
12308 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12309}
12310
12311impl ListTasksResponse {
12312 pub fn new() -> Self {
12313 std::default::Default::default()
12314 }
12315
12316 /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
12317 ///
12318 /// # Example
12319 /// ```ignore,no_run
12320 /// # use google_cloud_run_v2::model::ListTasksResponse;
12321 /// use google_cloud_run_v2::model::Task;
12322 /// let x = ListTasksResponse::new()
12323 /// .set_tasks([
12324 /// Task::default()/* use setters */,
12325 /// Task::default()/* use (different) setters */,
12326 /// ]);
12327 /// ```
12328 pub fn set_tasks<T, V>(mut self, v: T) -> Self
12329 where
12330 T: std::iter::IntoIterator<Item = V>,
12331 V: std::convert::Into<crate::model::Task>,
12332 {
12333 use std::iter::Iterator;
12334 self.tasks = v.into_iter().map(|i| i.into()).collect();
12335 self
12336 }
12337
12338 /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
12339 ///
12340 /// # Example
12341 /// ```ignore,no_run
12342 /// # use google_cloud_run_v2::model::ListTasksResponse;
12343 /// let x = ListTasksResponse::new().set_next_page_token("example");
12344 /// ```
12345 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12346 self.next_page_token = v.into();
12347 self
12348 }
12349}
12350
12351impl wkt::message::Message for ListTasksResponse {
12352 fn typename() -> &'static str {
12353 "type.googleapis.com/google.cloud.run.v2.ListTasksResponse"
12354 }
12355}
12356
12357#[doc(hidden)]
12358impl google_cloud_gax::paginator::internal::PageableResponse for ListTasksResponse {
12359 type PageItem = crate::model::Task;
12360
12361 fn items(self) -> std::vec::Vec<Self::PageItem> {
12362 self.tasks
12363 }
12364
12365 fn next_page_token(&self) -> std::string::String {
12366 use std::clone::Clone;
12367 self.next_page_token.clone()
12368 }
12369}
12370
12371/// Task represents a single run of a container to completion.
12372#[derive(Clone, Default, PartialEq)]
12373#[non_exhaustive]
12374pub struct Task {
12375 /// Output only. The unique name of this Task.
12376 pub name: std::string::String,
12377
12378 /// Output only. Server assigned unique identifier for the Task. The value is a
12379 /// UUID4 string and guaranteed to remain unchanged until the resource is
12380 /// deleted.
12381 pub uid: std::string::String,
12382
12383 /// Output only. A number that monotonically increases every time the user
12384 /// modifies the desired state.
12385 pub generation: i64,
12386
12387 /// Output only. Unstructured key value map that can be used to organize and
12388 /// categorize objects. User-provided labels are shared with Google's billing
12389 /// system, so they can be used to filter, or break down billing charges by
12390 /// team, component, environment, state, etc. For more information, visit
12391 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
12392 /// <https://cloud.google.com/run/docs/configuring/labels>
12393 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12394
12395 /// Output only. Unstructured key value map that may
12396 /// be set by external tools to store and arbitrary metadata.
12397 /// They are not queryable and should be preserved
12398 /// when modifying objects.
12399 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12400
12401 /// Output only. Represents time when the task was created by the system.
12402 /// It is not guaranteed to be set in happens-before order across separate
12403 /// operations.
12404 pub create_time: std::option::Option<wkt::Timestamp>,
12405
12406 /// Output only. Represents time when the task was scheduled to run by the
12407 /// system. It is not guaranteed to be set in happens-before order across
12408 /// separate operations.
12409 pub scheduled_time: std::option::Option<wkt::Timestamp>,
12410
12411 /// Output only. Represents time when the task started to run.
12412 /// It is not guaranteed to be set in happens-before order across separate
12413 /// operations.
12414 pub start_time: std::option::Option<wkt::Timestamp>,
12415
12416 /// Output only. Represents time when the Task was completed. It is not
12417 /// guaranteed to be set in happens-before order across separate operations.
12418 pub completion_time: std::option::Option<wkt::Timestamp>,
12419
12420 /// Output only. The last-modified time.
12421 pub update_time: std::option::Option<wkt::Timestamp>,
12422
12423 /// Output only. For a deleted resource, the deletion time. It is only
12424 /// populated as a response to a Delete request.
12425 pub delete_time: std::option::Option<wkt::Timestamp>,
12426
12427 /// Output only. For a deleted resource, the time after which it will be
12428 /// permamently deleted. It is only populated as a response to a Delete
12429 /// request.
12430 pub expire_time: std::option::Option<wkt::Timestamp>,
12431
12432 /// Output only. The name of the parent Job.
12433 pub job: std::string::String,
12434
12435 /// Output only. The name of the parent Execution.
12436 pub execution: std::string::String,
12437
12438 /// Holds the single container that defines the unit of execution for this
12439 /// task.
12440 pub containers: std::vec::Vec<crate::model::Container>,
12441
12442 /// A list of Volumes to make available to containers.
12443 pub volumes: std::vec::Vec<crate::model::Volume>,
12444
12445 /// Number of retries allowed per Task, before marking this Task failed.
12446 pub max_retries: i32,
12447
12448 /// Max allowed time duration the Task may be active before the system will
12449 /// actively try to mark it failed and kill associated containers. This applies
12450 /// per attempt of a task, meaning each retry can run for the full timeout.
12451 pub timeout: std::option::Option<wkt::Duration>,
12452
12453 /// Email address of the IAM service account associated with the Task of a
12454 /// Job. The service account represents the identity of the
12455 /// running task, and determines what permissions the task has. If
12456 /// not provided, the task will use the project's default service account.
12457 pub service_account: std::string::String,
12458
12459 /// The execution environment being used to host this Task.
12460 pub execution_environment: crate::model::ExecutionEnvironment,
12461
12462 /// Output only. Indicates whether the resource's reconciliation is still in
12463 /// progress. See comments in `Job.reconciling` for additional information on
12464 /// reconciliation process in Cloud Run.
12465 pub reconciling: bool,
12466
12467 /// Output only. The Condition of this Task, containing its readiness status,
12468 /// and detailed error information in case it did not reach the desired state.
12469 pub conditions: std::vec::Vec<crate::model::Condition>,
12470
12471 /// Output only. The generation of this Task. See comments in `Job.reconciling`
12472 /// for additional information on reconciliation process in Cloud Run.
12473 pub observed_generation: i64,
12474
12475 /// Output only. Index of the Task, unique per execution, and beginning at 0.
12476 pub index: i32,
12477
12478 /// Output only. The number of times this Task was retried.
12479 /// Tasks are retried when they fail up to the maxRetries limit.
12480 pub retried: i32,
12481
12482 /// Output only. Result of the last attempt of this Task.
12483 pub last_attempt_result: std::option::Option<crate::model::TaskAttemptResult>,
12484
12485 /// Output only. A reference to a customer managed encryption key (CMEK) to use
12486 /// to encrypt this container image. For more information, go to
12487 /// <https://cloud.google.com/run/docs/securing/using-cmek>
12488 pub encryption_key: std::string::String,
12489
12490 /// Output only. VPC Access configuration to use for this Task. For more
12491 /// information, visit
12492 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
12493 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
12494
12495 /// Output only. URI where logs for this execution can be found in Cloud
12496 /// Console.
12497 pub log_uri: std::string::String,
12498
12499 /// Output only. Reserved for future use.
12500 pub satisfies_pzs: bool,
12501
12502 /// Output only. The node selector for the task.
12503 pub node_selector: std::option::Option<crate::model::NodeSelector>,
12504
12505 /// Optional. Output only. True if GPU zonal redundancy is disabled on this
12506 /// task.
12507 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
12508
12509 /// Output only. A system-generated fingerprint for this version of the
12510 /// resource. May be used to detect modification conflict during updates.
12511 pub etag: std::string::String,
12512
12513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12514}
12515
12516impl Task {
12517 pub fn new() -> Self {
12518 std::default::Default::default()
12519 }
12520
12521 /// Sets the value of [name][crate::model::Task::name].
12522 ///
12523 /// # Example
12524 /// ```ignore,no_run
12525 /// # use google_cloud_run_v2::model::Task;
12526 /// let x = Task::new().set_name("example");
12527 /// ```
12528 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12529 self.name = v.into();
12530 self
12531 }
12532
12533 /// Sets the value of [uid][crate::model::Task::uid].
12534 ///
12535 /// # Example
12536 /// ```ignore,no_run
12537 /// # use google_cloud_run_v2::model::Task;
12538 /// let x = Task::new().set_uid("example");
12539 /// ```
12540 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12541 self.uid = v.into();
12542 self
12543 }
12544
12545 /// Sets the value of [generation][crate::model::Task::generation].
12546 ///
12547 /// # Example
12548 /// ```ignore,no_run
12549 /// # use google_cloud_run_v2::model::Task;
12550 /// let x = Task::new().set_generation(42);
12551 /// ```
12552 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12553 self.generation = v.into();
12554 self
12555 }
12556
12557 /// Sets the value of [labels][crate::model::Task::labels].
12558 ///
12559 /// # Example
12560 /// ```ignore,no_run
12561 /// # use google_cloud_run_v2::model::Task;
12562 /// let x = Task::new().set_labels([
12563 /// ("key0", "abc"),
12564 /// ("key1", "xyz"),
12565 /// ]);
12566 /// ```
12567 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12568 where
12569 T: std::iter::IntoIterator<Item = (K, V)>,
12570 K: std::convert::Into<std::string::String>,
12571 V: std::convert::Into<std::string::String>,
12572 {
12573 use std::iter::Iterator;
12574 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12575 self
12576 }
12577
12578 /// Sets the value of [annotations][crate::model::Task::annotations].
12579 ///
12580 /// # Example
12581 /// ```ignore,no_run
12582 /// # use google_cloud_run_v2::model::Task;
12583 /// let x = Task::new().set_annotations([
12584 /// ("key0", "abc"),
12585 /// ("key1", "xyz"),
12586 /// ]);
12587 /// ```
12588 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12589 where
12590 T: std::iter::IntoIterator<Item = (K, V)>,
12591 K: std::convert::Into<std::string::String>,
12592 V: std::convert::Into<std::string::String>,
12593 {
12594 use std::iter::Iterator;
12595 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12596 self
12597 }
12598
12599 /// Sets the value of [create_time][crate::model::Task::create_time].
12600 ///
12601 /// # Example
12602 /// ```ignore,no_run
12603 /// # use google_cloud_run_v2::model::Task;
12604 /// use wkt::Timestamp;
12605 /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
12606 /// ```
12607 pub fn set_create_time<T>(mut self, v: T) -> Self
12608 where
12609 T: std::convert::Into<wkt::Timestamp>,
12610 {
12611 self.create_time = std::option::Option::Some(v.into());
12612 self
12613 }
12614
12615 /// Sets or clears the value of [create_time][crate::model::Task::create_time].
12616 ///
12617 /// # Example
12618 /// ```ignore,no_run
12619 /// # use google_cloud_run_v2::model::Task;
12620 /// use wkt::Timestamp;
12621 /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12622 /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
12623 /// ```
12624 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12625 where
12626 T: std::convert::Into<wkt::Timestamp>,
12627 {
12628 self.create_time = v.map(|x| x.into());
12629 self
12630 }
12631
12632 /// Sets the value of [scheduled_time][crate::model::Task::scheduled_time].
12633 ///
12634 /// # Example
12635 /// ```ignore,no_run
12636 /// # use google_cloud_run_v2::model::Task;
12637 /// use wkt::Timestamp;
12638 /// let x = Task::new().set_scheduled_time(Timestamp::default()/* use setters */);
12639 /// ```
12640 pub fn set_scheduled_time<T>(mut self, v: T) -> Self
12641 where
12642 T: std::convert::Into<wkt::Timestamp>,
12643 {
12644 self.scheduled_time = std::option::Option::Some(v.into());
12645 self
12646 }
12647
12648 /// Sets or clears the value of [scheduled_time][crate::model::Task::scheduled_time].
12649 ///
12650 /// # Example
12651 /// ```ignore,no_run
12652 /// # use google_cloud_run_v2::model::Task;
12653 /// use wkt::Timestamp;
12654 /// let x = Task::new().set_or_clear_scheduled_time(Some(Timestamp::default()/* use setters */));
12655 /// let x = Task::new().set_or_clear_scheduled_time(None::<Timestamp>);
12656 /// ```
12657 pub fn set_or_clear_scheduled_time<T>(mut self, v: std::option::Option<T>) -> Self
12658 where
12659 T: std::convert::Into<wkt::Timestamp>,
12660 {
12661 self.scheduled_time = v.map(|x| x.into());
12662 self
12663 }
12664
12665 /// Sets the value of [start_time][crate::model::Task::start_time].
12666 ///
12667 /// # Example
12668 /// ```ignore,no_run
12669 /// # use google_cloud_run_v2::model::Task;
12670 /// use wkt::Timestamp;
12671 /// let x = Task::new().set_start_time(Timestamp::default()/* use setters */);
12672 /// ```
12673 pub fn set_start_time<T>(mut self, v: T) -> Self
12674 where
12675 T: std::convert::Into<wkt::Timestamp>,
12676 {
12677 self.start_time = std::option::Option::Some(v.into());
12678 self
12679 }
12680
12681 /// Sets or clears the value of [start_time][crate::model::Task::start_time].
12682 ///
12683 /// # Example
12684 /// ```ignore,no_run
12685 /// # use google_cloud_run_v2::model::Task;
12686 /// use wkt::Timestamp;
12687 /// let x = Task::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
12688 /// let x = Task::new().set_or_clear_start_time(None::<Timestamp>);
12689 /// ```
12690 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
12691 where
12692 T: std::convert::Into<wkt::Timestamp>,
12693 {
12694 self.start_time = v.map(|x| x.into());
12695 self
12696 }
12697
12698 /// Sets the value of [completion_time][crate::model::Task::completion_time].
12699 ///
12700 /// # Example
12701 /// ```ignore,no_run
12702 /// # use google_cloud_run_v2::model::Task;
12703 /// use wkt::Timestamp;
12704 /// let x = Task::new().set_completion_time(Timestamp::default()/* use setters */);
12705 /// ```
12706 pub fn set_completion_time<T>(mut self, v: T) -> Self
12707 where
12708 T: std::convert::Into<wkt::Timestamp>,
12709 {
12710 self.completion_time = std::option::Option::Some(v.into());
12711 self
12712 }
12713
12714 /// Sets or clears the value of [completion_time][crate::model::Task::completion_time].
12715 ///
12716 /// # Example
12717 /// ```ignore,no_run
12718 /// # use google_cloud_run_v2::model::Task;
12719 /// use wkt::Timestamp;
12720 /// let x = Task::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
12721 /// let x = Task::new().set_or_clear_completion_time(None::<Timestamp>);
12722 /// ```
12723 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
12724 where
12725 T: std::convert::Into<wkt::Timestamp>,
12726 {
12727 self.completion_time = v.map(|x| x.into());
12728 self
12729 }
12730
12731 /// Sets the value of [update_time][crate::model::Task::update_time].
12732 ///
12733 /// # Example
12734 /// ```ignore,no_run
12735 /// # use google_cloud_run_v2::model::Task;
12736 /// use wkt::Timestamp;
12737 /// let x = Task::new().set_update_time(Timestamp::default()/* use setters */);
12738 /// ```
12739 pub fn set_update_time<T>(mut self, v: T) -> Self
12740 where
12741 T: std::convert::Into<wkt::Timestamp>,
12742 {
12743 self.update_time = std::option::Option::Some(v.into());
12744 self
12745 }
12746
12747 /// Sets or clears the value of [update_time][crate::model::Task::update_time].
12748 ///
12749 /// # Example
12750 /// ```ignore,no_run
12751 /// # use google_cloud_run_v2::model::Task;
12752 /// use wkt::Timestamp;
12753 /// let x = Task::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12754 /// let x = Task::new().set_or_clear_update_time(None::<Timestamp>);
12755 /// ```
12756 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12757 where
12758 T: std::convert::Into<wkt::Timestamp>,
12759 {
12760 self.update_time = v.map(|x| x.into());
12761 self
12762 }
12763
12764 /// Sets the value of [delete_time][crate::model::Task::delete_time].
12765 ///
12766 /// # Example
12767 /// ```ignore,no_run
12768 /// # use google_cloud_run_v2::model::Task;
12769 /// use wkt::Timestamp;
12770 /// let x = Task::new().set_delete_time(Timestamp::default()/* use setters */);
12771 /// ```
12772 pub fn set_delete_time<T>(mut self, v: T) -> Self
12773 where
12774 T: std::convert::Into<wkt::Timestamp>,
12775 {
12776 self.delete_time = std::option::Option::Some(v.into());
12777 self
12778 }
12779
12780 /// Sets or clears the value of [delete_time][crate::model::Task::delete_time].
12781 ///
12782 /// # Example
12783 /// ```ignore,no_run
12784 /// # use google_cloud_run_v2::model::Task;
12785 /// use wkt::Timestamp;
12786 /// let x = Task::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12787 /// let x = Task::new().set_or_clear_delete_time(None::<Timestamp>);
12788 /// ```
12789 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12790 where
12791 T: std::convert::Into<wkt::Timestamp>,
12792 {
12793 self.delete_time = v.map(|x| x.into());
12794 self
12795 }
12796
12797 /// Sets the value of [expire_time][crate::model::Task::expire_time].
12798 ///
12799 /// # Example
12800 /// ```ignore,no_run
12801 /// # use google_cloud_run_v2::model::Task;
12802 /// use wkt::Timestamp;
12803 /// let x = Task::new().set_expire_time(Timestamp::default()/* use setters */);
12804 /// ```
12805 pub fn set_expire_time<T>(mut self, v: T) -> Self
12806 where
12807 T: std::convert::Into<wkt::Timestamp>,
12808 {
12809 self.expire_time = std::option::Option::Some(v.into());
12810 self
12811 }
12812
12813 /// Sets or clears the value of [expire_time][crate::model::Task::expire_time].
12814 ///
12815 /// # Example
12816 /// ```ignore,no_run
12817 /// # use google_cloud_run_v2::model::Task;
12818 /// use wkt::Timestamp;
12819 /// let x = Task::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
12820 /// let x = Task::new().set_or_clear_expire_time(None::<Timestamp>);
12821 /// ```
12822 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
12823 where
12824 T: std::convert::Into<wkt::Timestamp>,
12825 {
12826 self.expire_time = v.map(|x| x.into());
12827 self
12828 }
12829
12830 /// Sets the value of [job][crate::model::Task::job].
12831 ///
12832 /// # Example
12833 /// ```ignore,no_run
12834 /// # use google_cloud_run_v2::model::Task;
12835 /// let x = Task::new().set_job("example");
12836 /// ```
12837 pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12838 self.job = v.into();
12839 self
12840 }
12841
12842 /// Sets the value of [execution][crate::model::Task::execution].
12843 ///
12844 /// # Example
12845 /// ```ignore,no_run
12846 /// # use google_cloud_run_v2::model::Task;
12847 /// let x = Task::new().set_execution("example");
12848 /// ```
12849 pub fn set_execution<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12850 self.execution = v.into();
12851 self
12852 }
12853
12854 /// Sets the value of [containers][crate::model::Task::containers].
12855 ///
12856 /// # Example
12857 /// ```ignore,no_run
12858 /// # use google_cloud_run_v2::model::Task;
12859 /// use google_cloud_run_v2::model::Container;
12860 /// let x = Task::new()
12861 /// .set_containers([
12862 /// Container::default()/* use setters */,
12863 /// Container::default()/* use (different) setters */,
12864 /// ]);
12865 /// ```
12866 pub fn set_containers<T, V>(mut self, v: T) -> Self
12867 where
12868 T: std::iter::IntoIterator<Item = V>,
12869 V: std::convert::Into<crate::model::Container>,
12870 {
12871 use std::iter::Iterator;
12872 self.containers = v.into_iter().map(|i| i.into()).collect();
12873 self
12874 }
12875
12876 /// Sets the value of [volumes][crate::model::Task::volumes].
12877 ///
12878 /// # Example
12879 /// ```ignore,no_run
12880 /// # use google_cloud_run_v2::model::Task;
12881 /// use google_cloud_run_v2::model::Volume;
12882 /// let x = Task::new()
12883 /// .set_volumes([
12884 /// Volume::default()/* use setters */,
12885 /// Volume::default()/* use (different) setters */,
12886 /// ]);
12887 /// ```
12888 pub fn set_volumes<T, V>(mut self, v: T) -> Self
12889 where
12890 T: std::iter::IntoIterator<Item = V>,
12891 V: std::convert::Into<crate::model::Volume>,
12892 {
12893 use std::iter::Iterator;
12894 self.volumes = v.into_iter().map(|i| i.into()).collect();
12895 self
12896 }
12897
12898 /// Sets the value of [max_retries][crate::model::Task::max_retries].
12899 ///
12900 /// # Example
12901 /// ```ignore,no_run
12902 /// # use google_cloud_run_v2::model::Task;
12903 /// let x = Task::new().set_max_retries(42);
12904 /// ```
12905 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12906 self.max_retries = v.into();
12907 self
12908 }
12909
12910 /// Sets the value of [timeout][crate::model::Task::timeout].
12911 ///
12912 /// # Example
12913 /// ```ignore,no_run
12914 /// # use google_cloud_run_v2::model::Task;
12915 /// use wkt::Duration;
12916 /// let x = Task::new().set_timeout(Duration::default()/* use setters */);
12917 /// ```
12918 pub fn set_timeout<T>(mut self, v: T) -> Self
12919 where
12920 T: std::convert::Into<wkt::Duration>,
12921 {
12922 self.timeout = std::option::Option::Some(v.into());
12923 self
12924 }
12925
12926 /// Sets or clears the value of [timeout][crate::model::Task::timeout].
12927 ///
12928 /// # Example
12929 /// ```ignore,no_run
12930 /// # use google_cloud_run_v2::model::Task;
12931 /// use wkt::Duration;
12932 /// let x = Task::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
12933 /// let x = Task::new().set_or_clear_timeout(None::<Duration>);
12934 /// ```
12935 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
12936 where
12937 T: std::convert::Into<wkt::Duration>,
12938 {
12939 self.timeout = v.map(|x| x.into());
12940 self
12941 }
12942
12943 /// Sets the value of [service_account][crate::model::Task::service_account].
12944 ///
12945 /// # Example
12946 /// ```ignore,no_run
12947 /// # use google_cloud_run_v2::model::Task;
12948 /// let x = Task::new().set_service_account("example");
12949 /// ```
12950 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12951 self.service_account = v.into();
12952 self
12953 }
12954
12955 /// Sets the value of [execution_environment][crate::model::Task::execution_environment].
12956 ///
12957 /// # Example
12958 /// ```ignore,no_run
12959 /// # use google_cloud_run_v2::model::Task;
12960 /// use google_cloud_run_v2::model::ExecutionEnvironment;
12961 /// let x0 = Task::new().set_execution_environment(ExecutionEnvironment::Gen1);
12962 /// let x1 = Task::new().set_execution_environment(ExecutionEnvironment::Gen2);
12963 /// ```
12964 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
12965 mut self,
12966 v: T,
12967 ) -> Self {
12968 self.execution_environment = v.into();
12969 self
12970 }
12971
12972 /// Sets the value of [reconciling][crate::model::Task::reconciling].
12973 ///
12974 /// # Example
12975 /// ```ignore,no_run
12976 /// # use google_cloud_run_v2::model::Task;
12977 /// let x = Task::new().set_reconciling(true);
12978 /// ```
12979 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12980 self.reconciling = v.into();
12981 self
12982 }
12983
12984 /// Sets the value of [conditions][crate::model::Task::conditions].
12985 ///
12986 /// # Example
12987 /// ```ignore,no_run
12988 /// # use google_cloud_run_v2::model::Task;
12989 /// use google_cloud_run_v2::model::Condition;
12990 /// let x = Task::new()
12991 /// .set_conditions([
12992 /// Condition::default()/* use setters */,
12993 /// Condition::default()/* use (different) setters */,
12994 /// ]);
12995 /// ```
12996 pub fn set_conditions<T, V>(mut self, v: T) -> Self
12997 where
12998 T: std::iter::IntoIterator<Item = V>,
12999 V: std::convert::Into<crate::model::Condition>,
13000 {
13001 use std::iter::Iterator;
13002 self.conditions = v.into_iter().map(|i| i.into()).collect();
13003 self
13004 }
13005
13006 /// Sets the value of [observed_generation][crate::model::Task::observed_generation].
13007 ///
13008 /// # Example
13009 /// ```ignore,no_run
13010 /// # use google_cloud_run_v2::model::Task;
13011 /// let x = Task::new().set_observed_generation(42);
13012 /// ```
13013 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13014 self.observed_generation = v.into();
13015 self
13016 }
13017
13018 /// Sets the value of [index][crate::model::Task::index].
13019 ///
13020 /// # Example
13021 /// ```ignore,no_run
13022 /// # use google_cloud_run_v2::model::Task;
13023 /// let x = Task::new().set_index(42);
13024 /// ```
13025 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13026 self.index = v.into();
13027 self
13028 }
13029
13030 /// Sets the value of [retried][crate::model::Task::retried].
13031 ///
13032 /// # Example
13033 /// ```ignore,no_run
13034 /// # use google_cloud_run_v2::model::Task;
13035 /// let x = Task::new().set_retried(42);
13036 /// ```
13037 pub fn set_retried<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13038 self.retried = v.into();
13039 self
13040 }
13041
13042 /// Sets the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13043 ///
13044 /// # Example
13045 /// ```ignore,no_run
13046 /// # use google_cloud_run_v2::model::Task;
13047 /// use google_cloud_run_v2::model::TaskAttemptResult;
13048 /// let x = Task::new().set_last_attempt_result(TaskAttemptResult::default()/* use setters */);
13049 /// ```
13050 pub fn set_last_attempt_result<T>(mut self, v: T) -> Self
13051 where
13052 T: std::convert::Into<crate::model::TaskAttemptResult>,
13053 {
13054 self.last_attempt_result = std::option::Option::Some(v.into());
13055 self
13056 }
13057
13058 /// Sets or clears the value of [last_attempt_result][crate::model::Task::last_attempt_result].
13059 ///
13060 /// # Example
13061 /// ```ignore,no_run
13062 /// # use google_cloud_run_v2::model::Task;
13063 /// use google_cloud_run_v2::model::TaskAttemptResult;
13064 /// let x = Task::new().set_or_clear_last_attempt_result(Some(TaskAttemptResult::default()/* use setters */));
13065 /// let x = Task::new().set_or_clear_last_attempt_result(None::<TaskAttemptResult>);
13066 /// ```
13067 pub fn set_or_clear_last_attempt_result<T>(mut self, v: std::option::Option<T>) -> Self
13068 where
13069 T: std::convert::Into<crate::model::TaskAttemptResult>,
13070 {
13071 self.last_attempt_result = v.map(|x| x.into());
13072 self
13073 }
13074
13075 /// Sets the value of [encryption_key][crate::model::Task::encryption_key].
13076 ///
13077 /// # Example
13078 /// ```ignore,no_run
13079 /// # use google_cloud_run_v2::model::Task;
13080 /// let x = Task::new().set_encryption_key("example");
13081 /// ```
13082 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13083 self.encryption_key = v.into();
13084 self
13085 }
13086
13087 /// Sets the value of [vpc_access][crate::model::Task::vpc_access].
13088 ///
13089 /// # Example
13090 /// ```ignore,no_run
13091 /// # use google_cloud_run_v2::model::Task;
13092 /// use google_cloud_run_v2::model::VpcAccess;
13093 /// let x = Task::new().set_vpc_access(VpcAccess::default()/* use setters */);
13094 /// ```
13095 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13096 where
13097 T: std::convert::Into<crate::model::VpcAccess>,
13098 {
13099 self.vpc_access = std::option::Option::Some(v.into());
13100 self
13101 }
13102
13103 /// Sets or clears the value of [vpc_access][crate::model::Task::vpc_access].
13104 ///
13105 /// # Example
13106 /// ```ignore,no_run
13107 /// # use google_cloud_run_v2::model::Task;
13108 /// use google_cloud_run_v2::model::VpcAccess;
13109 /// let x = Task::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13110 /// let x = Task::new().set_or_clear_vpc_access(None::<VpcAccess>);
13111 /// ```
13112 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13113 where
13114 T: std::convert::Into<crate::model::VpcAccess>,
13115 {
13116 self.vpc_access = v.map(|x| x.into());
13117 self
13118 }
13119
13120 /// Sets the value of [log_uri][crate::model::Task::log_uri].
13121 ///
13122 /// # Example
13123 /// ```ignore,no_run
13124 /// # use google_cloud_run_v2::model::Task;
13125 /// let x = Task::new().set_log_uri("example");
13126 /// ```
13127 pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13128 self.log_uri = v.into();
13129 self
13130 }
13131
13132 /// Sets the value of [satisfies_pzs][crate::model::Task::satisfies_pzs].
13133 ///
13134 /// # Example
13135 /// ```ignore,no_run
13136 /// # use google_cloud_run_v2::model::Task;
13137 /// let x = Task::new().set_satisfies_pzs(true);
13138 /// ```
13139 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13140 self.satisfies_pzs = v.into();
13141 self
13142 }
13143
13144 /// Sets the value of [node_selector][crate::model::Task::node_selector].
13145 ///
13146 /// # Example
13147 /// ```ignore,no_run
13148 /// # use google_cloud_run_v2::model::Task;
13149 /// use google_cloud_run_v2::model::NodeSelector;
13150 /// let x = Task::new().set_node_selector(NodeSelector::default()/* use setters */);
13151 /// ```
13152 pub fn set_node_selector<T>(mut self, v: T) -> Self
13153 where
13154 T: std::convert::Into<crate::model::NodeSelector>,
13155 {
13156 self.node_selector = std::option::Option::Some(v.into());
13157 self
13158 }
13159
13160 /// Sets or clears the value of [node_selector][crate::model::Task::node_selector].
13161 ///
13162 /// # Example
13163 /// ```ignore,no_run
13164 /// # use google_cloud_run_v2::model::Task;
13165 /// use google_cloud_run_v2::model::NodeSelector;
13166 /// let x = Task::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13167 /// let x = Task::new().set_or_clear_node_selector(None::<NodeSelector>);
13168 /// ```
13169 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13170 where
13171 T: std::convert::Into<crate::model::NodeSelector>,
13172 {
13173 self.node_selector = v.map(|x| x.into());
13174 self
13175 }
13176
13177 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13178 ///
13179 /// # Example
13180 /// ```ignore,no_run
13181 /// # use google_cloud_run_v2::model::Task;
13182 /// let x = Task::new().set_gpu_zonal_redundancy_disabled(true);
13183 /// ```
13184 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13185 where
13186 T: std::convert::Into<bool>,
13187 {
13188 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13189 self
13190 }
13191
13192 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Task::gpu_zonal_redundancy_disabled].
13193 ///
13194 /// # Example
13195 /// ```ignore,no_run
13196 /// # use google_cloud_run_v2::model::Task;
13197 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13198 /// let x = Task::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13199 /// ```
13200 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13201 mut self,
13202 v: std::option::Option<T>,
13203 ) -> Self
13204 where
13205 T: std::convert::Into<bool>,
13206 {
13207 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13208 self
13209 }
13210
13211 /// Sets the value of [etag][crate::model::Task::etag].
13212 ///
13213 /// # Example
13214 /// ```ignore,no_run
13215 /// # use google_cloud_run_v2::model::Task;
13216 /// let x = Task::new().set_etag("example");
13217 /// ```
13218 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13219 self.etag = v.into();
13220 self
13221 }
13222}
13223
13224impl wkt::message::Message for Task {
13225 fn typename() -> &'static str {
13226 "type.googleapis.com/google.cloud.run.v2.Task"
13227 }
13228}
13229
13230/// Result of a task attempt.
13231#[derive(Clone, Default, PartialEq)]
13232#[non_exhaustive]
13233pub struct TaskAttemptResult {
13234 /// Output only. The status of this attempt.
13235 /// If the status code is OK, then the attempt succeeded.
13236 pub status: std::option::Option<google_cloud_rpc::model::Status>,
13237
13238 /// Output only. The exit code of this attempt.
13239 /// This may be unset if the container was unable to exit cleanly with a code
13240 /// due to some other failure.
13241 /// See status field for possible failure details.
13242 ///
13243 /// At most one of exit_code or term_signal will be set.
13244 pub exit_code: i32,
13245
13246 /// Output only. Termination signal of the container. This is set to non-zero
13247 /// if the container is terminated by the system.
13248 ///
13249 /// At most one of exit_code or term_signal will be set.
13250 pub term_signal: i32,
13251
13252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13253}
13254
13255impl TaskAttemptResult {
13256 pub fn new() -> Self {
13257 std::default::Default::default()
13258 }
13259
13260 /// Sets the value of [status][crate::model::TaskAttemptResult::status].
13261 ///
13262 /// # Example
13263 /// ```ignore,no_run
13264 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13265 /// use google_cloud_rpc::model::Status;
13266 /// let x = TaskAttemptResult::new().set_status(Status::default()/* use setters */);
13267 /// ```
13268 pub fn set_status<T>(mut self, v: T) -> Self
13269 where
13270 T: std::convert::Into<google_cloud_rpc::model::Status>,
13271 {
13272 self.status = std::option::Option::Some(v.into());
13273 self
13274 }
13275
13276 /// Sets or clears the value of [status][crate::model::TaskAttemptResult::status].
13277 ///
13278 /// # Example
13279 /// ```ignore,no_run
13280 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13281 /// use google_cloud_rpc::model::Status;
13282 /// let x = TaskAttemptResult::new().set_or_clear_status(Some(Status::default()/* use setters */));
13283 /// let x = TaskAttemptResult::new().set_or_clear_status(None::<Status>);
13284 /// ```
13285 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
13286 where
13287 T: std::convert::Into<google_cloud_rpc::model::Status>,
13288 {
13289 self.status = v.map(|x| x.into());
13290 self
13291 }
13292
13293 /// Sets the value of [exit_code][crate::model::TaskAttemptResult::exit_code].
13294 ///
13295 /// # Example
13296 /// ```ignore,no_run
13297 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13298 /// let x = TaskAttemptResult::new().set_exit_code(42);
13299 /// ```
13300 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13301 self.exit_code = v.into();
13302 self
13303 }
13304
13305 /// Sets the value of [term_signal][crate::model::TaskAttemptResult::term_signal].
13306 ///
13307 /// # Example
13308 /// ```ignore,no_run
13309 /// # use google_cloud_run_v2::model::TaskAttemptResult;
13310 /// let x = TaskAttemptResult::new().set_term_signal(42);
13311 /// ```
13312 pub fn set_term_signal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13313 self.term_signal = v.into();
13314 self
13315 }
13316}
13317
13318impl wkt::message::Message for TaskAttemptResult {
13319 fn typename() -> &'static str {
13320 "type.googleapis.com/google.cloud.run.v2.TaskAttemptResult"
13321 }
13322}
13323
13324/// TaskTemplate describes the data a task should have when created
13325/// from a template.
13326#[derive(Clone, Default, PartialEq)]
13327#[non_exhaustive]
13328pub struct TaskTemplate {
13329 /// Holds the single container that defines the unit of execution for this
13330 /// task.
13331 pub containers: std::vec::Vec<crate::model::Container>,
13332
13333 /// Optional. A list of Volumes to make available to containers.
13334 pub volumes: std::vec::Vec<crate::model::Volume>,
13335
13336 /// Optional. Max allowed time duration the Task may be active before the
13337 /// system will actively try to mark it failed and kill associated containers.
13338 /// This applies per attempt of a task, meaning each retry can run for the full
13339 /// timeout. Defaults to 600 seconds.
13340 pub timeout: std::option::Option<wkt::Duration>,
13341
13342 /// Optional. Email address of the IAM service account associated with the Task
13343 /// of a Job. The service account represents the identity of the running task,
13344 /// and determines what permissions the task has. If not provided, the task
13345 /// will use the project's default service account.
13346 pub service_account: std::string::String,
13347
13348 /// Optional. The execution environment being used to host this Task.
13349 pub execution_environment: crate::model::ExecutionEnvironment,
13350
13351 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
13352 /// this container image. For more information, go to
13353 /// <https://cloud.google.com/run/docs/securing/using-cmek>
13354 pub encryption_key: std::string::String,
13355
13356 /// Optional. VPC Access configuration to use for this Task. For more
13357 /// information, visit
13358 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13359 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
13360
13361 /// Optional. The node selector for the task template.
13362 pub node_selector: std::option::Option<crate::model::NodeSelector>,
13363
13364 /// Optional. True if GPU zonal redundancy is disabled on this task template.
13365 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
13366
13367 pub retries: std::option::Option<crate::model::task_template::Retries>,
13368
13369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13370}
13371
13372impl TaskTemplate {
13373 pub fn new() -> Self {
13374 std::default::Default::default()
13375 }
13376
13377 /// Sets the value of [containers][crate::model::TaskTemplate::containers].
13378 ///
13379 /// # Example
13380 /// ```ignore,no_run
13381 /// # use google_cloud_run_v2::model::TaskTemplate;
13382 /// use google_cloud_run_v2::model::Container;
13383 /// let x = TaskTemplate::new()
13384 /// .set_containers([
13385 /// Container::default()/* use setters */,
13386 /// Container::default()/* use (different) setters */,
13387 /// ]);
13388 /// ```
13389 pub fn set_containers<T, V>(mut self, v: T) -> Self
13390 where
13391 T: std::iter::IntoIterator<Item = V>,
13392 V: std::convert::Into<crate::model::Container>,
13393 {
13394 use std::iter::Iterator;
13395 self.containers = v.into_iter().map(|i| i.into()).collect();
13396 self
13397 }
13398
13399 /// Sets the value of [volumes][crate::model::TaskTemplate::volumes].
13400 ///
13401 /// # Example
13402 /// ```ignore,no_run
13403 /// # use google_cloud_run_v2::model::TaskTemplate;
13404 /// use google_cloud_run_v2::model::Volume;
13405 /// let x = TaskTemplate::new()
13406 /// .set_volumes([
13407 /// Volume::default()/* use setters */,
13408 /// Volume::default()/* use (different) setters */,
13409 /// ]);
13410 /// ```
13411 pub fn set_volumes<T, V>(mut self, v: T) -> Self
13412 where
13413 T: std::iter::IntoIterator<Item = V>,
13414 V: std::convert::Into<crate::model::Volume>,
13415 {
13416 use std::iter::Iterator;
13417 self.volumes = v.into_iter().map(|i| i.into()).collect();
13418 self
13419 }
13420
13421 /// Sets the value of [timeout][crate::model::TaskTemplate::timeout].
13422 ///
13423 /// # Example
13424 /// ```ignore,no_run
13425 /// # use google_cloud_run_v2::model::TaskTemplate;
13426 /// use wkt::Duration;
13427 /// let x = TaskTemplate::new().set_timeout(Duration::default()/* use setters */);
13428 /// ```
13429 pub fn set_timeout<T>(mut self, v: T) -> Self
13430 where
13431 T: std::convert::Into<wkt::Duration>,
13432 {
13433 self.timeout = std::option::Option::Some(v.into());
13434 self
13435 }
13436
13437 /// Sets or clears the value of [timeout][crate::model::TaskTemplate::timeout].
13438 ///
13439 /// # Example
13440 /// ```ignore,no_run
13441 /// # use google_cloud_run_v2::model::TaskTemplate;
13442 /// use wkt::Duration;
13443 /// let x = TaskTemplate::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13444 /// let x = TaskTemplate::new().set_or_clear_timeout(None::<Duration>);
13445 /// ```
13446 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13447 where
13448 T: std::convert::Into<wkt::Duration>,
13449 {
13450 self.timeout = v.map(|x| x.into());
13451 self
13452 }
13453
13454 /// Sets the value of [service_account][crate::model::TaskTemplate::service_account].
13455 ///
13456 /// # Example
13457 /// ```ignore,no_run
13458 /// # use google_cloud_run_v2::model::TaskTemplate;
13459 /// let x = TaskTemplate::new().set_service_account("example");
13460 /// ```
13461 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13462 self.service_account = v.into();
13463 self
13464 }
13465
13466 /// Sets the value of [execution_environment][crate::model::TaskTemplate::execution_environment].
13467 ///
13468 /// # Example
13469 /// ```ignore,no_run
13470 /// # use google_cloud_run_v2::model::TaskTemplate;
13471 /// use google_cloud_run_v2::model::ExecutionEnvironment;
13472 /// let x0 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
13473 /// let x1 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);
13474 /// ```
13475 pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
13476 mut self,
13477 v: T,
13478 ) -> Self {
13479 self.execution_environment = v.into();
13480 self
13481 }
13482
13483 /// Sets the value of [encryption_key][crate::model::TaskTemplate::encryption_key].
13484 ///
13485 /// # Example
13486 /// ```ignore,no_run
13487 /// # use google_cloud_run_v2::model::TaskTemplate;
13488 /// let x = TaskTemplate::new().set_encryption_key("example");
13489 /// ```
13490 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13491 self.encryption_key = v.into();
13492 self
13493 }
13494
13495 /// Sets the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13496 ///
13497 /// # Example
13498 /// ```ignore,no_run
13499 /// # use google_cloud_run_v2::model::TaskTemplate;
13500 /// use google_cloud_run_v2::model::VpcAccess;
13501 /// let x = TaskTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
13502 /// ```
13503 pub fn set_vpc_access<T>(mut self, v: T) -> Self
13504 where
13505 T: std::convert::Into<crate::model::VpcAccess>,
13506 {
13507 self.vpc_access = std::option::Option::Some(v.into());
13508 self
13509 }
13510
13511 /// Sets or clears the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
13512 ///
13513 /// # Example
13514 /// ```ignore,no_run
13515 /// # use google_cloud_run_v2::model::TaskTemplate;
13516 /// use google_cloud_run_v2::model::VpcAccess;
13517 /// let x = TaskTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
13518 /// let x = TaskTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
13519 /// ```
13520 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13521 where
13522 T: std::convert::Into<crate::model::VpcAccess>,
13523 {
13524 self.vpc_access = v.map(|x| x.into());
13525 self
13526 }
13527
13528 /// Sets the value of [node_selector][crate::model::TaskTemplate::node_selector].
13529 ///
13530 /// # Example
13531 /// ```ignore,no_run
13532 /// # use google_cloud_run_v2::model::TaskTemplate;
13533 /// use google_cloud_run_v2::model::NodeSelector;
13534 /// let x = TaskTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
13535 /// ```
13536 pub fn set_node_selector<T>(mut self, v: T) -> Self
13537 where
13538 T: std::convert::Into<crate::model::NodeSelector>,
13539 {
13540 self.node_selector = std::option::Option::Some(v.into());
13541 self
13542 }
13543
13544 /// Sets or clears the value of [node_selector][crate::model::TaskTemplate::node_selector].
13545 ///
13546 /// # Example
13547 /// ```ignore,no_run
13548 /// # use google_cloud_run_v2::model::TaskTemplate;
13549 /// use google_cloud_run_v2::model::NodeSelector;
13550 /// let x = TaskTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
13551 /// let x = TaskTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
13552 /// ```
13553 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
13554 where
13555 T: std::convert::Into<crate::model::NodeSelector>,
13556 {
13557 self.node_selector = v.map(|x| x.into());
13558 self
13559 }
13560
13561 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13562 ///
13563 /// # Example
13564 /// ```ignore,no_run
13565 /// # use google_cloud_run_v2::model::TaskTemplate;
13566 /// let x = TaskTemplate::new().set_gpu_zonal_redundancy_disabled(true);
13567 /// ```
13568 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
13569 where
13570 T: std::convert::Into<bool>,
13571 {
13572 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
13573 self
13574 }
13575
13576 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::TaskTemplate::gpu_zonal_redundancy_disabled].
13577 ///
13578 /// # Example
13579 /// ```ignore,no_run
13580 /// # use google_cloud_run_v2::model::TaskTemplate;
13581 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
13582 /// let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
13583 /// ```
13584 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
13585 mut self,
13586 v: std::option::Option<T>,
13587 ) -> Self
13588 where
13589 T: std::convert::Into<bool>,
13590 {
13591 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
13592 self
13593 }
13594
13595 /// Sets the value of [retries][crate::model::TaskTemplate::retries].
13596 ///
13597 /// Note that all the setters affecting `retries` are mutually
13598 /// exclusive.
13599 ///
13600 /// # Example
13601 /// ```ignore,no_run
13602 /// # use google_cloud_run_v2::model::TaskTemplate;
13603 /// use google_cloud_run_v2::model::task_template::Retries;
13604 /// let x = TaskTemplate::new().set_retries(Some(Retries::MaxRetries(42)));
13605 /// ```
13606 pub fn set_retries<
13607 T: std::convert::Into<std::option::Option<crate::model::task_template::Retries>>,
13608 >(
13609 mut self,
13610 v: T,
13611 ) -> Self {
13612 self.retries = v.into();
13613 self
13614 }
13615
13616 /// The value of [retries][crate::model::TaskTemplate::retries]
13617 /// if it holds a `MaxRetries`, `None` if the field is not set or
13618 /// holds a different branch.
13619 pub fn max_retries(&self) -> std::option::Option<&i32> {
13620 #[allow(unreachable_patterns)]
13621 self.retries.as_ref().and_then(|v| match v {
13622 crate::model::task_template::Retries::MaxRetries(v) => std::option::Option::Some(v),
13623 _ => std::option::Option::None,
13624 })
13625 }
13626
13627 /// Sets the value of [retries][crate::model::TaskTemplate::retries]
13628 /// to hold a `MaxRetries`.
13629 ///
13630 /// Note that all the setters affecting `retries` are
13631 /// mutually exclusive.
13632 ///
13633 /// # Example
13634 /// ```ignore,no_run
13635 /// # use google_cloud_run_v2::model::TaskTemplate;
13636 /// let x = TaskTemplate::new().set_max_retries(42);
13637 /// assert!(x.max_retries().is_some());
13638 /// ```
13639 pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13640 self.retries =
13641 std::option::Option::Some(crate::model::task_template::Retries::MaxRetries(v.into()));
13642 self
13643 }
13644}
13645
13646impl wkt::message::Message for TaskTemplate {
13647 fn typename() -> &'static str {
13648 "type.googleapis.com/google.cloud.run.v2.TaskTemplate"
13649 }
13650}
13651
13652/// Defines additional types related to [TaskTemplate].
13653pub mod task_template {
13654 #[allow(unused_imports)]
13655 use super::*;
13656
13657 #[derive(Clone, Debug, PartialEq)]
13658 #[non_exhaustive]
13659 pub enum Retries {
13660 /// Number of retries allowed per Task, before marking this Task failed.
13661 /// Defaults to 3.
13662 MaxRetries(i32),
13663 }
13664}
13665
13666/// Holds a single traffic routing entry for the Service. Allocations can be done
13667/// to a specific Revision name, or pointing to the latest Ready Revision.
13668#[derive(Clone, Default, PartialEq)]
13669#[non_exhaustive]
13670pub struct TrafficTarget {
13671 /// The allocation type for this traffic target.
13672 pub r#type: crate::model::TrafficTargetAllocationType,
13673
13674 /// Revision to which to send this portion of traffic, if traffic allocation is
13675 /// by revision.
13676 pub revision: std::string::String,
13677
13678 /// Specifies percent of the traffic to this Revision.
13679 /// This defaults to zero if unspecified.
13680 pub percent: i32,
13681
13682 /// Indicates a string to be part of the URI to exclusively reference this
13683 /// target.
13684 pub tag: std::string::String,
13685
13686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13687}
13688
13689impl TrafficTarget {
13690 pub fn new() -> Self {
13691 std::default::Default::default()
13692 }
13693
13694 /// Sets the value of [r#type][crate::model::TrafficTarget::type].
13695 ///
13696 /// # Example
13697 /// ```ignore,no_run
13698 /// # use google_cloud_run_v2::model::TrafficTarget;
13699 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13700 /// let x0 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Latest);
13701 /// let x1 = TrafficTarget::new().set_type(TrafficTargetAllocationType::Revision);
13702 /// ```
13703 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13704 mut self,
13705 v: T,
13706 ) -> Self {
13707 self.r#type = v.into();
13708 self
13709 }
13710
13711 /// Sets the value of [revision][crate::model::TrafficTarget::revision].
13712 ///
13713 /// # Example
13714 /// ```ignore,no_run
13715 /// # use google_cloud_run_v2::model::TrafficTarget;
13716 /// let x = TrafficTarget::new().set_revision("example");
13717 /// ```
13718 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13719 self.revision = v.into();
13720 self
13721 }
13722
13723 /// Sets the value of [percent][crate::model::TrafficTarget::percent].
13724 ///
13725 /// # Example
13726 /// ```ignore,no_run
13727 /// # use google_cloud_run_v2::model::TrafficTarget;
13728 /// let x = TrafficTarget::new().set_percent(42);
13729 /// ```
13730 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13731 self.percent = v.into();
13732 self
13733 }
13734
13735 /// Sets the value of [tag][crate::model::TrafficTarget::tag].
13736 ///
13737 /// # Example
13738 /// ```ignore,no_run
13739 /// # use google_cloud_run_v2::model::TrafficTarget;
13740 /// let x = TrafficTarget::new().set_tag("example");
13741 /// ```
13742 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13743 self.tag = v.into();
13744 self
13745 }
13746}
13747
13748impl wkt::message::Message for TrafficTarget {
13749 fn typename() -> &'static str {
13750 "type.googleapis.com/google.cloud.run.v2.TrafficTarget"
13751 }
13752}
13753
13754/// Represents the observed state of a single `TrafficTarget` entry.
13755#[derive(Clone, Default, PartialEq)]
13756#[non_exhaustive]
13757pub struct TrafficTargetStatus {
13758 /// The allocation type for this traffic target.
13759 pub r#type: crate::model::TrafficTargetAllocationType,
13760
13761 /// Revision to which this traffic is sent.
13762 pub revision: std::string::String,
13763
13764 /// Specifies percent of the traffic to this Revision.
13765 pub percent: i32,
13766
13767 /// Indicates the string used in the URI to exclusively reference this target.
13768 pub tag: std::string::String,
13769
13770 /// Displays the target URI.
13771 pub uri: std::string::String,
13772
13773 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13774}
13775
13776impl TrafficTargetStatus {
13777 pub fn new() -> Self {
13778 std::default::Default::default()
13779 }
13780
13781 /// Sets the value of [r#type][crate::model::TrafficTargetStatus::type].
13782 ///
13783 /// # Example
13784 /// ```ignore,no_run
13785 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13786 /// use google_cloud_run_v2::model::TrafficTargetAllocationType;
13787 /// let x0 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Latest);
13788 /// let x1 = TrafficTargetStatus::new().set_type(TrafficTargetAllocationType::Revision);
13789 /// ```
13790 pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
13791 mut self,
13792 v: T,
13793 ) -> Self {
13794 self.r#type = v.into();
13795 self
13796 }
13797
13798 /// Sets the value of [revision][crate::model::TrafficTargetStatus::revision].
13799 ///
13800 /// # Example
13801 /// ```ignore,no_run
13802 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13803 /// let x = TrafficTargetStatus::new().set_revision("example");
13804 /// ```
13805 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13806 self.revision = v.into();
13807 self
13808 }
13809
13810 /// Sets the value of [percent][crate::model::TrafficTargetStatus::percent].
13811 ///
13812 /// # Example
13813 /// ```ignore,no_run
13814 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13815 /// let x = TrafficTargetStatus::new().set_percent(42);
13816 /// ```
13817 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13818 self.percent = v.into();
13819 self
13820 }
13821
13822 /// Sets the value of [tag][crate::model::TrafficTargetStatus::tag].
13823 ///
13824 /// # Example
13825 /// ```ignore,no_run
13826 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13827 /// let x = TrafficTargetStatus::new().set_tag("example");
13828 /// ```
13829 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13830 self.tag = v.into();
13831 self
13832 }
13833
13834 /// Sets the value of [uri][crate::model::TrafficTargetStatus::uri].
13835 ///
13836 /// # Example
13837 /// ```ignore,no_run
13838 /// # use google_cloud_run_v2::model::TrafficTargetStatus;
13839 /// let x = TrafficTargetStatus::new().set_uri("example");
13840 /// ```
13841 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13842 self.uri = v.into();
13843 self
13844 }
13845}
13846
13847impl wkt::message::Message for TrafficTargetStatus {
13848 fn typename() -> &'static str {
13849 "type.googleapis.com/google.cloud.run.v2.TrafficTargetStatus"
13850 }
13851}
13852
13853/// VPC Access settings. For more information on sending traffic to a VPC
13854/// network, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13855#[derive(Clone, Default, PartialEq)]
13856#[non_exhaustive]
13857pub struct VpcAccess {
13858 /// VPC Access connector name.
13859 /// Format: `projects/{project}/locations/{location}/connectors/{connector}`,
13860 /// where `{project}` can be project id or number.
13861 /// For more information on sending traffic to a VPC network via a connector,
13862 /// visit <https://cloud.google.com/run/docs/configuring/vpc-connectors>.
13863 pub connector: std::string::String,
13864
13865 /// Optional. Traffic VPC egress settings. If not provided, it defaults to
13866 /// PRIVATE_RANGES_ONLY.
13867 pub egress: crate::model::vpc_access::VpcEgress,
13868
13869 /// Optional. Direct VPC egress settings. Currently only single network
13870 /// interface is supported.
13871 pub network_interfaces: std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
13872
13873 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13874}
13875
13876impl VpcAccess {
13877 pub fn new() -> Self {
13878 std::default::Default::default()
13879 }
13880
13881 /// Sets the value of [connector][crate::model::VpcAccess::connector].
13882 ///
13883 /// # Example
13884 /// ```ignore,no_run
13885 /// # use google_cloud_run_v2::model::VpcAccess;
13886 /// let x = VpcAccess::new().set_connector("example");
13887 /// ```
13888 pub fn set_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13889 self.connector = v.into();
13890 self
13891 }
13892
13893 /// Sets the value of [egress][crate::model::VpcAccess::egress].
13894 ///
13895 /// # Example
13896 /// ```ignore,no_run
13897 /// # use google_cloud_run_v2::model::VpcAccess;
13898 /// use google_cloud_run_v2::model::vpc_access::VpcEgress;
13899 /// let x0 = VpcAccess::new().set_egress(VpcEgress::AllTraffic);
13900 /// let x1 = VpcAccess::new().set_egress(VpcEgress::PrivateRangesOnly);
13901 /// ```
13902 pub fn set_egress<T: std::convert::Into<crate::model::vpc_access::VpcEgress>>(
13903 mut self,
13904 v: T,
13905 ) -> Self {
13906 self.egress = v.into();
13907 self
13908 }
13909
13910 /// Sets the value of [network_interfaces][crate::model::VpcAccess::network_interfaces].
13911 ///
13912 /// # Example
13913 /// ```ignore,no_run
13914 /// # use google_cloud_run_v2::model::VpcAccess;
13915 /// use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13916 /// let x = VpcAccess::new()
13917 /// .set_network_interfaces([
13918 /// NetworkInterface::default()/* use setters */,
13919 /// NetworkInterface::default()/* use (different) setters */,
13920 /// ]);
13921 /// ```
13922 pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
13923 where
13924 T: std::iter::IntoIterator<Item = V>,
13925 V: std::convert::Into<crate::model::vpc_access::NetworkInterface>,
13926 {
13927 use std::iter::Iterator;
13928 self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
13929 self
13930 }
13931}
13932
13933impl wkt::message::Message for VpcAccess {
13934 fn typename() -> &'static str {
13935 "type.googleapis.com/google.cloud.run.v2.VpcAccess"
13936 }
13937}
13938
13939/// Defines additional types related to [VpcAccess].
13940pub mod vpc_access {
13941 #[allow(unused_imports)]
13942 use super::*;
13943
13944 /// Direct VPC egress settings.
13945 #[derive(Clone, Default, PartialEq)]
13946 #[non_exhaustive]
13947 pub struct NetworkInterface {
13948 /// Optional. The VPC network that the Cloud Run resource will be able to
13949 /// send traffic to. At least one of network or subnetwork must be specified.
13950 /// If both network and subnetwork are specified, the given VPC subnetwork
13951 /// must belong to the given VPC network. If network is not specified, it
13952 /// will be looked up from the subnetwork.
13953 pub network: std::string::String,
13954
13955 /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs
13956 /// from. At least one of network or subnetwork must be specified. If both
13957 /// network and subnetwork are specified, the given VPC subnetwork must
13958 /// belong to the given VPC network. If subnetwork is not specified, the
13959 /// subnetwork with the same name with the network will be used.
13960 pub subnetwork: std::string::String,
13961
13962 /// Optional. Network tags applied to this Cloud Run resource.
13963 pub tags: std::vec::Vec<std::string::String>,
13964
13965 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13966 }
13967
13968 impl NetworkInterface {
13969 pub fn new() -> Self {
13970 std::default::Default::default()
13971 }
13972
13973 /// Sets the value of [network][crate::model::vpc_access::NetworkInterface::network].
13974 ///
13975 /// # Example
13976 /// ```ignore,no_run
13977 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13978 /// let x = NetworkInterface::new().set_network("example");
13979 /// ```
13980 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13981 self.network = v.into();
13982 self
13983 }
13984
13985 /// Sets the value of [subnetwork][crate::model::vpc_access::NetworkInterface::subnetwork].
13986 ///
13987 /// # Example
13988 /// ```ignore,no_run
13989 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
13990 /// let x = NetworkInterface::new().set_subnetwork("example");
13991 /// ```
13992 pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13993 self.subnetwork = v.into();
13994 self
13995 }
13996
13997 /// Sets the value of [tags][crate::model::vpc_access::NetworkInterface::tags].
13998 ///
13999 /// # Example
14000 /// ```ignore,no_run
14001 /// # use google_cloud_run_v2::model::vpc_access::NetworkInterface;
14002 /// let x = NetworkInterface::new().set_tags(["a", "b", "c"]);
14003 /// ```
14004 pub fn set_tags<T, V>(mut self, v: T) -> Self
14005 where
14006 T: std::iter::IntoIterator<Item = V>,
14007 V: std::convert::Into<std::string::String>,
14008 {
14009 use std::iter::Iterator;
14010 self.tags = v.into_iter().map(|i| i.into()).collect();
14011 self
14012 }
14013 }
14014
14015 impl wkt::message::Message for NetworkInterface {
14016 fn typename() -> &'static str {
14017 "type.googleapis.com/google.cloud.run.v2.VpcAccess.NetworkInterface"
14018 }
14019 }
14020
14021 /// Egress options for VPC access.
14022 ///
14023 /// # Working with unknown values
14024 ///
14025 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14026 /// additional enum variants at any time. Adding new variants is not considered
14027 /// a breaking change. Applications should write their code in anticipation of:
14028 ///
14029 /// - New values appearing in future releases of the client library, **and**
14030 /// - New values received dynamically, without application changes.
14031 ///
14032 /// Please consult the [Working with enums] section in the user guide for some
14033 /// guidelines.
14034 ///
14035 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14036 #[derive(Clone, Debug, PartialEq)]
14037 #[non_exhaustive]
14038 pub enum VpcEgress {
14039 /// Unspecified
14040 Unspecified,
14041 /// All outbound traffic is routed through the VPC connector.
14042 AllTraffic,
14043 /// Only private IP ranges are routed through the VPC connector.
14044 PrivateRangesOnly,
14045 /// If set, the enum was initialized with an unknown value.
14046 ///
14047 /// Applications can examine the value using [VpcEgress::value] or
14048 /// [VpcEgress::name].
14049 UnknownValue(vpc_egress::UnknownValue),
14050 }
14051
14052 #[doc(hidden)]
14053 pub mod vpc_egress {
14054 #[allow(unused_imports)]
14055 use super::*;
14056 #[derive(Clone, Debug, PartialEq)]
14057 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14058 }
14059
14060 impl VpcEgress {
14061 /// Gets the enum value.
14062 ///
14063 /// Returns `None` if the enum contains an unknown value deserialized from
14064 /// the string representation of enums.
14065 pub fn value(&self) -> std::option::Option<i32> {
14066 match self {
14067 Self::Unspecified => std::option::Option::Some(0),
14068 Self::AllTraffic => std::option::Option::Some(1),
14069 Self::PrivateRangesOnly => std::option::Option::Some(2),
14070 Self::UnknownValue(u) => u.0.value(),
14071 }
14072 }
14073
14074 /// Gets the enum value as a string.
14075 ///
14076 /// Returns `None` if the enum contains an unknown value deserialized from
14077 /// the integer representation of enums.
14078 pub fn name(&self) -> std::option::Option<&str> {
14079 match self {
14080 Self::Unspecified => std::option::Option::Some("VPC_EGRESS_UNSPECIFIED"),
14081 Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
14082 Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
14083 Self::UnknownValue(u) => u.0.name(),
14084 }
14085 }
14086 }
14087
14088 impl std::default::Default for VpcEgress {
14089 fn default() -> Self {
14090 use std::convert::From;
14091 Self::from(0)
14092 }
14093 }
14094
14095 impl std::fmt::Display for VpcEgress {
14096 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14097 wkt::internal::display_enum(f, self.name(), self.value())
14098 }
14099 }
14100
14101 impl std::convert::From<i32> for VpcEgress {
14102 fn from(value: i32) -> Self {
14103 match value {
14104 0 => Self::Unspecified,
14105 1 => Self::AllTraffic,
14106 2 => Self::PrivateRangesOnly,
14107 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14108 wkt::internal::UnknownEnumValue::Integer(value),
14109 )),
14110 }
14111 }
14112 }
14113
14114 impl std::convert::From<&str> for VpcEgress {
14115 fn from(value: &str) -> Self {
14116 use std::string::ToString;
14117 match value {
14118 "VPC_EGRESS_UNSPECIFIED" => Self::Unspecified,
14119 "ALL_TRAFFIC" => Self::AllTraffic,
14120 "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
14121 _ => Self::UnknownValue(vpc_egress::UnknownValue(
14122 wkt::internal::UnknownEnumValue::String(value.to_string()),
14123 )),
14124 }
14125 }
14126 }
14127
14128 impl serde::ser::Serialize for VpcEgress {
14129 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14130 where
14131 S: serde::Serializer,
14132 {
14133 match self {
14134 Self::Unspecified => serializer.serialize_i32(0),
14135 Self::AllTraffic => serializer.serialize_i32(1),
14136 Self::PrivateRangesOnly => serializer.serialize_i32(2),
14137 Self::UnknownValue(u) => u.0.serialize(serializer),
14138 }
14139 }
14140 }
14141
14142 impl<'de> serde::de::Deserialize<'de> for VpcEgress {
14143 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14144 where
14145 D: serde::Deserializer<'de>,
14146 {
14147 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VpcEgress>::new(
14148 ".google.cloud.run.v2.VpcAccess.VpcEgress",
14149 ))
14150 }
14151 }
14152}
14153
14154/// Settings for Binary Authorization feature.
14155#[derive(Clone, Default, PartialEq)]
14156#[non_exhaustive]
14157pub struct BinaryAuthorization {
14158 /// Optional. If present, indicates to use Breakglass using this justification.
14159 /// If use_default is False, then it must be empty.
14160 /// For more information on breakglass, see
14161 /// <https://cloud.google.com/binary-authorization/docs/using-breakglass>
14162 pub breakglass_justification: std::string::String,
14163
14164 pub binauthz_method: std::option::Option<crate::model::binary_authorization::BinauthzMethod>,
14165
14166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14167}
14168
14169impl BinaryAuthorization {
14170 pub fn new() -> Self {
14171 std::default::Default::default()
14172 }
14173
14174 /// Sets the value of [breakglass_justification][crate::model::BinaryAuthorization::breakglass_justification].
14175 ///
14176 /// # Example
14177 /// ```ignore,no_run
14178 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14179 /// let x = BinaryAuthorization::new().set_breakglass_justification("example");
14180 /// ```
14181 pub fn set_breakglass_justification<T: std::convert::Into<std::string::String>>(
14182 mut self,
14183 v: T,
14184 ) -> Self {
14185 self.breakglass_justification = v.into();
14186 self
14187 }
14188
14189 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method].
14190 ///
14191 /// Note that all the setters affecting `binauthz_method` are mutually
14192 /// exclusive.
14193 ///
14194 /// # Example
14195 /// ```ignore,no_run
14196 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14197 /// use google_cloud_run_v2::model::binary_authorization::BinauthzMethod;
14198 /// let x = BinaryAuthorization::new().set_binauthz_method(Some(BinauthzMethod::UseDefault(true)));
14199 /// ```
14200 pub fn set_binauthz_method<
14201 T: std::convert::Into<std::option::Option<crate::model::binary_authorization::BinauthzMethod>>,
14202 >(
14203 mut self,
14204 v: T,
14205 ) -> Self {
14206 self.binauthz_method = v.into();
14207 self
14208 }
14209
14210 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14211 /// if it holds a `UseDefault`, `None` if the field is not set or
14212 /// holds a different branch.
14213 pub fn use_default(&self) -> std::option::Option<&bool> {
14214 #[allow(unreachable_patterns)]
14215 self.binauthz_method.as_ref().and_then(|v| match v {
14216 crate::model::binary_authorization::BinauthzMethod::UseDefault(v) => {
14217 std::option::Option::Some(v)
14218 }
14219 _ => std::option::Option::None,
14220 })
14221 }
14222
14223 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14224 /// to hold a `UseDefault`.
14225 ///
14226 /// Note that all the setters affecting `binauthz_method` are
14227 /// mutually exclusive.
14228 ///
14229 /// # Example
14230 /// ```ignore,no_run
14231 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14232 /// let x = BinaryAuthorization::new().set_use_default(true);
14233 /// assert!(x.use_default().is_some());
14234 /// assert!(x.policy().is_none());
14235 /// ```
14236 pub fn set_use_default<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14237 self.binauthz_method = std::option::Option::Some(
14238 crate::model::binary_authorization::BinauthzMethod::UseDefault(v.into()),
14239 );
14240 self
14241 }
14242
14243 /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14244 /// if it holds a `Policy`, `None` if the field is not set or
14245 /// holds a different branch.
14246 pub fn policy(&self) -> std::option::Option<&std::string::String> {
14247 #[allow(unreachable_patterns)]
14248 self.binauthz_method.as_ref().and_then(|v| match v {
14249 crate::model::binary_authorization::BinauthzMethod::Policy(v) => {
14250 std::option::Option::Some(v)
14251 }
14252 _ => std::option::Option::None,
14253 })
14254 }
14255
14256 /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
14257 /// to hold a `Policy`.
14258 ///
14259 /// Note that all the setters affecting `binauthz_method` are
14260 /// mutually exclusive.
14261 ///
14262 /// # Example
14263 /// ```ignore,no_run
14264 /// # use google_cloud_run_v2::model::BinaryAuthorization;
14265 /// let x = BinaryAuthorization::new().set_policy("example");
14266 /// assert!(x.policy().is_some());
14267 /// assert!(x.use_default().is_none());
14268 /// ```
14269 pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14270 self.binauthz_method = std::option::Option::Some(
14271 crate::model::binary_authorization::BinauthzMethod::Policy(v.into()),
14272 );
14273 self
14274 }
14275}
14276
14277impl wkt::message::Message for BinaryAuthorization {
14278 fn typename() -> &'static str {
14279 "type.googleapis.com/google.cloud.run.v2.BinaryAuthorization"
14280 }
14281}
14282
14283/// Defines additional types related to [BinaryAuthorization].
14284pub mod binary_authorization {
14285 #[allow(unused_imports)]
14286 use super::*;
14287
14288 #[derive(Clone, Debug, PartialEq)]
14289 #[non_exhaustive]
14290 pub enum BinauthzMethod {
14291 /// Optional. If True, indicates to use the default project's binary
14292 /// authorization policy. If False, binary authorization will be disabled.
14293 UseDefault(bool),
14294 /// Optional. The path to a binary authorization policy.
14295 /// Format: `projects/{project}/platforms/cloudRun/{policy-name}`
14296 Policy(std::string::String),
14297 }
14298}
14299
14300/// Settings for revision-level scaling settings.
14301#[derive(Clone, Default, PartialEq)]
14302#[non_exhaustive]
14303pub struct RevisionScaling {
14304 /// Optional. Minimum number of serving instances that this resource should
14305 /// have.
14306 pub min_instance_count: i32,
14307
14308 /// Optional. Maximum number of serving instances that this resource should
14309 /// have. When unspecified, the field is set to the server default value of
14310 /// 100. For more information see
14311 /// <https://cloud.google.com/run/docs/configuring/max-instances>
14312 pub max_instance_count: i32,
14313
14314 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14315}
14316
14317impl RevisionScaling {
14318 pub fn new() -> Self {
14319 std::default::Default::default()
14320 }
14321
14322 /// Sets the value of [min_instance_count][crate::model::RevisionScaling::min_instance_count].
14323 ///
14324 /// # Example
14325 /// ```ignore,no_run
14326 /// # use google_cloud_run_v2::model::RevisionScaling;
14327 /// let x = RevisionScaling::new().set_min_instance_count(42);
14328 /// ```
14329 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14330 self.min_instance_count = v.into();
14331 self
14332 }
14333
14334 /// Sets the value of [max_instance_count][crate::model::RevisionScaling::max_instance_count].
14335 ///
14336 /// # Example
14337 /// ```ignore,no_run
14338 /// # use google_cloud_run_v2::model::RevisionScaling;
14339 /// let x = RevisionScaling::new().set_max_instance_count(42);
14340 /// ```
14341 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14342 self.max_instance_count = v.into();
14343 self
14344 }
14345}
14346
14347impl wkt::message::Message for RevisionScaling {
14348 fn typename() -> &'static str {
14349 "type.googleapis.com/google.cloud.run.v2.RevisionScaling"
14350 }
14351}
14352
14353/// Settings for Cloud Service Mesh. For more information see
14354/// <https://cloud.google.com/service-mesh/docs/overview>.
14355#[derive(Clone, Default, PartialEq)]
14356#[non_exhaustive]
14357pub struct ServiceMesh {
14358 /// The Mesh resource name. Format:
14359 /// `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can
14360 /// be project id or number.
14361 pub mesh: std::string::String,
14362
14363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14364}
14365
14366impl ServiceMesh {
14367 pub fn new() -> Self {
14368 std::default::Default::default()
14369 }
14370
14371 /// Sets the value of [mesh][crate::model::ServiceMesh::mesh].
14372 ///
14373 /// # Example
14374 /// ```ignore,no_run
14375 /// # use google_cloud_run_v2::model::ServiceMesh;
14376 /// let x = ServiceMesh::new().set_mesh("example");
14377 /// ```
14378 pub fn set_mesh<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14379 self.mesh = v.into();
14380 self
14381 }
14382}
14383
14384impl wkt::message::Message for ServiceMesh {
14385 fn typename() -> &'static str {
14386 "type.googleapis.com/google.cloud.run.v2.ServiceMesh"
14387 }
14388}
14389
14390/// Scaling settings applied at the service level rather than
14391/// at the revision level.
14392#[derive(Clone, Default, PartialEq)]
14393#[non_exhaustive]
14394pub struct ServiceScaling {
14395 /// Optional. total min instances for the service. This number of instances is
14396 /// divided among all revisions with specified traffic based on the percent
14397 /// of traffic they are receiving.
14398 pub min_instance_count: i32,
14399
14400 /// Optional. The scaling mode for the service.
14401 pub scaling_mode: crate::model::service_scaling::ScalingMode,
14402
14403 /// Optional. total max instances for the service. This number of instances is
14404 /// divided among all revisions with specified traffic based on the percent
14405 /// of traffic they are receiving.
14406 pub max_instance_count: i32,
14407
14408 /// Optional. total instance count for the service in manual scaling mode. This
14409 /// number of instances is divided among all revisions with specified traffic
14410 /// based on the percent of traffic they are receiving.
14411 pub manual_instance_count: std::option::Option<i32>,
14412
14413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14414}
14415
14416impl ServiceScaling {
14417 pub fn new() -> Self {
14418 std::default::Default::default()
14419 }
14420
14421 /// Sets the value of [min_instance_count][crate::model::ServiceScaling::min_instance_count].
14422 ///
14423 /// # Example
14424 /// ```ignore,no_run
14425 /// # use google_cloud_run_v2::model::ServiceScaling;
14426 /// let x = ServiceScaling::new().set_min_instance_count(42);
14427 /// ```
14428 pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14429 self.min_instance_count = v.into();
14430 self
14431 }
14432
14433 /// Sets the value of [scaling_mode][crate::model::ServiceScaling::scaling_mode].
14434 ///
14435 /// # Example
14436 /// ```ignore,no_run
14437 /// # use google_cloud_run_v2::model::ServiceScaling;
14438 /// use google_cloud_run_v2::model::service_scaling::ScalingMode;
14439 /// let x0 = ServiceScaling::new().set_scaling_mode(ScalingMode::Automatic);
14440 /// let x1 = ServiceScaling::new().set_scaling_mode(ScalingMode::Manual);
14441 /// ```
14442 pub fn set_scaling_mode<T: std::convert::Into<crate::model::service_scaling::ScalingMode>>(
14443 mut self,
14444 v: T,
14445 ) -> Self {
14446 self.scaling_mode = v.into();
14447 self
14448 }
14449
14450 /// Sets the value of [max_instance_count][crate::model::ServiceScaling::max_instance_count].
14451 ///
14452 /// # Example
14453 /// ```ignore,no_run
14454 /// # use google_cloud_run_v2::model::ServiceScaling;
14455 /// let x = ServiceScaling::new().set_max_instance_count(42);
14456 /// ```
14457 pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14458 self.max_instance_count = v.into();
14459 self
14460 }
14461
14462 /// Sets the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14463 ///
14464 /// # Example
14465 /// ```ignore,no_run
14466 /// # use google_cloud_run_v2::model::ServiceScaling;
14467 /// let x = ServiceScaling::new().set_manual_instance_count(42);
14468 /// ```
14469 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14470 where
14471 T: std::convert::Into<i32>,
14472 {
14473 self.manual_instance_count = std::option::Option::Some(v.into());
14474 self
14475 }
14476
14477 /// Sets or clears the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
14478 ///
14479 /// # Example
14480 /// ```ignore,no_run
14481 /// # use google_cloud_run_v2::model::ServiceScaling;
14482 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(Some(42));
14483 /// let x = ServiceScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14484 /// ```
14485 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14486 where
14487 T: std::convert::Into<i32>,
14488 {
14489 self.manual_instance_count = v.map(|x| x.into());
14490 self
14491 }
14492}
14493
14494impl wkt::message::Message for ServiceScaling {
14495 fn typename() -> &'static str {
14496 "type.googleapis.com/google.cloud.run.v2.ServiceScaling"
14497 }
14498}
14499
14500/// Defines additional types related to [ServiceScaling].
14501pub mod service_scaling {
14502 #[allow(unused_imports)]
14503 use super::*;
14504
14505 /// The scaling mode for the service. If not provided, it defaults to
14506 /// AUTOMATIC.
14507 ///
14508 /// # Working with unknown values
14509 ///
14510 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14511 /// additional enum variants at any time. Adding new variants is not considered
14512 /// a breaking change. Applications should write their code in anticipation of:
14513 ///
14514 /// - New values appearing in future releases of the client library, **and**
14515 /// - New values received dynamically, without application changes.
14516 ///
14517 /// Please consult the [Working with enums] section in the user guide for some
14518 /// guidelines.
14519 ///
14520 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14521 #[derive(Clone, Debug, PartialEq)]
14522 #[non_exhaustive]
14523 pub enum ScalingMode {
14524 /// Unspecified.
14525 Unspecified,
14526 /// Scale based on traffic between min and max instances.
14527 Automatic,
14528 /// Scale to exactly min instances and ignore max instances.
14529 Manual,
14530 /// If set, the enum was initialized with an unknown value.
14531 ///
14532 /// Applications can examine the value using [ScalingMode::value] or
14533 /// [ScalingMode::name].
14534 UnknownValue(scaling_mode::UnknownValue),
14535 }
14536
14537 #[doc(hidden)]
14538 pub mod scaling_mode {
14539 #[allow(unused_imports)]
14540 use super::*;
14541 #[derive(Clone, Debug, PartialEq)]
14542 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14543 }
14544
14545 impl ScalingMode {
14546 /// Gets the enum value.
14547 ///
14548 /// Returns `None` if the enum contains an unknown value deserialized from
14549 /// the string representation of enums.
14550 pub fn value(&self) -> std::option::Option<i32> {
14551 match self {
14552 Self::Unspecified => std::option::Option::Some(0),
14553 Self::Automatic => std::option::Option::Some(1),
14554 Self::Manual => std::option::Option::Some(2),
14555 Self::UnknownValue(u) => u.0.value(),
14556 }
14557 }
14558
14559 /// Gets the enum value as a string.
14560 ///
14561 /// Returns `None` if the enum contains an unknown value deserialized from
14562 /// the integer representation of enums.
14563 pub fn name(&self) -> std::option::Option<&str> {
14564 match self {
14565 Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
14566 Self::Automatic => std::option::Option::Some("AUTOMATIC"),
14567 Self::Manual => std::option::Option::Some("MANUAL"),
14568 Self::UnknownValue(u) => u.0.name(),
14569 }
14570 }
14571 }
14572
14573 impl std::default::Default for ScalingMode {
14574 fn default() -> Self {
14575 use std::convert::From;
14576 Self::from(0)
14577 }
14578 }
14579
14580 impl std::fmt::Display for ScalingMode {
14581 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14582 wkt::internal::display_enum(f, self.name(), self.value())
14583 }
14584 }
14585
14586 impl std::convert::From<i32> for ScalingMode {
14587 fn from(value: i32) -> Self {
14588 match value {
14589 0 => Self::Unspecified,
14590 1 => Self::Automatic,
14591 2 => Self::Manual,
14592 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14593 wkt::internal::UnknownEnumValue::Integer(value),
14594 )),
14595 }
14596 }
14597 }
14598
14599 impl std::convert::From<&str> for ScalingMode {
14600 fn from(value: &str) -> Self {
14601 use std::string::ToString;
14602 match value {
14603 "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
14604 "AUTOMATIC" => Self::Automatic,
14605 "MANUAL" => Self::Manual,
14606 _ => Self::UnknownValue(scaling_mode::UnknownValue(
14607 wkt::internal::UnknownEnumValue::String(value.to_string()),
14608 )),
14609 }
14610 }
14611 }
14612
14613 impl serde::ser::Serialize for ScalingMode {
14614 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14615 where
14616 S: serde::Serializer,
14617 {
14618 match self {
14619 Self::Unspecified => serializer.serialize_i32(0),
14620 Self::Automatic => serializer.serialize_i32(1),
14621 Self::Manual => serializer.serialize_i32(2),
14622 Self::UnknownValue(u) => u.0.serialize(serializer),
14623 }
14624 }
14625 }
14626
14627 impl<'de> serde::de::Deserialize<'de> for ScalingMode {
14628 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14629 where
14630 D: serde::Deserializer<'de>,
14631 {
14632 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
14633 ".google.cloud.run.v2.ServiceScaling.ScalingMode",
14634 ))
14635 }
14636 }
14637}
14638
14639/// Worker pool scaling settings.
14640#[derive(Clone, Default, PartialEq)]
14641#[non_exhaustive]
14642pub struct WorkerPoolScaling {
14643 /// Optional. The total number of instances in manual scaling mode.
14644 pub manual_instance_count: std::option::Option<i32>,
14645
14646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14647}
14648
14649impl WorkerPoolScaling {
14650 pub fn new() -> Self {
14651 std::default::Default::default()
14652 }
14653
14654 /// Sets the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14655 ///
14656 /// # Example
14657 /// ```ignore,no_run
14658 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14659 /// let x = WorkerPoolScaling::new().set_manual_instance_count(42);
14660 /// ```
14661 pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
14662 where
14663 T: std::convert::Into<i32>,
14664 {
14665 self.manual_instance_count = std::option::Option::Some(v.into());
14666 self
14667 }
14668
14669 /// Sets or clears the value of [manual_instance_count][crate::model::WorkerPoolScaling::manual_instance_count].
14670 ///
14671 /// # Example
14672 /// ```ignore,no_run
14673 /// # use google_cloud_run_v2::model::WorkerPoolScaling;
14674 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(Some(42));
14675 /// let x = WorkerPoolScaling::new().set_or_clear_manual_instance_count(None::<i32>);
14676 /// ```
14677 pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
14678 where
14679 T: std::convert::Into<i32>,
14680 {
14681 self.manual_instance_count = v.map(|x| x.into());
14682 self
14683 }
14684}
14685
14686impl wkt::message::Message for WorkerPoolScaling {
14687 fn typename() -> &'static str {
14688 "type.googleapis.com/google.cloud.run.v2.WorkerPoolScaling"
14689 }
14690}
14691
14692/// Hardware constraints configuration.
14693#[derive(Clone, Default, PartialEq)]
14694#[non_exhaustive]
14695pub struct NodeSelector {
14696 /// Required. GPU accelerator type to attach to an instance.
14697 pub accelerator: std::string::String,
14698
14699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14700}
14701
14702impl NodeSelector {
14703 pub fn new() -> Self {
14704 std::default::Default::default()
14705 }
14706
14707 /// Sets the value of [accelerator][crate::model::NodeSelector::accelerator].
14708 ///
14709 /// # Example
14710 /// ```ignore,no_run
14711 /// # use google_cloud_run_v2::model::NodeSelector;
14712 /// let x = NodeSelector::new().set_accelerator("example");
14713 /// ```
14714 pub fn set_accelerator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14715 self.accelerator = v.into();
14716 self
14717 }
14718}
14719
14720impl wkt::message::Message for NodeSelector {
14721 fn typename() -> &'static str {
14722 "type.googleapis.com/google.cloud.run.v2.NodeSelector"
14723 }
14724}
14725
14726/// Describes the Build step of the function that builds a container from the
14727/// given source.
14728#[derive(Clone, Default, PartialEq)]
14729#[non_exhaustive]
14730pub struct BuildConfig {
14731 /// Output only. The Cloud Build name of the latest successful deployment of
14732 /// the function.
14733 pub name: std::string::String,
14734
14735 /// The Cloud Storage bucket URI where the function source code is located.
14736 pub source_location: std::string::String,
14737
14738 /// Optional. The name of the function (as defined in source code) that will be
14739 /// executed. Defaults to the resource name suffix, if not specified. For
14740 /// backward compatibility, if function with given name is not found, then the
14741 /// system will try to use function named "function".
14742 pub function_target: std::string::String,
14743
14744 /// Optional. Artifact Registry URI to store the built image.
14745 pub image_uri: std::string::String,
14746
14747 /// Optional. The base image used to build the function.
14748 pub base_image: std::string::String,
14749
14750 /// Optional. Sets whether the function will receive automatic base image
14751 /// updates.
14752 pub enable_automatic_updates: bool,
14753
14754 /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
14755 /// build the Cloud Run function. The format of this field is
14756 /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
14757 /// `{project}` and `{region}` are the project id and region respectively where
14758 /// the worker pool is defined and `{workerPool}` is the short name of the
14759 /// worker pool.
14760 pub worker_pool: std::string::String,
14761
14762 /// Optional. User-provided build-time environment variables for the function
14763 pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
14764
14765 /// Optional. Service account to be used for building the container. The format
14766 /// of this field is
14767 /// `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
14768 pub service_account: std::string::String,
14769
14770 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14771}
14772
14773impl BuildConfig {
14774 pub fn new() -> Self {
14775 std::default::Default::default()
14776 }
14777
14778 /// Sets the value of [name][crate::model::BuildConfig::name].
14779 ///
14780 /// # Example
14781 /// ```ignore,no_run
14782 /// # use google_cloud_run_v2::model::BuildConfig;
14783 /// let x = BuildConfig::new().set_name("example");
14784 /// ```
14785 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14786 self.name = v.into();
14787 self
14788 }
14789
14790 /// Sets the value of [source_location][crate::model::BuildConfig::source_location].
14791 ///
14792 /// # Example
14793 /// ```ignore,no_run
14794 /// # use google_cloud_run_v2::model::BuildConfig;
14795 /// let x = BuildConfig::new().set_source_location("example");
14796 /// ```
14797 pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14798 self.source_location = v.into();
14799 self
14800 }
14801
14802 /// Sets the value of [function_target][crate::model::BuildConfig::function_target].
14803 ///
14804 /// # Example
14805 /// ```ignore,no_run
14806 /// # use google_cloud_run_v2::model::BuildConfig;
14807 /// let x = BuildConfig::new().set_function_target("example");
14808 /// ```
14809 pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14810 self.function_target = v.into();
14811 self
14812 }
14813
14814 /// Sets the value of [image_uri][crate::model::BuildConfig::image_uri].
14815 ///
14816 /// # Example
14817 /// ```ignore,no_run
14818 /// # use google_cloud_run_v2::model::BuildConfig;
14819 /// let x = BuildConfig::new().set_image_uri("example");
14820 /// ```
14821 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14822 self.image_uri = v.into();
14823 self
14824 }
14825
14826 /// Sets the value of [base_image][crate::model::BuildConfig::base_image].
14827 ///
14828 /// # Example
14829 /// ```ignore,no_run
14830 /// # use google_cloud_run_v2::model::BuildConfig;
14831 /// let x = BuildConfig::new().set_base_image("example");
14832 /// ```
14833 pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14834 self.base_image = v.into();
14835 self
14836 }
14837
14838 /// Sets the value of [enable_automatic_updates][crate::model::BuildConfig::enable_automatic_updates].
14839 ///
14840 /// # Example
14841 /// ```ignore,no_run
14842 /// # use google_cloud_run_v2::model::BuildConfig;
14843 /// let x = BuildConfig::new().set_enable_automatic_updates(true);
14844 /// ```
14845 pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14846 self.enable_automatic_updates = v.into();
14847 self
14848 }
14849
14850 /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
14851 ///
14852 /// # Example
14853 /// ```ignore,no_run
14854 /// # use google_cloud_run_v2::model::BuildConfig;
14855 /// let x = BuildConfig::new().set_worker_pool("example");
14856 /// ```
14857 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14858 self.worker_pool = v.into();
14859 self
14860 }
14861
14862 /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
14863 ///
14864 /// # Example
14865 /// ```ignore,no_run
14866 /// # use google_cloud_run_v2::model::BuildConfig;
14867 /// let x = BuildConfig::new().set_environment_variables([
14868 /// ("key0", "abc"),
14869 /// ("key1", "xyz"),
14870 /// ]);
14871 /// ```
14872 pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
14873 where
14874 T: std::iter::IntoIterator<Item = (K, V)>,
14875 K: std::convert::Into<std::string::String>,
14876 V: std::convert::Into<std::string::String>,
14877 {
14878 use std::iter::Iterator;
14879 self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14880 self
14881 }
14882
14883 /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
14884 ///
14885 /// # Example
14886 /// ```ignore,no_run
14887 /// # use google_cloud_run_v2::model::BuildConfig;
14888 /// let x = BuildConfig::new().set_service_account("example");
14889 /// ```
14890 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14891 self.service_account = v.into();
14892 self
14893 }
14894}
14895
14896impl wkt::message::Message for BuildConfig {
14897 fn typename() -> &'static str {
14898 "type.googleapis.com/google.cloud.run.v2.BuildConfig"
14899 }
14900}
14901
14902/// Request message for creating a WorkerPool.
14903#[derive(Clone, Default, PartialEq)]
14904#[non_exhaustive]
14905pub struct CreateWorkerPoolRequest {
14906 /// Required. The location and project in which this worker pool should be
14907 /// created. Format: `projects/{project}/locations/{location}`, where
14908 /// `{project}` can be project id or number. Only lowercase characters, digits,
14909 /// and hyphens.
14910 pub parent: std::string::String,
14911
14912 /// Required. The WorkerPool instance to create.
14913 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
14914
14915 /// Required. The unique identifier for the WorkerPool. It must begin with
14916 /// letter, and cannot end with hyphen; must contain fewer than 50 characters.
14917 /// The name of the worker pool becomes
14918 /// `{parent}/workerPools/{worker_pool_id}`.
14919 pub worker_pool_id: std::string::String,
14920
14921 /// Optional. Indicates that the request should be validated and default values
14922 /// populated, without persisting the request or creating any resources.
14923 pub validate_only: bool,
14924
14925 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14926}
14927
14928impl CreateWorkerPoolRequest {
14929 pub fn new() -> Self {
14930 std::default::Default::default()
14931 }
14932
14933 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
14934 ///
14935 /// # Example
14936 /// ```ignore,no_run
14937 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14938 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
14939 /// ```
14940 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14941 self.parent = v.into();
14942 self
14943 }
14944
14945 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
14946 ///
14947 /// # Example
14948 /// ```ignore,no_run
14949 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14950 /// use google_cloud_run_v2::model::WorkerPool;
14951 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
14952 /// ```
14953 pub fn set_worker_pool<T>(mut self, v: T) -> Self
14954 where
14955 T: std::convert::Into<crate::model::WorkerPool>,
14956 {
14957 self.worker_pool = std::option::Option::Some(v.into());
14958 self
14959 }
14960
14961 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
14962 ///
14963 /// # Example
14964 /// ```ignore,no_run
14965 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14966 /// use google_cloud_run_v2::model::WorkerPool;
14967 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
14968 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
14969 /// ```
14970 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
14971 where
14972 T: std::convert::Into<crate::model::WorkerPool>,
14973 {
14974 self.worker_pool = v.map(|x| x.into());
14975 self
14976 }
14977
14978 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
14979 ///
14980 /// # Example
14981 /// ```ignore,no_run
14982 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14983 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
14984 /// ```
14985 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14986 self.worker_pool_id = v.into();
14987 self
14988 }
14989
14990 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
14991 ///
14992 /// # Example
14993 /// ```ignore,no_run
14994 /// # use google_cloud_run_v2::model::CreateWorkerPoolRequest;
14995 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
14996 /// ```
14997 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14998 self.validate_only = v.into();
14999 self
15000 }
15001}
15002
15003impl wkt::message::Message for CreateWorkerPoolRequest {
15004 fn typename() -> &'static str {
15005 "type.googleapis.com/google.cloud.run.v2.CreateWorkerPoolRequest"
15006 }
15007}
15008
15009/// Request message for updating a worker pool.
15010#[derive(Clone, Default, PartialEq)]
15011#[non_exhaustive]
15012pub struct UpdateWorkerPoolRequest {
15013 /// Optional. The list of fields to be updated.
15014 pub update_mask: std::option::Option<wkt::FieldMask>,
15015
15016 /// Required. The WorkerPool to be updated.
15017 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
15018
15019 /// Optional. Indicates that the request should be validated and default values
15020 /// populated, without persisting the request or updating any resources.
15021 pub validate_only: bool,
15022
15023 /// Optional. If set to true, and if the WorkerPool does not exist, it will
15024 /// create a new one. The caller must have 'run.workerpools.create' permissions
15025 /// if this is set to true and the WorkerPool does not exist.
15026 pub allow_missing: bool,
15027
15028 /// Optional. If set to true, a new revision will be created from the template
15029 /// even if the system doesn't detect any changes from the previously deployed
15030 /// revision.
15031 ///
15032 /// This may be useful for cases where the underlying resources need to be
15033 /// recreated or reinitialized. For example if the image is specified by label,
15034 /// but the underlying image digest has changed) or if the container performs
15035 /// deployment initialization work that needs to be performed again.
15036 pub force_new_revision: bool,
15037
15038 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15039}
15040
15041impl UpdateWorkerPoolRequest {
15042 pub fn new() -> Self {
15043 std::default::Default::default()
15044 }
15045
15046 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15047 ///
15048 /// # Example
15049 /// ```ignore,no_run
15050 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15051 /// use wkt::FieldMask;
15052 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15053 /// ```
15054 pub fn set_update_mask<T>(mut self, v: T) -> Self
15055 where
15056 T: std::convert::Into<wkt::FieldMask>,
15057 {
15058 self.update_mask = std::option::Option::Some(v.into());
15059 self
15060 }
15061
15062 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
15063 ///
15064 /// # Example
15065 /// ```ignore,no_run
15066 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15067 /// use wkt::FieldMask;
15068 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15069 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15070 /// ```
15071 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15072 where
15073 T: std::convert::Into<wkt::FieldMask>,
15074 {
15075 self.update_mask = v.map(|x| x.into());
15076 self
15077 }
15078
15079 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15080 ///
15081 /// # Example
15082 /// ```ignore,no_run
15083 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15084 /// use google_cloud_run_v2::model::WorkerPool;
15085 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
15086 /// ```
15087 pub fn set_worker_pool<T>(mut self, v: T) -> Self
15088 where
15089 T: std::convert::Into<crate::model::WorkerPool>,
15090 {
15091 self.worker_pool = std::option::Option::Some(v.into());
15092 self
15093 }
15094
15095 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
15096 ///
15097 /// # Example
15098 /// ```ignore,no_run
15099 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15100 /// use google_cloud_run_v2::model::WorkerPool;
15101 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
15102 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
15103 /// ```
15104 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
15105 where
15106 T: std::convert::Into<crate::model::WorkerPool>,
15107 {
15108 self.worker_pool = v.map(|x| x.into());
15109 self
15110 }
15111
15112 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
15113 ///
15114 /// # Example
15115 /// ```ignore,no_run
15116 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15117 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
15118 /// ```
15119 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15120 self.validate_only = v.into();
15121 self
15122 }
15123
15124 /// Sets the value of [allow_missing][crate::model::UpdateWorkerPoolRequest::allow_missing].
15125 ///
15126 /// # Example
15127 /// ```ignore,no_run
15128 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15129 /// let x = UpdateWorkerPoolRequest::new().set_allow_missing(true);
15130 /// ```
15131 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15132 self.allow_missing = v.into();
15133 self
15134 }
15135
15136 /// Sets the value of [force_new_revision][crate::model::UpdateWorkerPoolRequest::force_new_revision].
15137 ///
15138 /// # Example
15139 /// ```ignore,no_run
15140 /// # use google_cloud_run_v2::model::UpdateWorkerPoolRequest;
15141 /// let x = UpdateWorkerPoolRequest::new().set_force_new_revision(true);
15142 /// ```
15143 pub fn set_force_new_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15144 self.force_new_revision = v.into();
15145 self
15146 }
15147}
15148
15149impl wkt::message::Message for UpdateWorkerPoolRequest {
15150 fn typename() -> &'static str {
15151 "type.googleapis.com/google.cloud.run.v2.UpdateWorkerPoolRequest"
15152 }
15153}
15154
15155/// Request message for retrieving a list of WorkerPools.
15156#[derive(Clone, Default, PartialEq)]
15157#[non_exhaustive]
15158pub struct ListWorkerPoolsRequest {
15159 /// Required. The location and project to list resources on.
15160 /// Location must be a valid Google Cloud region, and cannot be the "-"
15161 /// wildcard. Format: `projects/{project}/locations/{location}`, where
15162 /// `{project}` can be project id or number.
15163 pub parent: std::string::String,
15164
15165 /// Maximum number of WorkerPools to return in this call.
15166 pub page_size: i32,
15167
15168 /// A page token received from a previous call to ListWorkerPools.
15169 /// All other parameters must match.
15170 pub page_token: std::string::String,
15171
15172 /// If true, returns deleted (but unexpired) resources along with active ones.
15173 pub show_deleted: bool,
15174
15175 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15176}
15177
15178impl ListWorkerPoolsRequest {
15179 pub fn new() -> Self {
15180 std::default::Default::default()
15181 }
15182
15183 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
15184 ///
15185 /// # Example
15186 /// ```ignore,no_run
15187 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15188 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
15189 /// ```
15190 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15191 self.parent = v.into();
15192 self
15193 }
15194
15195 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
15196 ///
15197 /// # Example
15198 /// ```ignore,no_run
15199 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15200 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
15201 /// ```
15202 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15203 self.page_size = v.into();
15204 self
15205 }
15206
15207 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
15208 ///
15209 /// # Example
15210 /// ```ignore,no_run
15211 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15212 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
15213 /// ```
15214 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15215 self.page_token = v.into();
15216 self
15217 }
15218
15219 /// Sets the value of [show_deleted][crate::model::ListWorkerPoolsRequest::show_deleted].
15220 ///
15221 /// # Example
15222 /// ```ignore,no_run
15223 /// # use google_cloud_run_v2::model::ListWorkerPoolsRequest;
15224 /// let x = ListWorkerPoolsRequest::new().set_show_deleted(true);
15225 /// ```
15226 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15227 self.show_deleted = v.into();
15228 self
15229 }
15230}
15231
15232impl wkt::message::Message for ListWorkerPoolsRequest {
15233 fn typename() -> &'static str {
15234 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsRequest"
15235 }
15236}
15237
15238/// Response message containing a list of WorkerPools.
15239#[derive(Clone, Default, PartialEq)]
15240#[non_exhaustive]
15241pub struct ListWorkerPoolsResponse {
15242 /// The resulting list of WorkerPools.
15243 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
15244
15245 /// A token indicating there are more items than page_size. Use it in the next
15246 /// ListWorkerPools request to continue.
15247 pub next_page_token: std::string::String,
15248
15249 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15250}
15251
15252impl ListWorkerPoolsResponse {
15253 pub fn new() -> Self {
15254 std::default::Default::default()
15255 }
15256
15257 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
15258 ///
15259 /// # Example
15260 /// ```ignore,no_run
15261 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15262 /// use google_cloud_run_v2::model::WorkerPool;
15263 /// let x = ListWorkerPoolsResponse::new()
15264 /// .set_worker_pools([
15265 /// WorkerPool::default()/* use setters */,
15266 /// WorkerPool::default()/* use (different) setters */,
15267 /// ]);
15268 /// ```
15269 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
15270 where
15271 T: std::iter::IntoIterator<Item = V>,
15272 V: std::convert::Into<crate::model::WorkerPool>,
15273 {
15274 use std::iter::Iterator;
15275 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
15276 self
15277 }
15278
15279 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
15280 ///
15281 /// # Example
15282 /// ```ignore,no_run
15283 /// # use google_cloud_run_v2::model::ListWorkerPoolsResponse;
15284 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
15285 /// ```
15286 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15287 self.next_page_token = v.into();
15288 self
15289 }
15290}
15291
15292impl wkt::message::Message for ListWorkerPoolsResponse {
15293 fn typename() -> &'static str {
15294 "type.googleapis.com/google.cloud.run.v2.ListWorkerPoolsResponse"
15295 }
15296}
15297
15298#[doc(hidden)]
15299impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
15300 type PageItem = crate::model::WorkerPool;
15301
15302 fn items(self) -> std::vec::Vec<Self::PageItem> {
15303 self.worker_pools
15304 }
15305
15306 fn next_page_token(&self) -> std::string::String {
15307 use std::clone::Clone;
15308 self.next_page_token.clone()
15309 }
15310}
15311
15312/// Request message for obtaining a WorkerPool by its full name.
15313#[derive(Clone, Default, PartialEq)]
15314#[non_exhaustive]
15315pub struct GetWorkerPoolRequest {
15316 /// Required. The full name of the WorkerPool.
15317 /// Format:
15318 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15319 /// `{project}` can be project id or number.
15320 pub name: std::string::String,
15321
15322 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15323}
15324
15325impl GetWorkerPoolRequest {
15326 pub fn new() -> Self {
15327 std::default::Default::default()
15328 }
15329
15330 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
15331 ///
15332 /// # Example
15333 /// ```ignore,no_run
15334 /// # use google_cloud_run_v2::model::GetWorkerPoolRequest;
15335 /// let x = GetWorkerPoolRequest::new().set_name("example");
15336 /// ```
15337 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15338 self.name = v.into();
15339 self
15340 }
15341}
15342
15343impl wkt::message::Message for GetWorkerPoolRequest {
15344 fn typename() -> &'static str {
15345 "type.googleapis.com/google.cloud.run.v2.GetWorkerPoolRequest"
15346 }
15347}
15348
15349/// Request message to delete a WorkerPool by its full name.
15350#[derive(Clone, Default, PartialEq)]
15351#[non_exhaustive]
15352pub struct DeleteWorkerPoolRequest {
15353 /// Required. The full name of the WorkerPool.
15354 /// Format:
15355 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
15356 /// `{project}` can be project id or number.
15357 pub name: std::string::String,
15358
15359 /// Optional. Indicates that the request should be validated without actually
15360 /// deleting any resources.
15361 pub validate_only: bool,
15362
15363 /// A system-generated fingerprint for this version of the
15364 /// resource. May be used to detect modification conflict during updates.
15365 pub etag: std::string::String,
15366
15367 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15368}
15369
15370impl DeleteWorkerPoolRequest {
15371 pub fn new() -> Self {
15372 std::default::Default::default()
15373 }
15374
15375 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
15376 ///
15377 /// # Example
15378 /// ```ignore,no_run
15379 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15380 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
15381 /// ```
15382 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15383 self.name = v.into();
15384 self
15385 }
15386
15387 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
15388 ///
15389 /// # Example
15390 /// ```ignore,no_run
15391 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15392 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
15393 /// ```
15394 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15395 self.validate_only = v.into();
15396 self
15397 }
15398
15399 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
15400 ///
15401 /// # Example
15402 /// ```ignore,no_run
15403 /// # use google_cloud_run_v2::model::DeleteWorkerPoolRequest;
15404 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
15405 /// ```
15406 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15407 self.etag = v.into();
15408 self
15409 }
15410}
15411
15412impl wkt::message::Message for DeleteWorkerPoolRequest {
15413 fn typename() -> &'static str {
15414 "type.googleapis.com/google.cloud.run.v2.DeleteWorkerPoolRequest"
15415 }
15416}
15417
15418/// WorkerPool acts as a top-level container that manages a set of
15419/// configurations and revision templates which implement a pull-based workload.
15420/// WorkerPool exists to provide a singular abstraction which can be access
15421/// controlled, reasoned about, and which encapsulates software lifecycle
15422/// decisions such as rollout policy and team resource ownership.
15423#[derive(Clone, Default, PartialEq)]
15424#[non_exhaustive]
15425pub struct WorkerPool {
15426 /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest,
15427 /// this field is ignored, and instead composed from
15428 /// CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id.
15429 ///
15430 /// Format:
15431 /// `projects/{project}/locations/{location}/workerPools/{worker_id}`
15432 pub name: std::string::String,
15433
15434 /// User-provided description of the WorkerPool. This field currently has a
15435 /// 512-character limit.
15436 pub description: std::string::String,
15437
15438 /// Output only. Server assigned unique identifier for the trigger. The value
15439 /// is a UUID4 string and guaranteed to remain unchanged until the resource is
15440 /// deleted.
15441 pub uid: std::string::String,
15442
15443 /// Output only. A number that monotonically increases every time the user
15444 /// modifies the desired state.
15445 /// Please note that unlike v1, this is an int64 value. As with most Google
15446 /// APIs, its JSON representation will be a `string` instead of an `integer`.
15447 pub generation: i64,
15448
15449 /// Optional. Unstructured key value map that can be used to organize and
15450 /// categorize objects. User-provided labels are shared with Google's billing
15451 /// system, so they can be used to filter, or break down billing charges by
15452 /// team, component, environment, state, etc. For more information, visit
15453 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
15454 /// <https://cloud.google.com/run/docs/configuring/labels>.
15455 ///
15456 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
15457 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15458 /// namespaces, and they will be rejected. All system labels in v1 now have a
15459 /// corresponding field in v2 WorkerPool.
15460 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15461
15462 /// Optional. Unstructured key value map that may be set by external tools to
15463 /// store and arbitrary metadata. They are not queryable and should be
15464 /// preserved when modifying objects.
15465 ///
15466 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
15467 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
15468 /// namespaces, and they will be rejected in new resources. All system
15469 /// annotations in v1 now have a corresponding field in v2 WorkerPool.
15470 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
15471
15472 /// Output only. The creation time.
15473 pub create_time: std::option::Option<wkt::Timestamp>,
15474
15475 /// Output only. The last-modified time.
15476 pub update_time: std::option::Option<wkt::Timestamp>,
15477
15478 /// Output only. The deletion time. It is only populated as a response to a
15479 /// Delete request.
15480 pub delete_time: std::option::Option<wkt::Timestamp>,
15481
15482 /// Output only. For a deleted resource, the time after which it will be
15483 /// permamently deleted.
15484 pub expire_time: std::option::Option<wkt::Timestamp>,
15485
15486 /// Output only. Email address of the authenticated creator.
15487 pub creator: std::string::String,
15488
15489 /// Output only. Email address of the last authenticated modifier.
15490 pub last_modifier: std::string::String,
15491
15492 /// Arbitrary identifier for the API client.
15493 pub client: std::string::String,
15494
15495 /// Arbitrary version identifier for the API client.
15496 pub client_version: std::string::String,
15497
15498 /// Optional. The launch stage as defined by [Google Cloud Platform
15499 /// Launch Stages](https://cloud.google.com/terms/launch-stages).
15500 /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
15501 /// is assumed.
15502 /// Set the launch stage to a preview stage on input to allow use of preview
15503 /// features in that stage. On read (or output), describes whether the
15504 /// resource uses preview features.
15505 ///
15506 /// For example, if ALPHA is provided as input, but only BETA and GA-level
15507 /// features are used, this field will be BETA on output.
15508 pub launch_stage: google_cloud_api::model::LaunchStage,
15509
15510 /// Optional. Settings for the Binary Authorization feature.
15511 pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
15512
15513 /// Required. The template used to create revisions for this WorkerPool.
15514 pub template: std::option::Option<crate::model::WorkerPoolRevisionTemplate>,
15515
15516 /// Optional. Specifies how to distribute instances over a collection of
15517 /// Revisions belonging to the WorkerPool. If instance split is empty or not
15518 /// provided, defaults to 100% instances assigned to the latest `Ready`
15519 /// Revision.
15520 pub instance_splits: std::vec::Vec<crate::model::InstanceSplit>,
15521
15522 /// Optional. Specifies worker-pool-level scaling settings
15523 pub scaling: std::option::Option<crate::model::WorkerPoolScaling>,
15524
15525 /// Output only. The generation of this WorkerPool currently serving workloads.
15526 /// See comments in `reconciling` for additional information on reconciliation
15527 /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
15528 /// As with most Google APIs, its JSON representation will be a `string`
15529 /// instead of an `integer`.
15530 pub observed_generation: i64,
15531
15532 /// Output only. The Condition of this WorkerPool, containing its readiness
15533 /// status, and detailed error information in case it did not reach a serving
15534 /// state. See comments in `reconciling` for additional information on
15535 /// reconciliation process in Cloud Run.
15536 pub terminal_condition: std::option::Option<crate::model::Condition>,
15537
15538 /// Output only. The Conditions of all other associated sub-resources. They
15539 /// contain additional diagnostics information in case the WorkerPool does not
15540 /// reach its Serving state. See comments in `reconciling` for additional
15541 /// information on reconciliation process in Cloud Run.
15542 pub conditions: std::vec::Vec<crate::model::Condition>,
15543
15544 /// Output only. Name of the latest revision that is serving workloads. See
15545 /// comments in `reconciling` for additional information on reconciliation
15546 /// process in Cloud Run.
15547 pub latest_ready_revision: std::string::String,
15548
15549 /// Output only. Name of the last created revision. See comments in
15550 /// `reconciling` for additional information on reconciliation process in Cloud
15551 /// Run.
15552 pub latest_created_revision: std::string::String,
15553
15554 /// Output only. Detailed status information for corresponding instance splits.
15555 /// See comments in `reconciling` for additional information on reconciliation
15556 /// process in Cloud Run.
15557 pub instance_split_statuses: std::vec::Vec<crate::model::InstanceSplitStatus>,
15558
15559 /// Output only. Indicates whether Cloud Run Threat Detection monitoring is
15560 /// enabled for the parent project of this worker pool.
15561 pub threat_detection_enabled: bool,
15562
15563 /// Deprecated: Not supported, and ignored by Cloud Run.
15564 #[deprecated]
15565 pub custom_audiences: std::vec::Vec<std::string::String>,
15566
15567 /// Output only. Reserved for future use.
15568 pub satisfies_pzs: bool,
15569
15570 /// Output only. Returns true if the WorkerPool is currently being acted upon
15571 /// by the system to bring it into the desired state.
15572 ///
15573 /// When a new WorkerPool is created, or an existing one is updated, Cloud Run
15574 /// will asynchronously perform all necessary steps to bring the WorkerPool to
15575 /// the desired serving state. This process is called reconciliation. While
15576 /// reconciliation is in process, `observed_generation`,
15577 /// `latest_ready_revison`, `instance_split_statuses`, and `uri` will have
15578 /// transient values that might mismatch the intended state: Once
15579 /// reconciliation is over (and this field is false), there are two possible
15580 /// outcomes: reconciliation succeeded and the serving state matches the
15581 /// WorkerPool, or there was an error, and reconciliation failed. This state
15582 /// can be found in `terminal_condition.state`.
15583 ///
15584 /// If reconciliation succeeded, the following fields will match:
15585 /// `instance_splits` and `instance_split_statuses`, `observed_generation` and
15586 /// `generation`, `latest_ready_revision` and `latest_created_revision`.
15587 ///
15588 /// If reconciliation failed, `instance_split_statuses`, `observed_generation`,
15589 /// and `latest_ready_revision` will have the state of the last serving
15590 /// revision, or empty for newly created WorkerPools. Additional information on
15591 /// the failure can be found in `terminal_condition` and `conditions`.
15592 pub reconciling: bool,
15593
15594 /// Optional. A system-generated fingerprint for this version of the
15595 /// resource. May be used to detect modification conflict during updates.
15596 pub etag: std::string::String,
15597
15598 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15599}
15600
15601impl WorkerPool {
15602 pub fn new() -> Self {
15603 std::default::Default::default()
15604 }
15605
15606 /// Sets the value of [name][crate::model::WorkerPool::name].
15607 ///
15608 /// # Example
15609 /// ```ignore,no_run
15610 /// # use google_cloud_run_v2::model::WorkerPool;
15611 /// let x = WorkerPool::new().set_name("example");
15612 /// ```
15613 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15614 self.name = v.into();
15615 self
15616 }
15617
15618 /// Sets the value of [description][crate::model::WorkerPool::description].
15619 ///
15620 /// # Example
15621 /// ```ignore,no_run
15622 /// # use google_cloud_run_v2::model::WorkerPool;
15623 /// let x = WorkerPool::new().set_description("example");
15624 /// ```
15625 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15626 self.description = v.into();
15627 self
15628 }
15629
15630 /// Sets the value of [uid][crate::model::WorkerPool::uid].
15631 ///
15632 /// # Example
15633 /// ```ignore,no_run
15634 /// # use google_cloud_run_v2::model::WorkerPool;
15635 /// let x = WorkerPool::new().set_uid("example");
15636 /// ```
15637 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15638 self.uid = v.into();
15639 self
15640 }
15641
15642 /// Sets the value of [generation][crate::model::WorkerPool::generation].
15643 ///
15644 /// # Example
15645 /// ```ignore,no_run
15646 /// # use google_cloud_run_v2::model::WorkerPool;
15647 /// let x = WorkerPool::new().set_generation(42);
15648 /// ```
15649 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15650 self.generation = v.into();
15651 self
15652 }
15653
15654 /// Sets the value of [labels][crate::model::WorkerPool::labels].
15655 ///
15656 /// # Example
15657 /// ```ignore,no_run
15658 /// # use google_cloud_run_v2::model::WorkerPool;
15659 /// let x = WorkerPool::new().set_labels([
15660 /// ("key0", "abc"),
15661 /// ("key1", "xyz"),
15662 /// ]);
15663 /// ```
15664 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15665 where
15666 T: std::iter::IntoIterator<Item = (K, V)>,
15667 K: std::convert::Into<std::string::String>,
15668 V: std::convert::Into<std::string::String>,
15669 {
15670 use std::iter::Iterator;
15671 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15672 self
15673 }
15674
15675 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
15676 ///
15677 /// # Example
15678 /// ```ignore,no_run
15679 /// # use google_cloud_run_v2::model::WorkerPool;
15680 /// let x = WorkerPool::new().set_annotations([
15681 /// ("key0", "abc"),
15682 /// ("key1", "xyz"),
15683 /// ]);
15684 /// ```
15685 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
15686 where
15687 T: std::iter::IntoIterator<Item = (K, V)>,
15688 K: std::convert::Into<std::string::String>,
15689 V: std::convert::Into<std::string::String>,
15690 {
15691 use std::iter::Iterator;
15692 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15693 self
15694 }
15695
15696 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
15697 ///
15698 /// # Example
15699 /// ```ignore,no_run
15700 /// # use google_cloud_run_v2::model::WorkerPool;
15701 /// use wkt::Timestamp;
15702 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
15703 /// ```
15704 pub fn set_create_time<T>(mut self, v: T) -> Self
15705 where
15706 T: std::convert::Into<wkt::Timestamp>,
15707 {
15708 self.create_time = std::option::Option::Some(v.into());
15709 self
15710 }
15711
15712 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
15713 ///
15714 /// # Example
15715 /// ```ignore,no_run
15716 /// # use google_cloud_run_v2::model::WorkerPool;
15717 /// use wkt::Timestamp;
15718 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15719 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
15720 /// ```
15721 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15722 where
15723 T: std::convert::Into<wkt::Timestamp>,
15724 {
15725 self.create_time = v.map(|x| x.into());
15726 self
15727 }
15728
15729 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
15730 ///
15731 /// # Example
15732 /// ```ignore,no_run
15733 /// # use google_cloud_run_v2::model::WorkerPool;
15734 /// use wkt::Timestamp;
15735 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
15736 /// ```
15737 pub fn set_update_time<T>(mut self, v: T) -> Self
15738 where
15739 T: std::convert::Into<wkt::Timestamp>,
15740 {
15741 self.update_time = std::option::Option::Some(v.into());
15742 self
15743 }
15744
15745 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
15746 ///
15747 /// # Example
15748 /// ```ignore,no_run
15749 /// # use google_cloud_run_v2::model::WorkerPool;
15750 /// use wkt::Timestamp;
15751 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15752 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
15753 /// ```
15754 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15755 where
15756 T: std::convert::Into<wkt::Timestamp>,
15757 {
15758 self.update_time = v.map(|x| x.into());
15759 self
15760 }
15761
15762 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
15763 ///
15764 /// # Example
15765 /// ```ignore,no_run
15766 /// # use google_cloud_run_v2::model::WorkerPool;
15767 /// use wkt::Timestamp;
15768 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
15769 /// ```
15770 pub fn set_delete_time<T>(mut self, v: T) -> Self
15771 where
15772 T: std::convert::Into<wkt::Timestamp>,
15773 {
15774 self.delete_time = std::option::Option::Some(v.into());
15775 self
15776 }
15777
15778 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
15779 ///
15780 /// # Example
15781 /// ```ignore,no_run
15782 /// # use google_cloud_run_v2::model::WorkerPool;
15783 /// use wkt::Timestamp;
15784 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
15785 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
15786 /// ```
15787 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
15788 where
15789 T: std::convert::Into<wkt::Timestamp>,
15790 {
15791 self.delete_time = v.map(|x| x.into());
15792 self
15793 }
15794
15795 /// Sets the value of [expire_time][crate::model::WorkerPool::expire_time].
15796 ///
15797 /// # Example
15798 /// ```ignore,no_run
15799 /// # use google_cloud_run_v2::model::WorkerPool;
15800 /// use wkt::Timestamp;
15801 /// let x = WorkerPool::new().set_expire_time(Timestamp::default()/* use setters */);
15802 /// ```
15803 pub fn set_expire_time<T>(mut self, v: T) -> Self
15804 where
15805 T: std::convert::Into<wkt::Timestamp>,
15806 {
15807 self.expire_time = std::option::Option::Some(v.into());
15808 self
15809 }
15810
15811 /// Sets or clears the value of [expire_time][crate::model::WorkerPool::expire_time].
15812 ///
15813 /// # Example
15814 /// ```ignore,no_run
15815 /// # use google_cloud_run_v2::model::WorkerPool;
15816 /// use wkt::Timestamp;
15817 /// let x = WorkerPool::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
15818 /// let x = WorkerPool::new().set_or_clear_expire_time(None::<Timestamp>);
15819 /// ```
15820 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
15821 where
15822 T: std::convert::Into<wkt::Timestamp>,
15823 {
15824 self.expire_time = v.map(|x| x.into());
15825 self
15826 }
15827
15828 /// Sets the value of [creator][crate::model::WorkerPool::creator].
15829 ///
15830 /// # Example
15831 /// ```ignore,no_run
15832 /// # use google_cloud_run_v2::model::WorkerPool;
15833 /// let x = WorkerPool::new().set_creator("example");
15834 /// ```
15835 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15836 self.creator = v.into();
15837 self
15838 }
15839
15840 /// Sets the value of [last_modifier][crate::model::WorkerPool::last_modifier].
15841 ///
15842 /// # Example
15843 /// ```ignore,no_run
15844 /// # use google_cloud_run_v2::model::WorkerPool;
15845 /// let x = WorkerPool::new().set_last_modifier("example");
15846 /// ```
15847 pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15848 self.last_modifier = v.into();
15849 self
15850 }
15851
15852 /// Sets the value of [client][crate::model::WorkerPool::client].
15853 ///
15854 /// # Example
15855 /// ```ignore,no_run
15856 /// # use google_cloud_run_v2::model::WorkerPool;
15857 /// let x = WorkerPool::new().set_client("example");
15858 /// ```
15859 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15860 self.client = v.into();
15861 self
15862 }
15863
15864 /// Sets the value of [client_version][crate::model::WorkerPool::client_version].
15865 ///
15866 /// # Example
15867 /// ```ignore,no_run
15868 /// # use google_cloud_run_v2::model::WorkerPool;
15869 /// let x = WorkerPool::new().set_client_version("example");
15870 /// ```
15871 pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15872 self.client_version = v.into();
15873 self
15874 }
15875
15876 /// Sets the value of [launch_stage][crate::model::WorkerPool::launch_stage].
15877 ///
15878 /// # Example
15879 /// ```ignore,no_run
15880 /// # use google_cloud_run_v2::model::WorkerPool;
15881 /// use google_cloud_api::model::LaunchStage;
15882 /// let x0 = WorkerPool::new().set_launch_stage(LaunchStage::Unimplemented);
15883 /// let x1 = WorkerPool::new().set_launch_stage(LaunchStage::Prelaunch);
15884 /// let x2 = WorkerPool::new().set_launch_stage(LaunchStage::EarlyAccess);
15885 /// ```
15886 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
15887 mut self,
15888 v: T,
15889 ) -> Self {
15890 self.launch_stage = v.into();
15891 self
15892 }
15893
15894 /// Sets the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
15895 ///
15896 /// # Example
15897 /// ```ignore,no_run
15898 /// # use google_cloud_run_v2::model::WorkerPool;
15899 /// use google_cloud_run_v2::model::BinaryAuthorization;
15900 /// let x = WorkerPool::new().set_binary_authorization(BinaryAuthorization::default()/* use setters */);
15901 /// ```
15902 pub fn set_binary_authorization<T>(mut self, v: T) -> Self
15903 where
15904 T: std::convert::Into<crate::model::BinaryAuthorization>,
15905 {
15906 self.binary_authorization = std::option::Option::Some(v.into());
15907 self
15908 }
15909
15910 /// Sets or clears the value of [binary_authorization][crate::model::WorkerPool::binary_authorization].
15911 ///
15912 /// # Example
15913 /// ```ignore,no_run
15914 /// # use google_cloud_run_v2::model::WorkerPool;
15915 /// use google_cloud_run_v2::model::BinaryAuthorization;
15916 /// let x = WorkerPool::new().set_or_clear_binary_authorization(Some(BinaryAuthorization::default()/* use setters */));
15917 /// let x = WorkerPool::new().set_or_clear_binary_authorization(None::<BinaryAuthorization>);
15918 /// ```
15919 pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
15920 where
15921 T: std::convert::Into<crate::model::BinaryAuthorization>,
15922 {
15923 self.binary_authorization = v.map(|x| x.into());
15924 self
15925 }
15926
15927 /// Sets the value of [template][crate::model::WorkerPool::template].
15928 ///
15929 /// # Example
15930 /// ```ignore,no_run
15931 /// # use google_cloud_run_v2::model::WorkerPool;
15932 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15933 /// let x = WorkerPool::new().set_template(WorkerPoolRevisionTemplate::default()/* use setters */);
15934 /// ```
15935 pub fn set_template<T>(mut self, v: T) -> Self
15936 where
15937 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
15938 {
15939 self.template = std::option::Option::Some(v.into());
15940 self
15941 }
15942
15943 /// Sets or clears the value of [template][crate::model::WorkerPool::template].
15944 ///
15945 /// # Example
15946 /// ```ignore,no_run
15947 /// # use google_cloud_run_v2::model::WorkerPool;
15948 /// use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
15949 /// let x = WorkerPool::new().set_or_clear_template(Some(WorkerPoolRevisionTemplate::default()/* use setters */));
15950 /// let x = WorkerPool::new().set_or_clear_template(None::<WorkerPoolRevisionTemplate>);
15951 /// ```
15952 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
15953 where
15954 T: std::convert::Into<crate::model::WorkerPoolRevisionTemplate>,
15955 {
15956 self.template = v.map(|x| x.into());
15957 self
15958 }
15959
15960 /// Sets the value of [instance_splits][crate::model::WorkerPool::instance_splits].
15961 ///
15962 /// # Example
15963 /// ```ignore,no_run
15964 /// # use google_cloud_run_v2::model::WorkerPool;
15965 /// use google_cloud_run_v2::model::InstanceSplit;
15966 /// let x = WorkerPool::new()
15967 /// .set_instance_splits([
15968 /// InstanceSplit::default()/* use setters */,
15969 /// InstanceSplit::default()/* use (different) setters */,
15970 /// ]);
15971 /// ```
15972 pub fn set_instance_splits<T, V>(mut self, v: T) -> Self
15973 where
15974 T: std::iter::IntoIterator<Item = V>,
15975 V: std::convert::Into<crate::model::InstanceSplit>,
15976 {
15977 use std::iter::Iterator;
15978 self.instance_splits = v.into_iter().map(|i| i.into()).collect();
15979 self
15980 }
15981
15982 /// Sets the value of [scaling][crate::model::WorkerPool::scaling].
15983 ///
15984 /// # Example
15985 /// ```ignore,no_run
15986 /// # use google_cloud_run_v2::model::WorkerPool;
15987 /// use google_cloud_run_v2::model::WorkerPoolScaling;
15988 /// let x = WorkerPool::new().set_scaling(WorkerPoolScaling::default()/* use setters */);
15989 /// ```
15990 pub fn set_scaling<T>(mut self, v: T) -> Self
15991 where
15992 T: std::convert::Into<crate::model::WorkerPoolScaling>,
15993 {
15994 self.scaling = std::option::Option::Some(v.into());
15995 self
15996 }
15997
15998 /// Sets or clears the value of [scaling][crate::model::WorkerPool::scaling].
15999 ///
16000 /// # Example
16001 /// ```ignore,no_run
16002 /// # use google_cloud_run_v2::model::WorkerPool;
16003 /// use google_cloud_run_v2::model::WorkerPoolScaling;
16004 /// let x = WorkerPool::new().set_or_clear_scaling(Some(WorkerPoolScaling::default()/* use setters */));
16005 /// let x = WorkerPool::new().set_or_clear_scaling(None::<WorkerPoolScaling>);
16006 /// ```
16007 pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
16008 where
16009 T: std::convert::Into<crate::model::WorkerPoolScaling>,
16010 {
16011 self.scaling = v.map(|x| x.into());
16012 self
16013 }
16014
16015 /// Sets the value of [observed_generation][crate::model::WorkerPool::observed_generation].
16016 ///
16017 /// # Example
16018 /// ```ignore,no_run
16019 /// # use google_cloud_run_v2::model::WorkerPool;
16020 /// let x = WorkerPool::new().set_observed_generation(42);
16021 /// ```
16022 pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16023 self.observed_generation = v.into();
16024 self
16025 }
16026
16027 /// Sets the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16028 ///
16029 /// # Example
16030 /// ```ignore,no_run
16031 /// # use google_cloud_run_v2::model::WorkerPool;
16032 /// use google_cloud_run_v2::model::Condition;
16033 /// let x = WorkerPool::new().set_terminal_condition(Condition::default()/* use setters */);
16034 /// ```
16035 pub fn set_terminal_condition<T>(mut self, v: T) -> Self
16036 where
16037 T: std::convert::Into<crate::model::Condition>,
16038 {
16039 self.terminal_condition = std::option::Option::Some(v.into());
16040 self
16041 }
16042
16043 /// Sets or clears the value of [terminal_condition][crate::model::WorkerPool::terminal_condition].
16044 ///
16045 /// # Example
16046 /// ```ignore,no_run
16047 /// # use google_cloud_run_v2::model::WorkerPool;
16048 /// use google_cloud_run_v2::model::Condition;
16049 /// let x = WorkerPool::new().set_or_clear_terminal_condition(Some(Condition::default()/* use setters */));
16050 /// let x = WorkerPool::new().set_or_clear_terminal_condition(None::<Condition>);
16051 /// ```
16052 pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
16053 where
16054 T: std::convert::Into<crate::model::Condition>,
16055 {
16056 self.terminal_condition = v.map(|x| x.into());
16057 self
16058 }
16059
16060 /// Sets the value of [conditions][crate::model::WorkerPool::conditions].
16061 ///
16062 /// # Example
16063 /// ```ignore,no_run
16064 /// # use google_cloud_run_v2::model::WorkerPool;
16065 /// use google_cloud_run_v2::model::Condition;
16066 /// let x = WorkerPool::new()
16067 /// .set_conditions([
16068 /// Condition::default()/* use setters */,
16069 /// Condition::default()/* use (different) setters */,
16070 /// ]);
16071 /// ```
16072 pub fn set_conditions<T, V>(mut self, v: T) -> Self
16073 where
16074 T: std::iter::IntoIterator<Item = V>,
16075 V: std::convert::Into<crate::model::Condition>,
16076 {
16077 use std::iter::Iterator;
16078 self.conditions = v.into_iter().map(|i| i.into()).collect();
16079 self
16080 }
16081
16082 /// Sets the value of [latest_ready_revision][crate::model::WorkerPool::latest_ready_revision].
16083 ///
16084 /// # Example
16085 /// ```ignore,no_run
16086 /// # use google_cloud_run_v2::model::WorkerPool;
16087 /// let x = WorkerPool::new().set_latest_ready_revision("example");
16088 /// ```
16089 pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
16090 mut self,
16091 v: T,
16092 ) -> Self {
16093 self.latest_ready_revision = v.into();
16094 self
16095 }
16096
16097 /// Sets the value of [latest_created_revision][crate::model::WorkerPool::latest_created_revision].
16098 ///
16099 /// # Example
16100 /// ```ignore,no_run
16101 /// # use google_cloud_run_v2::model::WorkerPool;
16102 /// let x = WorkerPool::new().set_latest_created_revision("example");
16103 /// ```
16104 pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
16105 mut self,
16106 v: T,
16107 ) -> Self {
16108 self.latest_created_revision = v.into();
16109 self
16110 }
16111
16112 /// Sets the value of [instance_split_statuses][crate::model::WorkerPool::instance_split_statuses].
16113 ///
16114 /// # Example
16115 /// ```ignore,no_run
16116 /// # use google_cloud_run_v2::model::WorkerPool;
16117 /// use google_cloud_run_v2::model::InstanceSplitStatus;
16118 /// let x = WorkerPool::new()
16119 /// .set_instance_split_statuses([
16120 /// InstanceSplitStatus::default()/* use setters */,
16121 /// InstanceSplitStatus::default()/* use (different) setters */,
16122 /// ]);
16123 /// ```
16124 pub fn set_instance_split_statuses<T, V>(mut self, v: T) -> Self
16125 where
16126 T: std::iter::IntoIterator<Item = V>,
16127 V: std::convert::Into<crate::model::InstanceSplitStatus>,
16128 {
16129 use std::iter::Iterator;
16130 self.instance_split_statuses = v.into_iter().map(|i| i.into()).collect();
16131 self
16132 }
16133
16134 /// Sets the value of [threat_detection_enabled][crate::model::WorkerPool::threat_detection_enabled].
16135 ///
16136 /// # Example
16137 /// ```ignore,no_run
16138 /// # use google_cloud_run_v2::model::WorkerPool;
16139 /// let x = WorkerPool::new().set_threat_detection_enabled(true);
16140 /// ```
16141 pub fn set_threat_detection_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16142 self.threat_detection_enabled = v.into();
16143 self
16144 }
16145
16146 /// Sets the value of [custom_audiences][crate::model::WorkerPool::custom_audiences].
16147 ///
16148 /// # Example
16149 /// ```ignore,no_run
16150 /// # use google_cloud_run_v2::model::WorkerPool;
16151 /// let x = WorkerPool::new().set_custom_audiences(["a", "b", "c"]);
16152 /// ```
16153 #[deprecated]
16154 pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
16155 where
16156 T: std::iter::IntoIterator<Item = V>,
16157 V: std::convert::Into<std::string::String>,
16158 {
16159 use std::iter::Iterator;
16160 self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
16161 self
16162 }
16163
16164 /// Sets the value of [satisfies_pzs][crate::model::WorkerPool::satisfies_pzs].
16165 ///
16166 /// # Example
16167 /// ```ignore,no_run
16168 /// # use google_cloud_run_v2::model::WorkerPool;
16169 /// let x = WorkerPool::new().set_satisfies_pzs(true);
16170 /// ```
16171 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16172 self.satisfies_pzs = v.into();
16173 self
16174 }
16175
16176 /// Sets the value of [reconciling][crate::model::WorkerPool::reconciling].
16177 ///
16178 /// # Example
16179 /// ```ignore,no_run
16180 /// # use google_cloud_run_v2::model::WorkerPool;
16181 /// let x = WorkerPool::new().set_reconciling(true);
16182 /// ```
16183 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16184 self.reconciling = v.into();
16185 self
16186 }
16187
16188 /// Sets the value of [etag][crate::model::WorkerPool::etag].
16189 ///
16190 /// # Example
16191 /// ```ignore,no_run
16192 /// # use google_cloud_run_v2::model::WorkerPool;
16193 /// let x = WorkerPool::new().set_etag("example");
16194 /// ```
16195 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16196 self.etag = v.into();
16197 self
16198 }
16199}
16200
16201impl wkt::message::Message for WorkerPool {
16202 fn typename() -> &'static str {
16203 "type.googleapis.com/google.cloud.run.v2.WorkerPool"
16204 }
16205}
16206
16207/// WorkerPoolRevisionTemplate describes the data a worker pool revision should
16208/// have when created from a template.
16209#[derive(Clone, Default, PartialEq)]
16210#[non_exhaustive]
16211pub struct WorkerPoolRevisionTemplate {
16212 /// Optional. The unique name for the revision. If this field is omitted, it
16213 /// will be automatically generated based on the WorkerPool name.
16214 pub revision: std::string::String,
16215
16216 /// Optional. Unstructured key value map that can be used to organize and
16217 /// categorize objects. User-provided labels are shared with Google's billing
16218 /// system, so they can be used to filter, or break down billing charges by
16219 /// team, component, environment, state, etc. For more information, visit
16220 /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
16221 /// <https://cloud.google.com/run/docs/configuring/labels>.
16222 ///
16223 /// Cloud Run API v2 does not support labels with `run.googleapis.com`,
16224 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16225 /// namespaces, and they will be rejected. All system labels in v1 now have a
16226 /// corresponding field in v2 WorkerPoolRevisionTemplate.
16227 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16228
16229 /// Optional. Unstructured key value map that may be set by external tools to
16230 /// store and arbitrary metadata. They are not queryable and should be
16231 /// preserved when modifying objects.
16232 ///
16233 /// Cloud Run API v2 does not support annotations with `run.googleapis.com`,
16234 /// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
16235 /// namespaces, and they will be rejected. All system annotations in v1 now
16236 /// have a corresponding field in v2 WorkerPoolRevisionTemplate.
16237 ///
16238 /// This field follows Kubernetes annotations' namespacing, limits, and
16239 /// rules.
16240 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
16241
16242 /// Optional. VPC Access configuration to use for this Revision. For more
16243 /// information, visit
16244 /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
16245 pub vpc_access: std::option::Option<crate::model::VpcAccess>,
16246
16247 /// Optional. Email address of the IAM service account associated with the
16248 /// revision of the service. The service account represents the identity of the
16249 /// running revision, and determines what permissions the revision has. If not
16250 /// provided, the revision will use the project's default service account.
16251 pub service_account: std::string::String,
16252
16253 /// Holds list of the containers that defines the unit of execution for this
16254 /// Revision.
16255 pub containers: std::vec::Vec<crate::model::Container>,
16256
16257 /// Optional. A list of Volumes to make available to containers.
16258 pub volumes: std::vec::Vec<crate::model::Volume>,
16259
16260 /// A reference to a customer managed encryption key (CMEK) to use to encrypt
16261 /// this container image. For more information, go to
16262 /// <https://cloud.google.com/run/docs/securing/using-cmek>
16263 pub encryption_key: std::string::String,
16264
16265 /// Optional. Enables service mesh connectivity.
16266 pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
16267
16268 /// Optional. The action to take if the encryption key is revoked.
16269 pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
16270
16271 /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
16272 /// before shutting down all instances. The minimum increment is 1 hour.
16273 pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
16274
16275 /// Optional. The node selector for the revision template.
16276 pub node_selector: std::option::Option<crate::model::NodeSelector>,
16277
16278 /// Optional. True if GPU zonal redundancy is disabled on this worker pool.
16279 pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
16280
16281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16282}
16283
16284impl WorkerPoolRevisionTemplate {
16285 pub fn new() -> Self {
16286 std::default::Default::default()
16287 }
16288
16289 /// Sets the value of [revision][crate::model::WorkerPoolRevisionTemplate::revision].
16290 ///
16291 /// # Example
16292 /// ```ignore,no_run
16293 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16294 /// let x = WorkerPoolRevisionTemplate::new().set_revision("example");
16295 /// ```
16296 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16297 self.revision = v.into();
16298 self
16299 }
16300
16301 /// Sets the value of [labels][crate::model::WorkerPoolRevisionTemplate::labels].
16302 ///
16303 /// # Example
16304 /// ```ignore,no_run
16305 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16306 /// let x = WorkerPoolRevisionTemplate::new().set_labels([
16307 /// ("key0", "abc"),
16308 /// ("key1", "xyz"),
16309 /// ]);
16310 /// ```
16311 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16312 where
16313 T: std::iter::IntoIterator<Item = (K, V)>,
16314 K: std::convert::Into<std::string::String>,
16315 V: std::convert::Into<std::string::String>,
16316 {
16317 use std::iter::Iterator;
16318 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16319 self
16320 }
16321
16322 /// Sets the value of [annotations][crate::model::WorkerPoolRevisionTemplate::annotations].
16323 ///
16324 /// # Example
16325 /// ```ignore,no_run
16326 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16327 /// let x = WorkerPoolRevisionTemplate::new().set_annotations([
16328 /// ("key0", "abc"),
16329 /// ("key1", "xyz"),
16330 /// ]);
16331 /// ```
16332 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
16333 where
16334 T: std::iter::IntoIterator<Item = (K, V)>,
16335 K: std::convert::Into<std::string::String>,
16336 V: std::convert::Into<std::string::String>,
16337 {
16338 use std::iter::Iterator;
16339 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16340 self
16341 }
16342
16343 /// Sets the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16344 ///
16345 /// # Example
16346 /// ```ignore,no_run
16347 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16348 /// use google_cloud_run_v2::model::VpcAccess;
16349 /// let x = WorkerPoolRevisionTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);
16350 /// ```
16351 pub fn set_vpc_access<T>(mut self, v: T) -> Self
16352 where
16353 T: std::convert::Into<crate::model::VpcAccess>,
16354 {
16355 self.vpc_access = std::option::Option::Some(v.into());
16356 self
16357 }
16358
16359 /// Sets or clears the value of [vpc_access][crate::model::WorkerPoolRevisionTemplate::vpc_access].
16360 ///
16361 /// # Example
16362 /// ```ignore,no_run
16363 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16364 /// use google_cloud_run_v2::model::VpcAccess;
16365 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
16366 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);
16367 /// ```
16368 pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
16369 where
16370 T: std::convert::Into<crate::model::VpcAccess>,
16371 {
16372 self.vpc_access = v.map(|x| x.into());
16373 self
16374 }
16375
16376 /// Sets the value of [service_account][crate::model::WorkerPoolRevisionTemplate::service_account].
16377 ///
16378 /// # Example
16379 /// ```ignore,no_run
16380 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16381 /// let x = WorkerPoolRevisionTemplate::new().set_service_account("example");
16382 /// ```
16383 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16384 self.service_account = v.into();
16385 self
16386 }
16387
16388 /// Sets the value of [containers][crate::model::WorkerPoolRevisionTemplate::containers].
16389 ///
16390 /// # Example
16391 /// ```ignore,no_run
16392 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16393 /// use google_cloud_run_v2::model::Container;
16394 /// let x = WorkerPoolRevisionTemplate::new()
16395 /// .set_containers([
16396 /// Container::default()/* use setters */,
16397 /// Container::default()/* use (different) setters */,
16398 /// ]);
16399 /// ```
16400 pub fn set_containers<T, V>(mut self, v: T) -> Self
16401 where
16402 T: std::iter::IntoIterator<Item = V>,
16403 V: std::convert::Into<crate::model::Container>,
16404 {
16405 use std::iter::Iterator;
16406 self.containers = v.into_iter().map(|i| i.into()).collect();
16407 self
16408 }
16409
16410 /// Sets the value of [volumes][crate::model::WorkerPoolRevisionTemplate::volumes].
16411 ///
16412 /// # Example
16413 /// ```ignore,no_run
16414 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16415 /// use google_cloud_run_v2::model::Volume;
16416 /// let x = WorkerPoolRevisionTemplate::new()
16417 /// .set_volumes([
16418 /// Volume::default()/* use setters */,
16419 /// Volume::default()/* use (different) setters */,
16420 /// ]);
16421 /// ```
16422 pub fn set_volumes<T, V>(mut self, v: T) -> Self
16423 where
16424 T: std::iter::IntoIterator<Item = V>,
16425 V: std::convert::Into<crate::model::Volume>,
16426 {
16427 use std::iter::Iterator;
16428 self.volumes = v.into_iter().map(|i| i.into()).collect();
16429 self
16430 }
16431
16432 /// Sets the value of [encryption_key][crate::model::WorkerPoolRevisionTemplate::encryption_key].
16433 ///
16434 /// # Example
16435 /// ```ignore,no_run
16436 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16437 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key("example");
16438 /// ```
16439 pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16440 self.encryption_key = v.into();
16441 self
16442 }
16443
16444 /// Sets the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16445 ///
16446 /// # Example
16447 /// ```ignore,no_run
16448 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16449 /// use google_cloud_run_v2::model::ServiceMesh;
16450 /// let x = WorkerPoolRevisionTemplate::new().set_service_mesh(ServiceMesh::default()/* use setters */);
16451 /// ```
16452 pub fn set_service_mesh<T>(mut self, v: T) -> Self
16453 where
16454 T: std::convert::Into<crate::model::ServiceMesh>,
16455 {
16456 self.service_mesh = std::option::Option::Some(v.into());
16457 self
16458 }
16459
16460 /// Sets or clears the value of [service_mesh][crate::model::WorkerPoolRevisionTemplate::service_mesh].
16461 ///
16462 /// # Example
16463 /// ```ignore,no_run
16464 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16465 /// use google_cloud_run_v2::model::ServiceMesh;
16466 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(Some(ServiceMesh::default()/* use setters */));
16467 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_service_mesh(None::<ServiceMesh>);
16468 /// ```
16469 pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
16470 where
16471 T: std::convert::Into<crate::model::ServiceMesh>,
16472 {
16473 self.service_mesh = v.map(|x| x.into());
16474 self
16475 }
16476
16477 /// Sets the value of [encryption_key_revocation_action][crate::model::WorkerPoolRevisionTemplate::encryption_key_revocation_action].
16478 ///
16479 /// # Example
16480 /// ```ignore,no_run
16481 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16482 /// use google_cloud_run_v2::model::EncryptionKeyRevocationAction;
16483 /// let x0 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::PreventNew);
16484 /// let x1 = WorkerPoolRevisionTemplate::new().set_encryption_key_revocation_action(EncryptionKeyRevocationAction::Shutdown);
16485 /// ```
16486 pub fn set_encryption_key_revocation_action<
16487 T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
16488 >(
16489 mut self,
16490 v: T,
16491 ) -> Self {
16492 self.encryption_key_revocation_action = v.into();
16493 self
16494 }
16495
16496 /// Sets the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16497 ///
16498 /// # Example
16499 /// ```ignore,no_run
16500 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16501 /// use wkt::Duration;
16502 /// let x = WorkerPoolRevisionTemplate::new().set_encryption_key_shutdown_duration(Duration::default()/* use setters */);
16503 /// ```
16504 pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
16505 where
16506 T: std::convert::Into<wkt::Duration>,
16507 {
16508 self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
16509 self
16510 }
16511
16512 /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::WorkerPoolRevisionTemplate::encryption_key_shutdown_duration].
16513 ///
16514 /// # Example
16515 /// ```ignore,no_run
16516 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16517 /// use wkt::Duration;
16518 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(Some(Duration::default()/* use setters */));
16519 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_encryption_key_shutdown_duration(None::<Duration>);
16520 /// ```
16521 pub fn set_or_clear_encryption_key_shutdown_duration<T>(
16522 mut self,
16523 v: std::option::Option<T>,
16524 ) -> Self
16525 where
16526 T: std::convert::Into<wkt::Duration>,
16527 {
16528 self.encryption_key_shutdown_duration = v.map(|x| x.into());
16529 self
16530 }
16531
16532 /// Sets the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16533 ///
16534 /// # Example
16535 /// ```ignore,no_run
16536 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16537 /// use google_cloud_run_v2::model::NodeSelector;
16538 /// let x = WorkerPoolRevisionTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);
16539 /// ```
16540 pub fn set_node_selector<T>(mut self, v: T) -> Self
16541 where
16542 T: std::convert::Into<crate::model::NodeSelector>,
16543 {
16544 self.node_selector = std::option::Option::Some(v.into());
16545 self
16546 }
16547
16548 /// Sets or clears the value of [node_selector][crate::model::WorkerPoolRevisionTemplate::node_selector].
16549 ///
16550 /// # Example
16551 /// ```ignore,no_run
16552 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16553 /// use google_cloud_run_v2::model::NodeSelector;
16554 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
16555 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);
16556 /// ```
16557 pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
16558 where
16559 T: std::convert::Into<crate::model::NodeSelector>,
16560 {
16561 self.node_selector = v.map(|x| x.into());
16562 self
16563 }
16564
16565 /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16566 ///
16567 /// # Example
16568 /// ```ignore,no_run
16569 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16570 /// let x = WorkerPoolRevisionTemplate::new().set_gpu_zonal_redundancy_disabled(true);
16571 /// ```
16572 pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
16573 where
16574 T: std::convert::Into<bool>,
16575 {
16576 self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
16577 self
16578 }
16579
16580 /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::WorkerPoolRevisionTemplate::gpu_zonal_redundancy_disabled].
16581 ///
16582 /// # Example
16583 /// ```ignore,no_run
16584 /// # use google_cloud_run_v2::model::WorkerPoolRevisionTemplate;
16585 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
16586 /// let x = WorkerPoolRevisionTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);
16587 /// ```
16588 pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
16589 mut self,
16590 v: std::option::Option<T>,
16591 ) -> Self
16592 where
16593 T: std::convert::Into<bool>,
16594 {
16595 self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
16596 self
16597 }
16598}
16599
16600impl wkt::message::Message for WorkerPoolRevisionTemplate {
16601 fn typename() -> &'static str {
16602 "type.googleapis.com/google.cloud.run.v2.WorkerPoolRevisionTemplate"
16603 }
16604}
16605
16606/// The type of instance split allocation.
16607///
16608/// # Working with unknown values
16609///
16610/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16611/// additional enum variants at any time. Adding new variants is not considered
16612/// a breaking change. Applications should write their code in anticipation of:
16613///
16614/// - New values appearing in future releases of the client library, **and**
16615/// - New values received dynamically, without application changes.
16616///
16617/// Please consult the [Working with enums] section in the user guide for some
16618/// guidelines.
16619///
16620/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16621#[derive(Clone, Debug, PartialEq)]
16622#[non_exhaustive]
16623pub enum InstanceSplitAllocationType {
16624 /// Unspecified instance allocation type.
16625 Unspecified,
16626 /// Allocates instances to the Service's latest ready Revision.
16627 Latest,
16628 /// Allocates instances to a Revision by name.
16629 Revision,
16630 /// If set, the enum was initialized with an unknown value.
16631 ///
16632 /// Applications can examine the value using [InstanceSplitAllocationType::value] or
16633 /// [InstanceSplitAllocationType::name].
16634 UnknownValue(instance_split_allocation_type::UnknownValue),
16635}
16636
16637#[doc(hidden)]
16638pub mod instance_split_allocation_type {
16639 #[allow(unused_imports)]
16640 use super::*;
16641 #[derive(Clone, Debug, PartialEq)]
16642 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16643}
16644
16645impl InstanceSplitAllocationType {
16646 /// Gets the enum value.
16647 ///
16648 /// Returns `None` if the enum contains an unknown value deserialized from
16649 /// the string representation of enums.
16650 pub fn value(&self) -> std::option::Option<i32> {
16651 match self {
16652 Self::Unspecified => std::option::Option::Some(0),
16653 Self::Latest => std::option::Option::Some(1),
16654 Self::Revision => std::option::Option::Some(2),
16655 Self::UnknownValue(u) => u.0.value(),
16656 }
16657 }
16658
16659 /// Gets the enum value as a string.
16660 ///
16661 /// Returns `None` if the enum contains an unknown value deserialized from
16662 /// the integer representation of enums.
16663 pub fn name(&self) -> std::option::Option<&str> {
16664 match self {
16665 Self::Unspecified => {
16666 std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED")
16667 }
16668 Self::Latest => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST"),
16669 Self::Revision => std::option::Option::Some("INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION"),
16670 Self::UnknownValue(u) => u.0.name(),
16671 }
16672 }
16673}
16674
16675impl std::default::Default for InstanceSplitAllocationType {
16676 fn default() -> Self {
16677 use std::convert::From;
16678 Self::from(0)
16679 }
16680}
16681
16682impl std::fmt::Display for InstanceSplitAllocationType {
16683 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16684 wkt::internal::display_enum(f, self.name(), self.value())
16685 }
16686}
16687
16688impl std::convert::From<i32> for InstanceSplitAllocationType {
16689 fn from(value: i32) -> Self {
16690 match value {
16691 0 => Self::Unspecified,
16692 1 => Self::Latest,
16693 2 => Self::Revision,
16694 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16695 wkt::internal::UnknownEnumValue::Integer(value),
16696 )),
16697 }
16698 }
16699}
16700
16701impl std::convert::From<&str> for InstanceSplitAllocationType {
16702 fn from(value: &str) -> Self {
16703 use std::string::ToString;
16704 match value {
16705 "INSTANCE_SPLIT_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16706 "INSTANCE_SPLIT_ALLOCATION_TYPE_LATEST" => Self::Latest,
16707 "INSTANCE_SPLIT_ALLOCATION_TYPE_REVISION" => Self::Revision,
16708 _ => Self::UnknownValue(instance_split_allocation_type::UnknownValue(
16709 wkt::internal::UnknownEnumValue::String(value.to_string()),
16710 )),
16711 }
16712 }
16713}
16714
16715impl serde::ser::Serialize for InstanceSplitAllocationType {
16716 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16717 where
16718 S: serde::Serializer,
16719 {
16720 match self {
16721 Self::Unspecified => serializer.serialize_i32(0),
16722 Self::Latest => serializer.serialize_i32(1),
16723 Self::Revision => serializer.serialize_i32(2),
16724 Self::UnknownValue(u) => u.0.serialize(serializer),
16725 }
16726 }
16727}
16728
16729impl<'de> serde::de::Deserialize<'de> for InstanceSplitAllocationType {
16730 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16731 where
16732 D: serde::Deserializer<'de>,
16733 {
16734 deserializer.deserialize_any(
16735 wkt::internal::EnumVisitor::<InstanceSplitAllocationType>::new(
16736 ".google.cloud.run.v2.InstanceSplitAllocationType",
16737 ),
16738 )
16739 }
16740}
16741
16742/// The type of instance allocation.
16743///
16744/// # Working with unknown values
16745///
16746/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16747/// additional enum variants at any time. Adding new variants is not considered
16748/// a breaking change. Applications should write their code in anticipation of:
16749///
16750/// - New values appearing in future releases of the client library, **and**
16751/// - New values received dynamically, without application changes.
16752///
16753/// Please consult the [Working with enums] section in the user guide for some
16754/// guidelines.
16755///
16756/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16757#[derive(Clone, Debug, PartialEq)]
16758#[non_exhaustive]
16759pub enum TrafficTargetAllocationType {
16760 /// Unspecified instance allocation type.
16761 Unspecified,
16762 /// Allocates instances to the Service's latest ready Revision.
16763 Latest,
16764 /// Allocates instances to a Revision by name.
16765 Revision,
16766 /// If set, the enum was initialized with an unknown value.
16767 ///
16768 /// Applications can examine the value using [TrafficTargetAllocationType::value] or
16769 /// [TrafficTargetAllocationType::name].
16770 UnknownValue(traffic_target_allocation_type::UnknownValue),
16771}
16772
16773#[doc(hidden)]
16774pub mod traffic_target_allocation_type {
16775 #[allow(unused_imports)]
16776 use super::*;
16777 #[derive(Clone, Debug, PartialEq)]
16778 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16779}
16780
16781impl TrafficTargetAllocationType {
16782 /// Gets the enum value.
16783 ///
16784 /// Returns `None` if the enum contains an unknown value deserialized from
16785 /// the string representation of enums.
16786 pub fn value(&self) -> std::option::Option<i32> {
16787 match self {
16788 Self::Unspecified => std::option::Option::Some(0),
16789 Self::Latest => std::option::Option::Some(1),
16790 Self::Revision => std::option::Option::Some(2),
16791 Self::UnknownValue(u) => u.0.value(),
16792 }
16793 }
16794
16795 /// Gets the enum value as a string.
16796 ///
16797 /// Returns `None` if the enum contains an unknown value deserialized from
16798 /// the integer representation of enums.
16799 pub fn name(&self) -> std::option::Option<&str> {
16800 match self {
16801 Self::Unspecified => {
16802 std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED")
16803 }
16804 Self::Latest => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
16805 Self::Revision => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"),
16806 Self::UnknownValue(u) => u.0.name(),
16807 }
16808 }
16809}
16810
16811impl std::default::Default for TrafficTargetAllocationType {
16812 fn default() -> Self {
16813 use std::convert::From;
16814 Self::from(0)
16815 }
16816}
16817
16818impl std::fmt::Display for TrafficTargetAllocationType {
16819 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16820 wkt::internal::display_enum(f, self.name(), self.value())
16821 }
16822}
16823
16824impl std::convert::From<i32> for TrafficTargetAllocationType {
16825 fn from(value: i32) -> Self {
16826 match value {
16827 0 => Self::Unspecified,
16828 1 => Self::Latest,
16829 2 => Self::Revision,
16830 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
16831 wkt::internal::UnknownEnumValue::Integer(value),
16832 )),
16833 }
16834 }
16835}
16836
16837impl std::convert::From<&str> for TrafficTargetAllocationType {
16838 fn from(value: &str) -> Self {
16839 use std::string::ToString;
16840 match value {
16841 "TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16842 "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST" => Self::Latest,
16843 "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION" => Self::Revision,
16844 _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
16845 wkt::internal::UnknownEnumValue::String(value.to_string()),
16846 )),
16847 }
16848 }
16849}
16850
16851impl serde::ser::Serialize for TrafficTargetAllocationType {
16852 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16853 where
16854 S: serde::Serializer,
16855 {
16856 match self {
16857 Self::Unspecified => serializer.serialize_i32(0),
16858 Self::Latest => serializer.serialize_i32(1),
16859 Self::Revision => serializer.serialize_i32(2),
16860 Self::UnknownValue(u) => u.0.serialize(serializer),
16861 }
16862 }
16863}
16864
16865impl<'de> serde::de::Deserialize<'de> for TrafficTargetAllocationType {
16866 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16867 where
16868 D: serde::Deserializer<'de>,
16869 {
16870 deserializer.deserialize_any(
16871 wkt::internal::EnumVisitor::<TrafficTargetAllocationType>::new(
16872 ".google.cloud.run.v2.TrafficTargetAllocationType",
16873 ),
16874 )
16875 }
16876}
16877
16878/// Allowed ingress traffic for the Container.
16879///
16880/// # Working with unknown values
16881///
16882/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16883/// additional enum variants at any time. Adding new variants is not considered
16884/// a breaking change. Applications should write their code in anticipation of:
16885///
16886/// - New values appearing in future releases of the client library, **and**
16887/// - New values received dynamically, without application changes.
16888///
16889/// Please consult the [Working with enums] section in the user guide for some
16890/// guidelines.
16891///
16892/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16893#[derive(Clone, Debug, PartialEq)]
16894#[non_exhaustive]
16895pub enum IngressTraffic {
16896 /// Unspecified
16897 Unspecified,
16898 /// All inbound traffic is allowed.
16899 All,
16900 /// Only internal traffic is allowed.
16901 InternalOnly,
16902 /// Both internal and Google Cloud Load Balancer traffic is allowed.
16903 InternalLoadBalancer,
16904 /// No ingress traffic is allowed.
16905 None,
16906 /// If set, the enum was initialized with an unknown value.
16907 ///
16908 /// Applications can examine the value using [IngressTraffic::value] or
16909 /// [IngressTraffic::name].
16910 UnknownValue(ingress_traffic::UnknownValue),
16911}
16912
16913#[doc(hidden)]
16914pub mod ingress_traffic {
16915 #[allow(unused_imports)]
16916 use super::*;
16917 #[derive(Clone, Debug, PartialEq)]
16918 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16919}
16920
16921impl IngressTraffic {
16922 /// Gets the enum value.
16923 ///
16924 /// Returns `None` if the enum contains an unknown value deserialized from
16925 /// the string representation of enums.
16926 pub fn value(&self) -> std::option::Option<i32> {
16927 match self {
16928 Self::Unspecified => std::option::Option::Some(0),
16929 Self::All => std::option::Option::Some(1),
16930 Self::InternalOnly => std::option::Option::Some(2),
16931 Self::InternalLoadBalancer => std::option::Option::Some(3),
16932 Self::None => std::option::Option::Some(4),
16933 Self::UnknownValue(u) => u.0.value(),
16934 }
16935 }
16936
16937 /// Gets the enum value as a string.
16938 ///
16939 /// Returns `None` if the enum contains an unknown value deserialized from
16940 /// the integer representation of enums.
16941 pub fn name(&self) -> std::option::Option<&str> {
16942 match self {
16943 Self::Unspecified => std::option::Option::Some("INGRESS_TRAFFIC_UNSPECIFIED"),
16944 Self::All => std::option::Option::Some("INGRESS_TRAFFIC_ALL"),
16945 Self::InternalOnly => std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_ONLY"),
16946 Self::InternalLoadBalancer => {
16947 std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER")
16948 }
16949 Self::None => std::option::Option::Some("INGRESS_TRAFFIC_NONE"),
16950 Self::UnknownValue(u) => u.0.name(),
16951 }
16952 }
16953}
16954
16955impl std::default::Default for IngressTraffic {
16956 fn default() -> Self {
16957 use std::convert::From;
16958 Self::from(0)
16959 }
16960}
16961
16962impl std::fmt::Display for IngressTraffic {
16963 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16964 wkt::internal::display_enum(f, self.name(), self.value())
16965 }
16966}
16967
16968impl std::convert::From<i32> for IngressTraffic {
16969 fn from(value: i32) -> Self {
16970 match value {
16971 0 => Self::Unspecified,
16972 1 => Self::All,
16973 2 => Self::InternalOnly,
16974 3 => Self::InternalLoadBalancer,
16975 4 => Self::None,
16976 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
16977 wkt::internal::UnknownEnumValue::Integer(value),
16978 )),
16979 }
16980 }
16981}
16982
16983impl std::convert::From<&str> for IngressTraffic {
16984 fn from(value: &str) -> Self {
16985 use std::string::ToString;
16986 match value {
16987 "INGRESS_TRAFFIC_UNSPECIFIED" => Self::Unspecified,
16988 "INGRESS_TRAFFIC_ALL" => Self::All,
16989 "INGRESS_TRAFFIC_INTERNAL_ONLY" => Self::InternalOnly,
16990 "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER" => Self::InternalLoadBalancer,
16991 "INGRESS_TRAFFIC_NONE" => Self::None,
16992 _ => Self::UnknownValue(ingress_traffic::UnknownValue(
16993 wkt::internal::UnknownEnumValue::String(value.to_string()),
16994 )),
16995 }
16996 }
16997}
16998
16999impl serde::ser::Serialize for IngressTraffic {
17000 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17001 where
17002 S: serde::Serializer,
17003 {
17004 match self {
17005 Self::Unspecified => serializer.serialize_i32(0),
17006 Self::All => serializer.serialize_i32(1),
17007 Self::InternalOnly => serializer.serialize_i32(2),
17008 Self::InternalLoadBalancer => serializer.serialize_i32(3),
17009 Self::None => serializer.serialize_i32(4),
17010 Self::UnknownValue(u) => u.0.serialize(serializer),
17011 }
17012 }
17013}
17014
17015impl<'de> serde::de::Deserialize<'de> for IngressTraffic {
17016 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17017 where
17018 D: serde::Deserializer<'de>,
17019 {
17020 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressTraffic>::new(
17021 ".google.cloud.run.v2.IngressTraffic",
17022 ))
17023 }
17024}
17025
17026/// Alternatives for execution environments.
17027///
17028/// # Working with unknown values
17029///
17030/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17031/// additional enum variants at any time. Adding new variants is not considered
17032/// a breaking change. Applications should write their code in anticipation of:
17033///
17034/// - New values appearing in future releases of the client library, **and**
17035/// - New values received dynamically, without application changes.
17036///
17037/// Please consult the [Working with enums] section in the user guide for some
17038/// guidelines.
17039///
17040/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17041#[derive(Clone, Debug, PartialEq)]
17042#[non_exhaustive]
17043pub enum ExecutionEnvironment {
17044 /// Unspecified
17045 Unspecified,
17046 /// Uses the First Generation environment.
17047 Gen1,
17048 /// Uses Second Generation environment.
17049 Gen2,
17050 /// If set, the enum was initialized with an unknown value.
17051 ///
17052 /// Applications can examine the value using [ExecutionEnvironment::value] or
17053 /// [ExecutionEnvironment::name].
17054 UnknownValue(execution_environment::UnknownValue),
17055}
17056
17057#[doc(hidden)]
17058pub mod execution_environment {
17059 #[allow(unused_imports)]
17060 use super::*;
17061 #[derive(Clone, Debug, PartialEq)]
17062 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17063}
17064
17065impl ExecutionEnvironment {
17066 /// Gets the enum value.
17067 ///
17068 /// Returns `None` if the enum contains an unknown value deserialized from
17069 /// the string representation of enums.
17070 pub fn value(&self) -> std::option::Option<i32> {
17071 match self {
17072 Self::Unspecified => std::option::Option::Some(0),
17073 Self::Gen1 => std::option::Option::Some(1),
17074 Self::Gen2 => std::option::Option::Some(2),
17075 Self::UnknownValue(u) => u.0.value(),
17076 }
17077 }
17078
17079 /// Gets the enum value as a string.
17080 ///
17081 /// Returns `None` if the enum contains an unknown value deserialized from
17082 /// the integer representation of enums.
17083 pub fn name(&self) -> std::option::Option<&str> {
17084 match self {
17085 Self::Unspecified => std::option::Option::Some("EXECUTION_ENVIRONMENT_UNSPECIFIED"),
17086 Self::Gen1 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN1"),
17087 Self::Gen2 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN2"),
17088 Self::UnknownValue(u) => u.0.name(),
17089 }
17090 }
17091}
17092
17093impl std::default::Default for ExecutionEnvironment {
17094 fn default() -> Self {
17095 use std::convert::From;
17096 Self::from(0)
17097 }
17098}
17099
17100impl std::fmt::Display for ExecutionEnvironment {
17101 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17102 wkt::internal::display_enum(f, self.name(), self.value())
17103 }
17104}
17105
17106impl std::convert::From<i32> for ExecutionEnvironment {
17107 fn from(value: i32) -> Self {
17108 match value {
17109 0 => Self::Unspecified,
17110 1 => Self::Gen1,
17111 2 => Self::Gen2,
17112 _ => Self::UnknownValue(execution_environment::UnknownValue(
17113 wkt::internal::UnknownEnumValue::Integer(value),
17114 )),
17115 }
17116 }
17117}
17118
17119impl std::convert::From<&str> for ExecutionEnvironment {
17120 fn from(value: &str) -> Self {
17121 use std::string::ToString;
17122 match value {
17123 "EXECUTION_ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
17124 "EXECUTION_ENVIRONMENT_GEN1" => Self::Gen1,
17125 "EXECUTION_ENVIRONMENT_GEN2" => Self::Gen2,
17126 _ => Self::UnknownValue(execution_environment::UnknownValue(
17127 wkt::internal::UnknownEnumValue::String(value.to_string()),
17128 )),
17129 }
17130 }
17131}
17132
17133impl serde::ser::Serialize for ExecutionEnvironment {
17134 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17135 where
17136 S: serde::Serializer,
17137 {
17138 match self {
17139 Self::Unspecified => serializer.serialize_i32(0),
17140 Self::Gen1 => serializer.serialize_i32(1),
17141 Self::Gen2 => serializer.serialize_i32(2),
17142 Self::UnknownValue(u) => u.0.serialize(serializer),
17143 }
17144 }
17145}
17146
17147impl<'de> serde::de::Deserialize<'de> for ExecutionEnvironment {
17148 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17149 where
17150 D: serde::Deserializer<'de>,
17151 {
17152 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionEnvironment>::new(
17153 ".google.cloud.run.v2.ExecutionEnvironment",
17154 ))
17155 }
17156}
17157
17158/// Specifies behavior if an encryption key used by a resource is revoked.
17159///
17160/// # Working with unknown values
17161///
17162/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17163/// additional enum variants at any time. Adding new variants is not considered
17164/// a breaking change. Applications should write their code in anticipation of:
17165///
17166/// - New values appearing in future releases of the client library, **and**
17167/// - New values received dynamically, without application changes.
17168///
17169/// Please consult the [Working with enums] section in the user guide for some
17170/// guidelines.
17171///
17172/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17173#[derive(Clone, Debug, PartialEq)]
17174#[non_exhaustive]
17175pub enum EncryptionKeyRevocationAction {
17176 /// Unspecified
17177 Unspecified,
17178 /// Prevents the creation of new instances.
17179 PreventNew,
17180 /// Shuts down existing instances, and prevents creation of new ones.
17181 Shutdown,
17182 /// If set, the enum was initialized with an unknown value.
17183 ///
17184 /// Applications can examine the value using [EncryptionKeyRevocationAction::value] or
17185 /// [EncryptionKeyRevocationAction::name].
17186 UnknownValue(encryption_key_revocation_action::UnknownValue),
17187}
17188
17189#[doc(hidden)]
17190pub mod encryption_key_revocation_action {
17191 #[allow(unused_imports)]
17192 use super::*;
17193 #[derive(Clone, Debug, PartialEq)]
17194 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17195}
17196
17197impl EncryptionKeyRevocationAction {
17198 /// Gets the enum value.
17199 ///
17200 /// Returns `None` if the enum contains an unknown value deserialized from
17201 /// the string representation of enums.
17202 pub fn value(&self) -> std::option::Option<i32> {
17203 match self {
17204 Self::Unspecified => std::option::Option::Some(0),
17205 Self::PreventNew => std::option::Option::Some(1),
17206 Self::Shutdown => std::option::Option::Some(2),
17207 Self::UnknownValue(u) => u.0.value(),
17208 }
17209 }
17210
17211 /// Gets the enum value as a string.
17212 ///
17213 /// Returns `None` if the enum contains an unknown value deserialized from
17214 /// the integer representation of enums.
17215 pub fn name(&self) -> std::option::Option<&str> {
17216 match self {
17217 Self::Unspecified => {
17218 std::option::Option::Some("ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED")
17219 }
17220 Self::PreventNew => std::option::Option::Some("PREVENT_NEW"),
17221 Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
17222 Self::UnknownValue(u) => u.0.name(),
17223 }
17224 }
17225}
17226
17227impl std::default::Default for EncryptionKeyRevocationAction {
17228 fn default() -> Self {
17229 use std::convert::From;
17230 Self::from(0)
17231 }
17232}
17233
17234impl std::fmt::Display for EncryptionKeyRevocationAction {
17235 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17236 wkt::internal::display_enum(f, self.name(), self.value())
17237 }
17238}
17239
17240impl std::convert::From<i32> for EncryptionKeyRevocationAction {
17241 fn from(value: i32) -> Self {
17242 match value {
17243 0 => Self::Unspecified,
17244 1 => Self::PreventNew,
17245 2 => Self::Shutdown,
17246 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17247 wkt::internal::UnknownEnumValue::Integer(value),
17248 )),
17249 }
17250 }
17251}
17252
17253impl std::convert::From<&str> for EncryptionKeyRevocationAction {
17254 fn from(value: &str) -> Self {
17255 use std::string::ToString;
17256 match value {
17257 "ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED" => Self::Unspecified,
17258 "PREVENT_NEW" => Self::PreventNew,
17259 "SHUTDOWN" => Self::Shutdown,
17260 _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
17261 wkt::internal::UnknownEnumValue::String(value.to_string()),
17262 )),
17263 }
17264 }
17265}
17266
17267impl serde::ser::Serialize for EncryptionKeyRevocationAction {
17268 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17269 where
17270 S: serde::Serializer,
17271 {
17272 match self {
17273 Self::Unspecified => serializer.serialize_i32(0),
17274 Self::PreventNew => serializer.serialize_i32(1),
17275 Self::Shutdown => serializer.serialize_i32(2),
17276 Self::UnknownValue(u) => u.0.serialize(serializer),
17277 }
17278 }
17279}
17280
17281impl<'de> serde::de::Deserialize<'de> for EncryptionKeyRevocationAction {
17282 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17283 where
17284 D: serde::Deserializer<'de>,
17285 {
17286 deserializer.deserialize_any(
17287 wkt::internal::EnumVisitor::<EncryptionKeyRevocationAction>::new(
17288 ".google.cloud.run.v2.EncryptionKeyRevocationAction",
17289 ),
17290 )
17291 }
17292}