google_cloud_build_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate lazy_static;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
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/// Returns the default service account that will be used for `Builds`.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct GetDefaultServiceAccountRequest {
44 /// Required. The name of the `DefaultServiceAccount` to retrieve.
45 /// Format:
46 /// `projects/{project}/locations/{location}/defaultServiceAccount`
47 pub name: std::string::String,
48
49 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
50}
51
52impl GetDefaultServiceAccountRequest {
53 pub fn new() -> Self {
54 std::default::Default::default()
55 }
56
57 /// Sets the value of [name][crate::model::GetDefaultServiceAccountRequest::name].
58 ///
59 /// # Example
60 /// ```ignore,no_run
61 /// # use google_cloud_build_v1::model::GetDefaultServiceAccountRequest;
62 /// let x = GetDefaultServiceAccountRequest::new().set_name("example");
63 /// ```
64 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
65 self.name = v.into();
66 self
67 }
68}
69
70impl wkt::message::Message for GetDefaultServiceAccountRequest {
71 fn typename() -> &'static str {
72 "type.googleapis.com/google.devtools.cloudbuild.v1.GetDefaultServiceAccountRequest"
73 }
74}
75
76/// The default service account used for `Builds`.
77#[derive(Clone, Default, PartialEq)]
78#[non_exhaustive]
79pub struct DefaultServiceAccount {
80 /// Identifier. Format:
81 /// `projects/{project}/locations/{location}/defaultServiceAccount`
82 pub name: std::string::String,
83
84 /// Output only. The email address of the service account identity that will be
85 /// used for a build by default.
86 ///
87 /// This is returned in the format
88 /// `projects/{project}/serviceAccounts/{service_account}` where
89 /// `{service_account}` could be the legacy Cloud Build SA, in the format
90 /// [PROJECT_NUMBER]@cloudbuild.gserviceaccount.com or the Compute SA, in the
91 /// format [PROJECT_NUMBER]-compute@developer.gserviceaccount.com.
92 ///
93 /// If no service account will be used by default, this will be empty.
94 pub service_account_email: std::string::String,
95
96 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
97}
98
99impl DefaultServiceAccount {
100 pub fn new() -> Self {
101 std::default::Default::default()
102 }
103
104 /// Sets the value of [name][crate::model::DefaultServiceAccount::name].
105 ///
106 /// # Example
107 /// ```ignore,no_run
108 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
109 /// let x = DefaultServiceAccount::new().set_name("example");
110 /// ```
111 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
112 self.name = v.into();
113 self
114 }
115
116 /// Sets the value of [service_account_email][crate::model::DefaultServiceAccount::service_account_email].
117 ///
118 /// # Example
119 /// ```ignore,no_run
120 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
121 /// let x = DefaultServiceAccount::new().set_service_account_email("example");
122 /// ```
123 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
124 mut self,
125 v: T,
126 ) -> Self {
127 self.service_account_email = v.into();
128 self
129 }
130}
131
132impl wkt::message::Message for DefaultServiceAccount {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.devtools.cloudbuild.v1.DefaultServiceAccount"
135 }
136}
137
138/// Specifies a build to retry.
139#[derive(Clone, Default, PartialEq)]
140#[non_exhaustive]
141pub struct RetryBuildRequest {
142 /// The name of the `Build` to retry.
143 /// Format: `projects/{project}/locations/{location}/builds/{build}`
144 pub name: std::string::String,
145
146 /// Required. ID of the project.
147 pub project_id: std::string::String,
148
149 /// Required. Build ID of the original build.
150 pub id: std::string::String,
151
152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
153}
154
155impl RetryBuildRequest {
156 pub fn new() -> Self {
157 std::default::Default::default()
158 }
159
160 /// Sets the value of [name][crate::model::RetryBuildRequest::name].
161 ///
162 /// # Example
163 /// ```ignore,no_run
164 /// # use google_cloud_build_v1::model::RetryBuildRequest;
165 /// let x = RetryBuildRequest::new().set_name("example");
166 /// ```
167 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
168 self.name = v.into();
169 self
170 }
171
172 /// Sets the value of [project_id][crate::model::RetryBuildRequest::project_id].
173 ///
174 /// # Example
175 /// ```ignore,no_run
176 /// # use google_cloud_build_v1::model::RetryBuildRequest;
177 /// let x = RetryBuildRequest::new().set_project_id("example");
178 /// ```
179 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
180 self.project_id = v.into();
181 self
182 }
183
184 /// Sets the value of [id][crate::model::RetryBuildRequest::id].
185 ///
186 /// # Example
187 /// ```ignore,no_run
188 /// # use google_cloud_build_v1::model::RetryBuildRequest;
189 /// let x = RetryBuildRequest::new().set_id("example");
190 /// ```
191 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
192 self.id = v.into();
193 self
194 }
195}
196
197impl wkt::message::Message for RetryBuildRequest {
198 fn typename() -> &'static str {
199 "type.googleapis.com/google.devtools.cloudbuild.v1.RetryBuildRequest"
200 }
201}
202
203/// Specifies a build trigger to run and the source to use.
204#[derive(Clone, Default, PartialEq)]
205#[non_exhaustive]
206pub struct RunBuildTriggerRequest {
207 /// The name of the `Trigger` to run.
208 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
209 pub name: std::string::String,
210
211 /// Required. ID of the project.
212 pub project_id: std::string::String,
213
214 /// Required. ID of the trigger.
215 pub trigger_id: std::string::String,
216
217 /// Source to build against this trigger.
218 /// Branch and tag names cannot consist of regular expressions.
219 pub source: std::option::Option<crate::model::RepoSource>,
220
221 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
222}
223
224impl RunBuildTriggerRequest {
225 pub fn new() -> Self {
226 std::default::Default::default()
227 }
228
229 /// Sets the value of [name][crate::model::RunBuildTriggerRequest::name].
230 ///
231 /// # Example
232 /// ```ignore,no_run
233 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
234 /// let x = RunBuildTriggerRequest::new().set_name("example");
235 /// ```
236 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
237 self.name = v.into();
238 self
239 }
240
241 /// Sets the value of [project_id][crate::model::RunBuildTriggerRequest::project_id].
242 ///
243 /// # Example
244 /// ```ignore,no_run
245 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
246 /// let x = RunBuildTriggerRequest::new().set_project_id("example");
247 /// ```
248 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
249 self.project_id = v.into();
250 self
251 }
252
253 /// Sets the value of [trigger_id][crate::model::RunBuildTriggerRequest::trigger_id].
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
258 /// let x = RunBuildTriggerRequest::new().set_trigger_id("example");
259 /// ```
260 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
261 self.trigger_id = v.into();
262 self
263 }
264
265 /// Sets the value of [source][crate::model::RunBuildTriggerRequest::source].
266 ///
267 /// # Example
268 /// ```ignore,no_run
269 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
270 /// use google_cloud_build_v1::model::RepoSource;
271 /// let x = RunBuildTriggerRequest::new().set_source(RepoSource::default()/* use setters */);
272 /// ```
273 pub fn set_source<T>(mut self, v: T) -> Self
274 where
275 T: std::convert::Into<crate::model::RepoSource>,
276 {
277 self.source = std::option::Option::Some(v.into());
278 self
279 }
280
281 /// Sets or clears the value of [source][crate::model::RunBuildTriggerRequest::source].
282 ///
283 /// # Example
284 /// ```ignore,no_run
285 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
286 /// use google_cloud_build_v1::model::RepoSource;
287 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(Some(RepoSource::default()/* use setters */));
288 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(None::<RepoSource>);
289 /// ```
290 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
291 where
292 T: std::convert::Into<crate::model::RepoSource>,
293 {
294 self.source = v.map(|x| x.into());
295 self
296 }
297}
298
299impl wkt::message::Message for RunBuildTriggerRequest {
300 fn typename() -> &'static str {
301 "type.googleapis.com/google.devtools.cloudbuild.v1.RunBuildTriggerRequest"
302 }
303}
304
305/// Location of the source in an archive file in Cloud Storage.
306#[derive(Clone, Default, PartialEq)]
307#[non_exhaustive]
308pub struct StorageSource {
309 /// Cloud Storage bucket containing the source (see
310 /// [Bucket Name
311 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
312 pub bucket: std::string::String,
313
314 /// Required. Cloud Storage object containing the source.
315 ///
316 /// This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`)
317 /// containing source to build.
318 pub object: std::string::String,
319
320 /// Optional. Cloud Storage generation for the object. If the generation is
321 /// omitted, the latest generation will be used.
322 pub generation: i64,
323
324 /// Optional. Option to specify the tool to fetch the source file for the
325 /// build.
326 pub source_fetcher: crate::model::storage_source::SourceFetcher,
327
328 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
329}
330
331impl StorageSource {
332 pub fn new() -> Self {
333 std::default::Default::default()
334 }
335
336 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
337 ///
338 /// # Example
339 /// ```ignore,no_run
340 /// # use google_cloud_build_v1::model::StorageSource;
341 /// let x = StorageSource::new().set_bucket("example");
342 /// ```
343 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
344 self.bucket = v.into();
345 self
346 }
347
348 /// Sets the value of [object][crate::model::StorageSource::object].
349 ///
350 /// # Example
351 /// ```ignore,no_run
352 /// # use google_cloud_build_v1::model::StorageSource;
353 /// let x = StorageSource::new().set_object("example");
354 /// ```
355 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
356 self.object = v.into();
357 self
358 }
359
360 /// Sets the value of [generation][crate::model::StorageSource::generation].
361 ///
362 /// # Example
363 /// ```ignore,no_run
364 /// # use google_cloud_build_v1::model::StorageSource;
365 /// let x = StorageSource::new().set_generation(42);
366 /// ```
367 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
368 self.generation = v.into();
369 self
370 }
371
372 /// Sets the value of [source_fetcher][crate::model::StorageSource::source_fetcher].
373 ///
374 /// # Example
375 /// ```ignore,no_run
376 /// # use google_cloud_build_v1::model::StorageSource;
377 /// use google_cloud_build_v1::model::storage_source::SourceFetcher;
378 /// let x0 = StorageSource::new().set_source_fetcher(SourceFetcher::Gsutil);
379 /// let x1 = StorageSource::new().set_source_fetcher(SourceFetcher::GcsFetcher);
380 /// ```
381 pub fn set_source_fetcher<
382 T: std::convert::Into<crate::model::storage_source::SourceFetcher>,
383 >(
384 mut self,
385 v: T,
386 ) -> Self {
387 self.source_fetcher = v.into();
388 self
389 }
390}
391
392impl wkt::message::Message for StorageSource {
393 fn typename() -> &'static str {
394 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSource"
395 }
396}
397
398/// Defines additional types related to [StorageSource].
399pub mod storage_source {
400 #[allow(unused_imports)]
401 use super::*;
402
403 /// Specifies the tool to fetch the source file for the build.
404 ///
405 /// # Working with unknown values
406 ///
407 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
408 /// additional enum variants at any time. Adding new variants is not considered
409 /// a breaking change. Applications should write their code in anticipation of:
410 ///
411 /// - New values appearing in future releases of the client library, **and**
412 /// - New values received dynamically, without application changes.
413 ///
414 /// Please consult the [Working with enums] section in the user guide for some
415 /// guidelines.
416 ///
417 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
418 #[derive(Clone, Debug, PartialEq)]
419 #[non_exhaustive]
420 pub enum SourceFetcher {
421 /// Unspecified defaults to GSUTIL.
422 Unspecified,
423 /// Use the "gsutil" tool to download the source file.
424 Gsutil,
425 /// Use the Cloud Storage Fetcher tool to download the source file.
426 GcsFetcher,
427 /// If set, the enum was initialized with an unknown value.
428 ///
429 /// Applications can examine the value using [SourceFetcher::value] or
430 /// [SourceFetcher::name].
431 UnknownValue(source_fetcher::UnknownValue),
432 }
433
434 #[doc(hidden)]
435 pub mod source_fetcher {
436 #[allow(unused_imports)]
437 use super::*;
438 #[derive(Clone, Debug, PartialEq)]
439 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
440 }
441
442 impl SourceFetcher {
443 /// Gets the enum value.
444 ///
445 /// Returns `None` if the enum contains an unknown value deserialized from
446 /// the string representation of enums.
447 pub fn value(&self) -> std::option::Option<i32> {
448 match self {
449 Self::Unspecified => std::option::Option::Some(0),
450 Self::Gsutil => std::option::Option::Some(1),
451 Self::GcsFetcher => std::option::Option::Some(2),
452 Self::UnknownValue(u) => u.0.value(),
453 }
454 }
455
456 /// Gets the enum value as a string.
457 ///
458 /// Returns `None` if the enum contains an unknown value deserialized from
459 /// the integer representation of enums.
460 pub fn name(&self) -> std::option::Option<&str> {
461 match self {
462 Self::Unspecified => std::option::Option::Some("SOURCE_FETCHER_UNSPECIFIED"),
463 Self::Gsutil => std::option::Option::Some("GSUTIL"),
464 Self::GcsFetcher => std::option::Option::Some("GCS_FETCHER"),
465 Self::UnknownValue(u) => u.0.name(),
466 }
467 }
468 }
469
470 impl std::default::Default for SourceFetcher {
471 fn default() -> Self {
472 use std::convert::From;
473 Self::from(0)
474 }
475 }
476
477 impl std::fmt::Display for SourceFetcher {
478 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
479 wkt::internal::display_enum(f, self.name(), self.value())
480 }
481 }
482
483 impl std::convert::From<i32> for SourceFetcher {
484 fn from(value: i32) -> Self {
485 match value {
486 0 => Self::Unspecified,
487 1 => Self::Gsutil,
488 2 => Self::GcsFetcher,
489 _ => Self::UnknownValue(source_fetcher::UnknownValue(
490 wkt::internal::UnknownEnumValue::Integer(value),
491 )),
492 }
493 }
494 }
495
496 impl std::convert::From<&str> for SourceFetcher {
497 fn from(value: &str) -> Self {
498 use std::string::ToString;
499 match value {
500 "SOURCE_FETCHER_UNSPECIFIED" => Self::Unspecified,
501 "GSUTIL" => Self::Gsutil,
502 "GCS_FETCHER" => Self::GcsFetcher,
503 _ => Self::UnknownValue(source_fetcher::UnknownValue(
504 wkt::internal::UnknownEnumValue::String(value.to_string()),
505 )),
506 }
507 }
508 }
509
510 impl serde::ser::Serialize for SourceFetcher {
511 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
512 where
513 S: serde::Serializer,
514 {
515 match self {
516 Self::Unspecified => serializer.serialize_i32(0),
517 Self::Gsutil => serializer.serialize_i32(1),
518 Self::GcsFetcher => serializer.serialize_i32(2),
519 Self::UnknownValue(u) => u.0.serialize(serializer),
520 }
521 }
522 }
523
524 impl<'de> serde::de::Deserialize<'de> for SourceFetcher {
525 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
526 where
527 D: serde::Deserializer<'de>,
528 {
529 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SourceFetcher>::new(
530 ".google.devtools.cloudbuild.v1.StorageSource.SourceFetcher",
531 ))
532 }
533 }
534}
535
536/// Location of the source in any accessible Git repository.
537#[derive(Clone, Default, PartialEq)]
538#[non_exhaustive]
539pub struct GitSource {
540 /// Required. Location of the Git repo to build.
541 ///
542 /// This will be used as a `git remote`, see
543 /// <https://git-scm.com/docs/git-remote>.
544 pub url: std::string::String,
545
546 /// Optional. Directory, relative to the source root, in which to run the
547 /// build.
548 ///
549 /// This must be a relative path. If a step's `dir` is specified and is an
550 /// absolute path, this value is ignored for that step's execution.
551 pub dir: std::string::String,
552
553 /// Optional. The revision to fetch from the Git repository such as a branch, a
554 /// tag, a commit SHA, or any Git ref.
555 ///
556 /// Cloud Build uses `git fetch` to fetch the revision from the Git
557 /// repository; therefore make sure that the string you provide for `revision`
558 /// is parsable by the command. For information on string values accepted by
559 /// `git fetch`, see
560 /// <https://git-scm.com/docs/gitrevisions#_specifying_revisions>. For
561 /// information on `git fetch`, see <https://git-scm.com/docs/git-fetch>.
562 pub revision: std::string::String,
563
564 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
565}
566
567impl GitSource {
568 pub fn new() -> Self {
569 std::default::Default::default()
570 }
571
572 /// Sets the value of [url][crate::model::GitSource::url].
573 ///
574 /// # Example
575 /// ```ignore,no_run
576 /// # use google_cloud_build_v1::model::GitSource;
577 /// let x = GitSource::new().set_url("example");
578 /// ```
579 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
580 self.url = v.into();
581 self
582 }
583
584 /// Sets the value of [dir][crate::model::GitSource::dir].
585 ///
586 /// # Example
587 /// ```ignore,no_run
588 /// # use google_cloud_build_v1::model::GitSource;
589 /// let x = GitSource::new().set_dir("example");
590 /// ```
591 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
592 self.dir = v.into();
593 self
594 }
595
596 /// Sets the value of [revision][crate::model::GitSource::revision].
597 ///
598 /// # Example
599 /// ```ignore,no_run
600 /// # use google_cloud_build_v1::model::GitSource;
601 /// let x = GitSource::new().set_revision("example");
602 /// ```
603 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
604 self.revision = v.into();
605 self
606 }
607}
608
609impl wkt::message::Message for GitSource {
610 fn typename() -> &'static str {
611 "type.googleapis.com/google.devtools.cloudbuild.v1.GitSource"
612 }
613}
614
615/// Location of the source in a Google Cloud Source Repository.
616#[derive(Clone, Default, PartialEq)]
617#[non_exhaustive]
618pub struct RepoSource {
619 /// Optional. ID of the project that owns the Cloud Source Repository. If
620 /// omitted, the project ID requesting the build is assumed.
621 pub project_id: std::string::String,
622
623 /// Required. Name of the Cloud Source Repository.
624 pub repo_name: std::string::String,
625
626 /// Optional. Directory, relative to the source root, in which to run the
627 /// build.
628 ///
629 /// This must be a relative path. If a step's `dir` is specified and is an
630 /// absolute path, this value is ignored for that step's execution.
631 pub dir: std::string::String,
632
633 /// Optional. Only trigger a build if the revision regex does NOT match the
634 /// revision regex.
635 pub invert_regex: bool,
636
637 /// Optional. Substitutions to use in a triggered build.
638 /// Should only be used with RunBuildTrigger
639 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
640
641 /// A revision within the Cloud Source Repository must be specified in
642 /// one of these ways.
643 pub revision: std::option::Option<crate::model::repo_source::Revision>,
644
645 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
646}
647
648impl RepoSource {
649 pub fn new() -> Self {
650 std::default::Default::default()
651 }
652
653 /// Sets the value of [project_id][crate::model::RepoSource::project_id].
654 ///
655 /// # Example
656 /// ```ignore,no_run
657 /// # use google_cloud_build_v1::model::RepoSource;
658 /// let x = RepoSource::new().set_project_id("example");
659 /// ```
660 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
661 self.project_id = v.into();
662 self
663 }
664
665 /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
666 ///
667 /// # Example
668 /// ```ignore,no_run
669 /// # use google_cloud_build_v1::model::RepoSource;
670 /// let x = RepoSource::new().set_repo_name("example");
671 /// ```
672 pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
673 self.repo_name = v.into();
674 self
675 }
676
677 /// Sets the value of [dir][crate::model::RepoSource::dir].
678 ///
679 /// # Example
680 /// ```ignore,no_run
681 /// # use google_cloud_build_v1::model::RepoSource;
682 /// let x = RepoSource::new().set_dir("example");
683 /// ```
684 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
685 self.dir = v.into();
686 self
687 }
688
689 /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
690 ///
691 /// # Example
692 /// ```ignore,no_run
693 /// # use google_cloud_build_v1::model::RepoSource;
694 /// let x = RepoSource::new().set_invert_regex(true);
695 /// ```
696 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
697 self.invert_regex = v.into();
698 self
699 }
700
701 /// Sets the value of [substitutions][crate::model::RepoSource::substitutions].
702 ///
703 /// # Example
704 /// ```ignore,no_run
705 /// # use google_cloud_build_v1::model::RepoSource;
706 /// let x = RepoSource::new().set_substitutions([
707 /// ("key0", "abc"),
708 /// ("key1", "xyz"),
709 /// ]);
710 /// ```
711 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
712 where
713 T: std::iter::IntoIterator<Item = (K, V)>,
714 K: std::convert::Into<std::string::String>,
715 V: std::convert::Into<std::string::String>,
716 {
717 use std::iter::Iterator;
718 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
719 self
720 }
721
722 /// Sets the value of [revision][crate::model::RepoSource::revision].
723 ///
724 /// Note that all the setters affecting `revision` are mutually
725 /// exclusive.
726 ///
727 /// # Example
728 /// ```ignore,no_run
729 /// # use google_cloud_build_v1::model::RepoSource;
730 /// use google_cloud_build_v1::model::repo_source::Revision;
731 /// let x = RepoSource::new().set_revision(Some(Revision::BranchName("example".to_string())));
732 /// ```
733 pub fn set_revision<
734 T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
735 >(
736 mut self,
737 v: T,
738 ) -> Self {
739 self.revision = v.into();
740 self
741 }
742
743 /// The value of [revision][crate::model::RepoSource::revision]
744 /// if it holds a `BranchName`, `None` if the field is not set or
745 /// holds a different branch.
746 pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
747 #[allow(unreachable_patterns)]
748 self.revision.as_ref().and_then(|v| match v {
749 crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
750 _ => std::option::Option::None,
751 })
752 }
753
754 /// Sets the value of [revision][crate::model::RepoSource::revision]
755 /// to hold a `BranchName`.
756 ///
757 /// Note that all the setters affecting `revision` are
758 /// mutually exclusive.
759 ///
760 /// # Example
761 /// ```ignore,no_run
762 /// # use google_cloud_build_v1::model::RepoSource;
763 /// let x = RepoSource::new().set_branch_name("example");
764 /// assert!(x.branch_name().is_some());
765 /// assert!(x.tag_name().is_none());
766 /// assert!(x.commit_sha().is_none());
767 /// ```
768 pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
769 self.revision =
770 std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
771 self
772 }
773
774 /// The value of [revision][crate::model::RepoSource::revision]
775 /// if it holds a `TagName`, `None` if the field is not set or
776 /// holds a different branch.
777 pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
778 #[allow(unreachable_patterns)]
779 self.revision.as_ref().and_then(|v| match v {
780 crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
781 _ => std::option::Option::None,
782 })
783 }
784
785 /// Sets the value of [revision][crate::model::RepoSource::revision]
786 /// to hold a `TagName`.
787 ///
788 /// Note that all the setters affecting `revision` are
789 /// mutually exclusive.
790 ///
791 /// # Example
792 /// ```ignore,no_run
793 /// # use google_cloud_build_v1::model::RepoSource;
794 /// let x = RepoSource::new().set_tag_name("example");
795 /// assert!(x.tag_name().is_some());
796 /// assert!(x.branch_name().is_none());
797 /// assert!(x.commit_sha().is_none());
798 /// ```
799 pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
800 self.revision =
801 std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
802 self
803 }
804
805 /// The value of [revision][crate::model::RepoSource::revision]
806 /// if it holds a `CommitSha`, `None` if the field is not set or
807 /// holds a different branch.
808 pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
809 #[allow(unreachable_patterns)]
810 self.revision.as_ref().and_then(|v| match v {
811 crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
812 _ => std::option::Option::None,
813 })
814 }
815
816 /// Sets the value of [revision][crate::model::RepoSource::revision]
817 /// to hold a `CommitSha`.
818 ///
819 /// Note that all the setters affecting `revision` are
820 /// mutually exclusive.
821 ///
822 /// # Example
823 /// ```ignore,no_run
824 /// # use google_cloud_build_v1::model::RepoSource;
825 /// let x = RepoSource::new().set_commit_sha("example");
826 /// assert!(x.commit_sha().is_some());
827 /// assert!(x.branch_name().is_none());
828 /// assert!(x.tag_name().is_none());
829 /// ```
830 pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
831 self.revision =
832 std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
833 self
834 }
835}
836
837impl wkt::message::Message for RepoSource {
838 fn typename() -> &'static str {
839 "type.googleapis.com/google.devtools.cloudbuild.v1.RepoSource"
840 }
841}
842
843/// Defines additional types related to [RepoSource].
844pub mod repo_source {
845 #[allow(unused_imports)]
846 use super::*;
847
848 /// A revision within the Cloud Source Repository must be specified in
849 /// one of these ways.
850 #[derive(Clone, Debug, PartialEq)]
851 #[non_exhaustive]
852 pub enum Revision {
853 /// Regex matching branches to build.
854 ///
855 /// The syntax of the regular expressions accepted is the syntax accepted by
856 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
857 BranchName(std::string::String),
858 /// Regex matching tags to build.
859 ///
860 /// The syntax of the regular expressions accepted is the syntax accepted by
861 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
862 TagName(std::string::String),
863 /// Explicit commit SHA to build.
864 CommitSha(std::string::String),
865 }
866}
867
868/// Location of the source manifest in Cloud Storage.
869/// This feature is in Preview; see description
870/// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
871#[derive(Clone, Default, PartialEq)]
872#[non_exhaustive]
873pub struct StorageSourceManifest {
874 /// Required. Cloud Storage bucket containing the source manifest (see [Bucket
875 /// Name
876 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
877 pub bucket: std::string::String,
878
879 /// Required. Cloud Storage object containing the source manifest.
880 ///
881 /// This object must be a JSON file.
882 pub object: std::string::String,
883
884 /// Cloud Storage generation for the object. If the generation is
885 /// omitted, the latest generation will be used.
886 pub generation: i64,
887
888 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
889}
890
891impl StorageSourceManifest {
892 pub fn new() -> Self {
893 std::default::Default::default()
894 }
895
896 /// Sets the value of [bucket][crate::model::StorageSourceManifest::bucket].
897 ///
898 /// # Example
899 /// ```ignore,no_run
900 /// # use google_cloud_build_v1::model::StorageSourceManifest;
901 /// let x = StorageSourceManifest::new().set_bucket("example");
902 /// ```
903 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
904 self.bucket = v.into();
905 self
906 }
907
908 /// Sets the value of [object][crate::model::StorageSourceManifest::object].
909 ///
910 /// # Example
911 /// ```ignore,no_run
912 /// # use google_cloud_build_v1::model::StorageSourceManifest;
913 /// let x = StorageSourceManifest::new().set_object("example");
914 /// ```
915 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
916 self.object = v.into();
917 self
918 }
919
920 /// Sets the value of [generation][crate::model::StorageSourceManifest::generation].
921 ///
922 /// # Example
923 /// ```ignore,no_run
924 /// # use google_cloud_build_v1::model::StorageSourceManifest;
925 /// let x = StorageSourceManifest::new().set_generation(42);
926 /// ```
927 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
928 self.generation = v.into();
929 self
930 }
931}
932
933impl wkt::message::Message for StorageSourceManifest {
934 fn typename() -> &'static str {
935 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSourceManifest"
936 }
937}
938
939/// Location of the source in a 2nd-gen Google Cloud Build repository resource.
940#[derive(Clone, Default, PartialEq)]
941#[non_exhaustive]
942pub struct ConnectedRepository {
943 /// Required. Name of the Google Cloud Build repository, formatted as
944 /// `projects/*/locations/*/connections/*/repositories/*`.
945 pub repository: std::string::String,
946
947 /// Optional. Directory, relative to the source root, in which to run the
948 /// build.
949 pub dir: std::string::String,
950
951 /// Required. The revision to fetch from the Git repository such as a branch, a
952 /// tag, a commit SHA, or any Git ref.
953 pub revision: std::string::String,
954
955 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
956}
957
958impl ConnectedRepository {
959 pub fn new() -> Self {
960 std::default::Default::default()
961 }
962
963 /// Sets the value of [repository][crate::model::ConnectedRepository::repository].
964 ///
965 /// # Example
966 /// ```ignore,no_run
967 /// # use google_cloud_build_v1::model::ConnectedRepository;
968 /// let x = ConnectedRepository::new().set_repository("example");
969 /// ```
970 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
971 self.repository = v.into();
972 self
973 }
974
975 /// Sets the value of [dir][crate::model::ConnectedRepository::dir].
976 ///
977 /// # Example
978 /// ```ignore,no_run
979 /// # use google_cloud_build_v1::model::ConnectedRepository;
980 /// let x = ConnectedRepository::new().set_dir("example");
981 /// ```
982 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
983 self.dir = v.into();
984 self
985 }
986
987 /// Sets the value of [revision][crate::model::ConnectedRepository::revision].
988 ///
989 /// # Example
990 /// ```ignore,no_run
991 /// # use google_cloud_build_v1::model::ConnectedRepository;
992 /// let x = ConnectedRepository::new().set_revision("example");
993 /// ```
994 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
995 self.revision = v.into();
996 self
997 }
998}
999
1000impl wkt::message::Message for ConnectedRepository {
1001 fn typename() -> &'static str {
1002 "type.googleapis.com/google.devtools.cloudbuild.v1.ConnectedRepository"
1003 }
1004}
1005
1006/// Location of the source in a supported storage service.
1007#[derive(Clone, Default, PartialEq)]
1008#[non_exhaustive]
1009pub struct Source {
1010 /// Location of source.
1011 pub source: std::option::Option<crate::model::source::Source>,
1012
1013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1014}
1015
1016impl Source {
1017 pub fn new() -> Self {
1018 std::default::Default::default()
1019 }
1020
1021 /// Sets the value of [source][crate::model::Source::source].
1022 ///
1023 /// Note that all the setters affecting `source` are mutually
1024 /// exclusive.
1025 ///
1026 /// # Example
1027 /// ```ignore,no_run
1028 /// # use google_cloud_build_v1::model::Source;
1029 /// use google_cloud_build_v1::model::StorageSource;
1030 /// let x = Source::new().set_source(Some(
1031 /// google_cloud_build_v1::model::source::Source::StorageSource(StorageSource::default().into())));
1032 /// ```
1033 pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
1034 mut self,
1035 v: T,
1036 ) -> Self {
1037 self.source = v.into();
1038 self
1039 }
1040
1041 /// The value of [source][crate::model::Source::source]
1042 /// if it holds a `StorageSource`, `None` if the field is not set or
1043 /// holds a different branch.
1044 pub fn storage_source(
1045 &self,
1046 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
1047 #[allow(unreachable_patterns)]
1048 self.source.as_ref().and_then(|v| match v {
1049 crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
1050 _ => std::option::Option::None,
1051 })
1052 }
1053
1054 /// Sets the value of [source][crate::model::Source::source]
1055 /// to hold a `StorageSource`.
1056 ///
1057 /// Note that all the setters affecting `source` are
1058 /// mutually exclusive.
1059 ///
1060 /// # Example
1061 /// ```ignore,no_run
1062 /// # use google_cloud_build_v1::model::Source;
1063 /// use google_cloud_build_v1::model::StorageSource;
1064 /// let x = Source::new().set_storage_source(StorageSource::default()/* use setters */);
1065 /// assert!(x.storage_source().is_some());
1066 /// assert!(x.repo_source().is_none());
1067 /// assert!(x.git_source().is_none());
1068 /// assert!(x.storage_source_manifest().is_none());
1069 /// assert!(x.connected_repository().is_none());
1070 /// ```
1071 pub fn set_storage_source<
1072 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
1073 >(
1074 mut self,
1075 v: T,
1076 ) -> Self {
1077 self.source =
1078 std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
1079 self
1080 }
1081
1082 /// The value of [source][crate::model::Source::source]
1083 /// if it holds a `RepoSource`, `None` if the field is not set or
1084 /// holds a different branch.
1085 pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
1086 #[allow(unreachable_patterns)]
1087 self.source.as_ref().and_then(|v| match v {
1088 crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
1089 _ => std::option::Option::None,
1090 })
1091 }
1092
1093 /// Sets the value of [source][crate::model::Source::source]
1094 /// to hold a `RepoSource`.
1095 ///
1096 /// Note that all the setters affecting `source` are
1097 /// mutually exclusive.
1098 ///
1099 /// # Example
1100 /// ```ignore,no_run
1101 /// # use google_cloud_build_v1::model::Source;
1102 /// use google_cloud_build_v1::model::RepoSource;
1103 /// let x = Source::new().set_repo_source(RepoSource::default()/* use setters */);
1104 /// assert!(x.repo_source().is_some());
1105 /// assert!(x.storage_source().is_none());
1106 /// assert!(x.git_source().is_none());
1107 /// assert!(x.storage_source_manifest().is_none());
1108 /// assert!(x.connected_repository().is_none());
1109 /// ```
1110 pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
1111 mut self,
1112 v: T,
1113 ) -> Self {
1114 self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
1115 self
1116 }
1117
1118 /// The value of [source][crate::model::Source::source]
1119 /// if it holds a `GitSource`, `None` if the field is not set or
1120 /// holds a different branch.
1121 pub fn git_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSource>> {
1122 #[allow(unreachable_patterns)]
1123 self.source.as_ref().and_then(|v| match v {
1124 crate::model::source::Source::GitSource(v) => std::option::Option::Some(v),
1125 _ => std::option::Option::None,
1126 })
1127 }
1128
1129 /// Sets the value of [source][crate::model::Source::source]
1130 /// to hold a `GitSource`.
1131 ///
1132 /// Note that all the setters affecting `source` are
1133 /// mutually exclusive.
1134 ///
1135 /// # Example
1136 /// ```ignore,no_run
1137 /// # use google_cloud_build_v1::model::Source;
1138 /// use google_cloud_build_v1::model::GitSource;
1139 /// let x = Source::new().set_git_source(GitSource::default()/* use setters */);
1140 /// assert!(x.git_source().is_some());
1141 /// assert!(x.storage_source().is_none());
1142 /// assert!(x.repo_source().is_none());
1143 /// assert!(x.storage_source_manifest().is_none());
1144 /// assert!(x.connected_repository().is_none());
1145 /// ```
1146 pub fn set_git_source<T: std::convert::Into<std::boxed::Box<crate::model::GitSource>>>(
1147 mut self,
1148 v: T,
1149 ) -> Self {
1150 self.source = std::option::Option::Some(crate::model::source::Source::GitSource(v.into()));
1151 self
1152 }
1153
1154 /// The value of [source][crate::model::Source::source]
1155 /// if it holds a `StorageSourceManifest`, `None` if the field is not set or
1156 /// holds a different branch.
1157 pub fn storage_source_manifest(
1158 &self,
1159 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSourceManifest>> {
1160 #[allow(unreachable_patterns)]
1161 self.source.as_ref().and_then(|v| match v {
1162 crate::model::source::Source::StorageSourceManifest(v) => std::option::Option::Some(v),
1163 _ => std::option::Option::None,
1164 })
1165 }
1166
1167 /// Sets the value of [source][crate::model::Source::source]
1168 /// to hold a `StorageSourceManifest`.
1169 ///
1170 /// Note that all the setters affecting `source` are
1171 /// mutually exclusive.
1172 ///
1173 /// # Example
1174 /// ```ignore,no_run
1175 /// # use google_cloud_build_v1::model::Source;
1176 /// use google_cloud_build_v1::model::StorageSourceManifest;
1177 /// let x = Source::new().set_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
1178 /// assert!(x.storage_source_manifest().is_some());
1179 /// assert!(x.storage_source().is_none());
1180 /// assert!(x.repo_source().is_none());
1181 /// assert!(x.git_source().is_none());
1182 /// assert!(x.connected_repository().is_none());
1183 /// ```
1184 pub fn set_storage_source_manifest<
1185 T: std::convert::Into<std::boxed::Box<crate::model::StorageSourceManifest>>,
1186 >(
1187 mut self,
1188 v: T,
1189 ) -> Self {
1190 self.source = std::option::Option::Some(
1191 crate::model::source::Source::StorageSourceManifest(v.into()),
1192 );
1193 self
1194 }
1195
1196 /// The value of [source][crate::model::Source::source]
1197 /// if it holds a `ConnectedRepository`, `None` if the field is not set or
1198 /// holds a different branch.
1199 pub fn connected_repository(
1200 &self,
1201 ) -> std::option::Option<&std::boxed::Box<crate::model::ConnectedRepository>> {
1202 #[allow(unreachable_patterns)]
1203 self.source.as_ref().and_then(|v| match v {
1204 crate::model::source::Source::ConnectedRepository(v) => std::option::Option::Some(v),
1205 _ => std::option::Option::None,
1206 })
1207 }
1208
1209 /// Sets the value of [source][crate::model::Source::source]
1210 /// to hold a `ConnectedRepository`.
1211 ///
1212 /// Note that all the setters affecting `source` are
1213 /// mutually exclusive.
1214 ///
1215 /// # Example
1216 /// ```ignore,no_run
1217 /// # use google_cloud_build_v1::model::Source;
1218 /// use google_cloud_build_v1::model::ConnectedRepository;
1219 /// let x = Source::new().set_connected_repository(ConnectedRepository::default()/* use setters */);
1220 /// assert!(x.connected_repository().is_some());
1221 /// assert!(x.storage_source().is_none());
1222 /// assert!(x.repo_source().is_none());
1223 /// assert!(x.git_source().is_none());
1224 /// assert!(x.storage_source_manifest().is_none());
1225 /// ```
1226 pub fn set_connected_repository<
1227 T: std::convert::Into<std::boxed::Box<crate::model::ConnectedRepository>>,
1228 >(
1229 mut self,
1230 v: T,
1231 ) -> Self {
1232 self.source =
1233 std::option::Option::Some(crate::model::source::Source::ConnectedRepository(v.into()));
1234 self
1235 }
1236}
1237
1238impl wkt::message::Message for Source {
1239 fn typename() -> &'static str {
1240 "type.googleapis.com/google.devtools.cloudbuild.v1.Source"
1241 }
1242}
1243
1244/// Defines additional types related to [Source].
1245pub mod source {
1246 #[allow(unused_imports)]
1247 use super::*;
1248
1249 /// Location of source.
1250 #[derive(Clone, Debug, PartialEq)]
1251 #[non_exhaustive]
1252 pub enum Source {
1253 /// If provided, get the source from this location in Cloud Storage.
1254 StorageSource(std::boxed::Box<crate::model::StorageSource>),
1255 /// If provided, get the source from this location in a Cloud Source
1256 /// Repository.
1257 RepoSource(std::boxed::Box<crate::model::RepoSource>),
1258 /// If provided, get the source from this Git repository.
1259 GitSource(std::boxed::Box<crate::model::GitSource>),
1260 /// If provided, get the source from this manifest in Cloud Storage.
1261 /// This feature is in Preview; see description
1262 /// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
1263 StorageSourceManifest(std::boxed::Box<crate::model::StorageSourceManifest>),
1264 /// Optional. If provided, get the source from this 2nd-gen Google Cloud
1265 /// Build repository resource.
1266 ConnectedRepository(std::boxed::Box<crate::model::ConnectedRepository>),
1267 }
1268}
1269
1270/// An image built by the pipeline.
1271#[derive(Clone, Default, PartialEq)]
1272#[non_exhaustive]
1273pub struct BuiltImage {
1274 /// Name used to push the container image to Google Container Registry, as
1275 /// presented to `docker push`.
1276 pub name: std::string::String,
1277
1278 /// Docker Registry 2.0 digest.
1279 pub digest: std::string::String,
1280
1281 /// Output only. Stores timing information for pushing the specified image.
1282 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1283
1284 /// Output only. Path to the artifact in Artifact Registry.
1285 pub artifact_registry_package: std::string::String,
1286
1287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1288}
1289
1290impl BuiltImage {
1291 pub fn new() -> Self {
1292 std::default::Default::default()
1293 }
1294
1295 /// Sets the value of [name][crate::model::BuiltImage::name].
1296 ///
1297 /// # Example
1298 /// ```ignore,no_run
1299 /// # use google_cloud_build_v1::model::BuiltImage;
1300 /// let x = BuiltImage::new().set_name("example");
1301 /// ```
1302 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1303 self.name = v.into();
1304 self
1305 }
1306
1307 /// Sets the value of [digest][crate::model::BuiltImage::digest].
1308 ///
1309 /// # Example
1310 /// ```ignore,no_run
1311 /// # use google_cloud_build_v1::model::BuiltImage;
1312 /// let x = BuiltImage::new().set_digest("example");
1313 /// ```
1314 pub fn set_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1315 self.digest = v.into();
1316 self
1317 }
1318
1319 /// Sets the value of [push_timing][crate::model::BuiltImage::push_timing].
1320 ///
1321 /// # Example
1322 /// ```ignore,no_run
1323 /// # use google_cloud_build_v1::model::BuiltImage;
1324 /// use google_cloud_build_v1::model::TimeSpan;
1325 /// let x = BuiltImage::new().set_push_timing(TimeSpan::default()/* use setters */);
1326 /// ```
1327 pub fn set_push_timing<T>(mut self, v: T) -> Self
1328 where
1329 T: std::convert::Into<crate::model::TimeSpan>,
1330 {
1331 self.push_timing = std::option::Option::Some(v.into());
1332 self
1333 }
1334
1335 /// Sets or clears the value of [push_timing][crate::model::BuiltImage::push_timing].
1336 ///
1337 /// # Example
1338 /// ```ignore,no_run
1339 /// # use google_cloud_build_v1::model::BuiltImage;
1340 /// use google_cloud_build_v1::model::TimeSpan;
1341 /// let x = BuiltImage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1342 /// let x = BuiltImage::new().set_or_clear_push_timing(None::<TimeSpan>);
1343 /// ```
1344 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1345 where
1346 T: std::convert::Into<crate::model::TimeSpan>,
1347 {
1348 self.push_timing = v.map(|x| x.into());
1349 self
1350 }
1351
1352 /// Sets the value of [artifact_registry_package][crate::model::BuiltImage::artifact_registry_package].
1353 ///
1354 /// # Example
1355 /// ```ignore,no_run
1356 /// # use google_cloud_build_v1::model::BuiltImage;
1357 /// let x = BuiltImage::new().set_artifact_registry_package("example");
1358 /// ```
1359 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1360 mut self,
1361 v: T,
1362 ) -> Self {
1363 self.artifact_registry_package = v.into();
1364 self
1365 }
1366}
1367
1368impl wkt::message::Message for BuiltImage {
1369 fn typename() -> &'static str {
1370 "type.googleapis.com/google.devtools.cloudbuild.v1.BuiltImage"
1371 }
1372}
1373
1374/// Artifact uploaded using the PythonPackage directive.
1375#[derive(Clone, Default, PartialEq)]
1376#[non_exhaustive]
1377pub struct UploadedPythonPackage {
1378 /// URI of the uploaded artifact.
1379 pub uri: std::string::String,
1380
1381 /// Hash types and values of the Python Artifact.
1382 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1383
1384 /// Output only. Stores timing information for pushing the specified artifact.
1385 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1386
1387 /// Output only. Path to the artifact in Artifact Registry.
1388 pub artifact_registry_package: std::string::String,
1389
1390 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1391}
1392
1393impl UploadedPythonPackage {
1394 pub fn new() -> Self {
1395 std::default::Default::default()
1396 }
1397
1398 /// Sets the value of [uri][crate::model::UploadedPythonPackage::uri].
1399 ///
1400 /// # Example
1401 /// ```ignore,no_run
1402 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1403 /// let x = UploadedPythonPackage::new().set_uri("example");
1404 /// ```
1405 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1406 self.uri = v.into();
1407 self
1408 }
1409
1410 /// Sets the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1411 ///
1412 /// # Example
1413 /// ```ignore,no_run
1414 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1415 /// use google_cloud_build_v1::model::FileHashes;
1416 /// let x = UploadedPythonPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1417 /// ```
1418 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1419 where
1420 T: std::convert::Into<crate::model::FileHashes>,
1421 {
1422 self.file_hashes = std::option::Option::Some(v.into());
1423 self
1424 }
1425
1426 /// Sets or clears the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1427 ///
1428 /// # Example
1429 /// ```ignore,no_run
1430 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1431 /// use google_cloud_build_v1::model::FileHashes;
1432 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1433 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1434 /// ```
1435 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1436 where
1437 T: std::convert::Into<crate::model::FileHashes>,
1438 {
1439 self.file_hashes = v.map(|x| x.into());
1440 self
1441 }
1442
1443 /// Sets the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1444 ///
1445 /// # Example
1446 /// ```ignore,no_run
1447 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1448 /// use google_cloud_build_v1::model::TimeSpan;
1449 /// let x = UploadedPythonPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1450 /// ```
1451 pub fn set_push_timing<T>(mut self, v: T) -> Self
1452 where
1453 T: std::convert::Into<crate::model::TimeSpan>,
1454 {
1455 self.push_timing = std::option::Option::Some(v.into());
1456 self
1457 }
1458
1459 /// Sets or clears the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1460 ///
1461 /// # Example
1462 /// ```ignore,no_run
1463 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1464 /// use google_cloud_build_v1::model::TimeSpan;
1465 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1466 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1467 /// ```
1468 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1469 where
1470 T: std::convert::Into<crate::model::TimeSpan>,
1471 {
1472 self.push_timing = v.map(|x| x.into());
1473 self
1474 }
1475
1476 /// Sets the value of [artifact_registry_package][crate::model::UploadedPythonPackage::artifact_registry_package].
1477 ///
1478 /// # Example
1479 /// ```ignore,no_run
1480 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1481 /// let x = UploadedPythonPackage::new().set_artifact_registry_package("example");
1482 /// ```
1483 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1484 mut self,
1485 v: T,
1486 ) -> Self {
1487 self.artifact_registry_package = v.into();
1488 self
1489 }
1490}
1491
1492impl wkt::message::Message for UploadedPythonPackage {
1493 fn typename() -> &'static str {
1494 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedPythonPackage"
1495 }
1496}
1497
1498/// A Maven artifact uploaded using the MavenArtifact directive.
1499#[derive(Clone, Default, PartialEq)]
1500#[non_exhaustive]
1501pub struct UploadedMavenArtifact {
1502 /// URI of the uploaded artifact.
1503 pub uri: std::string::String,
1504
1505 /// Hash types and values of the Maven Artifact.
1506 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1507
1508 /// Output only. Stores timing information for pushing the specified artifact.
1509 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1510
1511 /// Output only. Path to the artifact in Artifact Registry.
1512 pub artifact_registry_package: std::string::String,
1513
1514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1515}
1516
1517impl UploadedMavenArtifact {
1518 pub fn new() -> Self {
1519 std::default::Default::default()
1520 }
1521
1522 /// Sets the value of [uri][crate::model::UploadedMavenArtifact::uri].
1523 ///
1524 /// # Example
1525 /// ```ignore,no_run
1526 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1527 /// let x = UploadedMavenArtifact::new().set_uri("example");
1528 /// ```
1529 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1530 self.uri = v.into();
1531 self
1532 }
1533
1534 /// Sets the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1535 ///
1536 /// # Example
1537 /// ```ignore,no_run
1538 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1539 /// use google_cloud_build_v1::model::FileHashes;
1540 /// let x = UploadedMavenArtifact::new().set_file_hashes(FileHashes::default()/* use setters */);
1541 /// ```
1542 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1543 where
1544 T: std::convert::Into<crate::model::FileHashes>,
1545 {
1546 self.file_hashes = std::option::Option::Some(v.into());
1547 self
1548 }
1549
1550 /// Sets or clears the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1551 ///
1552 /// # Example
1553 /// ```ignore,no_run
1554 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1555 /// use google_cloud_build_v1::model::FileHashes;
1556 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1557 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(None::<FileHashes>);
1558 /// ```
1559 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1560 where
1561 T: std::convert::Into<crate::model::FileHashes>,
1562 {
1563 self.file_hashes = v.map(|x| x.into());
1564 self
1565 }
1566
1567 /// Sets the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1568 ///
1569 /// # Example
1570 /// ```ignore,no_run
1571 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1572 /// use google_cloud_build_v1::model::TimeSpan;
1573 /// let x = UploadedMavenArtifact::new().set_push_timing(TimeSpan::default()/* use setters */);
1574 /// ```
1575 pub fn set_push_timing<T>(mut self, v: T) -> Self
1576 where
1577 T: std::convert::Into<crate::model::TimeSpan>,
1578 {
1579 self.push_timing = std::option::Option::Some(v.into());
1580 self
1581 }
1582
1583 /// Sets or clears the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1584 ///
1585 /// # Example
1586 /// ```ignore,no_run
1587 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1588 /// use google_cloud_build_v1::model::TimeSpan;
1589 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1590 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(None::<TimeSpan>);
1591 /// ```
1592 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1593 where
1594 T: std::convert::Into<crate::model::TimeSpan>,
1595 {
1596 self.push_timing = v.map(|x| x.into());
1597 self
1598 }
1599
1600 /// Sets the value of [artifact_registry_package][crate::model::UploadedMavenArtifact::artifact_registry_package].
1601 ///
1602 /// # Example
1603 /// ```ignore,no_run
1604 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1605 /// let x = UploadedMavenArtifact::new().set_artifact_registry_package("example");
1606 /// ```
1607 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1608 mut self,
1609 v: T,
1610 ) -> Self {
1611 self.artifact_registry_package = v.into();
1612 self
1613 }
1614}
1615
1616impl wkt::message::Message for UploadedMavenArtifact {
1617 fn typename() -> &'static str {
1618 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedMavenArtifact"
1619 }
1620}
1621
1622/// A Go module artifact uploaded to Artifact Registry using the GoModule
1623/// directive.
1624#[derive(Clone, Default, PartialEq)]
1625#[non_exhaustive]
1626pub struct UploadedGoModule {
1627 /// URI of the uploaded artifact.
1628 pub uri: std::string::String,
1629
1630 /// Hash types and values of the Go Module Artifact.
1631 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1632
1633 /// Output only. Stores timing information for pushing the specified artifact.
1634 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1635
1636 /// Output only. Path to the artifact in Artifact Registry.
1637 pub artifact_registry_package: std::string::String,
1638
1639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1640}
1641
1642impl UploadedGoModule {
1643 pub fn new() -> Self {
1644 std::default::Default::default()
1645 }
1646
1647 /// Sets the value of [uri][crate::model::UploadedGoModule::uri].
1648 ///
1649 /// # Example
1650 /// ```ignore,no_run
1651 /// # use google_cloud_build_v1::model::UploadedGoModule;
1652 /// let x = UploadedGoModule::new().set_uri("example");
1653 /// ```
1654 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1655 self.uri = v.into();
1656 self
1657 }
1658
1659 /// Sets the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1660 ///
1661 /// # Example
1662 /// ```ignore,no_run
1663 /// # use google_cloud_build_v1::model::UploadedGoModule;
1664 /// use google_cloud_build_v1::model::FileHashes;
1665 /// let x = UploadedGoModule::new().set_file_hashes(FileHashes::default()/* use setters */);
1666 /// ```
1667 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1668 where
1669 T: std::convert::Into<crate::model::FileHashes>,
1670 {
1671 self.file_hashes = std::option::Option::Some(v.into());
1672 self
1673 }
1674
1675 /// Sets or clears the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1676 ///
1677 /// # Example
1678 /// ```ignore,no_run
1679 /// # use google_cloud_build_v1::model::UploadedGoModule;
1680 /// use google_cloud_build_v1::model::FileHashes;
1681 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1682 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(None::<FileHashes>);
1683 /// ```
1684 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1685 where
1686 T: std::convert::Into<crate::model::FileHashes>,
1687 {
1688 self.file_hashes = v.map(|x| x.into());
1689 self
1690 }
1691
1692 /// Sets the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1693 ///
1694 /// # Example
1695 /// ```ignore,no_run
1696 /// # use google_cloud_build_v1::model::UploadedGoModule;
1697 /// use google_cloud_build_v1::model::TimeSpan;
1698 /// let x = UploadedGoModule::new().set_push_timing(TimeSpan::default()/* use setters */);
1699 /// ```
1700 pub fn set_push_timing<T>(mut self, v: T) -> Self
1701 where
1702 T: std::convert::Into<crate::model::TimeSpan>,
1703 {
1704 self.push_timing = std::option::Option::Some(v.into());
1705 self
1706 }
1707
1708 /// Sets or clears the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1709 ///
1710 /// # Example
1711 /// ```ignore,no_run
1712 /// # use google_cloud_build_v1::model::UploadedGoModule;
1713 /// use google_cloud_build_v1::model::TimeSpan;
1714 /// let x = UploadedGoModule::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1715 /// let x = UploadedGoModule::new().set_or_clear_push_timing(None::<TimeSpan>);
1716 /// ```
1717 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1718 where
1719 T: std::convert::Into<crate::model::TimeSpan>,
1720 {
1721 self.push_timing = v.map(|x| x.into());
1722 self
1723 }
1724
1725 /// Sets the value of [artifact_registry_package][crate::model::UploadedGoModule::artifact_registry_package].
1726 ///
1727 /// # Example
1728 /// ```ignore,no_run
1729 /// # use google_cloud_build_v1::model::UploadedGoModule;
1730 /// let x = UploadedGoModule::new().set_artifact_registry_package("example");
1731 /// ```
1732 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1733 mut self,
1734 v: T,
1735 ) -> Self {
1736 self.artifact_registry_package = v.into();
1737 self
1738 }
1739}
1740
1741impl wkt::message::Message for UploadedGoModule {
1742 fn typename() -> &'static str {
1743 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedGoModule"
1744 }
1745}
1746
1747/// An npm package uploaded to Artifact Registry using the NpmPackage
1748/// directive.
1749#[derive(Clone, Default, PartialEq)]
1750#[non_exhaustive]
1751pub struct UploadedNpmPackage {
1752 /// URI of the uploaded npm package.
1753 pub uri: std::string::String,
1754
1755 /// Hash types and values of the npm package.
1756 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1757
1758 /// Output only. Stores timing information for pushing the specified artifact.
1759 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1760
1761 /// Output only. Path to the artifact in Artifact Registry.
1762 pub artifact_registry_package: std::string::String,
1763
1764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1765}
1766
1767impl UploadedNpmPackage {
1768 pub fn new() -> Self {
1769 std::default::Default::default()
1770 }
1771
1772 /// Sets the value of [uri][crate::model::UploadedNpmPackage::uri].
1773 ///
1774 /// # Example
1775 /// ```ignore,no_run
1776 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1777 /// let x = UploadedNpmPackage::new().set_uri("example");
1778 /// ```
1779 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1780 self.uri = v.into();
1781 self
1782 }
1783
1784 /// Sets the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1785 ///
1786 /// # Example
1787 /// ```ignore,no_run
1788 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1789 /// use google_cloud_build_v1::model::FileHashes;
1790 /// let x = UploadedNpmPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1791 /// ```
1792 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1793 where
1794 T: std::convert::Into<crate::model::FileHashes>,
1795 {
1796 self.file_hashes = std::option::Option::Some(v.into());
1797 self
1798 }
1799
1800 /// Sets or clears the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1801 ///
1802 /// # Example
1803 /// ```ignore,no_run
1804 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1805 /// use google_cloud_build_v1::model::FileHashes;
1806 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1807 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1808 /// ```
1809 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1810 where
1811 T: std::convert::Into<crate::model::FileHashes>,
1812 {
1813 self.file_hashes = v.map(|x| x.into());
1814 self
1815 }
1816
1817 /// Sets the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1818 ///
1819 /// # Example
1820 /// ```ignore,no_run
1821 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1822 /// use google_cloud_build_v1::model::TimeSpan;
1823 /// let x = UploadedNpmPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1824 /// ```
1825 pub fn set_push_timing<T>(mut self, v: T) -> Self
1826 where
1827 T: std::convert::Into<crate::model::TimeSpan>,
1828 {
1829 self.push_timing = std::option::Option::Some(v.into());
1830 self
1831 }
1832
1833 /// Sets or clears the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1834 ///
1835 /// # Example
1836 /// ```ignore,no_run
1837 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1838 /// use google_cloud_build_v1::model::TimeSpan;
1839 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1840 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1841 /// ```
1842 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1843 where
1844 T: std::convert::Into<crate::model::TimeSpan>,
1845 {
1846 self.push_timing = v.map(|x| x.into());
1847 self
1848 }
1849
1850 /// Sets the value of [artifact_registry_package][crate::model::UploadedNpmPackage::artifact_registry_package].
1851 ///
1852 /// # Example
1853 /// ```ignore,no_run
1854 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1855 /// let x = UploadedNpmPackage::new().set_artifact_registry_package("example");
1856 /// ```
1857 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1858 mut self,
1859 v: T,
1860 ) -> Self {
1861 self.artifact_registry_package = v.into();
1862 self
1863 }
1864}
1865
1866impl wkt::message::Message for UploadedNpmPackage {
1867 fn typename() -> &'static str {
1868 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedNpmPackage"
1869 }
1870}
1871
1872/// A step in the build pipeline.
1873#[derive(Clone, Default, PartialEq)]
1874#[non_exhaustive]
1875pub struct BuildStep {
1876 /// Required. The name of the container image that will run this particular
1877 /// build step.
1878 ///
1879 /// If the image is available in the host's Docker daemon's cache, it
1880 /// will be run directly. If not, the host will attempt to pull the image
1881 /// first, using the builder service account's credentials if necessary.
1882 ///
1883 /// The Docker daemon's cache will already have the latest versions of all of
1884 /// the officially supported build steps
1885 /// ([<https://github.com/GoogleCloudPlatform/cloud-builders>](https://github.com/GoogleCloudPlatform/cloud-builders)).
1886 /// The Docker daemon will also have cached many of the layers for some popular
1887 /// images, like "ubuntu", "debian", but they will be refreshed at the time you
1888 /// attempt to use them.
1889 ///
1890 /// If you built an image in a previous build step, it will be stored in the
1891 /// host's Docker daemon's cache and is available to use as the name for a
1892 /// later build step.
1893 pub name: std::string::String,
1894
1895 /// A list of environment variable definitions to be used when running a step.
1896 ///
1897 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
1898 /// being given the value "VALUE".
1899 pub env: std::vec::Vec<std::string::String>,
1900
1901 /// A list of arguments that will be presented to the step when it is started.
1902 ///
1903 /// If the image used to run the step's container has an entrypoint, the `args`
1904 /// are used as arguments to that entrypoint. If the image does not define
1905 /// an entrypoint, the first element in args is used as the entrypoint,
1906 /// and the remainder will be used as arguments.
1907 pub args: std::vec::Vec<std::string::String>,
1908
1909 /// Working directory to use when running this step's container.
1910 ///
1911 /// If this value is a relative path, it is relative to the build's working
1912 /// directory. If this value is absolute, it may be outside the build's working
1913 /// directory, in which case the contents of the path may not be persisted
1914 /// across build step executions, unless a `volume` for that path is specified.
1915 ///
1916 /// If the build specifies a `RepoSource` with `dir` and a step with a `dir`,
1917 /// which specifies an absolute path, the `RepoSource` `dir` is ignored for
1918 /// the step's execution.
1919 pub dir: std::string::String,
1920
1921 /// Unique identifier for this build step, used in `wait_for` to
1922 /// reference this build step as a dependency.
1923 pub id: std::string::String,
1924
1925 /// The ID(s) of the step(s) that this build step depends on.
1926 /// This build step will not start until all the build steps in `wait_for`
1927 /// have completed successfully. If `wait_for` is empty, this build step will
1928 /// start when all previous build steps in the `Build.Steps` list have
1929 /// completed successfully.
1930 pub wait_for: std::vec::Vec<std::string::String>,
1931
1932 /// Entrypoint to be used instead of the build step image's default entrypoint.
1933 /// If unset, the image's default entrypoint is used.
1934 pub entrypoint: std::string::String,
1935
1936 /// A list of environment variables which are encrypted using a Cloud Key
1937 /// Management Service crypto key. These values must be specified in the
1938 /// build's `Secret`.
1939 pub secret_env: std::vec::Vec<std::string::String>,
1940
1941 /// List of volumes to mount into the build step.
1942 ///
1943 /// Each volume is created as an empty volume prior to execution of the
1944 /// build step. Upon completion of the build, volumes and their contents are
1945 /// discarded.
1946 ///
1947 /// Using a named volume in only one step is not valid as it is indicative
1948 /// of a build request with an incorrect configuration.
1949 pub volumes: std::vec::Vec<crate::model::Volume>,
1950
1951 /// Output only. Stores timing information for executing this build step.
1952 pub timing: std::option::Option<crate::model::TimeSpan>,
1953
1954 /// Output only. Stores timing information for pulling this build step's
1955 /// builder image only.
1956 pub pull_timing: std::option::Option<crate::model::TimeSpan>,
1957
1958 /// Time limit for executing this build step. If not defined, the step has no
1959 /// time limit and will be allowed to continue to run until either it completes
1960 /// or the build itself times out.
1961 pub timeout: std::option::Option<wkt::Duration>,
1962
1963 /// Output only. Status of the build step. At this time, build step status is
1964 /// only updated on build completion; step status is not updated in real-time
1965 /// as the build progresses.
1966 pub status: crate::model::build::Status,
1967
1968 /// Allow this build step to fail without failing the entire build.
1969 ///
1970 /// If false, the entire build will fail if this step fails. Otherwise, the
1971 /// build will succeed, but this step will still have a failure status.
1972 /// Error information will be reported in the failure_detail field.
1973 pub allow_failure: bool,
1974
1975 /// Output only. Return code from running the step.
1976 pub exit_code: i32,
1977
1978 /// Allow this build step to fail without failing the entire build if and
1979 /// only if the exit code is one of the specified codes. If allow_failure
1980 /// is also specified, this field will take precedence.
1981 pub allow_exit_codes: std::vec::Vec<i32>,
1982
1983 /// A shell script to be executed in the step.
1984 ///
1985 /// When script is provided, the user cannot specify the entrypoint or args.
1986 pub script: std::string::String,
1987
1988 /// Option to include built-in and custom substitutions as env variables
1989 /// for this build step. This option will override the global option
1990 /// in BuildOption.
1991 pub automap_substitutions: std::option::Option<bool>,
1992
1993 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1994}
1995
1996impl BuildStep {
1997 pub fn new() -> Self {
1998 std::default::Default::default()
1999 }
2000
2001 /// Sets the value of [name][crate::model::BuildStep::name].
2002 ///
2003 /// # Example
2004 /// ```ignore,no_run
2005 /// # use google_cloud_build_v1::model::BuildStep;
2006 /// let x = BuildStep::new().set_name("example");
2007 /// ```
2008 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2009 self.name = v.into();
2010 self
2011 }
2012
2013 /// Sets the value of [env][crate::model::BuildStep::env].
2014 ///
2015 /// # Example
2016 /// ```ignore,no_run
2017 /// # use google_cloud_build_v1::model::BuildStep;
2018 /// let x = BuildStep::new().set_env(["a", "b", "c"]);
2019 /// ```
2020 pub fn set_env<T, V>(mut self, v: T) -> Self
2021 where
2022 T: std::iter::IntoIterator<Item = V>,
2023 V: std::convert::Into<std::string::String>,
2024 {
2025 use std::iter::Iterator;
2026 self.env = v.into_iter().map(|i| i.into()).collect();
2027 self
2028 }
2029
2030 /// Sets the value of [args][crate::model::BuildStep::args].
2031 ///
2032 /// # Example
2033 /// ```ignore,no_run
2034 /// # use google_cloud_build_v1::model::BuildStep;
2035 /// let x = BuildStep::new().set_args(["a", "b", "c"]);
2036 /// ```
2037 pub fn set_args<T, V>(mut self, v: T) -> Self
2038 where
2039 T: std::iter::IntoIterator<Item = V>,
2040 V: std::convert::Into<std::string::String>,
2041 {
2042 use std::iter::Iterator;
2043 self.args = v.into_iter().map(|i| i.into()).collect();
2044 self
2045 }
2046
2047 /// Sets the value of [dir][crate::model::BuildStep::dir].
2048 ///
2049 /// # Example
2050 /// ```ignore,no_run
2051 /// # use google_cloud_build_v1::model::BuildStep;
2052 /// let x = BuildStep::new().set_dir("example");
2053 /// ```
2054 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2055 self.dir = v.into();
2056 self
2057 }
2058
2059 /// Sets the value of [id][crate::model::BuildStep::id].
2060 ///
2061 /// # Example
2062 /// ```ignore,no_run
2063 /// # use google_cloud_build_v1::model::BuildStep;
2064 /// let x = BuildStep::new().set_id("example");
2065 /// ```
2066 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2067 self.id = v.into();
2068 self
2069 }
2070
2071 /// Sets the value of [wait_for][crate::model::BuildStep::wait_for].
2072 ///
2073 /// # Example
2074 /// ```ignore,no_run
2075 /// # use google_cloud_build_v1::model::BuildStep;
2076 /// let x = BuildStep::new().set_wait_for(["a", "b", "c"]);
2077 /// ```
2078 pub fn set_wait_for<T, V>(mut self, v: T) -> Self
2079 where
2080 T: std::iter::IntoIterator<Item = V>,
2081 V: std::convert::Into<std::string::String>,
2082 {
2083 use std::iter::Iterator;
2084 self.wait_for = v.into_iter().map(|i| i.into()).collect();
2085 self
2086 }
2087
2088 /// Sets the value of [entrypoint][crate::model::BuildStep::entrypoint].
2089 ///
2090 /// # Example
2091 /// ```ignore,no_run
2092 /// # use google_cloud_build_v1::model::BuildStep;
2093 /// let x = BuildStep::new().set_entrypoint("example");
2094 /// ```
2095 pub fn set_entrypoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2096 self.entrypoint = v.into();
2097 self
2098 }
2099
2100 /// Sets the value of [secret_env][crate::model::BuildStep::secret_env].
2101 ///
2102 /// # Example
2103 /// ```ignore,no_run
2104 /// # use google_cloud_build_v1::model::BuildStep;
2105 /// let x = BuildStep::new().set_secret_env(["a", "b", "c"]);
2106 /// ```
2107 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
2108 where
2109 T: std::iter::IntoIterator<Item = V>,
2110 V: std::convert::Into<std::string::String>,
2111 {
2112 use std::iter::Iterator;
2113 self.secret_env = v.into_iter().map(|i| i.into()).collect();
2114 self
2115 }
2116
2117 /// Sets the value of [volumes][crate::model::BuildStep::volumes].
2118 ///
2119 /// # Example
2120 /// ```ignore,no_run
2121 /// # use google_cloud_build_v1::model::BuildStep;
2122 /// use google_cloud_build_v1::model::Volume;
2123 /// let x = BuildStep::new()
2124 /// .set_volumes([
2125 /// Volume::default()/* use setters */,
2126 /// Volume::default()/* use (different) setters */,
2127 /// ]);
2128 /// ```
2129 pub fn set_volumes<T, V>(mut self, v: T) -> Self
2130 where
2131 T: std::iter::IntoIterator<Item = V>,
2132 V: std::convert::Into<crate::model::Volume>,
2133 {
2134 use std::iter::Iterator;
2135 self.volumes = v.into_iter().map(|i| i.into()).collect();
2136 self
2137 }
2138
2139 /// Sets the value of [timing][crate::model::BuildStep::timing].
2140 ///
2141 /// # Example
2142 /// ```ignore,no_run
2143 /// # use google_cloud_build_v1::model::BuildStep;
2144 /// use google_cloud_build_v1::model::TimeSpan;
2145 /// let x = BuildStep::new().set_timing(TimeSpan::default()/* use setters */);
2146 /// ```
2147 pub fn set_timing<T>(mut self, v: T) -> Self
2148 where
2149 T: std::convert::Into<crate::model::TimeSpan>,
2150 {
2151 self.timing = std::option::Option::Some(v.into());
2152 self
2153 }
2154
2155 /// Sets or clears the value of [timing][crate::model::BuildStep::timing].
2156 ///
2157 /// # Example
2158 /// ```ignore,no_run
2159 /// # use google_cloud_build_v1::model::BuildStep;
2160 /// use google_cloud_build_v1::model::TimeSpan;
2161 /// let x = BuildStep::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
2162 /// let x = BuildStep::new().set_or_clear_timing(None::<TimeSpan>);
2163 /// ```
2164 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
2165 where
2166 T: std::convert::Into<crate::model::TimeSpan>,
2167 {
2168 self.timing = v.map(|x| x.into());
2169 self
2170 }
2171
2172 /// Sets the value of [pull_timing][crate::model::BuildStep::pull_timing].
2173 ///
2174 /// # Example
2175 /// ```ignore,no_run
2176 /// # use google_cloud_build_v1::model::BuildStep;
2177 /// use google_cloud_build_v1::model::TimeSpan;
2178 /// let x = BuildStep::new().set_pull_timing(TimeSpan::default()/* use setters */);
2179 /// ```
2180 pub fn set_pull_timing<T>(mut self, v: T) -> Self
2181 where
2182 T: std::convert::Into<crate::model::TimeSpan>,
2183 {
2184 self.pull_timing = std::option::Option::Some(v.into());
2185 self
2186 }
2187
2188 /// Sets or clears the value of [pull_timing][crate::model::BuildStep::pull_timing].
2189 ///
2190 /// # Example
2191 /// ```ignore,no_run
2192 /// # use google_cloud_build_v1::model::BuildStep;
2193 /// use google_cloud_build_v1::model::TimeSpan;
2194 /// let x = BuildStep::new().set_or_clear_pull_timing(Some(TimeSpan::default()/* use setters */));
2195 /// let x = BuildStep::new().set_or_clear_pull_timing(None::<TimeSpan>);
2196 /// ```
2197 pub fn set_or_clear_pull_timing<T>(mut self, v: std::option::Option<T>) -> Self
2198 where
2199 T: std::convert::Into<crate::model::TimeSpan>,
2200 {
2201 self.pull_timing = v.map(|x| x.into());
2202 self
2203 }
2204
2205 /// Sets the value of [timeout][crate::model::BuildStep::timeout].
2206 ///
2207 /// # Example
2208 /// ```ignore,no_run
2209 /// # use google_cloud_build_v1::model::BuildStep;
2210 /// use wkt::Duration;
2211 /// let x = BuildStep::new().set_timeout(Duration::default()/* use setters */);
2212 /// ```
2213 pub fn set_timeout<T>(mut self, v: T) -> Self
2214 where
2215 T: std::convert::Into<wkt::Duration>,
2216 {
2217 self.timeout = std::option::Option::Some(v.into());
2218 self
2219 }
2220
2221 /// Sets or clears the value of [timeout][crate::model::BuildStep::timeout].
2222 ///
2223 /// # Example
2224 /// ```ignore,no_run
2225 /// # use google_cloud_build_v1::model::BuildStep;
2226 /// use wkt::Duration;
2227 /// let x = BuildStep::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
2228 /// let x = BuildStep::new().set_or_clear_timeout(None::<Duration>);
2229 /// ```
2230 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2231 where
2232 T: std::convert::Into<wkt::Duration>,
2233 {
2234 self.timeout = v.map(|x| x.into());
2235 self
2236 }
2237
2238 /// Sets the value of [status][crate::model::BuildStep::status].
2239 ///
2240 /// # Example
2241 /// ```ignore,no_run
2242 /// # use google_cloud_build_v1::model::BuildStep;
2243 /// use google_cloud_build_v1::model::build::Status;
2244 /// let x0 = BuildStep::new().set_status(Status::Pending);
2245 /// let x1 = BuildStep::new().set_status(Status::Queued);
2246 /// let x2 = BuildStep::new().set_status(Status::Working);
2247 /// ```
2248 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2249 self.status = v.into();
2250 self
2251 }
2252
2253 /// Sets the value of [allow_failure][crate::model::BuildStep::allow_failure].
2254 ///
2255 /// # Example
2256 /// ```ignore,no_run
2257 /// # use google_cloud_build_v1::model::BuildStep;
2258 /// let x = BuildStep::new().set_allow_failure(true);
2259 /// ```
2260 pub fn set_allow_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2261 self.allow_failure = v.into();
2262 self
2263 }
2264
2265 /// Sets the value of [exit_code][crate::model::BuildStep::exit_code].
2266 ///
2267 /// # Example
2268 /// ```ignore,no_run
2269 /// # use google_cloud_build_v1::model::BuildStep;
2270 /// let x = BuildStep::new().set_exit_code(42);
2271 /// ```
2272 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2273 self.exit_code = v.into();
2274 self
2275 }
2276
2277 /// Sets the value of [allow_exit_codes][crate::model::BuildStep::allow_exit_codes].
2278 ///
2279 /// # Example
2280 /// ```ignore,no_run
2281 /// # use google_cloud_build_v1::model::BuildStep;
2282 /// let x = BuildStep::new().set_allow_exit_codes([1, 2, 3]);
2283 /// ```
2284 pub fn set_allow_exit_codes<T, V>(mut self, v: T) -> Self
2285 where
2286 T: std::iter::IntoIterator<Item = V>,
2287 V: std::convert::Into<i32>,
2288 {
2289 use std::iter::Iterator;
2290 self.allow_exit_codes = v.into_iter().map(|i| i.into()).collect();
2291 self
2292 }
2293
2294 /// Sets the value of [script][crate::model::BuildStep::script].
2295 ///
2296 /// # Example
2297 /// ```ignore,no_run
2298 /// # use google_cloud_build_v1::model::BuildStep;
2299 /// let x = BuildStep::new().set_script("example");
2300 /// ```
2301 pub fn set_script<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2302 self.script = v.into();
2303 self
2304 }
2305
2306 /// Sets the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2307 ///
2308 /// # Example
2309 /// ```ignore,no_run
2310 /// # use google_cloud_build_v1::model::BuildStep;
2311 /// let x = BuildStep::new().set_automap_substitutions(true);
2312 /// ```
2313 pub fn set_automap_substitutions<T>(mut self, v: T) -> Self
2314 where
2315 T: std::convert::Into<bool>,
2316 {
2317 self.automap_substitutions = std::option::Option::Some(v.into());
2318 self
2319 }
2320
2321 /// Sets or clears the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2322 ///
2323 /// # Example
2324 /// ```ignore,no_run
2325 /// # use google_cloud_build_v1::model::BuildStep;
2326 /// let x = BuildStep::new().set_or_clear_automap_substitutions(Some(false));
2327 /// let x = BuildStep::new().set_or_clear_automap_substitutions(None::<bool>);
2328 /// ```
2329 pub fn set_or_clear_automap_substitutions<T>(mut self, v: std::option::Option<T>) -> Self
2330 where
2331 T: std::convert::Into<bool>,
2332 {
2333 self.automap_substitutions = v.map(|x| x.into());
2334 self
2335 }
2336}
2337
2338impl wkt::message::Message for BuildStep {
2339 fn typename() -> &'static str {
2340 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildStep"
2341 }
2342}
2343
2344/// Volume describes a Docker container volume which is mounted into build steps
2345/// in order to persist files across build step execution.
2346#[derive(Clone, Default, PartialEq)]
2347#[non_exhaustive]
2348pub struct Volume {
2349 /// Name of the volume to mount.
2350 ///
2351 /// Volume names must be unique per build step and must be valid names for
2352 /// Docker volumes. Each named volume must be used by at least two build steps.
2353 pub name: std::string::String,
2354
2355 /// Path at which to mount the volume.
2356 ///
2357 /// Paths must be absolute and cannot conflict with other volume paths on the
2358 /// same build step or with certain reserved volume paths.
2359 pub path: std::string::String,
2360
2361 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2362}
2363
2364impl Volume {
2365 pub fn new() -> Self {
2366 std::default::Default::default()
2367 }
2368
2369 /// Sets the value of [name][crate::model::Volume::name].
2370 ///
2371 /// # Example
2372 /// ```ignore,no_run
2373 /// # use google_cloud_build_v1::model::Volume;
2374 /// let x = Volume::new().set_name("example");
2375 /// ```
2376 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2377 self.name = v.into();
2378 self
2379 }
2380
2381 /// Sets the value of [path][crate::model::Volume::path].
2382 ///
2383 /// # Example
2384 /// ```ignore,no_run
2385 /// # use google_cloud_build_v1::model::Volume;
2386 /// let x = Volume::new().set_path("example");
2387 /// ```
2388 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2389 self.path = v.into();
2390 self
2391 }
2392}
2393
2394impl wkt::message::Message for Volume {
2395 fn typename() -> &'static str {
2396 "type.googleapis.com/google.devtools.cloudbuild.v1.Volume"
2397 }
2398}
2399
2400/// Artifacts created by the build pipeline.
2401#[derive(Clone, Default, PartialEq)]
2402#[non_exhaustive]
2403pub struct Results {
2404 /// Container images that were built as a part of the build.
2405 pub images: std::vec::Vec<crate::model::BuiltImage>,
2406
2407 /// List of build step digests, in the order corresponding to build step
2408 /// indices.
2409 pub build_step_images: std::vec::Vec<std::string::String>,
2410
2411 /// Path to the artifact manifest for non-container artifacts uploaded to Cloud
2412 /// Storage. Only populated when artifacts are uploaded to Cloud Storage.
2413 pub artifact_manifest: std::string::String,
2414
2415 /// Number of non-container artifacts uploaded to Cloud Storage. Only populated
2416 /// when artifacts are uploaded to Cloud Storage.
2417 pub num_artifacts: i64,
2418
2419 /// List of build step outputs, produced by builder images, in the order
2420 /// corresponding to build step indices.
2421 ///
2422 /// [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders)
2423 /// can produce this output by writing to `$BUILDER_OUTPUT/output`. Only the
2424 /// first 50KB of data is stored. Note that the `$BUILDER_OUTPUT` variable is
2425 /// read-only and can't be substituted.
2426 pub build_step_outputs: std::vec::Vec<::bytes::Bytes>,
2427
2428 /// Time to push all non-container artifacts to Cloud Storage.
2429 pub artifact_timing: std::option::Option<crate::model::TimeSpan>,
2430
2431 /// Python artifacts uploaded to Artifact Registry at the end of the build.
2432 pub python_packages: std::vec::Vec<crate::model::UploadedPythonPackage>,
2433
2434 /// Maven artifacts uploaded to Artifact Registry at the end of the build.
2435 pub maven_artifacts: std::vec::Vec<crate::model::UploadedMavenArtifact>,
2436
2437 /// Optional. Go module artifacts uploaded to Artifact Registry at the end of
2438 /// the build.
2439 pub go_modules: std::vec::Vec<crate::model::UploadedGoModule>,
2440
2441 /// Npm packages uploaded to Artifact Registry at the end of the build.
2442 pub npm_packages: std::vec::Vec<crate::model::UploadedNpmPackage>,
2443
2444 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2445}
2446
2447impl Results {
2448 pub fn new() -> Self {
2449 std::default::Default::default()
2450 }
2451
2452 /// Sets the value of [images][crate::model::Results::images].
2453 ///
2454 /// # Example
2455 /// ```ignore,no_run
2456 /// # use google_cloud_build_v1::model::Results;
2457 /// use google_cloud_build_v1::model::BuiltImage;
2458 /// let x = Results::new()
2459 /// .set_images([
2460 /// BuiltImage::default()/* use setters */,
2461 /// BuiltImage::default()/* use (different) setters */,
2462 /// ]);
2463 /// ```
2464 pub fn set_images<T, V>(mut self, v: T) -> Self
2465 where
2466 T: std::iter::IntoIterator<Item = V>,
2467 V: std::convert::Into<crate::model::BuiltImage>,
2468 {
2469 use std::iter::Iterator;
2470 self.images = v.into_iter().map(|i| i.into()).collect();
2471 self
2472 }
2473
2474 /// Sets the value of [build_step_images][crate::model::Results::build_step_images].
2475 ///
2476 /// # Example
2477 /// ```ignore,no_run
2478 /// # use google_cloud_build_v1::model::Results;
2479 /// let x = Results::new().set_build_step_images(["a", "b", "c"]);
2480 /// ```
2481 pub fn set_build_step_images<T, V>(mut self, v: T) -> Self
2482 where
2483 T: std::iter::IntoIterator<Item = V>,
2484 V: std::convert::Into<std::string::String>,
2485 {
2486 use std::iter::Iterator;
2487 self.build_step_images = v.into_iter().map(|i| i.into()).collect();
2488 self
2489 }
2490
2491 /// Sets the value of [artifact_manifest][crate::model::Results::artifact_manifest].
2492 ///
2493 /// # Example
2494 /// ```ignore,no_run
2495 /// # use google_cloud_build_v1::model::Results;
2496 /// let x = Results::new().set_artifact_manifest("example");
2497 /// ```
2498 pub fn set_artifact_manifest<T: std::convert::Into<std::string::String>>(
2499 mut self,
2500 v: T,
2501 ) -> Self {
2502 self.artifact_manifest = v.into();
2503 self
2504 }
2505
2506 /// Sets the value of [num_artifacts][crate::model::Results::num_artifacts].
2507 ///
2508 /// # Example
2509 /// ```ignore,no_run
2510 /// # use google_cloud_build_v1::model::Results;
2511 /// let x = Results::new().set_num_artifacts(42);
2512 /// ```
2513 pub fn set_num_artifacts<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2514 self.num_artifacts = v.into();
2515 self
2516 }
2517
2518 /// Sets the value of [build_step_outputs][crate::model::Results::build_step_outputs].
2519 ///
2520 /// # Example
2521 /// ```ignore,no_run
2522 /// # use google_cloud_build_v1::model::Results;
2523 /// let b1 = bytes::Bytes::from_static(b"abc");
2524 /// let b2 = bytes::Bytes::from_static(b"xyz");
2525 /// let x = Results::new().set_build_step_outputs([b1, b2]);
2526 /// ```
2527 pub fn set_build_step_outputs<T, V>(mut self, v: T) -> Self
2528 where
2529 T: std::iter::IntoIterator<Item = V>,
2530 V: std::convert::Into<::bytes::Bytes>,
2531 {
2532 use std::iter::Iterator;
2533 self.build_step_outputs = v.into_iter().map(|i| i.into()).collect();
2534 self
2535 }
2536
2537 /// Sets the value of [artifact_timing][crate::model::Results::artifact_timing].
2538 ///
2539 /// # Example
2540 /// ```ignore,no_run
2541 /// # use google_cloud_build_v1::model::Results;
2542 /// use google_cloud_build_v1::model::TimeSpan;
2543 /// let x = Results::new().set_artifact_timing(TimeSpan::default()/* use setters */);
2544 /// ```
2545 pub fn set_artifact_timing<T>(mut self, v: T) -> Self
2546 where
2547 T: std::convert::Into<crate::model::TimeSpan>,
2548 {
2549 self.artifact_timing = std::option::Option::Some(v.into());
2550 self
2551 }
2552
2553 /// Sets or clears the value of [artifact_timing][crate::model::Results::artifact_timing].
2554 ///
2555 /// # Example
2556 /// ```ignore,no_run
2557 /// # use google_cloud_build_v1::model::Results;
2558 /// use google_cloud_build_v1::model::TimeSpan;
2559 /// let x = Results::new().set_or_clear_artifact_timing(Some(TimeSpan::default()/* use setters */));
2560 /// let x = Results::new().set_or_clear_artifact_timing(None::<TimeSpan>);
2561 /// ```
2562 pub fn set_or_clear_artifact_timing<T>(mut self, v: std::option::Option<T>) -> Self
2563 where
2564 T: std::convert::Into<crate::model::TimeSpan>,
2565 {
2566 self.artifact_timing = v.map(|x| x.into());
2567 self
2568 }
2569
2570 /// Sets the value of [python_packages][crate::model::Results::python_packages].
2571 ///
2572 /// # Example
2573 /// ```ignore,no_run
2574 /// # use google_cloud_build_v1::model::Results;
2575 /// use google_cloud_build_v1::model::UploadedPythonPackage;
2576 /// let x = Results::new()
2577 /// .set_python_packages([
2578 /// UploadedPythonPackage::default()/* use setters */,
2579 /// UploadedPythonPackage::default()/* use (different) setters */,
2580 /// ]);
2581 /// ```
2582 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
2583 where
2584 T: std::iter::IntoIterator<Item = V>,
2585 V: std::convert::Into<crate::model::UploadedPythonPackage>,
2586 {
2587 use std::iter::Iterator;
2588 self.python_packages = v.into_iter().map(|i| i.into()).collect();
2589 self
2590 }
2591
2592 /// Sets the value of [maven_artifacts][crate::model::Results::maven_artifacts].
2593 ///
2594 /// # Example
2595 /// ```ignore,no_run
2596 /// # use google_cloud_build_v1::model::Results;
2597 /// use google_cloud_build_v1::model::UploadedMavenArtifact;
2598 /// let x = Results::new()
2599 /// .set_maven_artifacts([
2600 /// UploadedMavenArtifact::default()/* use setters */,
2601 /// UploadedMavenArtifact::default()/* use (different) setters */,
2602 /// ]);
2603 /// ```
2604 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
2605 where
2606 T: std::iter::IntoIterator<Item = V>,
2607 V: std::convert::Into<crate::model::UploadedMavenArtifact>,
2608 {
2609 use std::iter::Iterator;
2610 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
2611 self
2612 }
2613
2614 /// Sets the value of [go_modules][crate::model::Results::go_modules].
2615 ///
2616 /// # Example
2617 /// ```ignore,no_run
2618 /// # use google_cloud_build_v1::model::Results;
2619 /// use google_cloud_build_v1::model::UploadedGoModule;
2620 /// let x = Results::new()
2621 /// .set_go_modules([
2622 /// UploadedGoModule::default()/* use setters */,
2623 /// UploadedGoModule::default()/* use (different) setters */,
2624 /// ]);
2625 /// ```
2626 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
2627 where
2628 T: std::iter::IntoIterator<Item = V>,
2629 V: std::convert::Into<crate::model::UploadedGoModule>,
2630 {
2631 use std::iter::Iterator;
2632 self.go_modules = v.into_iter().map(|i| i.into()).collect();
2633 self
2634 }
2635
2636 /// Sets the value of [npm_packages][crate::model::Results::npm_packages].
2637 ///
2638 /// # Example
2639 /// ```ignore,no_run
2640 /// # use google_cloud_build_v1::model::Results;
2641 /// use google_cloud_build_v1::model::UploadedNpmPackage;
2642 /// let x = Results::new()
2643 /// .set_npm_packages([
2644 /// UploadedNpmPackage::default()/* use setters */,
2645 /// UploadedNpmPackage::default()/* use (different) setters */,
2646 /// ]);
2647 /// ```
2648 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
2649 where
2650 T: std::iter::IntoIterator<Item = V>,
2651 V: std::convert::Into<crate::model::UploadedNpmPackage>,
2652 {
2653 use std::iter::Iterator;
2654 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
2655 self
2656 }
2657}
2658
2659impl wkt::message::Message for Results {
2660 fn typename() -> &'static str {
2661 "type.googleapis.com/google.devtools.cloudbuild.v1.Results"
2662 }
2663}
2664
2665/// An artifact that was uploaded during a build. This
2666/// is a single record in the artifact manifest JSON file.
2667#[derive(Clone, Default, PartialEq)]
2668#[non_exhaustive]
2669pub struct ArtifactResult {
2670 /// The path of an artifact in a Cloud Storage bucket, with the
2671 /// generation number. For example,
2672 /// `gs://mybucket/path/to/output.jar#generation`.
2673 pub location: std::string::String,
2674
2675 /// The file hash of the artifact.
2676 pub file_hash: std::vec::Vec<crate::model::FileHashes>,
2677
2678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2679}
2680
2681impl ArtifactResult {
2682 pub fn new() -> Self {
2683 std::default::Default::default()
2684 }
2685
2686 /// Sets the value of [location][crate::model::ArtifactResult::location].
2687 ///
2688 /// # Example
2689 /// ```ignore,no_run
2690 /// # use google_cloud_build_v1::model::ArtifactResult;
2691 /// let x = ArtifactResult::new().set_location("example");
2692 /// ```
2693 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2694 self.location = v.into();
2695 self
2696 }
2697
2698 /// Sets the value of [file_hash][crate::model::ArtifactResult::file_hash].
2699 ///
2700 /// # Example
2701 /// ```ignore,no_run
2702 /// # use google_cloud_build_v1::model::ArtifactResult;
2703 /// use google_cloud_build_v1::model::FileHashes;
2704 /// let x = ArtifactResult::new()
2705 /// .set_file_hash([
2706 /// FileHashes::default()/* use setters */,
2707 /// FileHashes::default()/* use (different) setters */,
2708 /// ]);
2709 /// ```
2710 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
2711 where
2712 T: std::iter::IntoIterator<Item = V>,
2713 V: std::convert::Into<crate::model::FileHashes>,
2714 {
2715 use std::iter::Iterator;
2716 self.file_hash = v.into_iter().map(|i| i.into()).collect();
2717 self
2718 }
2719}
2720
2721impl wkt::message::Message for ArtifactResult {
2722 fn typename() -> &'static str {
2723 "type.googleapis.com/google.devtools.cloudbuild.v1.ArtifactResult"
2724 }
2725}
2726
2727/// A build resource in the Cloud Build API.
2728///
2729/// At a high level, a `Build` describes where to find source code, how to build
2730/// it (for example, the builder image to run on the source), and where to store
2731/// the built artifacts.
2732///
2733/// Fields can include the following variables, which will be expanded when the
2734/// build is created:
2735///
2736/// - $PROJECT_ID: the project ID of the build.
2737/// - $PROJECT_NUMBER: the project number of the build.
2738/// - $LOCATION: the location/region of the build.
2739/// - $BUILD_ID: the autogenerated ID of the build.
2740/// - $REPO_NAME: the source repository name specified by RepoSource.
2741/// - $BRANCH_NAME: the branch name specified by RepoSource.
2742/// - $TAG_NAME: the tag name specified by RepoSource.
2743/// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or
2744/// resolved from the specified branch or tag.
2745/// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA.
2746#[derive(Clone, Default, PartialEq)]
2747#[non_exhaustive]
2748pub struct Build {
2749 /// Output only. The 'Build' name with format:
2750 /// `projects/{project}/locations/{location}/builds/{build}`, where {build}
2751 /// is a unique identifier generated by the service.
2752 pub name: std::string::String,
2753
2754 /// Output only. Unique identifier of the build.
2755 pub id: std::string::String,
2756
2757 /// Output only. ID of the project.
2758 pub project_id: std::string::String,
2759
2760 /// Output only. Status of the build.
2761 pub status: crate::model::build::Status,
2762
2763 /// Output only. Customer-readable message about the current status.
2764 pub status_detail: std::string::String,
2765
2766 /// Optional. The location of the source files to build.
2767 pub source: std::option::Option<crate::model::Source>,
2768
2769 /// Required. The operations to be performed on the workspace.
2770 pub steps: std::vec::Vec<crate::model::BuildStep>,
2771
2772 /// Output only. Results of the build.
2773 pub results: std::option::Option<crate::model::Results>,
2774
2775 /// Output only. Time at which the request to create the build was received.
2776 pub create_time: std::option::Option<wkt::Timestamp>,
2777
2778 /// Output only. Time at which execution of the build was started.
2779 pub start_time: std::option::Option<wkt::Timestamp>,
2780
2781 /// Output only. Time at which execution of the build was finished.
2782 ///
2783 /// The difference between finish_time and start_time is the duration of the
2784 /// build's execution.
2785 pub finish_time: std::option::Option<wkt::Timestamp>,
2786
2787 /// Amount of time that this build should be allowed to run, to second
2788 /// granularity. If this amount of time elapses, work on the build will cease
2789 /// and the build status will be `TIMEOUT`.
2790 ///
2791 /// `timeout` starts ticking from `startTime`.
2792 ///
2793 /// Default time is 60 minutes.
2794 pub timeout: std::option::Option<wkt::Duration>,
2795
2796 /// A list of images to be pushed upon the successful completion of all build
2797 /// steps.
2798 ///
2799 /// The images are pushed using the builder service account's credentials.
2800 ///
2801 /// The digests of the pushed images will be stored in the `Build` resource's
2802 /// results field.
2803 ///
2804 /// If any of the images fail to be pushed, the build status is marked
2805 /// `FAILURE`.
2806 pub images: std::vec::Vec<std::string::String>,
2807
2808 /// TTL in queue for this build. If provided and the build is enqueued longer
2809 /// than this value, the build will expire and the build status will be
2810 /// `EXPIRED`.
2811 ///
2812 /// The TTL starts ticking from create_time.
2813 pub queue_ttl: std::option::Option<wkt::Duration>,
2814
2815 /// Artifacts produced by the build that should be uploaded upon
2816 /// successful completion of all build steps.
2817 pub artifacts: std::option::Option<crate::model::Artifacts>,
2818
2819 /// Cloud Storage bucket where logs should be written (see
2820 /// [Bucket Name
2821 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
2822 /// Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`.
2823 pub logs_bucket: std::string::String,
2824
2825 /// Output only. A permanent fixed identifier for source.
2826 pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
2827
2828 /// Output only. The ID of the `BuildTrigger` that triggered this build, if it
2829 /// was triggered automatically.
2830 pub build_trigger_id: std::string::String,
2831
2832 /// Special options for this build.
2833 pub options: std::option::Option<crate::model::BuildOptions>,
2834
2835 /// Output only. URL to logs for this build in Google Cloud Console.
2836 pub log_url: std::string::String,
2837
2838 /// Substitutions data for `Build` resource.
2839 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
2840
2841 /// Tags for annotation of a `Build`. These are not docker tags.
2842 pub tags: std::vec::Vec<std::string::String>,
2843
2844 /// Secrets to decrypt using Cloud Key Management Service.
2845 /// Note: Secret Manager is the recommended technique
2846 /// for managing sensitive data with Cloud Build. Use `available_secrets` to
2847 /// configure builds to access secrets from Secret Manager. For instructions,
2848 /// see: <https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets>
2849 pub secrets: std::vec::Vec<crate::model::Secret>,
2850
2851 /// Output only. Stores timing information for phases of the build. Valid keys
2852 /// are:
2853 ///
2854 /// * BUILD: time to execute all build steps.
2855 /// * PUSH: time to push all artifacts including docker images and non docker
2856 /// artifacts.
2857 /// * FETCHSOURCE: time to fetch source.
2858 /// * SETUPBUILD: time to set up build.
2859 ///
2860 /// If the build does not specify source or images,
2861 /// these keys will not be included.
2862 pub timing: std::collections::HashMap<std::string::String, crate::model::TimeSpan>,
2863
2864 /// Output only. Describes this build's approval configuration, status,
2865 /// and result.
2866 pub approval: std::option::Option<crate::model::BuildApproval>,
2867
2868 /// IAM service account whose credentials will be used at build runtime.
2869 /// Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
2870 /// ACCOUNT can be email address or uniqueId of the service account.
2871 pub service_account: std::string::String,
2872
2873 /// Secrets and secret environment variables.
2874 pub available_secrets: std::option::Option<crate::model::Secrets>,
2875
2876 /// Output only. Non-fatal problems encountered during the execution of the
2877 /// build.
2878 pub warnings: std::vec::Vec<crate::model::build::Warning>,
2879
2880 /// Optional. Configuration for git operations.
2881 pub git_config: std::option::Option<crate::model::GitConfig>,
2882
2883 /// Output only. Contains information about the build when status=FAILURE.
2884 pub failure_info: std::option::Option<crate::model::build::FailureInfo>,
2885
2886 /// Optional. Dependencies that the Cloud Build worker will fetch before
2887 /// executing user steps.
2888 pub dependencies: std::vec::Vec<crate::model::Dependency>,
2889
2890 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2891}
2892
2893impl Build {
2894 pub fn new() -> Self {
2895 std::default::Default::default()
2896 }
2897
2898 /// Sets the value of [name][crate::model::Build::name].
2899 ///
2900 /// # Example
2901 /// ```ignore,no_run
2902 /// # use google_cloud_build_v1::model::Build;
2903 /// let x = Build::new().set_name("example");
2904 /// ```
2905 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2906 self.name = v.into();
2907 self
2908 }
2909
2910 /// Sets the value of [id][crate::model::Build::id].
2911 ///
2912 /// # Example
2913 /// ```ignore,no_run
2914 /// # use google_cloud_build_v1::model::Build;
2915 /// let x = Build::new().set_id("example");
2916 /// ```
2917 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2918 self.id = v.into();
2919 self
2920 }
2921
2922 /// Sets the value of [project_id][crate::model::Build::project_id].
2923 ///
2924 /// # Example
2925 /// ```ignore,no_run
2926 /// # use google_cloud_build_v1::model::Build;
2927 /// let x = Build::new().set_project_id("example");
2928 /// ```
2929 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2930 self.project_id = v.into();
2931 self
2932 }
2933
2934 /// Sets the value of [status][crate::model::Build::status].
2935 ///
2936 /// # Example
2937 /// ```ignore,no_run
2938 /// # use google_cloud_build_v1::model::Build;
2939 /// use google_cloud_build_v1::model::build::Status;
2940 /// let x0 = Build::new().set_status(Status::Pending);
2941 /// let x1 = Build::new().set_status(Status::Queued);
2942 /// let x2 = Build::new().set_status(Status::Working);
2943 /// ```
2944 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2945 self.status = v.into();
2946 self
2947 }
2948
2949 /// Sets the value of [status_detail][crate::model::Build::status_detail].
2950 ///
2951 /// # Example
2952 /// ```ignore,no_run
2953 /// # use google_cloud_build_v1::model::Build;
2954 /// let x = Build::new().set_status_detail("example");
2955 /// ```
2956 pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2957 self.status_detail = v.into();
2958 self
2959 }
2960
2961 /// Sets the value of [source][crate::model::Build::source].
2962 ///
2963 /// # Example
2964 /// ```ignore,no_run
2965 /// # use google_cloud_build_v1::model::Build;
2966 /// use google_cloud_build_v1::model::Source;
2967 /// let x = Build::new().set_source(Source::default()/* use setters */);
2968 /// ```
2969 pub fn set_source<T>(mut self, v: T) -> Self
2970 where
2971 T: std::convert::Into<crate::model::Source>,
2972 {
2973 self.source = std::option::Option::Some(v.into());
2974 self
2975 }
2976
2977 /// Sets or clears the value of [source][crate::model::Build::source].
2978 ///
2979 /// # Example
2980 /// ```ignore,no_run
2981 /// # use google_cloud_build_v1::model::Build;
2982 /// use google_cloud_build_v1::model::Source;
2983 /// let x = Build::new().set_or_clear_source(Some(Source::default()/* use setters */));
2984 /// let x = Build::new().set_or_clear_source(None::<Source>);
2985 /// ```
2986 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
2987 where
2988 T: std::convert::Into<crate::model::Source>,
2989 {
2990 self.source = v.map(|x| x.into());
2991 self
2992 }
2993
2994 /// Sets the value of [steps][crate::model::Build::steps].
2995 ///
2996 /// # Example
2997 /// ```ignore,no_run
2998 /// # use google_cloud_build_v1::model::Build;
2999 /// use google_cloud_build_v1::model::BuildStep;
3000 /// let x = Build::new()
3001 /// .set_steps([
3002 /// BuildStep::default()/* use setters */,
3003 /// BuildStep::default()/* use (different) setters */,
3004 /// ]);
3005 /// ```
3006 pub fn set_steps<T, V>(mut self, v: T) -> Self
3007 where
3008 T: std::iter::IntoIterator<Item = V>,
3009 V: std::convert::Into<crate::model::BuildStep>,
3010 {
3011 use std::iter::Iterator;
3012 self.steps = v.into_iter().map(|i| i.into()).collect();
3013 self
3014 }
3015
3016 /// Sets the value of [results][crate::model::Build::results].
3017 ///
3018 /// # Example
3019 /// ```ignore,no_run
3020 /// # use google_cloud_build_v1::model::Build;
3021 /// use google_cloud_build_v1::model::Results;
3022 /// let x = Build::new().set_results(Results::default()/* use setters */);
3023 /// ```
3024 pub fn set_results<T>(mut self, v: T) -> Self
3025 where
3026 T: std::convert::Into<crate::model::Results>,
3027 {
3028 self.results = std::option::Option::Some(v.into());
3029 self
3030 }
3031
3032 /// Sets or clears the value of [results][crate::model::Build::results].
3033 ///
3034 /// # Example
3035 /// ```ignore,no_run
3036 /// # use google_cloud_build_v1::model::Build;
3037 /// use google_cloud_build_v1::model::Results;
3038 /// let x = Build::new().set_or_clear_results(Some(Results::default()/* use setters */));
3039 /// let x = Build::new().set_or_clear_results(None::<Results>);
3040 /// ```
3041 pub fn set_or_clear_results<T>(mut self, v: std::option::Option<T>) -> Self
3042 where
3043 T: std::convert::Into<crate::model::Results>,
3044 {
3045 self.results = v.map(|x| x.into());
3046 self
3047 }
3048
3049 /// Sets the value of [create_time][crate::model::Build::create_time].
3050 ///
3051 /// # Example
3052 /// ```ignore,no_run
3053 /// # use google_cloud_build_v1::model::Build;
3054 /// use wkt::Timestamp;
3055 /// let x = Build::new().set_create_time(Timestamp::default()/* use setters */);
3056 /// ```
3057 pub fn set_create_time<T>(mut self, v: T) -> Self
3058 where
3059 T: std::convert::Into<wkt::Timestamp>,
3060 {
3061 self.create_time = std::option::Option::Some(v.into());
3062 self
3063 }
3064
3065 /// Sets or clears the value of [create_time][crate::model::Build::create_time].
3066 ///
3067 /// # Example
3068 /// ```ignore,no_run
3069 /// # use google_cloud_build_v1::model::Build;
3070 /// use wkt::Timestamp;
3071 /// let x = Build::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3072 /// let x = Build::new().set_or_clear_create_time(None::<Timestamp>);
3073 /// ```
3074 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3075 where
3076 T: std::convert::Into<wkt::Timestamp>,
3077 {
3078 self.create_time = v.map(|x| x.into());
3079 self
3080 }
3081
3082 /// Sets the value of [start_time][crate::model::Build::start_time].
3083 ///
3084 /// # Example
3085 /// ```ignore,no_run
3086 /// # use google_cloud_build_v1::model::Build;
3087 /// use wkt::Timestamp;
3088 /// let x = Build::new().set_start_time(Timestamp::default()/* use setters */);
3089 /// ```
3090 pub fn set_start_time<T>(mut self, v: T) -> Self
3091 where
3092 T: std::convert::Into<wkt::Timestamp>,
3093 {
3094 self.start_time = std::option::Option::Some(v.into());
3095 self
3096 }
3097
3098 /// Sets or clears the value of [start_time][crate::model::Build::start_time].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_cloud_build_v1::model::Build;
3103 /// use wkt::Timestamp;
3104 /// let x = Build::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3105 /// let x = Build::new().set_or_clear_start_time(None::<Timestamp>);
3106 /// ```
3107 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3108 where
3109 T: std::convert::Into<wkt::Timestamp>,
3110 {
3111 self.start_time = v.map(|x| x.into());
3112 self
3113 }
3114
3115 /// Sets the value of [finish_time][crate::model::Build::finish_time].
3116 ///
3117 /// # Example
3118 /// ```ignore,no_run
3119 /// # use google_cloud_build_v1::model::Build;
3120 /// use wkt::Timestamp;
3121 /// let x = Build::new().set_finish_time(Timestamp::default()/* use setters */);
3122 /// ```
3123 pub fn set_finish_time<T>(mut self, v: T) -> Self
3124 where
3125 T: std::convert::Into<wkt::Timestamp>,
3126 {
3127 self.finish_time = std::option::Option::Some(v.into());
3128 self
3129 }
3130
3131 /// Sets or clears the value of [finish_time][crate::model::Build::finish_time].
3132 ///
3133 /// # Example
3134 /// ```ignore,no_run
3135 /// # use google_cloud_build_v1::model::Build;
3136 /// use wkt::Timestamp;
3137 /// let x = Build::new().set_or_clear_finish_time(Some(Timestamp::default()/* use setters */));
3138 /// let x = Build::new().set_or_clear_finish_time(None::<Timestamp>);
3139 /// ```
3140 pub fn set_or_clear_finish_time<T>(mut self, v: std::option::Option<T>) -> Self
3141 where
3142 T: std::convert::Into<wkt::Timestamp>,
3143 {
3144 self.finish_time = v.map(|x| x.into());
3145 self
3146 }
3147
3148 /// Sets the value of [timeout][crate::model::Build::timeout].
3149 ///
3150 /// # Example
3151 /// ```ignore,no_run
3152 /// # use google_cloud_build_v1::model::Build;
3153 /// use wkt::Duration;
3154 /// let x = Build::new().set_timeout(Duration::default()/* use setters */);
3155 /// ```
3156 pub fn set_timeout<T>(mut self, v: T) -> Self
3157 where
3158 T: std::convert::Into<wkt::Duration>,
3159 {
3160 self.timeout = std::option::Option::Some(v.into());
3161 self
3162 }
3163
3164 /// Sets or clears the value of [timeout][crate::model::Build::timeout].
3165 ///
3166 /// # Example
3167 /// ```ignore,no_run
3168 /// # use google_cloud_build_v1::model::Build;
3169 /// use wkt::Duration;
3170 /// let x = Build::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
3171 /// let x = Build::new().set_or_clear_timeout(None::<Duration>);
3172 /// ```
3173 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3174 where
3175 T: std::convert::Into<wkt::Duration>,
3176 {
3177 self.timeout = v.map(|x| x.into());
3178 self
3179 }
3180
3181 /// Sets the value of [images][crate::model::Build::images].
3182 ///
3183 /// # Example
3184 /// ```ignore,no_run
3185 /// # use google_cloud_build_v1::model::Build;
3186 /// let x = Build::new().set_images(["a", "b", "c"]);
3187 /// ```
3188 pub fn set_images<T, V>(mut self, v: T) -> Self
3189 where
3190 T: std::iter::IntoIterator<Item = V>,
3191 V: std::convert::Into<std::string::String>,
3192 {
3193 use std::iter::Iterator;
3194 self.images = v.into_iter().map(|i| i.into()).collect();
3195 self
3196 }
3197
3198 /// Sets the value of [queue_ttl][crate::model::Build::queue_ttl].
3199 ///
3200 /// # Example
3201 /// ```ignore,no_run
3202 /// # use google_cloud_build_v1::model::Build;
3203 /// use wkt::Duration;
3204 /// let x = Build::new().set_queue_ttl(Duration::default()/* use setters */);
3205 /// ```
3206 pub fn set_queue_ttl<T>(mut self, v: T) -> Self
3207 where
3208 T: std::convert::Into<wkt::Duration>,
3209 {
3210 self.queue_ttl = std::option::Option::Some(v.into());
3211 self
3212 }
3213
3214 /// Sets or clears the value of [queue_ttl][crate::model::Build::queue_ttl].
3215 ///
3216 /// # Example
3217 /// ```ignore,no_run
3218 /// # use google_cloud_build_v1::model::Build;
3219 /// use wkt::Duration;
3220 /// let x = Build::new().set_or_clear_queue_ttl(Some(Duration::default()/* use setters */));
3221 /// let x = Build::new().set_or_clear_queue_ttl(None::<Duration>);
3222 /// ```
3223 pub fn set_or_clear_queue_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3224 where
3225 T: std::convert::Into<wkt::Duration>,
3226 {
3227 self.queue_ttl = v.map(|x| x.into());
3228 self
3229 }
3230
3231 /// Sets the value of [artifacts][crate::model::Build::artifacts].
3232 ///
3233 /// # Example
3234 /// ```ignore,no_run
3235 /// # use google_cloud_build_v1::model::Build;
3236 /// use google_cloud_build_v1::model::Artifacts;
3237 /// let x = Build::new().set_artifacts(Artifacts::default()/* use setters */);
3238 /// ```
3239 pub fn set_artifacts<T>(mut self, v: T) -> Self
3240 where
3241 T: std::convert::Into<crate::model::Artifacts>,
3242 {
3243 self.artifacts = std::option::Option::Some(v.into());
3244 self
3245 }
3246
3247 /// Sets or clears the value of [artifacts][crate::model::Build::artifacts].
3248 ///
3249 /// # Example
3250 /// ```ignore,no_run
3251 /// # use google_cloud_build_v1::model::Build;
3252 /// use google_cloud_build_v1::model::Artifacts;
3253 /// let x = Build::new().set_or_clear_artifacts(Some(Artifacts::default()/* use setters */));
3254 /// let x = Build::new().set_or_clear_artifacts(None::<Artifacts>);
3255 /// ```
3256 pub fn set_or_clear_artifacts<T>(mut self, v: std::option::Option<T>) -> Self
3257 where
3258 T: std::convert::Into<crate::model::Artifacts>,
3259 {
3260 self.artifacts = v.map(|x| x.into());
3261 self
3262 }
3263
3264 /// Sets the value of [logs_bucket][crate::model::Build::logs_bucket].
3265 ///
3266 /// # Example
3267 /// ```ignore,no_run
3268 /// # use google_cloud_build_v1::model::Build;
3269 /// let x = Build::new().set_logs_bucket("example");
3270 /// ```
3271 pub fn set_logs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3272 self.logs_bucket = v.into();
3273 self
3274 }
3275
3276 /// Sets the value of [source_provenance][crate::model::Build::source_provenance].
3277 ///
3278 /// # Example
3279 /// ```ignore,no_run
3280 /// # use google_cloud_build_v1::model::Build;
3281 /// use google_cloud_build_v1::model::SourceProvenance;
3282 /// let x = Build::new().set_source_provenance(SourceProvenance::default()/* use setters */);
3283 /// ```
3284 pub fn set_source_provenance<T>(mut self, v: T) -> Self
3285 where
3286 T: std::convert::Into<crate::model::SourceProvenance>,
3287 {
3288 self.source_provenance = std::option::Option::Some(v.into());
3289 self
3290 }
3291
3292 /// Sets or clears the value of [source_provenance][crate::model::Build::source_provenance].
3293 ///
3294 /// # Example
3295 /// ```ignore,no_run
3296 /// # use google_cloud_build_v1::model::Build;
3297 /// use google_cloud_build_v1::model::SourceProvenance;
3298 /// let x = Build::new().set_or_clear_source_provenance(Some(SourceProvenance::default()/* use setters */));
3299 /// let x = Build::new().set_or_clear_source_provenance(None::<SourceProvenance>);
3300 /// ```
3301 pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3302 where
3303 T: std::convert::Into<crate::model::SourceProvenance>,
3304 {
3305 self.source_provenance = v.map(|x| x.into());
3306 self
3307 }
3308
3309 /// Sets the value of [build_trigger_id][crate::model::Build::build_trigger_id].
3310 ///
3311 /// # Example
3312 /// ```ignore,no_run
3313 /// # use google_cloud_build_v1::model::Build;
3314 /// let x = Build::new().set_build_trigger_id("example");
3315 /// ```
3316 pub fn set_build_trigger_id<T: std::convert::Into<std::string::String>>(
3317 mut self,
3318 v: T,
3319 ) -> Self {
3320 self.build_trigger_id = v.into();
3321 self
3322 }
3323
3324 /// Sets the value of [options][crate::model::Build::options].
3325 ///
3326 /// # Example
3327 /// ```ignore,no_run
3328 /// # use google_cloud_build_v1::model::Build;
3329 /// use google_cloud_build_v1::model::BuildOptions;
3330 /// let x = Build::new().set_options(BuildOptions::default()/* use setters */);
3331 /// ```
3332 pub fn set_options<T>(mut self, v: T) -> Self
3333 where
3334 T: std::convert::Into<crate::model::BuildOptions>,
3335 {
3336 self.options = std::option::Option::Some(v.into());
3337 self
3338 }
3339
3340 /// Sets or clears the value of [options][crate::model::Build::options].
3341 ///
3342 /// # Example
3343 /// ```ignore,no_run
3344 /// # use google_cloud_build_v1::model::Build;
3345 /// use google_cloud_build_v1::model::BuildOptions;
3346 /// let x = Build::new().set_or_clear_options(Some(BuildOptions::default()/* use setters */));
3347 /// let x = Build::new().set_or_clear_options(None::<BuildOptions>);
3348 /// ```
3349 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3350 where
3351 T: std::convert::Into<crate::model::BuildOptions>,
3352 {
3353 self.options = v.map(|x| x.into());
3354 self
3355 }
3356
3357 /// Sets the value of [log_url][crate::model::Build::log_url].
3358 ///
3359 /// # Example
3360 /// ```ignore,no_run
3361 /// # use google_cloud_build_v1::model::Build;
3362 /// let x = Build::new().set_log_url("example");
3363 /// ```
3364 pub fn set_log_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3365 self.log_url = v.into();
3366 self
3367 }
3368
3369 /// Sets the value of [substitutions][crate::model::Build::substitutions].
3370 ///
3371 /// # Example
3372 /// ```ignore,no_run
3373 /// # use google_cloud_build_v1::model::Build;
3374 /// let x = Build::new().set_substitutions([
3375 /// ("key0", "abc"),
3376 /// ("key1", "xyz"),
3377 /// ]);
3378 /// ```
3379 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
3380 where
3381 T: std::iter::IntoIterator<Item = (K, V)>,
3382 K: std::convert::Into<std::string::String>,
3383 V: std::convert::Into<std::string::String>,
3384 {
3385 use std::iter::Iterator;
3386 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3387 self
3388 }
3389
3390 /// Sets the value of [tags][crate::model::Build::tags].
3391 ///
3392 /// # Example
3393 /// ```ignore,no_run
3394 /// # use google_cloud_build_v1::model::Build;
3395 /// let x = Build::new().set_tags(["a", "b", "c"]);
3396 /// ```
3397 pub fn set_tags<T, V>(mut self, v: T) -> Self
3398 where
3399 T: std::iter::IntoIterator<Item = V>,
3400 V: std::convert::Into<std::string::String>,
3401 {
3402 use std::iter::Iterator;
3403 self.tags = v.into_iter().map(|i| i.into()).collect();
3404 self
3405 }
3406
3407 /// Sets the value of [secrets][crate::model::Build::secrets].
3408 ///
3409 /// # Example
3410 /// ```ignore,no_run
3411 /// # use google_cloud_build_v1::model::Build;
3412 /// use google_cloud_build_v1::model::Secret;
3413 /// let x = Build::new()
3414 /// .set_secrets([
3415 /// Secret::default()/* use setters */,
3416 /// Secret::default()/* use (different) setters */,
3417 /// ]);
3418 /// ```
3419 pub fn set_secrets<T, V>(mut self, v: T) -> Self
3420 where
3421 T: std::iter::IntoIterator<Item = V>,
3422 V: std::convert::Into<crate::model::Secret>,
3423 {
3424 use std::iter::Iterator;
3425 self.secrets = v.into_iter().map(|i| i.into()).collect();
3426 self
3427 }
3428
3429 /// Sets the value of [timing][crate::model::Build::timing].
3430 ///
3431 /// # Example
3432 /// ```ignore,no_run
3433 /// # use google_cloud_build_v1::model::Build;
3434 /// use google_cloud_build_v1::model::TimeSpan;
3435 /// let x = Build::new().set_timing([
3436 /// ("key0", TimeSpan::default()/* use setters */),
3437 /// ("key1", TimeSpan::default()/* use (different) setters */),
3438 /// ]);
3439 /// ```
3440 pub fn set_timing<T, K, V>(mut self, v: T) -> Self
3441 where
3442 T: std::iter::IntoIterator<Item = (K, V)>,
3443 K: std::convert::Into<std::string::String>,
3444 V: std::convert::Into<crate::model::TimeSpan>,
3445 {
3446 use std::iter::Iterator;
3447 self.timing = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3448 self
3449 }
3450
3451 /// Sets the value of [approval][crate::model::Build::approval].
3452 ///
3453 /// # Example
3454 /// ```ignore,no_run
3455 /// # use google_cloud_build_v1::model::Build;
3456 /// use google_cloud_build_v1::model::BuildApproval;
3457 /// let x = Build::new().set_approval(BuildApproval::default()/* use setters */);
3458 /// ```
3459 pub fn set_approval<T>(mut self, v: T) -> Self
3460 where
3461 T: std::convert::Into<crate::model::BuildApproval>,
3462 {
3463 self.approval = std::option::Option::Some(v.into());
3464 self
3465 }
3466
3467 /// Sets or clears the value of [approval][crate::model::Build::approval].
3468 ///
3469 /// # Example
3470 /// ```ignore,no_run
3471 /// # use google_cloud_build_v1::model::Build;
3472 /// use google_cloud_build_v1::model::BuildApproval;
3473 /// let x = Build::new().set_or_clear_approval(Some(BuildApproval::default()/* use setters */));
3474 /// let x = Build::new().set_or_clear_approval(None::<BuildApproval>);
3475 /// ```
3476 pub fn set_or_clear_approval<T>(mut self, v: std::option::Option<T>) -> Self
3477 where
3478 T: std::convert::Into<crate::model::BuildApproval>,
3479 {
3480 self.approval = v.map(|x| x.into());
3481 self
3482 }
3483
3484 /// Sets the value of [service_account][crate::model::Build::service_account].
3485 ///
3486 /// # Example
3487 /// ```ignore,no_run
3488 /// # use google_cloud_build_v1::model::Build;
3489 /// let x = Build::new().set_service_account("example");
3490 /// ```
3491 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3492 self.service_account = v.into();
3493 self
3494 }
3495
3496 /// Sets the value of [available_secrets][crate::model::Build::available_secrets].
3497 ///
3498 /// # Example
3499 /// ```ignore,no_run
3500 /// # use google_cloud_build_v1::model::Build;
3501 /// use google_cloud_build_v1::model::Secrets;
3502 /// let x = Build::new().set_available_secrets(Secrets::default()/* use setters */);
3503 /// ```
3504 pub fn set_available_secrets<T>(mut self, v: T) -> Self
3505 where
3506 T: std::convert::Into<crate::model::Secrets>,
3507 {
3508 self.available_secrets = std::option::Option::Some(v.into());
3509 self
3510 }
3511
3512 /// Sets or clears the value of [available_secrets][crate::model::Build::available_secrets].
3513 ///
3514 /// # Example
3515 /// ```ignore,no_run
3516 /// # use google_cloud_build_v1::model::Build;
3517 /// use google_cloud_build_v1::model::Secrets;
3518 /// let x = Build::new().set_or_clear_available_secrets(Some(Secrets::default()/* use setters */));
3519 /// let x = Build::new().set_or_clear_available_secrets(None::<Secrets>);
3520 /// ```
3521 pub fn set_or_clear_available_secrets<T>(mut self, v: std::option::Option<T>) -> Self
3522 where
3523 T: std::convert::Into<crate::model::Secrets>,
3524 {
3525 self.available_secrets = v.map(|x| x.into());
3526 self
3527 }
3528
3529 /// Sets the value of [warnings][crate::model::Build::warnings].
3530 ///
3531 /// # Example
3532 /// ```ignore,no_run
3533 /// # use google_cloud_build_v1::model::Build;
3534 /// use google_cloud_build_v1::model::build::Warning;
3535 /// let x = Build::new()
3536 /// .set_warnings([
3537 /// Warning::default()/* use setters */,
3538 /// Warning::default()/* use (different) setters */,
3539 /// ]);
3540 /// ```
3541 pub fn set_warnings<T, V>(mut self, v: T) -> Self
3542 where
3543 T: std::iter::IntoIterator<Item = V>,
3544 V: std::convert::Into<crate::model::build::Warning>,
3545 {
3546 use std::iter::Iterator;
3547 self.warnings = v.into_iter().map(|i| i.into()).collect();
3548 self
3549 }
3550
3551 /// Sets the value of [git_config][crate::model::Build::git_config].
3552 ///
3553 /// # Example
3554 /// ```ignore,no_run
3555 /// # use google_cloud_build_v1::model::Build;
3556 /// use google_cloud_build_v1::model::GitConfig;
3557 /// let x = Build::new().set_git_config(GitConfig::default()/* use setters */);
3558 /// ```
3559 pub fn set_git_config<T>(mut self, v: T) -> Self
3560 where
3561 T: std::convert::Into<crate::model::GitConfig>,
3562 {
3563 self.git_config = std::option::Option::Some(v.into());
3564 self
3565 }
3566
3567 /// Sets or clears the value of [git_config][crate::model::Build::git_config].
3568 ///
3569 /// # Example
3570 /// ```ignore,no_run
3571 /// # use google_cloud_build_v1::model::Build;
3572 /// use google_cloud_build_v1::model::GitConfig;
3573 /// let x = Build::new().set_or_clear_git_config(Some(GitConfig::default()/* use setters */));
3574 /// let x = Build::new().set_or_clear_git_config(None::<GitConfig>);
3575 /// ```
3576 pub fn set_or_clear_git_config<T>(mut self, v: std::option::Option<T>) -> Self
3577 where
3578 T: std::convert::Into<crate::model::GitConfig>,
3579 {
3580 self.git_config = v.map(|x| x.into());
3581 self
3582 }
3583
3584 /// Sets the value of [failure_info][crate::model::Build::failure_info].
3585 ///
3586 /// # Example
3587 /// ```ignore,no_run
3588 /// # use google_cloud_build_v1::model::Build;
3589 /// use google_cloud_build_v1::model::build::FailureInfo;
3590 /// let x = Build::new().set_failure_info(FailureInfo::default()/* use setters */);
3591 /// ```
3592 pub fn set_failure_info<T>(mut self, v: T) -> Self
3593 where
3594 T: std::convert::Into<crate::model::build::FailureInfo>,
3595 {
3596 self.failure_info = std::option::Option::Some(v.into());
3597 self
3598 }
3599
3600 /// Sets or clears the value of [failure_info][crate::model::Build::failure_info].
3601 ///
3602 /// # Example
3603 /// ```ignore,no_run
3604 /// # use google_cloud_build_v1::model::Build;
3605 /// use google_cloud_build_v1::model::build::FailureInfo;
3606 /// let x = Build::new().set_or_clear_failure_info(Some(FailureInfo::default()/* use setters */));
3607 /// let x = Build::new().set_or_clear_failure_info(None::<FailureInfo>);
3608 /// ```
3609 pub fn set_or_clear_failure_info<T>(mut self, v: std::option::Option<T>) -> Self
3610 where
3611 T: std::convert::Into<crate::model::build::FailureInfo>,
3612 {
3613 self.failure_info = v.map(|x| x.into());
3614 self
3615 }
3616
3617 /// Sets the value of [dependencies][crate::model::Build::dependencies].
3618 ///
3619 /// # Example
3620 /// ```ignore,no_run
3621 /// # use google_cloud_build_v1::model::Build;
3622 /// use google_cloud_build_v1::model::Dependency;
3623 /// let x = Build::new()
3624 /// .set_dependencies([
3625 /// Dependency::default()/* use setters */,
3626 /// Dependency::default()/* use (different) setters */,
3627 /// ]);
3628 /// ```
3629 pub fn set_dependencies<T, V>(mut self, v: T) -> Self
3630 where
3631 T: std::iter::IntoIterator<Item = V>,
3632 V: std::convert::Into<crate::model::Dependency>,
3633 {
3634 use std::iter::Iterator;
3635 self.dependencies = v.into_iter().map(|i| i.into()).collect();
3636 self
3637 }
3638}
3639
3640impl wkt::message::Message for Build {
3641 fn typename() -> &'static str {
3642 "type.googleapis.com/google.devtools.cloudbuild.v1.Build"
3643 }
3644}
3645
3646/// Defines additional types related to [Build].
3647pub mod build {
3648 #[allow(unused_imports)]
3649 use super::*;
3650
3651 /// A non-fatal problem encountered during the execution of the build.
3652 #[derive(Clone, Default, PartialEq)]
3653 #[non_exhaustive]
3654 pub struct Warning {
3655 /// Explanation of the warning generated.
3656 pub text: std::string::String,
3657
3658 /// The priority for this warning.
3659 pub priority: crate::model::build::warning::Priority,
3660
3661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3662 }
3663
3664 impl Warning {
3665 pub fn new() -> Self {
3666 std::default::Default::default()
3667 }
3668
3669 /// Sets the value of [text][crate::model::build::Warning::text].
3670 ///
3671 /// # Example
3672 /// ```ignore,no_run
3673 /// # use google_cloud_build_v1::model::build::Warning;
3674 /// let x = Warning::new().set_text("example");
3675 /// ```
3676 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3677 self.text = v.into();
3678 self
3679 }
3680
3681 /// Sets the value of [priority][crate::model::build::Warning::priority].
3682 ///
3683 /// # Example
3684 /// ```ignore,no_run
3685 /// # use google_cloud_build_v1::model::build::Warning;
3686 /// use google_cloud_build_v1::model::build::warning::Priority;
3687 /// let x0 = Warning::new().set_priority(Priority::Info);
3688 /// let x1 = Warning::new().set_priority(Priority::Warning);
3689 /// let x2 = Warning::new().set_priority(Priority::Alert);
3690 /// ```
3691 pub fn set_priority<T: std::convert::Into<crate::model::build::warning::Priority>>(
3692 mut self,
3693 v: T,
3694 ) -> Self {
3695 self.priority = v.into();
3696 self
3697 }
3698 }
3699
3700 impl wkt::message::Message for Warning {
3701 fn typename() -> &'static str {
3702 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.Warning"
3703 }
3704 }
3705
3706 /// Defines additional types related to [Warning].
3707 pub mod warning {
3708 #[allow(unused_imports)]
3709 use super::*;
3710
3711 /// The relative importance of this warning.
3712 ///
3713 /// # Working with unknown values
3714 ///
3715 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3716 /// additional enum variants at any time. Adding new variants is not considered
3717 /// a breaking change. Applications should write their code in anticipation of:
3718 ///
3719 /// - New values appearing in future releases of the client library, **and**
3720 /// - New values received dynamically, without application changes.
3721 ///
3722 /// Please consult the [Working with enums] section in the user guide for some
3723 /// guidelines.
3724 ///
3725 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3726 #[derive(Clone, Debug, PartialEq)]
3727 #[non_exhaustive]
3728 pub enum Priority {
3729 /// Should not be used.
3730 Unspecified,
3731 /// e.g. deprecation warnings and alternative feature highlights.
3732 Info,
3733 /// e.g. automated detection of possible issues with the build.
3734 Warning,
3735 /// e.g. alerts that a feature used in the build is pending removal
3736 Alert,
3737 /// If set, the enum was initialized with an unknown value.
3738 ///
3739 /// Applications can examine the value using [Priority::value] or
3740 /// [Priority::name].
3741 UnknownValue(priority::UnknownValue),
3742 }
3743
3744 #[doc(hidden)]
3745 pub mod priority {
3746 #[allow(unused_imports)]
3747 use super::*;
3748 #[derive(Clone, Debug, PartialEq)]
3749 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3750 }
3751
3752 impl Priority {
3753 /// Gets the enum value.
3754 ///
3755 /// Returns `None` if the enum contains an unknown value deserialized from
3756 /// the string representation of enums.
3757 pub fn value(&self) -> std::option::Option<i32> {
3758 match self {
3759 Self::Unspecified => std::option::Option::Some(0),
3760 Self::Info => std::option::Option::Some(1),
3761 Self::Warning => std::option::Option::Some(2),
3762 Self::Alert => std::option::Option::Some(3),
3763 Self::UnknownValue(u) => u.0.value(),
3764 }
3765 }
3766
3767 /// Gets the enum value as a string.
3768 ///
3769 /// Returns `None` if the enum contains an unknown value deserialized from
3770 /// the integer representation of enums.
3771 pub fn name(&self) -> std::option::Option<&str> {
3772 match self {
3773 Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
3774 Self::Info => std::option::Option::Some("INFO"),
3775 Self::Warning => std::option::Option::Some("WARNING"),
3776 Self::Alert => std::option::Option::Some("ALERT"),
3777 Self::UnknownValue(u) => u.0.name(),
3778 }
3779 }
3780 }
3781
3782 impl std::default::Default for Priority {
3783 fn default() -> Self {
3784 use std::convert::From;
3785 Self::from(0)
3786 }
3787 }
3788
3789 impl std::fmt::Display for Priority {
3790 fn fmt(
3791 &self,
3792 f: &mut std::fmt::Formatter<'_>,
3793 ) -> std::result::Result<(), std::fmt::Error> {
3794 wkt::internal::display_enum(f, self.name(), self.value())
3795 }
3796 }
3797
3798 impl std::convert::From<i32> for Priority {
3799 fn from(value: i32) -> Self {
3800 match value {
3801 0 => Self::Unspecified,
3802 1 => Self::Info,
3803 2 => Self::Warning,
3804 3 => Self::Alert,
3805 _ => Self::UnknownValue(priority::UnknownValue(
3806 wkt::internal::UnknownEnumValue::Integer(value),
3807 )),
3808 }
3809 }
3810 }
3811
3812 impl std::convert::From<&str> for Priority {
3813 fn from(value: &str) -> Self {
3814 use std::string::ToString;
3815 match value {
3816 "PRIORITY_UNSPECIFIED" => Self::Unspecified,
3817 "INFO" => Self::Info,
3818 "WARNING" => Self::Warning,
3819 "ALERT" => Self::Alert,
3820 _ => Self::UnknownValue(priority::UnknownValue(
3821 wkt::internal::UnknownEnumValue::String(value.to_string()),
3822 )),
3823 }
3824 }
3825 }
3826
3827 impl serde::ser::Serialize for Priority {
3828 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3829 where
3830 S: serde::Serializer,
3831 {
3832 match self {
3833 Self::Unspecified => serializer.serialize_i32(0),
3834 Self::Info => serializer.serialize_i32(1),
3835 Self::Warning => serializer.serialize_i32(2),
3836 Self::Alert => serializer.serialize_i32(3),
3837 Self::UnknownValue(u) => u.0.serialize(serializer),
3838 }
3839 }
3840 }
3841
3842 impl<'de> serde::de::Deserialize<'de> for Priority {
3843 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3844 where
3845 D: serde::Deserializer<'de>,
3846 {
3847 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
3848 ".google.devtools.cloudbuild.v1.Build.Warning.Priority",
3849 ))
3850 }
3851 }
3852 }
3853
3854 /// A fatal problem encountered during the execution of the build.
3855 #[derive(Clone, Default, PartialEq)]
3856 #[non_exhaustive]
3857 pub struct FailureInfo {
3858 /// The name of the failure.
3859 pub r#type: crate::model::build::failure_info::FailureType,
3860
3861 /// Explains the failure issue in more detail using hard-coded text.
3862 pub detail: std::string::String,
3863
3864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3865 }
3866
3867 impl FailureInfo {
3868 pub fn new() -> Self {
3869 std::default::Default::default()
3870 }
3871
3872 /// Sets the value of [r#type][crate::model::build::FailureInfo::type].
3873 ///
3874 /// # Example
3875 /// ```ignore,no_run
3876 /// # use google_cloud_build_v1::model::build::FailureInfo;
3877 /// use google_cloud_build_v1::model::build::failure_info::FailureType;
3878 /// let x0 = FailureInfo::new().set_type(FailureType::PushFailed);
3879 /// let x1 = FailureInfo::new().set_type(FailureType::PushImageNotFound);
3880 /// let x2 = FailureInfo::new().set_type(FailureType::PushNotAuthorized);
3881 /// ```
3882 pub fn set_type<T: std::convert::Into<crate::model::build::failure_info::FailureType>>(
3883 mut self,
3884 v: T,
3885 ) -> Self {
3886 self.r#type = v.into();
3887 self
3888 }
3889
3890 /// Sets the value of [detail][crate::model::build::FailureInfo::detail].
3891 ///
3892 /// # Example
3893 /// ```ignore,no_run
3894 /// # use google_cloud_build_v1::model::build::FailureInfo;
3895 /// let x = FailureInfo::new().set_detail("example");
3896 /// ```
3897 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3898 self.detail = v.into();
3899 self
3900 }
3901 }
3902
3903 impl wkt::message::Message for FailureInfo {
3904 fn typename() -> &'static str {
3905 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.FailureInfo"
3906 }
3907 }
3908
3909 /// Defines additional types related to [FailureInfo].
3910 pub mod failure_info {
3911 #[allow(unused_imports)]
3912 use super::*;
3913
3914 /// The name of a fatal problem encountered during the execution of the
3915 /// build.
3916 ///
3917 /// # Working with unknown values
3918 ///
3919 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3920 /// additional enum variants at any time. Adding new variants is not considered
3921 /// a breaking change. Applications should write their code in anticipation of:
3922 ///
3923 /// - New values appearing in future releases of the client library, **and**
3924 /// - New values received dynamically, without application changes.
3925 ///
3926 /// Please consult the [Working with enums] section in the user guide for some
3927 /// guidelines.
3928 ///
3929 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3930 #[derive(Clone, Debug, PartialEq)]
3931 #[non_exhaustive]
3932 pub enum FailureType {
3933 /// Type unspecified
3934 Unspecified,
3935 /// Unable to push the image to the repository.
3936 PushFailed,
3937 /// Final image not found.
3938 PushImageNotFound,
3939 /// Unauthorized push of the final image.
3940 PushNotAuthorized,
3941 /// Backend logging failures. Should retry.
3942 LoggingFailure,
3943 /// A build step has failed.
3944 UserBuildStep,
3945 /// The source fetching has failed.
3946 FetchSourceFailed,
3947 /// If set, the enum was initialized with an unknown value.
3948 ///
3949 /// Applications can examine the value using [FailureType::value] or
3950 /// [FailureType::name].
3951 UnknownValue(failure_type::UnknownValue),
3952 }
3953
3954 #[doc(hidden)]
3955 pub mod failure_type {
3956 #[allow(unused_imports)]
3957 use super::*;
3958 #[derive(Clone, Debug, PartialEq)]
3959 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3960 }
3961
3962 impl FailureType {
3963 /// Gets the enum value.
3964 ///
3965 /// Returns `None` if the enum contains an unknown value deserialized from
3966 /// the string representation of enums.
3967 pub fn value(&self) -> std::option::Option<i32> {
3968 match self {
3969 Self::Unspecified => std::option::Option::Some(0),
3970 Self::PushFailed => std::option::Option::Some(1),
3971 Self::PushImageNotFound => std::option::Option::Some(2),
3972 Self::PushNotAuthorized => std::option::Option::Some(3),
3973 Self::LoggingFailure => std::option::Option::Some(4),
3974 Self::UserBuildStep => std::option::Option::Some(5),
3975 Self::FetchSourceFailed => std::option::Option::Some(6),
3976 Self::UnknownValue(u) => u.0.value(),
3977 }
3978 }
3979
3980 /// Gets the enum value as a string.
3981 ///
3982 /// Returns `None` if the enum contains an unknown value deserialized from
3983 /// the integer representation of enums.
3984 pub fn name(&self) -> std::option::Option<&str> {
3985 match self {
3986 Self::Unspecified => std::option::Option::Some("FAILURE_TYPE_UNSPECIFIED"),
3987 Self::PushFailed => std::option::Option::Some("PUSH_FAILED"),
3988 Self::PushImageNotFound => std::option::Option::Some("PUSH_IMAGE_NOT_FOUND"),
3989 Self::PushNotAuthorized => std::option::Option::Some("PUSH_NOT_AUTHORIZED"),
3990 Self::LoggingFailure => std::option::Option::Some("LOGGING_FAILURE"),
3991 Self::UserBuildStep => std::option::Option::Some("USER_BUILD_STEP"),
3992 Self::FetchSourceFailed => std::option::Option::Some("FETCH_SOURCE_FAILED"),
3993 Self::UnknownValue(u) => u.0.name(),
3994 }
3995 }
3996 }
3997
3998 impl std::default::Default for FailureType {
3999 fn default() -> Self {
4000 use std::convert::From;
4001 Self::from(0)
4002 }
4003 }
4004
4005 impl std::fmt::Display for FailureType {
4006 fn fmt(
4007 &self,
4008 f: &mut std::fmt::Formatter<'_>,
4009 ) -> std::result::Result<(), std::fmt::Error> {
4010 wkt::internal::display_enum(f, self.name(), self.value())
4011 }
4012 }
4013
4014 impl std::convert::From<i32> for FailureType {
4015 fn from(value: i32) -> Self {
4016 match value {
4017 0 => Self::Unspecified,
4018 1 => Self::PushFailed,
4019 2 => Self::PushImageNotFound,
4020 3 => Self::PushNotAuthorized,
4021 4 => Self::LoggingFailure,
4022 5 => Self::UserBuildStep,
4023 6 => Self::FetchSourceFailed,
4024 _ => Self::UnknownValue(failure_type::UnknownValue(
4025 wkt::internal::UnknownEnumValue::Integer(value),
4026 )),
4027 }
4028 }
4029 }
4030
4031 impl std::convert::From<&str> for FailureType {
4032 fn from(value: &str) -> Self {
4033 use std::string::ToString;
4034 match value {
4035 "FAILURE_TYPE_UNSPECIFIED" => Self::Unspecified,
4036 "PUSH_FAILED" => Self::PushFailed,
4037 "PUSH_IMAGE_NOT_FOUND" => Self::PushImageNotFound,
4038 "PUSH_NOT_AUTHORIZED" => Self::PushNotAuthorized,
4039 "LOGGING_FAILURE" => Self::LoggingFailure,
4040 "USER_BUILD_STEP" => Self::UserBuildStep,
4041 "FETCH_SOURCE_FAILED" => Self::FetchSourceFailed,
4042 _ => Self::UnknownValue(failure_type::UnknownValue(
4043 wkt::internal::UnknownEnumValue::String(value.to_string()),
4044 )),
4045 }
4046 }
4047 }
4048
4049 impl serde::ser::Serialize for FailureType {
4050 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4051 where
4052 S: serde::Serializer,
4053 {
4054 match self {
4055 Self::Unspecified => serializer.serialize_i32(0),
4056 Self::PushFailed => serializer.serialize_i32(1),
4057 Self::PushImageNotFound => serializer.serialize_i32(2),
4058 Self::PushNotAuthorized => serializer.serialize_i32(3),
4059 Self::LoggingFailure => serializer.serialize_i32(4),
4060 Self::UserBuildStep => serializer.serialize_i32(5),
4061 Self::FetchSourceFailed => serializer.serialize_i32(6),
4062 Self::UnknownValue(u) => u.0.serialize(serializer),
4063 }
4064 }
4065 }
4066
4067 impl<'de> serde::de::Deserialize<'de> for FailureType {
4068 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4069 where
4070 D: serde::Deserializer<'de>,
4071 {
4072 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureType>::new(
4073 ".google.devtools.cloudbuild.v1.Build.FailureInfo.FailureType",
4074 ))
4075 }
4076 }
4077 }
4078
4079 /// Possible status of a build or build step.
4080 ///
4081 /// # Working with unknown values
4082 ///
4083 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4084 /// additional enum variants at any time. Adding new variants is not considered
4085 /// a breaking change. Applications should write their code in anticipation of:
4086 ///
4087 /// - New values appearing in future releases of the client library, **and**
4088 /// - New values received dynamically, without application changes.
4089 ///
4090 /// Please consult the [Working with enums] section in the user guide for some
4091 /// guidelines.
4092 ///
4093 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4094 #[derive(Clone, Debug, PartialEq)]
4095 #[non_exhaustive]
4096 pub enum Status {
4097 /// Status of the build is unknown.
4098 Unknown,
4099 /// Build has been created and is pending execution and queuing. It has not
4100 /// been queued.
4101 Pending,
4102 /// Build or step is queued; work has not yet begun.
4103 Queued,
4104 /// Build or step is being executed.
4105 Working,
4106 /// Build or step finished successfully.
4107 Success,
4108 /// Build or step failed to complete successfully.
4109 Failure,
4110 /// Build or step failed due to an internal cause.
4111 InternalError,
4112 /// Build or step took longer than was allowed.
4113 Timeout,
4114 /// Build or step was canceled by a user.
4115 Cancelled,
4116 /// Build was enqueued for longer than the value of `queue_ttl`.
4117 Expired,
4118 /// If set, the enum was initialized with an unknown value.
4119 ///
4120 /// Applications can examine the value using [Status::value] or
4121 /// [Status::name].
4122 UnknownValue(status::UnknownValue),
4123 }
4124
4125 #[doc(hidden)]
4126 pub mod status {
4127 #[allow(unused_imports)]
4128 use super::*;
4129 #[derive(Clone, Debug, PartialEq)]
4130 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4131 }
4132
4133 impl Status {
4134 /// Gets the enum value.
4135 ///
4136 /// Returns `None` if the enum contains an unknown value deserialized from
4137 /// the string representation of enums.
4138 pub fn value(&self) -> std::option::Option<i32> {
4139 match self {
4140 Self::Unknown => std::option::Option::Some(0),
4141 Self::Pending => std::option::Option::Some(10),
4142 Self::Queued => std::option::Option::Some(1),
4143 Self::Working => std::option::Option::Some(2),
4144 Self::Success => std::option::Option::Some(3),
4145 Self::Failure => std::option::Option::Some(4),
4146 Self::InternalError => std::option::Option::Some(5),
4147 Self::Timeout => std::option::Option::Some(6),
4148 Self::Cancelled => std::option::Option::Some(7),
4149 Self::Expired => std::option::Option::Some(9),
4150 Self::UnknownValue(u) => u.0.value(),
4151 }
4152 }
4153
4154 /// Gets the enum value as a string.
4155 ///
4156 /// Returns `None` if the enum contains an unknown value deserialized from
4157 /// the integer representation of enums.
4158 pub fn name(&self) -> std::option::Option<&str> {
4159 match self {
4160 Self::Unknown => std::option::Option::Some("STATUS_UNKNOWN"),
4161 Self::Pending => std::option::Option::Some("PENDING"),
4162 Self::Queued => std::option::Option::Some("QUEUED"),
4163 Self::Working => std::option::Option::Some("WORKING"),
4164 Self::Success => std::option::Option::Some("SUCCESS"),
4165 Self::Failure => std::option::Option::Some("FAILURE"),
4166 Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
4167 Self::Timeout => std::option::Option::Some("TIMEOUT"),
4168 Self::Cancelled => std::option::Option::Some("CANCELLED"),
4169 Self::Expired => std::option::Option::Some("EXPIRED"),
4170 Self::UnknownValue(u) => u.0.name(),
4171 }
4172 }
4173 }
4174
4175 impl std::default::Default for Status {
4176 fn default() -> Self {
4177 use std::convert::From;
4178 Self::from(0)
4179 }
4180 }
4181
4182 impl std::fmt::Display for Status {
4183 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4184 wkt::internal::display_enum(f, self.name(), self.value())
4185 }
4186 }
4187
4188 impl std::convert::From<i32> for Status {
4189 fn from(value: i32) -> Self {
4190 match value {
4191 0 => Self::Unknown,
4192 1 => Self::Queued,
4193 2 => Self::Working,
4194 3 => Self::Success,
4195 4 => Self::Failure,
4196 5 => Self::InternalError,
4197 6 => Self::Timeout,
4198 7 => Self::Cancelled,
4199 9 => Self::Expired,
4200 10 => Self::Pending,
4201 _ => Self::UnknownValue(status::UnknownValue(
4202 wkt::internal::UnknownEnumValue::Integer(value),
4203 )),
4204 }
4205 }
4206 }
4207
4208 impl std::convert::From<&str> for Status {
4209 fn from(value: &str) -> Self {
4210 use std::string::ToString;
4211 match value {
4212 "STATUS_UNKNOWN" => Self::Unknown,
4213 "PENDING" => Self::Pending,
4214 "QUEUED" => Self::Queued,
4215 "WORKING" => Self::Working,
4216 "SUCCESS" => Self::Success,
4217 "FAILURE" => Self::Failure,
4218 "INTERNAL_ERROR" => Self::InternalError,
4219 "TIMEOUT" => Self::Timeout,
4220 "CANCELLED" => Self::Cancelled,
4221 "EXPIRED" => Self::Expired,
4222 _ => Self::UnknownValue(status::UnknownValue(
4223 wkt::internal::UnknownEnumValue::String(value.to_string()),
4224 )),
4225 }
4226 }
4227 }
4228
4229 impl serde::ser::Serialize for Status {
4230 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4231 where
4232 S: serde::Serializer,
4233 {
4234 match self {
4235 Self::Unknown => serializer.serialize_i32(0),
4236 Self::Pending => serializer.serialize_i32(10),
4237 Self::Queued => serializer.serialize_i32(1),
4238 Self::Working => serializer.serialize_i32(2),
4239 Self::Success => serializer.serialize_i32(3),
4240 Self::Failure => serializer.serialize_i32(4),
4241 Self::InternalError => serializer.serialize_i32(5),
4242 Self::Timeout => serializer.serialize_i32(6),
4243 Self::Cancelled => serializer.serialize_i32(7),
4244 Self::Expired => serializer.serialize_i32(9),
4245 Self::UnknownValue(u) => u.0.serialize(serializer),
4246 }
4247 }
4248 }
4249
4250 impl<'de> serde::de::Deserialize<'de> for Status {
4251 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4252 where
4253 D: serde::Deserializer<'de>,
4254 {
4255 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
4256 ".google.devtools.cloudbuild.v1.Build.Status",
4257 ))
4258 }
4259 }
4260}
4261
4262/// A dependency that the Cloud Build worker will fetch before executing user
4263/// steps.
4264#[derive(Clone, Default, PartialEq)]
4265#[non_exhaustive]
4266pub struct Dependency {
4267 /// The type of dependency to fetch.
4268 pub dep: std::option::Option<crate::model::dependency::Dep>,
4269
4270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4271}
4272
4273impl Dependency {
4274 pub fn new() -> Self {
4275 std::default::Default::default()
4276 }
4277
4278 /// Sets the value of [dep][crate::model::Dependency::dep].
4279 ///
4280 /// Note that all the setters affecting `dep` are mutually
4281 /// exclusive.
4282 ///
4283 /// # Example
4284 /// ```ignore,no_run
4285 /// # use google_cloud_build_v1::model::Dependency;
4286 /// use google_cloud_build_v1::model::dependency::Dep;
4287 /// let x = Dependency::new().set_dep(Some(Dep::Empty(true)));
4288 /// ```
4289 pub fn set_dep<T: std::convert::Into<std::option::Option<crate::model::dependency::Dep>>>(
4290 mut self,
4291 v: T,
4292 ) -> Self {
4293 self.dep = v.into();
4294 self
4295 }
4296
4297 /// The value of [dep][crate::model::Dependency::dep]
4298 /// if it holds a `Empty`, `None` if the field is not set or
4299 /// holds a different branch.
4300 pub fn empty(&self) -> std::option::Option<&bool> {
4301 #[allow(unreachable_patterns)]
4302 self.dep.as_ref().and_then(|v| match v {
4303 crate::model::dependency::Dep::Empty(v) => std::option::Option::Some(v),
4304 _ => std::option::Option::None,
4305 })
4306 }
4307
4308 /// Sets the value of [dep][crate::model::Dependency::dep]
4309 /// to hold a `Empty`.
4310 ///
4311 /// Note that all the setters affecting `dep` are
4312 /// mutually exclusive.
4313 ///
4314 /// # Example
4315 /// ```ignore,no_run
4316 /// # use google_cloud_build_v1::model::Dependency;
4317 /// let x = Dependency::new().set_empty(true);
4318 /// assert!(x.empty().is_some());
4319 /// assert!(x.git_source().is_none());
4320 /// ```
4321 pub fn set_empty<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4322 self.dep = std::option::Option::Some(crate::model::dependency::Dep::Empty(v.into()));
4323 self
4324 }
4325
4326 /// The value of [dep][crate::model::Dependency::dep]
4327 /// if it holds a `GitSource`, `None` if the field is not set or
4328 /// holds a different branch.
4329 pub fn git_source(
4330 &self,
4331 ) -> std::option::Option<&std::boxed::Box<crate::model::dependency::GitSourceDependency>> {
4332 #[allow(unreachable_patterns)]
4333 self.dep.as_ref().and_then(|v| match v {
4334 crate::model::dependency::Dep::GitSource(v) => std::option::Option::Some(v),
4335 _ => std::option::Option::None,
4336 })
4337 }
4338
4339 /// Sets the value of [dep][crate::model::Dependency::dep]
4340 /// to hold a `GitSource`.
4341 ///
4342 /// Note that all the setters affecting `dep` are
4343 /// mutually exclusive.
4344 ///
4345 /// # Example
4346 /// ```ignore,no_run
4347 /// # use google_cloud_build_v1::model::Dependency;
4348 /// use google_cloud_build_v1::model::dependency::GitSourceDependency;
4349 /// let x = Dependency::new().set_git_source(GitSourceDependency::default()/* use setters */);
4350 /// assert!(x.git_source().is_some());
4351 /// assert!(x.empty().is_none());
4352 /// ```
4353 pub fn set_git_source<
4354 T: std::convert::Into<std::boxed::Box<crate::model::dependency::GitSourceDependency>>,
4355 >(
4356 mut self,
4357 v: T,
4358 ) -> Self {
4359 self.dep = std::option::Option::Some(crate::model::dependency::Dep::GitSource(v.into()));
4360 self
4361 }
4362}
4363
4364impl wkt::message::Message for Dependency {
4365 fn typename() -> &'static str {
4366 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency"
4367 }
4368}
4369
4370/// Defines additional types related to [Dependency].
4371pub mod dependency {
4372 #[allow(unused_imports)]
4373 use super::*;
4374
4375 /// Represents a git repository as a build dependency.
4376 #[derive(Clone, Default, PartialEq)]
4377 #[non_exhaustive]
4378 pub struct GitSourceDependency {
4379 /// Required. The kind of repo (url or dev connect).
4380 pub repository: std::option::Option<crate::model::dependency::GitSourceRepository>,
4381
4382 /// Required. The revision that we will fetch the repo at.
4383 pub revision: std::string::String,
4384
4385 /// Optional. True if submodules should be fetched too (default false).
4386 pub recurse_submodules: bool,
4387
4388 /// Optional. How much history should be fetched for the build (default 1, -1
4389 /// for all history).
4390 pub depth: i64,
4391
4392 /// Required. Where should the files be placed on the worker.
4393 pub dest_path: std::string::String,
4394
4395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4396 }
4397
4398 impl GitSourceDependency {
4399 pub fn new() -> Self {
4400 std::default::Default::default()
4401 }
4402
4403 /// Sets the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4404 ///
4405 /// # Example
4406 /// ```ignore,no_run
4407 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4408 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4409 /// let x = GitSourceDependency::new().set_repository(GitSourceRepository::default()/* use setters */);
4410 /// ```
4411 pub fn set_repository<T>(mut self, v: T) -> Self
4412 where
4413 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4414 {
4415 self.repository = std::option::Option::Some(v.into());
4416 self
4417 }
4418
4419 /// Sets or clears the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4420 ///
4421 /// # Example
4422 /// ```ignore,no_run
4423 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4424 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4425 /// let x = GitSourceDependency::new().set_or_clear_repository(Some(GitSourceRepository::default()/* use setters */));
4426 /// let x = GitSourceDependency::new().set_or_clear_repository(None::<GitSourceRepository>);
4427 /// ```
4428 pub fn set_or_clear_repository<T>(mut self, v: std::option::Option<T>) -> Self
4429 where
4430 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4431 {
4432 self.repository = v.map(|x| x.into());
4433 self
4434 }
4435
4436 /// Sets the value of [revision][crate::model::dependency::GitSourceDependency::revision].
4437 ///
4438 /// # Example
4439 /// ```ignore,no_run
4440 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4441 /// let x = GitSourceDependency::new().set_revision("example");
4442 /// ```
4443 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4444 self.revision = v.into();
4445 self
4446 }
4447
4448 /// Sets the value of [recurse_submodules][crate::model::dependency::GitSourceDependency::recurse_submodules].
4449 ///
4450 /// # Example
4451 /// ```ignore,no_run
4452 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4453 /// let x = GitSourceDependency::new().set_recurse_submodules(true);
4454 /// ```
4455 pub fn set_recurse_submodules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4456 self.recurse_submodules = v.into();
4457 self
4458 }
4459
4460 /// Sets the value of [depth][crate::model::dependency::GitSourceDependency::depth].
4461 ///
4462 /// # Example
4463 /// ```ignore,no_run
4464 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4465 /// let x = GitSourceDependency::new().set_depth(42);
4466 /// ```
4467 pub fn set_depth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4468 self.depth = v.into();
4469 self
4470 }
4471
4472 /// Sets the value of [dest_path][crate::model::dependency::GitSourceDependency::dest_path].
4473 ///
4474 /// # Example
4475 /// ```ignore,no_run
4476 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4477 /// let x = GitSourceDependency::new().set_dest_path("example");
4478 /// ```
4479 pub fn set_dest_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4480 self.dest_path = v.into();
4481 self
4482 }
4483 }
4484
4485 impl wkt::message::Message for GitSourceDependency {
4486 fn typename() -> &'static str {
4487 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceDependency"
4488 }
4489 }
4490
4491 /// A repository for a git source.
4492 #[derive(Clone, Default, PartialEq)]
4493 #[non_exhaustive]
4494 pub struct GitSourceRepository {
4495 /// The type of git source repo (url or dev connect).
4496 pub repotype:
4497 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4498
4499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4500 }
4501
4502 impl GitSourceRepository {
4503 pub fn new() -> Self {
4504 std::default::Default::default()
4505 }
4506
4507 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype].
4508 ///
4509 /// Note that all the setters affecting `repotype` are mutually
4510 /// exclusive.
4511 ///
4512 /// # Example
4513 /// ```ignore,no_run
4514 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4515 /// use google_cloud_build_v1::model::dependency::git_source_repository::Repotype;
4516 /// let x = GitSourceRepository::new().set_repotype(Some(Repotype::Url("example".to_string())));
4517 /// ```
4518 pub fn set_repotype<
4519 T: std::convert::Into<
4520 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4521 >,
4522 >(
4523 mut self,
4524 v: T,
4525 ) -> Self {
4526 self.repotype = v.into();
4527 self
4528 }
4529
4530 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4531 /// if it holds a `Url`, `None` if the field is not set or
4532 /// holds a different branch.
4533 pub fn url(&self) -> std::option::Option<&std::string::String> {
4534 #[allow(unreachable_patterns)]
4535 self.repotype.as_ref().and_then(|v| match v {
4536 crate::model::dependency::git_source_repository::Repotype::Url(v) => {
4537 std::option::Option::Some(v)
4538 }
4539 _ => std::option::Option::None,
4540 })
4541 }
4542
4543 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4544 /// to hold a `Url`.
4545 ///
4546 /// Note that all the setters affecting `repotype` are
4547 /// mutually exclusive.
4548 ///
4549 /// # Example
4550 /// ```ignore,no_run
4551 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4552 /// let x = GitSourceRepository::new().set_url("example");
4553 /// assert!(x.url().is_some());
4554 /// assert!(x.developer_connect().is_none());
4555 /// ```
4556 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4557 self.repotype = std::option::Option::Some(
4558 crate::model::dependency::git_source_repository::Repotype::Url(v.into()),
4559 );
4560 self
4561 }
4562
4563 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4564 /// if it holds a `DeveloperConnect`, `None` if the field is not set or
4565 /// holds a different branch.
4566 pub fn developer_connect(&self) -> std::option::Option<&std::string::String> {
4567 #[allow(unreachable_patterns)]
4568 self.repotype.as_ref().and_then(|v| match v {
4569 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(v) => {
4570 std::option::Option::Some(v)
4571 }
4572 _ => std::option::Option::None,
4573 })
4574 }
4575
4576 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4577 /// to hold a `DeveloperConnect`.
4578 ///
4579 /// Note that all the setters affecting `repotype` are
4580 /// mutually exclusive.
4581 ///
4582 /// # Example
4583 /// ```ignore,no_run
4584 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4585 /// let x = GitSourceRepository::new().set_developer_connect("example");
4586 /// assert!(x.developer_connect().is_some());
4587 /// assert!(x.url().is_none());
4588 /// ```
4589 pub fn set_developer_connect<T: std::convert::Into<std::string::String>>(
4590 mut self,
4591 v: T,
4592 ) -> Self {
4593 self.repotype = std::option::Option::Some(
4594 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(
4595 v.into(),
4596 ),
4597 );
4598 self
4599 }
4600 }
4601
4602 impl wkt::message::Message for GitSourceRepository {
4603 fn typename() -> &'static str {
4604 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceRepository"
4605 }
4606 }
4607
4608 /// Defines additional types related to [GitSourceRepository].
4609 pub mod git_source_repository {
4610 #[allow(unused_imports)]
4611 use super::*;
4612
4613 /// The type of git source repo (url or dev connect).
4614 #[derive(Clone, Debug, PartialEq)]
4615 #[non_exhaustive]
4616 pub enum Repotype {
4617 /// Location of the Git repository.
4618 Url(std::string::String),
4619 /// The Developer Connect Git repository link formatted as
4620 /// `projects/*/locations/*/connections/*/gitRepositoryLink/*`
4621 DeveloperConnect(std::string::String),
4622 }
4623 }
4624
4625 /// The type of dependency to fetch.
4626 #[derive(Clone, Debug, PartialEq)]
4627 #[non_exhaustive]
4628 pub enum Dep {
4629 /// If set to true disable all dependency fetching (ignoring the default
4630 /// source as well).
4631 Empty(bool),
4632 /// Represents a git repository as a build dependency.
4633 GitSource(std::boxed::Box<crate::model::dependency::GitSourceDependency>),
4634 }
4635}
4636
4637/// GitConfig is a configuration for git operations.
4638#[derive(Clone, Default, PartialEq)]
4639#[non_exhaustive]
4640pub struct GitConfig {
4641 /// Configuration for HTTP related git operations.
4642 pub http: std::option::Option<crate::model::git_config::HttpConfig>,
4643
4644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4645}
4646
4647impl GitConfig {
4648 pub fn new() -> Self {
4649 std::default::Default::default()
4650 }
4651
4652 /// Sets the value of [http][crate::model::GitConfig::http].
4653 ///
4654 /// # Example
4655 /// ```ignore,no_run
4656 /// # use google_cloud_build_v1::model::GitConfig;
4657 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4658 /// let x = GitConfig::new().set_http(HttpConfig::default()/* use setters */);
4659 /// ```
4660 pub fn set_http<T>(mut self, v: T) -> Self
4661 where
4662 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4663 {
4664 self.http = std::option::Option::Some(v.into());
4665 self
4666 }
4667
4668 /// Sets or clears the value of [http][crate::model::GitConfig::http].
4669 ///
4670 /// # Example
4671 /// ```ignore,no_run
4672 /// # use google_cloud_build_v1::model::GitConfig;
4673 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4674 /// let x = GitConfig::new().set_or_clear_http(Some(HttpConfig::default()/* use setters */));
4675 /// let x = GitConfig::new().set_or_clear_http(None::<HttpConfig>);
4676 /// ```
4677 pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
4678 where
4679 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4680 {
4681 self.http = v.map(|x| x.into());
4682 self
4683 }
4684}
4685
4686impl wkt::message::Message for GitConfig {
4687 fn typename() -> &'static str {
4688 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig"
4689 }
4690}
4691
4692/// Defines additional types related to [GitConfig].
4693pub mod git_config {
4694 #[allow(unused_imports)]
4695 use super::*;
4696
4697 /// HttpConfig is a configuration for HTTP related git operations.
4698 #[derive(Clone, Default, PartialEq)]
4699 #[non_exhaustive]
4700 pub struct HttpConfig {
4701 /// SecretVersion resource of the HTTP proxy URL. The Service Account used in
4702 /// the build (either the default Service Account or
4703 /// user-specified Service Account) should have
4704 /// `secretmanager.versions.access` permissions on this secret. The proxy URL
4705 /// should be in format `[protocol://][user[:password]@]proxyhost[:port]`.
4706 pub proxy_secret_version_name: std::string::String,
4707
4708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4709 }
4710
4711 impl HttpConfig {
4712 pub fn new() -> Self {
4713 std::default::Default::default()
4714 }
4715
4716 /// Sets the value of [proxy_secret_version_name][crate::model::git_config::HttpConfig::proxy_secret_version_name].
4717 ///
4718 /// # Example
4719 /// ```ignore,no_run
4720 /// # use google_cloud_build_v1::model::git_config::HttpConfig;
4721 /// let x = HttpConfig::new().set_proxy_secret_version_name("example");
4722 /// ```
4723 pub fn set_proxy_secret_version_name<T: std::convert::Into<std::string::String>>(
4724 mut self,
4725 v: T,
4726 ) -> Self {
4727 self.proxy_secret_version_name = v.into();
4728 self
4729 }
4730 }
4731
4732 impl wkt::message::Message for HttpConfig {
4733 fn typename() -> &'static str {
4734 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig.HttpConfig"
4735 }
4736 }
4737}
4738
4739/// Artifacts produced by a build that should be uploaded upon
4740/// successful completion of all build steps.
4741#[derive(Clone, Default, PartialEq)]
4742#[non_exhaustive]
4743pub struct Artifacts {
4744 /// A list of images to be pushed upon the successful completion of all build
4745 /// steps.
4746 ///
4747 /// The images will be pushed using the builder service account's credentials.
4748 ///
4749 /// The digests of the pushed images will be stored in the Build resource's
4750 /// results field.
4751 ///
4752 /// If any of the images fail to be pushed, the build is marked FAILURE.
4753 pub images: std::vec::Vec<std::string::String>,
4754
4755 /// A list of objects to be uploaded to Cloud Storage upon successful
4756 /// completion of all build steps.
4757 ///
4758 /// Files in the workspace matching specified paths globs will be uploaded to
4759 /// the specified Cloud Storage location using the builder service account's
4760 /// credentials.
4761 ///
4762 /// The location and generation of the uploaded objects will be stored in the
4763 /// Build resource's results field.
4764 ///
4765 /// If any objects fail to be pushed, the build is marked FAILURE.
4766 pub objects: std::option::Option<crate::model::artifacts::ArtifactObjects>,
4767
4768 /// A list of Maven artifacts to be uploaded to Artifact Registry upon
4769 /// successful completion of all build steps.
4770 ///
4771 /// Artifacts in the workspace matching specified paths globs will be uploaded
4772 /// to the specified Artifact Registry repository using the builder service
4773 /// account's credentials.
4774 ///
4775 /// If any artifacts fail to be pushed, the build is marked FAILURE.
4776 pub maven_artifacts: std::vec::Vec<crate::model::artifacts::MavenArtifact>,
4777
4778 /// Optional. A list of Go modules to be uploaded to Artifact Registry upon
4779 /// successful completion of all build steps.
4780 ///
4781 /// If any objects fail to be pushed, the build is marked FAILURE.
4782 pub go_modules: std::vec::Vec<crate::model::artifacts::GoModule>,
4783
4784 /// A list of Python packages to be uploaded to Artifact Registry upon
4785 /// successful completion of all build steps.
4786 ///
4787 /// The build service account credentials will be used to perform the upload.
4788 ///
4789 /// If any objects fail to be pushed, the build is marked FAILURE.
4790 pub python_packages: std::vec::Vec<crate::model::artifacts::PythonPackage>,
4791
4792 /// A list of npm packages to be uploaded to Artifact Registry upon
4793 /// successful completion of all build steps.
4794 ///
4795 /// Npm packages in the specified paths will be uploaded
4796 /// to the specified Artifact Registry repository using the builder service
4797 /// account's credentials.
4798 ///
4799 /// If any packages fail to be pushed, the build is marked FAILURE.
4800 pub npm_packages: std::vec::Vec<crate::model::artifacts::NpmPackage>,
4801
4802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4803}
4804
4805impl Artifacts {
4806 pub fn new() -> Self {
4807 std::default::Default::default()
4808 }
4809
4810 /// Sets the value of [images][crate::model::Artifacts::images].
4811 ///
4812 /// # Example
4813 /// ```ignore,no_run
4814 /// # use google_cloud_build_v1::model::Artifacts;
4815 /// let x = Artifacts::new().set_images(["a", "b", "c"]);
4816 /// ```
4817 pub fn set_images<T, V>(mut self, v: T) -> Self
4818 where
4819 T: std::iter::IntoIterator<Item = V>,
4820 V: std::convert::Into<std::string::String>,
4821 {
4822 use std::iter::Iterator;
4823 self.images = v.into_iter().map(|i| i.into()).collect();
4824 self
4825 }
4826
4827 /// Sets the value of [objects][crate::model::Artifacts::objects].
4828 ///
4829 /// # Example
4830 /// ```ignore,no_run
4831 /// # use google_cloud_build_v1::model::Artifacts;
4832 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4833 /// let x = Artifacts::new().set_objects(ArtifactObjects::default()/* use setters */);
4834 /// ```
4835 pub fn set_objects<T>(mut self, v: T) -> Self
4836 where
4837 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4838 {
4839 self.objects = std::option::Option::Some(v.into());
4840 self
4841 }
4842
4843 /// Sets or clears the value of [objects][crate::model::Artifacts::objects].
4844 ///
4845 /// # Example
4846 /// ```ignore,no_run
4847 /// # use google_cloud_build_v1::model::Artifacts;
4848 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4849 /// let x = Artifacts::new().set_or_clear_objects(Some(ArtifactObjects::default()/* use setters */));
4850 /// let x = Artifacts::new().set_or_clear_objects(None::<ArtifactObjects>);
4851 /// ```
4852 pub fn set_or_clear_objects<T>(mut self, v: std::option::Option<T>) -> Self
4853 where
4854 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4855 {
4856 self.objects = v.map(|x| x.into());
4857 self
4858 }
4859
4860 /// Sets the value of [maven_artifacts][crate::model::Artifacts::maven_artifacts].
4861 ///
4862 /// # Example
4863 /// ```ignore,no_run
4864 /// # use google_cloud_build_v1::model::Artifacts;
4865 /// use google_cloud_build_v1::model::artifacts::MavenArtifact;
4866 /// let x = Artifacts::new()
4867 /// .set_maven_artifacts([
4868 /// MavenArtifact::default()/* use setters */,
4869 /// MavenArtifact::default()/* use (different) setters */,
4870 /// ]);
4871 /// ```
4872 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
4873 where
4874 T: std::iter::IntoIterator<Item = V>,
4875 V: std::convert::Into<crate::model::artifacts::MavenArtifact>,
4876 {
4877 use std::iter::Iterator;
4878 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
4879 self
4880 }
4881
4882 /// Sets the value of [go_modules][crate::model::Artifacts::go_modules].
4883 ///
4884 /// # Example
4885 /// ```ignore,no_run
4886 /// # use google_cloud_build_v1::model::Artifacts;
4887 /// use google_cloud_build_v1::model::artifacts::GoModule;
4888 /// let x = Artifacts::new()
4889 /// .set_go_modules([
4890 /// GoModule::default()/* use setters */,
4891 /// GoModule::default()/* use (different) setters */,
4892 /// ]);
4893 /// ```
4894 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
4895 where
4896 T: std::iter::IntoIterator<Item = V>,
4897 V: std::convert::Into<crate::model::artifacts::GoModule>,
4898 {
4899 use std::iter::Iterator;
4900 self.go_modules = v.into_iter().map(|i| i.into()).collect();
4901 self
4902 }
4903
4904 /// Sets the value of [python_packages][crate::model::Artifacts::python_packages].
4905 ///
4906 /// # Example
4907 /// ```ignore,no_run
4908 /// # use google_cloud_build_v1::model::Artifacts;
4909 /// use google_cloud_build_v1::model::artifacts::PythonPackage;
4910 /// let x = Artifacts::new()
4911 /// .set_python_packages([
4912 /// PythonPackage::default()/* use setters */,
4913 /// PythonPackage::default()/* use (different) setters */,
4914 /// ]);
4915 /// ```
4916 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
4917 where
4918 T: std::iter::IntoIterator<Item = V>,
4919 V: std::convert::Into<crate::model::artifacts::PythonPackage>,
4920 {
4921 use std::iter::Iterator;
4922 self.python_packages = v.into_iter().map(|i| i.into()).collect();
4923 self
4924 }
4925
4926 /// Sets the value of [npm_packages][crate::model::Artifacts::npm_packages].
4927 ///
4928 /// # Example
4929 /// ```ignore,no_run
4930 /// # use google_cloud_build_v1::model::Artifacts;
4931 /// use google_cloud_build_v1::model::artifacts::NpmPackage;
4932 /// let x = Artifacts::new()
4933 /// .set_npm_packages([
4934 /// NpmPackage::default()/* use setters */,
4935 /// NpmPackage::default()/* use (different) setters */,
4936 /// ]);
4937 /// ```
4938 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
4939 where
4940 T: std::iter::IntoIterator<Item = V>,
4941 V: std::convert::Into<crate::model::artifacts::NpmPackage>,
4942 {
4943 use std::iter::Iterator;
4944 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
4945 self
4946 }
4947}
4948
4949impl wkt::message::Message for Artifacts {
4950 fn typename() -> &'static str {
4951 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts"
4952 }
4953}
4954
4955/// Defines additional types related to [Artifacts].
4956pub mod artifacts {
4957 #[allow(unused_imports)]
4958 use super::*;
4959
4960 /// Files in the workspace to upload to Cloud Storage upon successful
4961 /// completion of all build steps.
4962 #[derive(Clone, Default, PartialEq)]
4963 #[non_exhaustive]
4964 pub struct ArtifactObjects {
4965 /// Cloud Storage bucket and optional object path, in the form
4966 /// "gs://bucket/path/to/somewhere/". (see [Bucket Name
4967 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
4968 ///
4969 /// Files in the workspace matching any path pattern will be uploaded to
4970 /// Cloud Storage with this location as a prefix.
4971 pub location: std::string::String,
4972
4973 /// Path globs used to match files in the build's workspace.
4974 pub paths: std::vec::Vec<std::string::String>,
4975
4976 /// Output only. Stores timing information for pushing all artifact objects.
4977 pub timing: std::option::Option<crate::model::TimeSpan>,
4978
4979 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4980 }
4981
4982 impl ArtifactObjects {
4983 pub fn new() -> Self {
4984 std::default::Default::default()
4985 }
4986
4987 /// Sets the value of [location][crate::model::artifacts::ArtifactObjects::location].
4988 ///
4989 /// # Example
4990 /// ```ignore,no_run
4991 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4992 /// let x = ArtifactObjects::new().set_location("example");
4993 /// ```
4994 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4995 self.location = v.into();
4996 self
4997 }
4998
4999 /// Sets the value of [paths][crate::model::artifacts::ArtifactObjects::paths].
5000 ///
5001 /// # Example
5002 /// ```ignore,no_run
5003 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5004 /// let x = ArtifactObjects::new().set_paths(["a", "b", "c"]);
5005 /// ```
5006 pub fn set_paths<T, V>(mut self, v: T) -> Self
5007 where
5008 T: std::iter::IntoIterator<Item = V>,
5009 V: std::convert::Into<std::string::String>,
5010 {
5011 use std::iter::Iterator;
5012 self.paths = v.into_iter().map(|i| i.into()).collect();
5013 self
5014 }
5015
5016 /// Sets the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5017 ///
5018 /// # Example
5019 /// ```ignore,no_run
5020 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5021 /// use google_cloud_build_v1::model::TimeSpan;
5022 /// let x = ArtifactObjects::new().set_timing(TimeSpan::default()/* use setters */);
5023 /// ```
5024 pub fn set_timing<T>(mut self, v: T) -> Self
5025 where
5026 T: std::convert::Into<crate::model::TimeSpan>,
5027 {
5028 self.timing = std::option::Option::Some(v.into());
5029 self
5030 }
5031
5032 /// Sets or clears the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5033 ///
5034 /// # Example
5035 /// ```ignore,no_run
5036 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5037 /// use google_cloud_build_v1::model::TimeSpan;
5038 /// let x = ArtifactObjects::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
5039 /// let x = ArtifactObjects::new().set_or_clear_timing(None::<TimeSpan>);
5040 /// ```
5041 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
5042 where
5043 T: std::convert::Into<crate::model::TimeSpan>,
5044 {
5045 self.timing = v.map(|x| x.into());
5046 self
5047 }
5048 }
5049
5050 impl wkt::message::Message for ArtifactObjects {
5051 fn typename() -> &'static str {
5052 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects"
5053 }
5054 }
5055
5056 /// A Maven artifact to upload to Artifact Registry upon successful completion
5057 /// of all build steps.
5058 #[derive(Clone, Default, PartialEq)]
5059 #[non_exhaustive]
5060 pub struct MavenArtifact {
5061 /// Artifact Registry repository, in the form
5062 /// "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY"
5063 ///
5064 /// Artifact in the workspace specified by path will be uploaded to
5065 /// Artifact Registry with this location as a prefix.
5066 pub repository: std::string::String,
5067
5068 /// Optional. Path to an artifact in the build's workspace to be uploaded to
5069 /// Artifact Registry.
5070 /// This can be either an absolute path,
5071 /// e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar
5072 /// or a relative path from /workspace,
5073 /// e.g. my-app/target/my-app-1.0.SNAPSHOT.jar.
5074 pub path: std::string::String,
5075
5076 /// Maven `artifactId` value used when uploading the artifact to Artifact
5077 /// Registry.
5078 pub artifact_id: std::string::String,
5079
5080 /// Maven `groupId` value used when uploading the artifact to Artifact
5081 /// Registry.
5082 pub group_id: std::string::String,
5083
5084 /// Maven `version` value used when uploading the artifact to Artifact
5085 /// Registry.
5086 pub version: std::string::String,
5087
5088 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5089 }
5090
5091 impl MavenArtifact {
5092 pub fn new() -> Self {
5093 std::default::Default::default()
5094 }
5095
5096 /// Sets the value of [repository][crate::model::artifacts::MavenArtifact::repository].
5097 ///
5098 /// # Example
5099 /// ```ignore,no_run
5100 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5101 /// let x = MavenArtifact::new().set_repository("example");
5102 /// ```
5103 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5104 self.repository = v.into();
5105 self
5106 }
5107
5108 /// Sets the value of [path][crate::model::artifacts::MavenArtifact::path].
5109 ///
5110 /// # Example
5111 /// ```ignore,no_run
5112 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5113 /// let x = MavenArtifact::new().set_path("example");
5114 /// ```
5115 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5116 self.path = v.into();
5117 self
5118 }
5119
5120 /// Sets the value of [artifact_id][crate::model::artifacts::MavenArtifact::artifact_id].
5121 ///
5122 /// # Example
5123 /// ```ignore,no_run
5124 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5125 /// let x = MavenArtifact::new().set_artifact_id("example");
5126 /// ```
5127 pub fn set_artifact_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5128 self.artifact_id = v.into();
5129 self
5130 }
5131
5132 /// Sets the value of [group_id][crate::model::artifacts::MavenArtifact::group_id].
5133 ///
5134 /// # Example
5135 /// ```ignore,no_run
5136 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5137 /// let x = MavenArtifact::new().set_group_id("example");
5138 /// ```
5139 pub fn set_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5140 self.group_id = v.into();
5141 self
5142 }
5143
5144 /// Sets the value of [version][crate::model::artifacts::MavenArtifact::version].
5145 ///
5146 /// # Example
5147 /// ```ignore,no_run
5148 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5149 /// let x = MavenArtifact::new().set_version("example");
5150 /// ```
5151 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5152 self.version = v.into();
5153 self
5154 }
5155 }
5156
5157 impl wkt::message::Message for MavenArtifact {
5158 fn typename() -> &'static str {
5159 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.MavenArtifact"
5160 }
5161 }
5162
5163 /// Go module to upload to Artifact Registry upon successful completion of all
5164 /// build steps. A module refers to all dependencies in a go.mod file.
5165 #[derive(Clone, Default, PartialEq)]
5166 #[non_exhaustive]
5167 pub struct GoModule {
5168 /// Optional. Artifact Registry repository name.
5169 ///
5170 /// Specified Go modules will be zipped and uploaded to Artifact Registry
5171 /// with this location as a prefix.
5172 /// e.g. my-go-repo
5173 pub repository_name: std::string::String,
5174
5175 /// Optional. Location of the Artifact Registry repository. i.e. us-east1
5176 /// Defaults to the build’s location.
5177 pub repository_location: std::string::String,
5178
5179 /// Optional. Project ID of the Artifact Registry repository.
5180 /// Defaults to the build project.
5181 pub repository_project_id: std::string::String,
5182
5183 /// Optional. Source path of the go.mod file in the build's workspace. If not
5184 /// specified, this will default to the current directory.
5185 /// e.g. ~/code/go/mypackage
5186 pub source_path: std::string::String,
5187
5188 /// Optional. The Go module's "module path".
5189 /// e.g. example.com/foo/v2
5190 pub module_path: std::string::String,
5191
5192 /// Optional. The Go module's semantic version in the form vX.Y.Z. e.g.
5193 /// v0.1.1 Pre-release identifiers can also be added by appending a dash and
5194 /// dot separated ASCII alphanumeric characters and hyphens.
5195 /// e.g. v0.2.3-alpha.x.12m.5
5196 pub module_version: std::string::String,
5197
5198 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5199 }
5200
5201 impl GoModule {
5202 pub fn new() -> Self {
5203 std::default::Default::default()
5204 }
5205
5206 /// Sets the value of [repository_name][crate::model::artifacts::GoModule::repository_name].
5207 ///
5208 /// # Example
5209 /// ```ignore,no_run
5210 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5211 /// let x = GoModule::new().set_repository_name("example");
5212 /// ```
5213 pub fn set_repository_name<T: std::convert::Into<std::string::String>>(
5214 mut self,
5215 v: T,
5216 ) -> Self {
5217 self.repository_name = v.into();
5218 self
5219 }
5220
5221 /// Sets the value of [repository_location][crate::model::artifacts::GoModule::repository_location].
5222 ///
5223 /// # Example
5224 /// ```ignore,no_run
5225 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5226 /// let x = GoModule::new().set_repository_location("example");
5227 /// ```
5228 pub fn set_repository_location<T: std::convert::Into<std::string::String>>(
5229 mut self,
5230 v: T,
5231 ) -> Self {
5232 self.repository_location = v.into();
5233 self
5234 }
5235
5236 /// Sets the value of [repository_project_id][crate::model::artifacts::GoModule::repository_project_id].
5237 ///
5238 /// # Example
5239 /// ```ignore,no_run
5240 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5241 /// let x = GoModule::new().set_repository_project_id("example");
5242 /// ```
5243 pub fn set_repository_project_id<T: std::convert::Into<std::string::String>>(
5244 mut self,
5245 v: T,
5246 ) -> Self {
5247 self.repository_project_id = v.into();
5248 self
5249 }
5250
5251 /// Sets the value of [source_path][crate::model::artifacts::GoModule::source_path].
5252 ///
5253 /// # Example
5254 /// ```ignore,no_run
5255 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5256 /// let x = GoModule::new().set_source_path("example");
5257 /// ```
5258 pub fn set_source_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5259 self.source_path = v.into();
5260 self
5261 }
5262
5263 /// Sets the value of [module_path][crate::model::artifacts::GoModule::module_path].
5264 ///
5265 /// # Example
5266 /// ```ignore,no_run
5267 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5268 /// let x = GoModule::new().set_module_path("example");
5269 /// ```
5270 pub fn set_module_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5271 self.module_path = v.into();
5272 self
5273 }
5274
5275 /// Sets the value of [module_version][crate::model::artifacts::GoModule::module_version].
5276 ///
5277 /// # Example
5278 /// ```ignore,no_run
5279 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5280 /// let x = GoModule::new().set_module_version("example");
5281 /// ```
5282 pub fn set_module_version<T: std::convert::Into<std::string::String>>(
5283 mut self,
5284 v: T,
5285 ) -> Self {
5286 self.module_version = v.into();
5287 self
5288 }
5289 }
5290
5291 impl wkt::message::Message for GoModule {
5292 fn typename() -> &'static str {
5293 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.GoModule"
5294 }
5295 }
5296
5297 /// Python package to upload to Artifact Registry upon successful completion
5298 /// of all build steps. A package can encapsulate multiple objects to be
5299 /// uploaded to a single repository.
5300 #[derive(Clone, Default, PartialEq)]
5301 #[non_exhaustive]
5302 pub struct PythonPackage {
5303 /// Artifact Registry repository, in the form
5304 /// "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY"
5305 ///
5306 /// Files in the workspace matching any path pattern will be uploaded to
5307 /// Artifact Registry with this location as a prefix.
5308 pub repository: std::string::String,
5309
5310 /// Path globs used to match files in the build's workspace. For Python/
5311 /// Twine, this is usually `dist/*`, and sometimes additionally an `.asc`
5312 /// file.
5313 pub paths: std::vec::Vec<std::string::String>,
5314
5315 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5316 }
5317
5318 impl PythonPackage {
5319 pub fn new() -> Self {
5320 std::default::Default::default()
5321 }
5322
5323 /// Sets the value of [repository][crate::model::artifacts::PythonPackage::repository].
5324 ///
5325 /// # Example
5326 /// ```ignore,no_run
5327 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5328 /// let x = PythonPackage::new().set_repository("example");
5329 /// ```
5330 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5331 self.repository = v.into();
5332 self
5333 }
5334
5335 /// Sets the value of [paths][crate::model::artifacts::PythonPackage::paths].
5336 ///
5337 /// # Example
5338 /// ```ignore,no_run
5339 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5340 /// let x = PythonPackage::new().set_paths(["a", "b", "c"]);
5341 /// ```
5342 pub fn set_paths<T, V>(mut self, v: T) -> Self
5343 where
5344 T: std::iter::IntoIterator<Item = V>,
5345 V: std::convert::Into<std::string::String>,
5346 {
5347 use std::iter::Iterator;
5348 self.paths = v.into_iter().map(|i| i.into()).collect();
5349 self
5350 }
5351 }
5352
5353 impl wkt::message::Message for PythonPackage {
5354 fn typename() -> &'static str {
5355 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.PythonPackage"
5356 }
5357 }
5358
5359 /// Npm package to upload to Artifact Registry upon successful completion
5360 /// of all build steps.
5361 #[derive(Clone, Default, PartialEq)]
5362 #[non_exhaustive]
5363 pub struct NpmPackage {
5364 /// Artifact Registry repository, in the form
5365 /// "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY"
5366 ///
5367 /// Npm package in the workspace specified by path will be zipped and
5368 /// uploaded to Artifact Registry with this location as a prefix.
5369 pub repository: std::string::String,
5370
5371 /// Optional. Path to the package.json.
5372 /// e.g. workspace/path/to/package
5373 ///
5374 /// Only one of `archive` or `package_path` can be specified.
5375 pub package_path: std::string::String,
5376
5377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5378 }
5379
5380 impl NpmPackage {
5381 pub fn new() -> Self {
5382 std::default::Default::default()
5383 }
5384
5385 /// Sets the value of [repository][crate::model::artifacts::NpmPackage::repository].
5386 ///
5387 /// # Example
5388 /// ```ignore,no_run
5389 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5390 /// let x = NpmPackage::new().set_repository("example");
5391 /// ```
5392 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5393 self.repository = v.into();
5394 self
5395 }
5396
5397 /// Sets the value of [package_path][crate::model::artifacts::NpmPackage::package_path].
5398 ///
5399 /// # Example
5400 /// ```ignore,no_run
5401 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5402 /// let x = NpmPackage::new().set_package_path("example");
5403 /// ```
5404 pub fn set_package_path<T: std::convert::Into<std::string::String>>(
5405 mut self,
5406 v: T,
5407 ) -> Self {
5408 self.package_path = v.into();
5409 self
5410 }
5411 }
5412
5413 impl wkt::message::Message for NpmPackage {
5414 fn typename() -> &'static str {
5415 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.NpmPackage"
5416 }
5417 }
5418}
5419
5420/// Start and end times for a build execution phase.
5421#[derive(Clone, Default, PartialEq)]
5422#[non_exhaustive]
5423pub struct TimeSpan {
5424 /// Start of time span.
5425 pub start_time: std::option::Option<wkt::Timestamp>,
5426
5427 /// End of time span.
5428 pub end_time: std::option::Option<wkt::Timestamp>,
5429
5430 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5431}
5432
5433impl TimeSpan {
5434 pub fn new() -> Self {
5435 std::default::Default::default()
5436 }
5437
5438 /// Sets the value of [start_time][crate::model::TimeSpan::start_time].
5439 ///
5440 /// # Example
5441 /// ```ignore,no_run
5442 /// # use google_cloud_build_v1::model::TimeSpan;
5443 /// use wkt::Timestamp;
5444 /// let x = TimeSpan::new().set_start_time(Timestamp::default()/* use setters */);
5445 /// ```
5446 pub fn set_start_time<T>(mut self, v: T) -> Self
5447 where
5448 T: std::convert::Into<wkt::Timestamp>,
5449 {
5450 self.start_time = std::option::Option::Some(v.into());
5451 self
5452 }
5453
5454 /// Sets or clears the value of [start_time][crate::model::TimeSpan::start_time].
5455 ///
5456 /// # Example
5457 /// ```ignore,no_run
5458 /// # use google_cloud_build_v1::model::TimeSpan;
5459 /// use wkt::Timestamp;
5460 /// let x = TimeSpan::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
5461 /// let x = TimeSpan::new().set_or_clear_start_time(None::<Timestamp>);
5462 /// ```
5463 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5464 where
5465 T: std::convert::Into<wkt::Timestamp>,
5466 {
5467 self.start_time = v.map(|x| x.into());
5468 self
5469 }
5470
5471 /// Sets the value of [end_time][crate::model::TimeSpan::end_time].
5472 ///
5473 /// # Example
5474 /// ```ignore,no_run
5475 /// # use google_cloud_build_v1::model::TimeSpan;
5476 /// use wkt::Timestamp;
5477 /// let x = TimeSpan::new().set_end_time(Timestamp::default()/* use setters */);
5478 /// ```
5479 pub fn set_end_time<T>(mut self, v: T) -> Self
5480 where
5481 T: std::convert::Into<wkt::Timestamp>,
5482 {
5483 self.end_time = std::option::Option::Some(v.into());
5484 self
5485 }
5486
5487 /// Sets or clears the value of [end_time][crate::model::TimeSpan::end_time].
5488 ///
5489 /// # Example
5490 /// ```ignore,no_run
5491 /// # use google_cloud_build_v1::model::TimeSpan;
5492 /// use wkt::Timestamp;
5493 /// let x = TimeSpan::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5494 /// let x = TimeSpan::new().set_or_clear_end_time(None::<Timestamp>);
5495 /// ```
5496 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5497 where
5498 T: std::convert::Into<wkt::Timestamp>,
5499 {
5500 self.end_time = v.map(|x| x.into());
5501 self
5502 }
5503}
5504
5505impl wkt::message::Message for TimeSpan {
5506 fn typename() -> &'static str {
5507 "type.googleapis.com/google.devtools.cloudbuild.v1.TimeSpan"
5508 }
5509}
5510
5511/// Metadata for build operations.
5512#[derive(Clone, Default, PartialEq)]
5513#[non_exhaustive]
5514pub struct BuildOperationMetadata {
5515 /// The build that the operation is tracking.
5516 pub build: std::option::Option<crate::model::Build>,
5517
5518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5519}
5520
5521impl BuildOperationMetadata {
5522 pub fn new() -> Self {
5523 std::default::Default::default()
5524 }
5525
5526 /// Sets the value of [build][crate::model::BuildOperationMetadata::build].
5527 ///
5528 /// # Example
5529 /// ```ignore,no_run
5530 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5531 /// use google_cloud_build_v1::model::Build;
5532 /// let x = BuildOperationMetadata::new().set_build(Build::default()/* use setters */);
5533 /// ```
5534 pub fn set_build<T>(mut self, v: T) -> Self
5535 where
5536 T: std::convert::Into<crate::model::Build>,
5537 {
5538 self.build = std::option::Option::Some(v.into());
5539 self
5540 }
5541
5542 /// Sets or clears the value of [build][crate::model::BuildOperationMetadata::build].
5543 ///
5544 /// # Example
5545 /// ```ignore,no_run
5546 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5547 /// use google_cloud_build_v1::model::Build;
5548 /// let x = BuildOperationMetadata::new().set_or_clear_build(Some(Build::default()/* use setters */));
5549 /// let x = BuildOperationMetadata::new().set_or_clear_build(None::<Build>);
5550 /// ```
5551 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
5552 where
5553 T: std::convert::Into<crate::model::Build>,
5554 {
5555 self.build = v.map(|x| x.into());
5556 self
5557 }
5558}
5559
5560impl wkt::message::Message for BuildOperationMetadata {
5561 fn typename() -> &'static str {
5562 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata"
5563 }
5564}
5565
5566/// Provenance of the source. Ways to find the original source, or verify that
5567/// some source was used for this build.
5568#[derive(Clone, Default, PartialEq)]
5569#[non_exhaustive]
5570pub struct SourceProvenance {
5571 /// A copy of the build's `source.storage_source`, if exists, with any
5572 /// generations resolved.
5573 pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
5574
5575 /// A copy of the build's `source.repo_source`, if exists, with any
5576 /// revisions resolved.
5577 pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
5578
5579 /// A copy of the build's `source.storage_source_manifest`, if exists, with any
5580 /// revisions resolved.
5581 /// This feature is in Preview.
5582 pub resolved_storage_source_manifest: std::option::Option<crate::model::StorageSourceManifest>,
5583
5584 /// Output only. A copy of the build's `source.connected_repository`, if
5585 /// exists, with any revisions resolved.
5586 pub resolved_connected_repository: std::option::Option<crate::model::ConnectedRepository>,
5587
5588 /// Output only. A copy of the build's `source.git_source`, if exists, with any
5589 /// revisions resolved.
5590 pub resolved_git_source: std::option::Option<crate::model::GitSource>,
5591
5592 /// Output only. Hash(es) of the build source, which can be used to verify that
5593 /// the original source integrity was maintained in the build. Note that
5594 /// `FileHashes` will only be populated if `BuildOptions` has requested a
5595 /// `SourceProvenanceHash`.
5596 ///
5597 /// The keys to this map are file paths used as build source and the values
5598 /// contain the hash values for those files.
5599 ///
5600 /// If the build source came in a single package such as a gzipped tarfile
5601 /// (`.tar.gz`), the `FileHash` will be for the single path to that file.
5602 pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
5603
5604 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5605}
5606
5607impl SourceProvenance {
5608 pub fn new() -> Self {
5609 std::default::Default::default()
5610 }
5611
5612 /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5613 ///
5614 /// # Example
5615 /// ```ignore,no_run
5616 /// # use google_cloud_build_v1::model::SourceProvenance;
5617 /// use google_cloud_build_v1::model::StorageSource;
5618 /// let x = SourceProvenance::new().set_resolved_storage_source(StorageSource::default()/* use setters */);
5619 /// ```
5620 pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
5621 where
5622 T: std::convert::Into<crate::model::StorageSource>,
5623 {
5624 self.resolved_storage_source = std::option::Option::Some(v.into());
5625 self
5626 }
5627
5628 /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5629 ///
5630 /// # Example
5631 /// ```ignore,no_run
5632 /// # use google_cloud_build_v1::model::SourceProvenance;
5633 /// use google_cloud_build_v1::model::StorageSource;
5634 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(Some(StorageSource::default()/* use setters */));
5635 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(None::<StorageSource>);
5636 /// ```
5637 pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
5638 where
5639 T: std::convert::Into<crate::model::StorageSource>,
5640 {
5641 self.resolved_storage_source = v.map(|x| x.into());
5642 self
5643 }
5644
5645 /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5646 ///
5647 /// # Example
5648 /// ```ignore,no_run
5649 /// # use google_cloud_build_v1::model::SourceProvenance;
5650 /// use google_cloud_build_v1::model::RepoSource;
5651 /// let x = SourceProvenance::new().set_resolved_repo_source(RepoSource::default()/* use setters */);
5652 /// ```
5653 pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
5654 where
5655 T: std::convert::Into<crate::model::RepoSource>,
5656 {
5657 self.resolved_repo_source = std::option::Option::Some(v.into());
5658 self
5659 }
5660
5661 /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5662 ///
5663 /// # Example
5664 /// ```ignore,no_run
5665 /// # use google_cloud_build_v1::model::SourceProvenance;
5666 /// use google_cloud_build_v1::model::RepoSource;
5667 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(Some(RepoSource::default()/* use setters */));
5668 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(None::<RepoSource>);
5669 /// ```
5670 pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
5671 where
5672 T: std::convert::Into<crate::model::RepoSource>,
5673 {
5674 self.resolved_repo_source = v.map(|x| x.into());
5675 self
5676 }
5677
5678 /// Sets the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5679 ///
5680 /// # Example
5681 /// ```ignore,no_run
5682 /// # use google_cloud_build_v1::model::SourceProvenance;
5683 /// use google_cloud_build_v1::model::StorageSourceManifest;
5684 /// let x = SourceProvenance::new().set_resolved_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
5685 /// ```
5686 pub fn set_resolved_storage_source_manifest<T>(mut self, v: T) -> Self
5687 where
5688 T: std::convert::Into<crate::model::StorageSourceManifest>,
5689 {
5690 self.resolved_storage_source_manifest = std::option::Option::Some(v.into());
5691 self
5692 }
5693
5694 /// Sets or clears the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5695 ///
5696 /// # Example
5697 /// ```ignore,no_run
5698 /// # use google_cloud_build_v1::model::SourceProvenance;
5699 /// use google_cloud_build_v1::model::StorageSourceManifest;
5700 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(Some(StorageSourceManifest::default()/* use setters */));
5701 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(None::<StorageSourceManifest>);
5702 /// ```
5703 pub fn set_or_clear_resolved_storage_source_manifest<T>(
5704 mut self,
5705 v: std::option::Option<T>,
5706 ) -> Self
5707 where
5708 T: std::convert::Into<crate::model::StorageSourceManifest>,
5709 {
5710 self.resolved_storage_source_manifest = v.map(|x| x.into());
5711 self
5712 }
5713
5714 /// Sets the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5715 ///
5716 /// # Example
5717 /// ```ignore,no_run
5718 /// # use google_cloud_build_v1::model::SourceProvenance;
5719 /// use google_cloud_build_v1::model::ConnectedRepository;
5720 /// let x = SourceProvenance::new().set_resolved_connected_repository(ConnectedRepository::default()/* use setters */);
5721 /// ```
5722 pub fn set_resolved_connected_repository<T>(mut self, v: T) -> Self
5723 where
5724 T: std::convert::Into<crate::model::ConnectedRepository>,
5725 {
5726 self.resolved_connected_repository = std::option::Option::Some(v.into());
5727 self
5728 }
5729
5730 /// Sets or clears the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5731 ///
5732 /// # Example
5733 /// ```ignore,no_run
5734 /// # use google_cloud_build_v1::model::SourceProvenance;
5735 /// use google_cloud_build_v1::model::ConnectedRepository;
5736 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(Some(ConnectedRepository::default()/* use setters */));
5737 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(None::<ConnectedRepository>);
5738 /// ```
5739 pub fn set_or_clear_resolved_connected_repository<T>(
5740 mut self,
5741 v: std::option::Option<T>,
5742 ) -> Self
5743 where
5744 T: std::convert::Into<crate::model::ConnectedRepository>,
5745 {
5746 self.resolved_connected_repository = v.map(|x| x.into());
5747 self
5748 }
5749
5750 /// Sets the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5751 ///
5752 /// # Example
5753 /// ```ignore,no_run
5754 /// # use google_cloud_build_v1::model::SourceProvenance;
5755 /// use google_cloud_build_v1::model::GitSource;
5756 /// let x = SourceProvenance::new().set_resolved_git_source(GitSource::default()/* use setters */);
5757 /// ```
5758 pub fn set_resolved_git_source<T>(mut self, v: T) -> Self
5759 where
5760 T: std::convert::Into<crate::model::GitSource>,
5761 {
5762 self.resolved_git_source = std::option::Option::Some(v.into());
5763 self
5764 }
5765
5766 /// Sets or clears the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5767 ///
5768 /// # Example
5769 /// ```ignore,no_run
5770 /// # use google_cloud_build_v1::model::SourceProvenance;
5771 /// use google_cloud_build_v1::model::GitSource;
5772 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(Some(GitSource::default()/* use setters */));
5773 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(None::<GitSource>);
5774 /// ```
5775 pub fn set_or_clear_resolved_git_source<T>(mut self, v: std::option::Option<T>) -> Self
5776 where
5777 T: std::convert::Into<crate::model::GitSource>,
5778 {
5779 self.resolved_git_source = v.map(|x| x.into());
5780 self
5781 }
5782
5783 /// Sets the value of [file_hashes][crate::model::SourceProvenance::file_hashes].
5784 ///
5785 /// # Example
5786 /// ```ignore,no_run
5787 /// # use google_cloud_build_v1::model::SourceProvenance;
5788 /// use google_cloud_build_v1::model::FileHashes;
5789 /// let x = SourceProvenance::new().set_file_hashes([
5790 /// ("key0", FileHashes::default()/* use setters */),
5791 /// ("key1", FileHashes::default()/* use (different) setters */),
5792 /// ]);
5793 /// ```
5794 pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
5795 where
5796 T: std::iter::IntoIterator<Item = (K, V)>,
5797 K: std::convert::Into<std::string::String>,
5798 V: std::convert::Into<crate::model::FileHashes>,
5799 {
5800 use std::iter::Iterator;
5801 self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5802 self
5803 }
5804}
5805
5806impl wkt::message::Message for SourceProvenance {
5807 fn typename() -> &'static str {
5808 "type.googleapis.com/google.devtools.cloudbuild.v1.SourceProvenance"
5809 }
5810}
5811
5812/// Container message for hashes of byte content of files, used in
5813/// SourceProvenance messages to verify integrity of source input to the build.
5814#[derive(Clone, Default, PartialEq)]
5815#[non_exhaustive]
5816pub struct FileHashes {
5817 /// Collection of file hashes.
5818 pub file_hash: std::vec::Vec<crate::model::Hash>,
5819
5820 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5821}
5822
5823impl FileHashes {
5824 pub fn new() -> Self {
5825 std::default::Default::default()
5826 }
5827
5828 /// Sets the value of [file_hash][crate::model::FileHashes::file_hash].
5829 ///
5830 /// # Example
5831 /// ```ignore,no_run
5832 /// # use google_cloud_build_v1::model::FileHashes;
5833 /// use google_cloud_build_v1::model::Hash;
5834 /// let x = FileHashes::new()
5835 /// .set_file_hash([
5836 /// Hash::default()/* use setters */,
5837 /// Hash::default()/* use (different) setters */,
5838 /// ]);
5839 /// ```
5840 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
5841 where
5842 T: std::iter::IntoIterator<Item = V>,
5843 V: std::convert::Into<crate::model::Hash>,
5844 {
5845 use std::iter::Iterator;
5846 self.file_hash = v.into_iter().map(|i| i.into()).collect();
5847 self
5848 }
5849}
5850
5851impl wkt::message::Message for FileHashes {
5852 fn typename() -> &'static str {
5853 "type.googleapis.com/google.devtools.cloudbuild.v1.FileHashes"
5854 }
5855}
5856
5857/// Container message for hash values.
5858#[derive(Clone, Default, PartialEq)]
5859#[non_exhaustive]
5860pub struct Hash {
5861 /// The type of hash that was performed.
5862 pub r#type: crate::model::hash::HashType,
5863
5864 /// The hash value.
5865 pub value: ::bytes::Bytes,
5866
5867 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5868}
5869
5870impl Hash {
5871 pub fn new() -> Self {
5872 std::default::Default::default()
5873 }
5874
5875 /// Sets the value of [r#type][crate::model::Hash::type].
5876 ///
5877 /// # Example
5878 /// ```ignore,no_run
5879 /// # use google_cloud_build_v1::model::Hash;
5880 /// use google_cloud_build_v1::model::hash::HashType;
5881 /// let x0 = Hash::new().set_type(HashType::Sha256);
5882 /// let x1 = Hash::new().set_type(HashType::Md5);
5883 /// let x2 = Hash::new().set_type(HashType::GoModuleH1);
5884 /// ```
5885 pub fn set_type<T: std::convert::Into<crate::model::hash::HashType>>(mut self, v: T) -> Self {
5886 self.r#type = v.into();
5887 self
5888 }
5889
5890 /// Sets the value of [value][crate::model::Hash::value].
5891 ///
5892 /// # Example
5893 /// ```ignore,no_run
5894 /// # use google_cloud_build_v1::model::Hash;
5895 /// let x = Hash::new().set_value(bytes::Bytes::from_static(b"example"));
5896 /// ```
5897 pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5898 self.value = v.into();
5899 self
5900 }
5901}
5902
5903impl wkt::message::Message for Hash {
5904 fn typename() -> &'static str {
5905 "type.googleapis.com/google.devtools.cloudbuild.v1.Hash"
5906 }
5907}
5908
5909/// Defines additional types related to [Hash].
5910pub mod hash {
5911 #[allow(unused_imports)]
5912 use super::*;
5913
5914 /// Specifies the hash algorithm, if any.
5915 ///
5916 /// # Working with unknown values
5917 ///
5918 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5919 /// additional enum variants at any time. Adding new variants is not considered
5920 /// a breaking change. Applications should write their code in anticipation of:
5921 ///
5922 /// - New values appearing in future releases of the client library, **and**
5923 /// - New values received dynamically, without application changes.
5924 ///
5925 /// Please consult the [Working with enums] section in the user guide for some
5926 /// guidelines.
5927 ///
5928 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5929 #[derive(Clone, Debug, PartialEq)]
5930 #[non_exhaustive]
5931 pub enum HashType {
5932 /// No hash requested.
5933 None,
5934 /// Use a sha256 hash.
5935 Sha256,
5936 /// Use a md5 hash.
5937 Md5,
5938 /// Dirhash of a Go module's source code which is then hex-encoded.
5939 GoModuleH1,
5940 /// Use a sha512 hash.
5941 Sha512,
5942 /// If set, the enum was initialized with an unknown value.
5943 ///
5944 /// Applications can examine the value using [HashType::value] or
5945 /// [HashType::name].
5946 UnknownValue(hash_type::UnknownValue),
5947 }
5948
5949 #[doc(hidden)]
5950 pub mod hash_type {
5951 #[allow(unused_imports)]
5952 use super::*;
5953 #[derive(Clone, Debug, PartialEq)]
5954 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5955 }
5956
5957 impl HashType {
5958 /// Gets the enum value.
5959 ///
5960 /// Returns `None` if the enum contains an unknown value deserialized from
5961 /// the string representation of enums.
5962 pub fn value(&self) -> std::option::Option<i32> {
5963 match self {
5964 Self::None => std::option::Option::Some(0),
5965 Self::Sha256 => std::option::Option::Some(1),
5966 Self::Md5 => std::option::Option::Some(2),
5967 Self::GoModuleH1 => std::option::Option::Some(3),
5968 Self::Sha512 => std::option::Option::Some(4),
5969 Self::UnknownValue(u) => u.0.value(),
5970 }
5971 }
5972
5973 /// Gets the enum value as a string.
5974 ///
5975 /// Returns `None` if the enum contains an unknown value deserialized from
5976 /// the integer representation of enums.
5977 pub fn name(&self) -> std::option::Option<&str> {
5978 match self {
5979 Self::None => std::option::Option::Some("NONE"),
5980 Self::Sha256 => std::option::Option::Some("SHA256"),
5981 Self::Md5 => std::option::Option::Some("MD5"),
5982 Self::GoModuleH1 => std::option::Option::Some("GO_MODULE_H1"),
5983 Self::Sha512 => std::option::Option::Some("SHA512"),
5984 Self::UnknownValue(u) => u.0.name(),
5985 }
5986 }
5987 }
5988
5989 impl std::default::Default for HashType {
5990 fn default() -> Self {
5991 use std::convert::From;
5992 Self::from(0)
5993 }
5994 }
5995
5996 impl std::fmt::Display for HashType {
5997 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5998 wkt::internal::display_enum(f, self.name(), self.value())
5999 }
6000 }
6001
6002 impl std::convert::From<i32> for HashType {
6003 fn from(value: i32) -> Self {
6004 match value {
6005 0 => Self::None,
6006 1 => Self::Sha256,
6007 2 => Self::Md5,
6008 3 => Self::GoModuleH1,
6009 4 => Self::Sha512,
6010 _ => Self::UnknownValue(hash_type::UnknownValue(
6011 wkt::internal::UnknownEnumValue::Integer(value),
6012 )),
6013 }
6014 }
6015 }
6016
6017 impl std::convert::From<&str> for HashType {
6018 fn from(value: &str) -> Self {
6019 use std::string::ToString;
6020 match value {
6021 "NONE" => Self::None,
6022 "SHA256" => Self::Sha256,
6023 "MD5" => Self::Md5,
6024 "GO_MODULE_H1" => Self::GoModuleH1,
6025 "SHA512" => Self::Sha512,
6026 _ => Self::UnknownValue(hash_type::UnknownValue(
6027 wkt::internal::UnknownEnumValue::String(value.to_string()),
6028 )),
6029 }
6030 }
6031 }
6032
6033 impl serde::ser::Serialize for HashType {
6034 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6035 where
6036 S: serde::Serializer,
6037 {
6038 match self {
6039 Self::None => serializer.serialize_i32(0),
6040 Self::Sha256 => serializer.serialize_i32(1),
6041 Self::Md5 => serializer.serialize_i32(2),
6042 Self::GoModuleH1 => serializer.serialize_i32(3),
6043 Self::Sha512 => serializer.serialize_i32(4),
6044 Self::UnknownValue(u) => u.0.serialize(serializer),
6045 }
6046 }
6047 }
6048
6049 impl<'de> serde::de::Deserialize<'de> for HashType {
6050 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6051 where
6052 D: serde::Deserializer<'de>,
6053 {
6054 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HashType>::new(
6055 ".google.devtools.cloudbuild.v1.Hash.HashType",
6056 ))
6057 }
6058 }
6059}
6060
6061/// Secrets and secret environment variables.
6062#[derive(Clone, Default, PartialEq)]
6063#[non_exhaustive]
6064pub struct Secrets {
6065 /// Secrets in Secret Manager and associated secret environment variable.
6066 pub secret_manager: std::vec::Vec<crate::model::SecretManagerSecret>,
6067
6068 /// Secrets encrypted with KMS key and the associated secret environment
6069 /// variable.
6070 pub inline: std::vec::Vec<crate::model::InlineSecret>,
6071
6072 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6073}
6074
6075impl Secrets {
6076 pub fn new() -> Self {
6077 std::default::Default::default()
6078 }
6079
6080 /// Sets the value of [secret_manager][crate::model::Secrets::secret_manager].
6081 ///
6082 /// # Example
6083 /// ```ignore,no_run
6084 /// # use google_cloud_build_v1::model::Secrets;
6085 /// use google_cloud_build_v1::model::SecretManagerSecret;
6086 /// let x = Secrets::new()
6087 /// .set_secret_manager([
6088 /// SecretManagerSecret::default()/* use setters */,
6089 /// SecretManagerSecret::default()/* use (different) setters */,
6090 /// ]);
6091 /// ```
6092 pub fn set_secret_manager<T, V>(mut self, v: T) -> Self
6093 where
6094 T: std::iter::IntoIterator<Item = V>,
6095 V: std::convert::Into<crate::model::SecretManagerSecret>,
6096 {
6097 use std::iter::Iterator;
6098 self.secret_manager = v.into_iter().map(|i| i.into()).collect();
6099 self
6100 }
6101
6102 /// Sets the value of [inline][crate::model::Secrets::inline].
6103 ///
6104 /// # Example
6105 /// ```ignore,no_run
6106 /// # use google_cloud_build_v1::model::Secrets;
6107 /// use google_cloud_build_v1::model::InlineSecret;
6108 /// let x = Secrets::new()
6109 /// .set_inline([
6110 /// InlineSecret::default()/* use setters */,
6111 /// InlineSecret::default()/* use (different) setters */,
6112 /// ]);
6113 /// ```
6114 pub fn set_inline<T, V>(mut self, v: T) -> Self
6115 where
6116 T: std::iter::IntoIterator<Item = V>,
6117 V: std::convert::Into<crate::model::InlineSecret>,
6118 {
6119 use std::iter::Iterator;
6120 self.inline = v.into_iter().map(|i| i.into()).collect();
6121 self
6122 }
6123}
6124
6125impl wkt::message::Message for Secrets {
6126 fn typename() -> &'static str {
6127 "type.googleapis.com/google.devtools.cloudbuild.v1.Secrets"
6128 }
6129}
6130
6131/// Pairs a set of secret environment variables mapped to encrypted
6132/// values with the Cloud KMS key to use to decrypt the value.
6133#[derive(Clone, Default, PartialEq)]
6134#[non_exhaustive]
6135pub struct InlineSecret {
6136 /// Resource name of Cloud KMS crypto key to decrypt the encrypted value.
6137 /// In format: projects/*/locations/*/keyRings/*/cryptoKeys/*
6138 pub kms_key_name: std::string::String,
6139
6140 /// Map of environment variable name to its encrypted value.
6141 ///
6142 /// Secret environment variables must be unique across all of a build's
6143 /// secrets, and must be used by at least one build step. Values can be at most
6144 /// 64 KB in size. There can be at most 100 secret values across all of a
6145 /// build's secrets.
6146 pub env_map: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6147
6148 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6149}
6150
6151impl InlineSecret {
6152 pub fn new() -> Self {
6153 std::default::Default::default()
6154 }
6155
6156 /// Sets the value of [kms_key_name][crate::model::InlineSecret::kms_key_name].
6157 ///
6158 /// # Example
6159 /// ```ignore,no_run
6160 /// # use google_cloud_build_v1::model::InlineSecret;
6161 /// let x = InlineSecret::new().set_kms_key_name("example");
6162 /// ```
6163 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6164 self.kms_key_name = v.into();
6165 self
6166 }
6167
6168 /// Sets the value of [env_map][crate::model::InlineSecret::env_map].
6169 ///
6170 /// # Example
6171 /// ```ignore,no_run
6172 /// # use google_cloud_build_v1::model::InlineSecret;
6173 /// let x = InlineSecret::new().set_env_map([
6174 /// ("key0", bytes::Bytes::from_static(b"abc")),
6175 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6176 /// ]);
6177 /// ```
6178 pub fn set_env_map<T, K, V>(mut self, v: T) -> Self
6179 where
6180 T: std::iter::IntoIterator<Item = (K, V)>,
6181 K: std::convert::Into<std::string::String>,
6182 V: std::convert::Into<::bytes::Bytes>,
6183 {
6184 use std::iter::Iterator;
6185 self.env_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6186 self
6187 }
6188}
6189
6190impl wkt::message::Message for InlineSecret {
6191 fn typename() -> &'static str {
6192 "type.googleapis.com/google.devtools.cloudbuild.v1.InlineSecret"
6193 }
6194}
6195
6196/// Pairs a secret environment variable with a SecretVersion in Secret Manager.
6197#[derive(Clone, Default, PartialEq)]
6198#[non_exhaustive]
6199pub struct SecretManagerSecret {
6200 /// Resource name of the SecretVersion. In format:
6201 /// projects/*/secrets/*/versions/*
6202 pub version_name: std::string::String,
6203
6204 /// Environment variable name to associate with the secret.
6205 /// Secret environment variables must be unique across all of a build's
6206 /// secrets, and must be used by at least one build step.
6207 pub env: std::string::String,
6208
6209 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6210}
6211
6212impl SecretManagerSecret {
6213 pub fn new() -> Self {
6214 std::default::Default::default()
6215 }
6216
6217 /// Sets the value of [version_name][crate::model::SecretManagerSecret::version_name].
6218 ///
6219 /// # Example
6220 /// ```ignore,no_run
6221 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6222 /// let x = SecretManagerSecret::new().set_version_name("example");
6223 /// ```
6224 pub fn set_version_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6225 self.version_name = v.into();
6226 self
6227 }
6228
6229 /// Sets the value of [env][crate::model::SecretManagerSecret::env].
6230 ///
6231 /// # Example
6232 /// ```ignore,no_run
6233 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6234 /// let x = SecretManagerSecret::new().set_env("example");
6235 /// ```
6236 pub fn set_env<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6237 self.env = v.into();
6238 self
6239 }
6240}
6241
6242impl wkt::message::Message for SecretManagerSecret {
6243 fn typename() -> &'static str {
6244 "type.googleapis.com/google.devtools.cloudbuild.v1.SecretManagerSecret"
6245 }
6246}
6247
6248/// Pairs a set of secret environment variables containing encrypted
6249/// values with the Cloud KMS key to use to decrypt the value.
6250/// Note: Use `kmsKeyName` with `available_secrets` instead of using
6251/// `kmsKeyName` with `secret`. For instructions see:
6252/// <https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials>.
6253#[derive(Clone, Default, PartialEq)]
6254#[non_exhaustive]
6255pub struct Secret {
6256 /// Cloud KMS key name to use to decrypt these envs.
6257 pub kms_key_name: std::string::String,
6258
6259 /// Map of environment variable name to its encrypted value.
6260 ///
6261 /// Secret environment variables must be unique across all of a build's
6262 /// secrets, and must be used by at least one build step. Values can be at most
6263 /// 64 KB in size. There can be at most 100 secret values across all of a
6264 /// build's secrets.
6265 pub secret_env: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6266
6267 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6268}
6269
6270impl Secret {
6271 pub fn new() -> Self {
6272 std::default::Default::default()
6273 }
6274
6275 /// Sets the value of [kms_key_name][crate::model::Secret::kms_key_name].
6276 ///
6277 /// # Example
6278 /// ```ignore,no_run
6279 /// # use google_cloud_build_v1::model::Secret;
6280 /// let x = Secret::new().set_kms_key_name("example");
6281 /// ```
6282 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6283 self.kms_key_name = v.into();
6284 self
6285 }
6286
6287 /// Sets the value of [secret_env][crate::model::Secret::secret_env].
6288 ///
6289 /// # Example
6290 /// ```ignore,no_run
6291 /// # use google_cloud_build_v1::model::Secret;
6292 /// let x = Secret::new().set_secret_env([
6293 /// ("key0", bytes::Bytes::from_static(b"abc")),
6294 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6295 /// ]);
6296 /// ```
6297 pub fn set_secret_env<T, K, V>(mut self, v: T) -> Self
6298 where
6299 T: std::iter::IntoIterator<Item = (K, V)>,
6300 K: std::convert::Into<std::string::String>,
6301 V: std::convert::Into<::bytes::Bytes>,
6302 {
6303 use std::iter::Iterator;
6304 self.secret_env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6305 self
6306 }
6307}
6308
6309impl wkt::message::Message for Secret {
6310 fn typename() -> &'static str {
6311 "type.googleapis.com/google.devtools.cloudbuild.v1.Secret"
6312 }
6313}
6314
6315/// Request to create a new build.
6316#[derive(Clone, Default, PartialEq)]
6317#[non_exhaustive]
6318pub struct CreateBuildRequest {
6319 /// The parent resource where this build will be created.
6320 /// Format: `projects/{project}/locations/{location}`
6321 pub parent: std::string::String,
6322
6323 /// Required. ID of the project.
6324 pub project_id: std::string::String,
6325
6326 /// Required. Build resource to create.
6327 pub build: std::option::Option<crate::model::Build>,
6328
6329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6330}
6331
6332impl CreateBuildRequest {
6333 pub fn new() -> Self {
6334 std::default::Default::default()
6335 }
6336
6337 /// Sets the value of [parent][crate::model::CreateBuildRequest::parent].
6338 ///
6339 /// # Example
6340 /// ```ignore,no_run
6341 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6342 /// let x = CreateBuildRequest::new().set_parent("example");
6343 /// ```
6344 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6345 self.parent = v.into();
6346 self
6347 }
6348
6349 /// Sets the value of [project_id][crate::model::CreateBuildRequest::project_id].
6350 ///
6351 /// # Example
6352 /// ```ignore,no_run
6353 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6354 /// let x = CreateBuildRequest::new().set_project_id("example");
6355 /// ```
6356 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6357 self.project_id = v.into();
6358 self
6359 }
6360
6361 /// Sets the value of [build][crate::model::CreateBuildRequest::build].
6362 ///
6363 /// # Example
6364 /// ```ignore,no_run
6365 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6366 /// use google_cloud_build_v1::model::Build;
6367 /// let x = CreateBuildRequest::new().set_build(Build::default()/* use setters */);
6368 /// ```
6369 pub fn set_build<T>(mut self, v: T) -> Self
6370 where
6371 T: std::convert::Into<crate::model::Build>,
6372 {
6373 self.build = std::option::Option::Some(v.into());
6374 self
6375 }
6376
6377 /// Sets or clears the value of [build][crate::model::CreateBuildRequest::build].
6378 ///
6379 /// # Example
6380 /// ```ignore,no_run
6381 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6382 /// use google_cloud_build_v1::model::Build;
6383 /// let x = CreateBuildRequest::new().set_or_clear_build(Some(Build::default()/* use setters */));
6384 /// let x = CreateBuildRequest::new().set_or_clear_build(None::<Build>);
6385 /// ```
6386 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
6387 where
6388 T: std::convert::Into<crate::model::Build>,
6389 {
6390 self.build = v.map(|x| x.into());
6391 self
6392 }
6393}
6394
6395impl wkt::message::Message for CreateBuildRequest {
6396 fn typename() -> &'static str {
6397 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildRequest"
6398 }
6399}
6400
6401/// Request to get a build.
6402#[derive(Clone, Default, PartialEq)]
6403#[non_exhaustive]
6404pub struct GetBuildRequest {
6405 /// The name of the `Build` to retrieve.
6406 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6407 pub name: std::string::String,
6408
6409 /// Required. ID of the project.
6410 pub project_id: std::string::String,
6411
6412 /// Required. ID of the build.
6413 pub id: std::string::String,
6414
6415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6416}
6417
6418impl GetBuildRequest {
6419 pub fn new() -> Self {
6420 std::default::Default::default()
6421 }
6422
6423 /// Sets the value of [name][crate::model::GetBuildRequest::name].
6424 ///
6425 /// # Example
6426 /// ```ignore,no_run
6427 /// # use google_cloud_build_v1::model::GetBuildRequest;
6428 /// let x = GetBuildRequest::new().set_name("example");
6429 /// ```
6430 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6431 self.name = v.into();
6432 self
6433 }
6434
6435 /// Sets the value of [project_id][crate::model::GetBuildRequest::project_id].
6436 ///
6437 /// # Example
6438 /// ```ignore,no_run
6439 /// # use google_cloud_build_v1::model::GetBuildRequest;
6440 /// let x = GetBuildRequest::new().set_project_id("example");
6441 /// ```
6442 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6443 self.project_id = v.into();
6444 self
6445 }
6446
6447 /// Sets the value of [id][crate::model::GetBuildRequest::id].
6448 ///
6449 /// # Example
6450 /// ```ignore,no_run
6451 /// # use google_cloud_build_v1::model::GetBuildRequest;
6452 /// let x = GetBuildRequest::new().set_id("example");
6453 /// ```
6454 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6455 self.id = v.into();
6456 self
6457 }
6458}
6459
6460impl wkt::message::Message for GetBuildRequest {
6461 fn typename() -> &'static str {
6462 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildRequest"
6463 }
6464}
6465
6466/// Request to list builds.
6467#[derive(Clone, Default, PartialEq)]
6468#[non_exhaustive]
6469pub struct ListBuildsRequest {
6470 /// The parent of the collection of `Builds`.
6471 /// Format: `projects/{project}/locations/{location}`
6472 pub parent: std::string::String,
6473
6474 /// Required. ID of the project.
6475 pub project_id: std::string::String,
6476
6477 /// Number of results to return in the list.
6478 pub page_size: i32,
6479
6480 /// The page token for the next page of Builds.
6481 ///
6482 /// If unspecified, the first page of results is returned.
6483 ///
6484 /// If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
6485 /// In this case, the token should be discarded, and pagination should be
6486 /// restarted from the first page of results.
6487 ///
6488 /// See <https://google.aip.dev/158> for more.
6489 pub page_token: std::string::String,
6490
6491 /// The raw filter text to constrain the results.
6492 pub filter: std::string::String,
6493
6494 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6495}
6496
6497impl ListBuildsRequest {
6498 pub fn new() -> Self {
6499 std::default::Default::default()
6500 }
6501
6502 /// Sets the value of [parent][crate::model::ListBuildsRequest::parent].
6503 ///
6504 /// # Example
6505 /// ```ignore,no_run
6506 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6507 /// let x = ListBuildsRequest::new().set_parent("example");
6508 /// ```
6509 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6510 self.parent = v.into();
6511 self
6512 }
6513
6514 /// Sets the value of [project_id][crate::model::ListBuildsRequest::project_id].
6515 ///
6516 /// # Example
6517 /// ```ignore,no_run
6518 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6519 /// let x = ListBuildsRequest::new().set_project_id("example");
6520 /// ```
6521 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6522 self.project_id = v.into();
6523 self
6524 }
6525
6526 /// Sets the value of [page_size][crate::model::ListBuildsRequest::page_size].
6527 ///
6528 /// # Example
6529 /// ```ignore,no_run
6530 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6531 /// let x = ListBuildsRequest::new().set_page_size(42);
6532 /// ```
6533 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6534 self.page_size = v.into();
6535 self
6536 }
6537
6538 /// Sets the value of [page_token][crate::model::ListBuildsRequest::page_token].
6539 ///
6540 /// # Example
6541 /// ```ignore,no_run
6542 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6543 /// let x = ListBuildsRequest::new().set_page_token("example");
6544 /// ```
6545 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6546 self.page_token = v.into();
6547 self
6548 }
6549
6550 /// Sets the value of [filter][crate::model::ListBuildsRequest::filter].
6551 ///
6552 /// # Example
6553 /// ```ignore,no_run
6554 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6555 /// let x = ListBuildsRequest::new().set_filter("example");
6556 /// ```
6557 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6558 self.filter = v.into();
6559 self
6560 }
6561}
6562
6563impl wkt::message::Message for ListBuildsRequest {
6564 fn typename() -> &'static str {
6565 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsRequest"
6566 }
6567}
6568
6569/// Response including listed builds.
6570#[derive(Clone, Default, PartialEq)]
6571#[non_exhaustive]
6572pub struct ListBuildsResponse {
6573 /// Builds will be sorted by `create_time`, descending.
6574 pub builds: std::vec::Vec<crate::model::Build>,
6575
6576 /// Token to receive the next page of results.
6577 /// This will be absent if the end of the response list has been reached.
6578 pub next_page_token: std::string::String,
6579
6580 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6581}
6582
6583impl ListBuildsResponse {
6584 pub fn new() -> Self {
6585 std::default::Default::default()
6586 }
6587
6588 /// Sets the value of [builds][crate::model::ListBuildsResponse::builds].
6589 ///
6590 /// # Example
6591 /// ```ignore,no_run
6592 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6593 /// use google_cloud_build_v1::model::Build;
6594 /// let x = ListBuildsResponse::new()
6595 /// .set_builds([
6596 /// Build::default()/* use setters */,
6597 /// Build::default()/* use (different) setters */,
6598 /// ]);
6599 /// ```
6600 pub fn set_builds<T, V>(mut self, v: T) -> Self
6601 where
6602 T: std::iter::IntoIterator<Item = V>,
6603 V: std::convert::Into<crate::model::Build>,
6604 {
6605 use std::iter::Iterator;
6606 self.builds = v.into_iter().map(|i| i.into()).collect();
6607 self
6608 }
6609
6610 /// Sets the value of [next_page_token][crate::model::ListBuildsResponse::next_page_token].
6611 ///
6612 /// # Example
6613 /// ```ignore,no_run
6614 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6615 /// let x = ListBuildsResponse::new().set_next_page_token("example");
6616 /// ```
6617 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6618 self.next_page_token = v.into();
6619 self
6620 }
6621}
6622
6623impl wkt::message::Message for ListBuildsResponse {
6624 fn typename() -> &'static str {
6625 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsResponse"
6626 }
6627}
6628
6629#[doc(hidden)]
6630impl gax::paginator::internal::PageableResponse for ListBuildsResponse {
6631 type PageItem = crate::model::Build;
6632
6633 fn items(self) -> std::vec::Vec<Self::PageItem> {
6634 self.builds
6635 }
6636
6637 fn next_page_token(&self) -> std::string::String {
6638 use std::clone::Clone;
6639 self.next_page_token.clone()
6640 }
6641}
6642
6643/// Request to cancel an ongoing build.
6644#[derive(Clone, Default, PartialEq)]
6645#[non_exhaustive]
6646pub struct CancelBuildRequest {
6647 /// The name of the `Build` to cancel.
6648 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6649 pub name: std::string::String,
6650
6651 /// Required. ID of the project.
6652 pub project_id: std::string::String,
6653
6654 /// Required. ID of the build.
6655 pub id: std::string::String,
6656
6657 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6658}
6659
6660impl CancelBuildRequest {
6661 pub fn new() -> Self {
6662 std::default::Default::default()
6663 }
6664
6665 /// Sets the value of [name][crate::model::CancelBuildRequest::name].
6666 ///
6667 /// # Example
6668 /// ```ignore,no_run
6669 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6670 /// let x = CancelBuildRequest::new().set_name("example");
6671 /// ```
6672 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6673 self.name = v.into();
6674 self
6675 }
6676
6677 /// Sets the value of [project_id][crate::model::CancelBuildRequest::project_id].
6678 ///
6679 /// # Example
6680 /// ```ignore,no_run
6681 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6682 /// let x = CancelBuildRequest::new().set_project_id("example");
6683 /// ```
6684 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6685 self.project_id = v.into();
6686 self
6687 }
6688
6689 /// Sets the value of [id][crate::model::CancelBuildRequest::id].
6690 ///
6691 /// # Example
6692 /// ```ignore,no_run
6693 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6694 /// let x = CancelBuildRequest::new().set_id("example");
6695 /// ```
6696 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6697 self.id = v.into();
6698 self
6699 }
6700}
6701
6702impl wkt::message::Message for CancelBuildRequest {
6703 fn typename() -> &'static str {
6704 "type.googleapis.com/google.devtools.cloudbuild.v1.CancelBuildRequest"
6705 }
6706}
6707
6708/// Request to approve or reject a pending build.
6709#[derive(Clone, Default, PartialEq)]
6710#[non_exhaustive]
6711pub struct ApproveBuildRequest {
6712 /// Required. Name of the target build.
6713 /// For example: "projects/{$project_id}/builds/{$build_id}"
6714 pub name: std::string::String,
6715
6716 /// Approval decision and metadata.
6717 pub approval_result: std::option::Option<crate::model::ApprovalResult>,
6718
6719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6720}
6721
6722impl ApproveBuildRequest {
6723 pub fn new() -> Self {
6724 std::default::Default::default()
6725 }
6726
6727 /// Sets the value of [name][crate::model::ApproveBuildRequest::name].
6728 ///
6729 /// # Example
6730 /// ```ignore,no_run
6731 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6732 /// let x = ApproveBuildRequest::new().set_name("example");
6733 /// ```
6734 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6735 self.name = v.into();
6736 self
6737 }
6738
6739 /// Sets the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6740 ///
6741 /// # Example
6742 /// ```ignore,no_run
6743 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6744 /// use google_cloud_build_v1::model::ApprovalResult;
6745 /// let x = ApproveBuildRequest::new().set_approval_result(ApprovalResult::default()/* use setters */);
6746 /// ```
6747 pub fn set_approval_result<T>(mut self, v: T) -> Self
6748 where
6749 T: std::convert::Into<crate::model::ApprovalResult>,
6750 {
6751 self.approval_result = std::option::Option::Some(v.into());
6752 self
6753 }
6754
6755 /// Sets or clears the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6756 ///
6757 /// # Example
6758 /// ```ignore,no_run
6759 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6760 /// use google_cloud_build_v1::model::ApprovalResult;
6761 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(Some(ApprovalResult::default()/* use setters */));
6762 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(None::<ApprovalResult>);
6763 /// ```
6764 pub fn set_or_clear_approval_result<T>(mut self, v: std::option::Option<T>) -> Self
6765 where
6766 T: std::convert::Into<crate::model::ApprovalResult>,
6767 {
6768 self.approval_result = v.map(|x| x.into());
6769 self
6770 }
6771}
6772
6773impl wkt::message::Message for ApproveBuildRequest {
6774 fn typename() -> &'static str {
6775 "type.googleapis.com/google.devtools.cloudbuild.v1.ApproveBuildRequest"
6776 }
6777}
6778
6779/// BuildApproval describes a build's approval configuration, state, and
6780/// result.
6781#[derive(Clone, Default, PartialEq)]
6782#[non_exhaustive]
6783pub struct BuildApproval {
6784 /// Output only. The state of this build's approval.
6785 pub state: crate::model::build_approval::State,
6786
6787 /// Output only. Configuration for manual approval of this build.
6788 pub config: std::option::Option<crate::model::ApprovalConfig>,
6789
6790 /// Output only. Result of manual approval for this Build.
6791 pub result: std::option::Option<crate::model::ApprovalResult>,
6792
6793 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6794}
6795
6796impl BuildApproval {
6797 pub fn new() -> Self {
6798 std::default::Default::default()
6799 }
6800
6801 /// Sets the value of [state][crate::model::BuildApproval::state].
6802 ///
6803 /// # Example
6804 /// ```ignore,no_run
6805 /// # use google_cloud_build_v1::model::BuildApproval;
6806 /// use google_cloud_build_v1::model::build_approval::State;
6807 /// let x0 = BuildApproval::new().set_state(State::Pending);
6808 /// let x1 = BuildApproval::new().set_state(State::Approved);
6809 /// let x2 = BuildApproval::new().set_state(State::Rejected);
6810 /// ```
6811 pub fn set_state<T: std::convert::Into<crate::model::build_approval::State>>(
6812 mut self,
6813 v: T,
6814 ) -> Self {
6815 self.state = v.into();
6816 self
6817 }
6818
6819 /// Sets the value of [config][crate::model::BuildApproval::config].
6820 ///
6821 /// # Example
6822 /// ```ignore,no_run
6823 /// # use google_cloud_build_v1::model::BuildApproval;
6824 /// use google_cloud_build_v1::model::ApprovalConfig;
6825 /// let x = BuildApproval::new().set_config(ApprovalConfig::default()/* use setters */);
6826 /// ```
6827 pub fn set_config<T>(mut self, v: T) -> Self
6828 where
6829 T: std::convert::Into<crate::model::ApprovalConfig>,
6830 {
6831 self.config = std::option::Option::Some(v.into());
6832 self
6833 }
6834
6835 /// Sets or clears the value of [config][crate::model::BuildApproval::config].
6836 ///
6837 /// # Example
6838 /// ```ignore,no_run
6839 /// # use google_cloud_build_v1::model::BuildApproval;
6840 /// use google_cloud_build_v1::model::ApprovalConfig;
6841 /// let x = BuildApproval::new().set_or_clear_config(Some(ApprovalConfig::default()/* use setters */));
6842 /// let x = BuildApproval::new().set_or_clear_config(None::<ApprovalConfig>);
6843 /// ```
6844 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
6845 where
6846 T: std::convert::Into<crate::model::ApprovalConfig>,
6847 {
6848 self.config = v.map(|x| x.into());
6849 self
6850 }
6851
6852 /// Sets the value of [result][crate::model::BuildApproval::result].
6853 ///
6854 /// # Example
6855 /// ```ignore,no_run
6856 /// # use google_cloud_build_v1::model::BuildApproval;
6857 /// use google_cloud_build_v1::model::ApprovalResult;
6858 /// let x = BuildApproval::new().set_result(ApprovalResult::default()/* use setters */);
6859 /// ```
6860 pub fn set_result<T>(mut self, v: T) -> Self
6861 where
6862 T: std::convert::Into<crate::model::ApprovalResult>,
6863 {
6864 self.result = std::option::Option::Some(v.into());
6865 self
6866 }
6867
6868 /// Sets or clears the value of [result][crate::model::BuildApproval::result].
6869 ///
6870 /// # Example
6871 /// ```ignore,no_run
6872 /// # use google_cloud_build_v1::model::BuildApproval;
6873 /// use google_cloud_build_v1::model::ApprovalResult;
6874 /// let x = BuildApproval::new().set_or_clear_result(Some(ApprovalResult::default()/* use setters */));
6875 /// let x = BuildApproval::new().set_or_clear_result(None::<ApprovalResult>);
6876 /// ```
6877 pub fn set_or_clear_result<T>(mut self, v: std::option::Option<T>) -> Self
6878 where
6879 T: std::convert::Into<crate::model::ApprovalResult>,
6880 {
6881 self.result = v.map(|x| x.into());
6882 self
6883 }
6884}
6885
6886impl wkt::message::Message for BuildApproval {
6887 fn typename() -> &'static str {
6888 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildApproval"
6889 }
6890}
6891
6892/// Defines additional types related to [BuildApproval].
6893pub mod build_approval {
6894 #[allow(unused_imports)]
6895 use super::*;
6896
6897 /// Specifies the current state of a build's approval.
6898 ///
6899 /// # Working with unknown values
6900 ///
6901 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6902 /// additional enum variants at any time. Adding new variants is not considered
6903 /// a breaking change. Applications should write their code in anticipation of:
6904 ///
6905 /// - New values appearing in future releases of the client library, **and**
6906 /// - New values received dynamically, without application changes.
6907 ///
6908 /// Please consult the [Working with enums] section in the user guide for some
6909 /// guidelines.
6910 ///
6911 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6912 #[derive(Clone, Debug, PartialEq)]
6913 #[non_exhaustive]
6914 pub enum State {
6915 /// Default enum type. This should not be used.
6916 Unspecified,
6917 /// Build approval is pending.
6918 Pending,
6919 /// Build approval has been approved.
6920 Approved,
6921 /// Build approval has been rejected.
6922 Rejected,
6923 /// Build was cancelled while it was still pending approval.
6924 Cancelled,
6925 /// If set, the enum was initialized with an unknown value.
6926 ///
6927 /// Applications can examine the value using [State::value] or
6928 /// [State::name].
6929 UnknownValue(state::UnknownValue),
6930 }
6931
6932 #[doc(hidden)]
6933 pub mod state {
6934 #[allow(unused_imports)]
6935 use super::*;
6936 #[derive(Clone, Debug, PartialEq)]
6937 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6938 }
6939
6940 impl State {
6941 /// Gets the enum value.
6942 ///
6943 /// Returns `None` if the enum contains an unknown value deserialized from
6944 /// the string representation of enums.
6945 pub fn value(&self) -> std::option::Option<i32> {
6946 match self {
6947 Self::Unspecified => std::option::Option::Some(0),
6948 Self::Pending => std::option::Option::Some(1),
6949 Self::Approved => std::option::Option::Some(2),
6950 Self::Rejected => std::option::Option::Some(3),
6951 Self::Cancelled => std::option::Option::Some(5),
6952 Self::UnknownValue(u) => u.0.value(),
6953 }
6954 }
6955
6956 /// Gets the enum value as a string.
6957 ///
6958 /// Returns `None` if the enum contains an unknown value deserialized from
6959 /// the integer representation of enums.
6960 pub fn name(&self) -> std::option::Option<&str> {
6961 match self {
6962 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6963 Self::Pending => std::option::Option::Some("PENDING"),
6964 Self::Approved => std::option::Option::Some("APPROVED"),
6965 Self::Rejected => std::option::Option::Some("REJECTED"),
6966 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6967 Self::UnknownValue(u) => u.0.name(),
6968 }
6969 }
6970 }
6971
6972 impl std::default::Default for State {
6973 fn default() -> Self {
6974 use std::convert::From;
6975 Self::from(0)
6976 }
6977 }
6978
6979 impl std::fmt::Display for State {
6980 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6981 wkt::internal::display_enum(f, self.name(), self.value())
6982 }
6983 }
6984
6985 impl std::convert::From<i32> for State {
6986 fn from(value: i32) -> Self {
6987 match value {
6988 0 => Self::Unspecified,
6989 1 => Self::Pending,
6990 2 => Self::Approved,
6991 3 => Self::Rejected,
6992 5 => Self::Cancelled,
6993 _ => Self::UnknownValue(state::UnknownValue(
6994 wkt::internal::UnknownEnumValue::Integer(value),
6995 )),
6996 }
6997 }
6998 }
6999
7000 impl std::convert::From<&str> for State {
7001 fn from(value: &str) -> Self {
7002 use std::string::ToString;
7003 match value {
7004 "STATE_UNSPECIFIED" => Self::Unspecified,
7005 "PENDING" => Self::Pending,
7006 "APPROVED" => Self::Approved,
7007 "REJECTED" => Self::Rejected,
7008 "CANCELLED" => Self::Cancelled,
7009 _ => Self::UnknownValue(state::UnknownValue(
7010 wkt::internal::UnknownEnumValue::String(value.to_string()),
7011 )),
7012 }
7013 }
7014 }
7015
7016 impl serde::ser::Serialize for State {
7017 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7018 where
7019 S: serde::Serializer,
7020 {
7021 match self {
7022 Self::Unspecified => serializer.serialize_i32(0),
7023 Self::Pending => serializer.serialize_i32(1),
7024 Self::Approved => serializer.serialize_i32(2),
7025 Self::Rejected => serializer.serialize_i32(3),
7026 Self::Cancelled => serializer.serialize_i32(5),
7027 Self::UnknownValue(u) => u.0.serialize(serializer),
7028 }
7029 }
7030 }
7031
7032 impl<'de> serde::de::Deserialize<'de> for State {
7033 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7034 where
7035 D: serde::Deserializer<'de>,
7036 {
7037 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7038 ".google.devtools.cloudbuild.v1.BuildApproval.State",
7039 ))
7040 }
7041 }
7042}
7043
7044/// ApprovalConfig describes configuration for manual approval of a build.
7045#[derive(Clone, Default, PartialEq)]
7046#[non_exhaustive]
7047pub struct ApprovalConfig {
7048 /// Whether or not approval is needed. If this is set on a build, it will
7049 /// become pending when created, and will need to be explicitly approved
7050 /// to start.
7051 pub approval_required: bool,
7052
7053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7054}
7055
7056impl ApprovalConfig {
7057 pub fn new() -> Self {
7058 std::default::Default::default()
7059 }
7060
7061 /// Sets the value of [approval_required][crate::model::ApprovalConfig::approval_required].
7062 ///
7063 /// # Example
7064 /// ```ignore,no_run
7065 /// # use google_cloud_build_v1::model::ApprovalConfig;
7066 /// let x = ApprovalConfig::new().set_approval_required(true);
7067 /// ```
7068 pub fn set_approval_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7069 self.approval_required = v.into();
7070 self
7071 }
7072}
7073
7074impl wkt::message::Message for ApprovalConfig {
7075 fn typename() -> &'static str {
7076 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalConfig"
7077 }
7078}
7079
7080/// ApprovalResult describes the decision and associated metadata of a manual
7081/// approval of a build.
7082#[derive(Clone, Default, PartialEq)]
7083#[non_exhaustive]
7084pub struct ApprovalResult {
7085 /// Output only. Email of the user that called the ApproveBuild API to
7086 /// approve or reject a build at the time that the API was called.
7087 pub approver_account: std::string::String,
7088
7089 /// Output only. The time when the approval decision was made.
7090 pub approval_time: std::option::Option<wkt::Timestamp>,
7091
7092 /// Required. The decision of this manual approval.
7093 pub decision: crate::model::approval_result::Decision,
7094
7095 /// Optional. An optional comment for this manual approval result.
7096 pub comment: std::string::String,
7097
7098 /// Optional. An optional URL tied to this manual approval result. This field
7099 /// is essentially the same as comment, except that it will be rendered by the
7100 /// UI differently. An example use case is a link to an external job that
7101 /// approved this Build.
7102 pub url: std::string::String,
7103
7104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7105}
7106
7107impl ApprovalResult {
7108 pub fn new() -> Self {
7109 std::default::Default::default()
7110 }
7111
7112 /// Sets the value of [approver_account][crate::model::ApprovalResult::approver_account].
7113 ///
7114 /// # Example
7115 /// ```ignore,no_run
7116 /// # use google_cloud_build_v1::model::ApprovalResult;
7117 /// let x = ApprovalResult::new().set_approver_account("example");
7118 /// ```
7119 pub fn set_approver_account<T: std::convert::Into<std::string::String>>(
7120 mut self,
7121 v: T,
7122 ) -> Self {
7123 self.approver_account = v.into();
7124 self
7125 }
7126
7127 /// Sets the value of [approval_time][crate::model::ApprovalResult::approval_time].
7128 ///
7129 /// # Example
7130 /// ```ignore,no_run
7131 /// # use google_cloud_build_v1::model::ApprovalResult;
7132 /// use wkt::Timestamp;
7133 /// let x = ApprovalResult::new().set_approval_time(Timestamp::default()/* use setters */);
7134 /// ```
7135 pub fn set_approval_time<T>(mut self, v: T) -> Self
7136 where
7137 T: std::convert::Into<wkt::Timestamp>,
7138 {
7139 self.approval_time = std::option::Option::Some(v.into());
7140 self
7141 }
7142
7143 /// Sets or clears the value of [approval_time][crate::model::ApprovalResult::approval_time].
7144 ///
7145 /// # Example
7146 /// ```ignore,no_run
7147 /// # use google_cloud_build_v1::model::ApprovalResult;
7148 /// use wkt::Timestamp;
7149 /// let x = ApprovalResult::new().set_or_clear_approval_time(Some(Timestamp::default()/* use setters */));
7150 /// let x = ApprovalResult::new().set_or_clear_approval_time(None::<Timestamp>);
7151 /// ```
7152 pub fn set_or_clear_approval_time<T>(mut self, v: std::option::Option<T>) -> Self
7153 where
7154 T: std::convert::Into<wkt::Timestamp>,
7155 {
7156 self.approval_time = v.map(|x| x.into());
7157 self
7158 }
7159
7160 /// Sets the value of [decision][crate::model::ApprovalResult::decision].
7161 ///
7162 /// # Example
7163 /// ```ignore,no_run
7164 /// # use google_cloud_build_v1::model::ApprovalResult;
7165 /// use google_cloud_build_v1::model::approval_result::Decision;
7166 /// let x0 = ApprovalResult::new().set_decision(Decision::Approved);
7167 /// let x1 = ApprovalResult::new().set_decision(Decision::Rejected);
7168 /// ```
7169 pub fn set_decision<T: std::convert::Into<crate::model::approval_result::Decision>>(
7170 mut self,
7171 v: T,
7172 ) -> Self {
7173 self.decision = v.into();
7174 self
7175 }
7176
7177 /// Sets the value of [comment][crate::model::ApprovalResult::comment].
7178 ///
7179 /// # Example
7180 /// ```ignore,no_run
7181 /// # use google_cloud_build_v1::model::ApprovalResult;
7182 /// let x = ApprovalResult::new().set_comment("example");
7183 /// ```
7184 pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7185 self.comment = v.into();
7186 self
7187 }
7188
7189 /// Sets the value of [url][crate::model::ApprovalResult::url].
7190 ///
7191 /// # Example
7192 /// ```ignore,no_run
7193 /// # use google_cloud_build_v1::model::ApprovalResult;
7194 /// let x = ApprovalResult::new().set_url("example");
7195 /// ```
7196 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7197 self.url = v.into();
7198 self
7199 }
7200}
7201
7202impl wkt::message::Message for ApprovalResult {
7203 fn typename() -> &'static str {
7204 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalResult"
7205 }
7206}
7207
7208/// Defines additional types related to [ApprovalResult].
7209pub mod approval_result {
7210 #[allow(unused_imports)]
7211 use super::*;
7212
7213 /// Specifies whether or not this manual approval result is to approve
7214 /// or reject a build.
7215 ///
7216 /// # Working with unknown values
7217 ///
7218 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7219 /// additional enum variants at any time. Adding new variants is not considered
7220 /// a breaking change. Applications should write their code in anticipation of:
7221 ///
7222 /// - New values appearing in future releases of the client library, **and**
7223 /// - New values received dynamically, without application changes.
7224 ///
7225 /// Please consult the [Working with enums] section in the user guide for some
7226 /// guidelines.
7227 ///
7228 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7229 #[derive(Clone, Debug, PartialEq)]
7230 #[non_exhaustive]
7231 pub enum Decision {
7232 /// Default enum type. This should not be used.
7233 Unspecified,
7234 /// Build is approved.
7235 Approved,
7236 /// Build is rejected.
7237 Rejected,
7238 /// If set, the enum was initialized with an unknown value.
7239 ///
7240 /// Applications can examine the value using [Decision::value] or
7241 /// [Decision::name].
7242 UnknownValue(decision::UnknownValue),
7243 }
7244
7245 #[doc(hidden)]
7246 pub mod decision {
7247 #[allow(unused_imports)]
7248 use super::*;
7249 #[derive(Clone, Debug, PartialEq)]
7250 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7251 }
7252
7253 impl Decision {
7254 /// Gets the enum value.
7255 ///
7256 /// Returns `None` if the enum contains an unknown value deserialized from
7257 /// the string representation of enums.
7258 pub fn value(&self) -> std::option::Option<i32> {
7259 match self {
7260 Self::Unspecified => std::option::Option::Some(0),
7261 Self::Approved => std::option::Option::Some(1),
7262 Self::Rejected => std::option::Option::Some(2),
7263 Self::UnknownValue(u) => u.0.value(),
7264 }
7265 }
7266
7267 /// Gets the enum value as a string.
7268 ///
7269 /// Returns `None` if the enum contains an unknown value deserialized from
7270 /// the integer representation of enums.
7271 pub fn name(&self) -> std::option::Option<&str> {
7272 match self {
7273 Self::Unspecified => std::option::Option::Some("DECISION_UNSPECIFIED"),
7274 Self::Approved => std::option::Option::Some("APPROVED"),
7275 Self::Rejected => std::option::Option::Some("REJECTED"),
7276 Self::UnknownValue(u) => u.0.name(),
7277 }
7278 }
7279 }
7280
7281 impl std::default::Default for Decision {
7282 fn default() -> Self {
7283 use std::convert::From;
7284 Self::from(0)
7285 }
7286 }
7287
7288 impl std::fmt::Display for Decision {
7289 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7290 wkt::internal::display_enum(f, self.name(), self.value())
7291 }
7292 }
7293
7294 impl std::convert::From<i32> for Decision {
7295 fn from(value: i32) -> Self {
7296 match value {
7297 0 => Self::Unspecified,
7298 1 => Self::Approved,
7299 2 => Self::Rejected,
7300 _ => Self::UnknownValue(decision::UnknownValue(
7301 wkt::internal::UnknownEnumValue::Integer(value),
7302 )),
7303 }
7304 }
7305 }
7306
7307 impl std::convert::From<&str> for Decision {
7308 fn from(value: &str) -> Self {
7309 use std::string::ToString;
7310 match value {
7311 "DECISION_UNSPECIFIED" => Self::Unspecified,
7312 "APPROVED" => Self::Approved,
7313 "REJECTED" => Self::Rejected,
7314 _ => Self::UnknownValue(decision::UnknownValue(
7315 wkt::internal::UnknownEnumValue::String(value.to_string()),
7316 )),
7317 }
7318 }
7319 }
7320
7321 impl serde::ser::Serialize for Decision {
7322 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7323 where
7324 S: serde::Serializer,
7325 {
7326 match self {
7327 Self::Unspecified => serializer.serialize_i32(0),
7328 Self::Approved => serializer.serialize_i32(1),
7329 Self::Rejected => serializer.serialize_i32(2),
7330 Self::UnknownValue(u) => u.0.serialize(serializer),
7331 }
7332 }
7333 }
7334
7335 impl<'de> serde::de::Deserialize<'de> for Decision {
7336 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7337 where
7338 D: serde::Deserializer<'de>,
7339 {
7340 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Decision>::new(
7341 ".google.devtools.cloudbuild.v1.ApprovalResult.Decision",
7342 ))
7343 }
7344 }
7345}
7346
7347/// GitRepoSource describes a repo and ref of a code repository.
7348#[derive(Clone, Default, PartialEq)]
7349#[non_exhaustive]
7350pub struct GitRepoSource {
7351 /// The URI of the repo (e.g. <https://github.com/user/repo.git>).
7352 /// Either `uri` or `repository` can be specified and is required.
7353 pub uri: std::string::String,
7354
7355 /// The branch or tag to use. Must start with "refs/" (required).
7356 pub r#ref: std::string::String,
7357
7358 /// See RepoType below.
7359 pub repo_type: crate::model::git_file_source::RepoType,
7360
7361 /// The source of the SCM repo.
7362 pub source: std::option::Option<crate::model::git_repo_source::Source>,
7363
7364 /// The resource name of the enterprise config that should be applied
7365 /// to this source.
7366 pub enterprise_config: std::option::Option<crate::model::git_repo_source::EnterpriseConfig>,
7367
7368 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7369}
7370
7371impl GitRepoSource {
7372 pub fn new() -> Self {
7373 std::default::Default::default()
7374 }
7375
7376 /// Sets the value of [uri][crate::model::GitRepoSource::uri].
7377 ///
7378 /// # Example
7379 /// ```ignore,no_run
7380 /// # use google_cloud_build_v1::model::GitRepoSource;
7381 /// let x = GitRepoSource::new().set_uri("example");
7382 /// ```
7383 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7384 self.uri = v.into();
7385 self
7386 }
7387
7388 /// Sets the value of [r#ref][crate::model::GitRepoSource::ref].
7389 ///
7390 /// # Example
7391 /// ```ignore,no_run
7392 /// # use google_cloud_build_v1::model::GitRepoSource;
7393 /// let x = GitRepoSource::new().set_ref("example");
7394 /// ```
7395 pub fn set_ref<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7396 self.r#ref = v.into();
7397 self
7398 }
7399
7400 /// Sets the value of [repo_type][crate::model::GitRepoSource::repo_type].
7401 ///
7402 /// # Example
7403 /// ```ignore,no_run
7404 /// # use google_cloud_build_v1::model::GitRepoSource;
7405 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7406 /// let x0 = GitRepoSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7407 /// let x1 = GitRepoSource::new().set_repo_type(RepoType::Github);
7408 /// let x2 = GitRepoSource::new().set_repo_type(RepoType::BitbucketServer);
7409 /// ```
7410 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7411 mut self,
7412 v: T,
7413 ) -> Self {
7414 self.repo_type = v.into();
7415 self
7416 }
7417
7418 /// Sets the value of [source][crate::model::GitRepoSource::source].
7419 ///
7420 /// Note that all the setters affecting `source` are mutually
7421 /// exclusive.
7422 ///
7423 /// # Example
7424 /// ```ignore,no_run
7425 /// # use google_cloud_build_v1::model::GitRepoSource;
7426 /// use google_cloud_build_v1::model::git_repo_source::Source;
7427 /// let x = GitRepoSource::new().set_source(Some(Source::Repository("example".to_string())));
7428 /// ```
7429 pub fn set_source<
7430 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::Source>>,
7431 >(
7432 mut self,
7433 v: T,
7434 ) -> Self {
7435 self.source = v.into();
7436 self
7437 }
7438
7439 /// The value of [source][crate::model::GitRepoSource::source]
7440 /// if it holds a `Repository`, `None` if the field is not set or
7441 /// holds a different branch.
7442 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7443 #[allow(unreachable_patterns)]
7444 self.source.as_ref().and_then(|v| match v {
7445 crate::model::git_repo_source::Source::Repository(v) => std::option::Option::Some(v),
7446 _ => std::option::Option::None,
7447 })
7448 }
7449
7450 /// Sets the value of [source][crate::model::GitRepoSource::source]
7451 /// to hold a `Repository`.
7452 ///
7453 /// Note that all the setters affecting `source` are
7454 /// mutually exclusive.
7455 ///
7456 /// # Example
7457 /// ```ignore,no_run
7458 /// # use google_cloud_build_v1::model::GitRepoSource;
7459 /// let x = GitRepoSource::new().set_repository("example");
7460 /// assert!(x.repository().is_some());
7461 /// ```
7462 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7463 self.source =
7464 std::option::Option::Some(crate::model::git_repo_source::Source::Repository(v.into()));
7465 self
7466 }
7467
7468 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config].
7469 ///
7470 /// Note that all the setters affecting `enterprise_config` are mutually
7471 /// exclusive.
7472 ///
7473 /// # Example
7474 /// ```ignore,no_run
7475 /// # use google_cloud_build_v1::model::GitRepoSource;
7476 /// use google_cloud_build_v1::model::git_repo_source::EnterpriseConfig;
7477 /// let x = GitRepoSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7478 /// ```
7479 pub fn set_enterprise_config<
7480 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::EnterpriseConfig>>,
7481 >(
7482 mut self,
7483 v: T,
7484 ) -> Self {
7485 self.enterprise_config = v.into();
7486 self
7487 }
7488
7489 /// The value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7490 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7491 /// holds a different branch.
7492 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7493 #[allow(unreachable_patterns)]
7494 self.enterprise_config.as_ref().and_then(|v| match v {
7495 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7496 std::option::Option::Some(v)
7497 }
7498 _ => std::option::Option::None,
7499 })
7500 }
7501
7502 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7503 /// to hold a `GithubEnterpriseConfig`.
7504 ///
7505 /// Note that all the setters affecting `enterprise_config` are
7506 /// mutually exclusive.
7507 ///
7508 /// # Example
7509 /// ```ignore,no_run
7510 /// # use google_cloud_build_v1::model::GitRepoSource;
7511 /// let x = GitRepoSource::new().set_github_enterprise_config("example");
7512 /// assert!(x.github_enterprise_config().is_some());
7513 /// ```
7514 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7515 mut self,
7516 v: T,
7517 ) -> Self {
7518 self.enterprise_config = std::option::Option::Some(
7519 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7520 );
7521 self
7522 }
7523}
7524
7525impl wkt::message::Message for GitRepoSource {
7526 fn typename() -> &'static str {
7527 "type.googleapis.com/google.devtools.cloudbuild.v1.GitRepoSource"
7528 }
7529}
7530
7531/// Defines additional types related to [GitRepoSource].
7532pub mod git_repo_source {
7533 #[allow(unused_imports)]
7534 use super::*;
7535
7536 /// The source of the SCM repo.
7537 #[derive(Clone, Debug, PartialEq)]
7538 #[non_exhaustive]
7539 pub enum Source {
7540 /// The connected repository resource name, in the format
7541 /// `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or
7542 /// `repository` can be specified and is required.
7543 Repository(std::string::String),
7544 }
7545
7546 /// The resource name of the enterprise config that should be applied
7547 /// to this source.
7548 #[derive(Clone, Debug, PartialEq)]
7549 #[non_exhaustive]
7550 pub enum EnterpriseConfig {
7551 /// The full resource name of the github enterprise config.
7552 /// Format:
7553 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7554 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7555 GithubEnterpriseConfig(std::string::String),
7556 }
7557}
7558
7559/// GitFileSource describes a file within a (possibly remote) code repository.
7560#[derive(Clone, Default, PartialEq)]
7561#[non_exhaustive]
7562pub struct GitFileSource {
7563 /// The path of the file, with the repo root as the root of the path.
7564 pub path: std::string::String,
7565
7566 /// The URI of the repo.
7567 /// Either uri or repository can be specified.
7568 /// If unspecified, the repo from which the trigger invocation originated is
7569 /// assumed to be the repo from which to read the specified path.
7570 pub uri: std::string::String,
7571
7572 /// See RepoType above.
7573 pub repo_type: crate::model::git_file_source::RepoType,
7574
7575 /// The branch, tag, arbitrary ref, or SHA version of the repo to use when
7576 /// resolving the filename (optional).
7577 /// This field respects the same syntax/resolution as described here:
7578 /// <https://git-scm.com/docs/gitrevisions>
7579 /// If unspecified, the revision from which the trigger invocation originated
7580 /// is assumed to be the revision from which to read the specified path.
7581 pub revision: std::string::String,
7582
7583 /// The source of the SCM repo.
7584 pub source: std::option::Option<crate::model::git_file_source::Source>,
7585
7586 /// The resource name of the enterprise config that should be applied
7587 /// to this source.
7588 pub enterprise_config: std::option::Option<crate::model::git_file_source::EnterpriseConfig>,
7589
7590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7591}
7592
7593impl GitFileSource {
7594 pub fn new() -> Self {
7595 std::default::Default::default()
7596 }
7597
7598 /// Sets the value of [path][crate::model::GitFileSource::path].
7599 ///
7600 /// # Example
7601 /// ```ignore,no_run
7602 /// # use google_cloud_build_v1::model::GitFileSource;
7603 /// let x = GitFileSource::new().set_path("example");
7604 /// ```
7605 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7606 self.path = v.into();
7607 self
7608 }
7609
7610 /// Sets the value of [uri][crate::model::GitFileSource::uri].
7611 ///
7612 /// # Example
7613 /// ```ignore,no_run
7614 /// # use google_cloud_build_v1::model::GitFileSource;
7615 /// let x = GitFileSource::new().set_uri("example");
7616 /// ```
7617 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7618 self.uri = v.into();
7619 self
7620 }
7621
7622 /// Sets the value of [repo_type][crate::model::GitFileSource::repo_type].
7623 ///
7624 /// # Example
7625 /// ```ignore,no_run
7626 /// # use google_cloud_build_v1::model::GitFileSource;
7627 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7628 /// let x0 = GitFileSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7629 /// let x1 = GitFileSource::new().set_repo_type(RepoType::Github);
7630 /// let x2 = GitFileSource::new().set_repo_type(RepoType::BitbucketServer);
7631 /// ```
7632 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7633 mut self,
7634 v: T,
7635 ) -> Self {
7636 self.repo_type = v.into();
7637 self
7638 }
7639
7640 /// Sets the value of [revision][crate::model::GitFileSource::revision].
7641 ///
7642 /// # Example
7643 /// ```ignore,no_run
7644 /// # use google_cloud_build_v1::model::GitFileSource;
7645 /// let x = GitFileSource::new().set_revision("example");
7646 /// ```
7647 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7648 self.revision = v.into();
7649 self
7650 }
7651
7652 /// Sets the value of [source][crate::model::GitFileSource::source].
7653 ///
7654 /// Note that all the setters affecting `source` are mutually
7655 /// exclusive.
7656 ///
7657 /// # Example
7658 /// ```ignore,no_run
7659 /// # use google_cloud_build_v1::model::GitFileSource;
7660 /// use google_cloud_build_v1::model::git_file_source::Source;
7661 /// let x = GitFileSource::new().set_source(Some(Source::Repository("example".to_string())));
7662 /// ```
7663 pub fn set_source<
7664 T: std::convert::Into<std::option::Option<crate::model::git_file_source::Source>>,
7665 >(
7666 mut self,
7667 v: T,
7668 ) -> Self {
7669 self.source = v.into();
7670 self
7671 }
7672
7673 /// The value of [source][crate::model::GitFileSource::source]
7674 /// if it holds a `Repository`, `None` if the field is not set or
7675 /// holds a different branch.
7676 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7677 #[allow(unreachable_patterns)]
7678 self.source.as_ref().and_then(|v| match v {
7679 crate::model::git_file_source::Source::Repository(v) => std::option::Option::Some(v),
7680 _ => std::option::Option::None,
7681 })
7682 }
7683
7684 /// Sets the value of [source][crate::model::GitFileSource::source]
7685 /// to hold a `Repository`.
7686 ///
7687 /// Note that all the setters affecting `source` are
7688 /// mutually exclusive.
7689 ///
7690 /// # Example
7691 /// ```ignore,no_run
7692 /// # use google_cloud_build_v1::model::GitFileSource;
7693 /// let x = GitFileSource::new().set_repository("example");
7694 /// assert!(x.repository().is_some());
7695 /// ```
7696 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7697 self.source =
7698 std::option::Option::Some(crate::model::git_file_source::Source::Repository(v.into()));
7699 self
7700 }
7701
7702 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config].
7703 ///
7704 /// Note that all the setters affecting `enterprise_config` are mutually
7705 /// exclusive.
7706 ///
7707 /// # Example
7708 /// ```ignore,no_run
7709 /// # use google_cloud_build_v1::model::GitFileSource;
7710 /// use google_cloud_build_v1::model::git_file_source::EnterpriseConfig;
7711 /// let x = GitFileSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7712 /// ```
7713 pub fn set_enterprise_config<
7714 T: std::convert::Into<std::option::Option<crate::model::git_file_source::EnterpriseConfig>>,
7715 >(
7716 mut self,
7717 v: T,
7718 ) -> Self {
7719 self.enterprise_config = v.into();
7720 self
7721 }
7722
7723 /// The value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7724 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7725 /// holds a different branch.
7726 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7727 #[allow(unreachable_patterns)]
7728 self.enterprise_config.as_ref().and_then(|v| match v {
7729 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7730 std::option::Option::Some(v)
7731 }
7732 _ => std::option::Option::None,
7733 })
7734 }
7735
7736 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7737 /// to hold a `GithubEnterpriseConfig`.
7738 ///
7739 /// Note that all the setters affecting `enterprise_config` are
7740 /// mutually exclusive.
7741 ///
7742 /// # Example
7743 /// ```ignore,no_run
7744 /// # use google_cloud_build_v1::model::GitFileSource;
7745 /// let x = GitFileSource::new().set_github_enterprise_config("example");
7746 /// assert!(x.github_enterprise_config().is_some());
7747 /// ```
7748 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7749 mut self,
7750 v: T,
7751 ) -> Self {
7752 self.enterprise_config = std::option::Option::Some(
7753 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7754 );
7755 self
7756 }
7757}
7758
7759impl wkt::message::Message for GitFileSource {
7760 fn typename() -> &'static str {
7761 "type.googleapis.com/google.devtools.cloudbuild.v1.GitFileSource"
7762 }
7763}
7764
7765/// Defines additional types related to [GitFileSource].
7766pub mod git_file_source {
7767 #[allow(unused_imports)]
7768 use super::*;
7769
7770 /// The type of the repo, since it may not be explicit from the `repo` field
7771 /// (e.g from a URL).
7772 ///
7773 /// # Working with unknown values
7774 ///
7775 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7776 /// additional enum variants at any time. Adding new variants is not considered
7777 /// a breaking change. Applications should write their code in anticipation of:
7778 ///
7779 /// - New values appearing in future releases of the client library, **and**
7780 /// - New values received dynamically, without application changes.
7781 ///
7782 /// Please consult the [Working with enums] section in the user guide for some
7783 /// guidelines.
7784 ///
7785 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7786 #[derive(Clone, Debug, PartialEq)]
7787 #[non_exhaustive]
7788 pub enum RepoType {
7789 /// The default, unknown repo type. Don't use it, instead use one of
7790 /// the other repo types.
7791 Unknown,
7792 /// A Google Cloud Source Repositories-hosted repo.
7793 CloudSourceRepositories,
7794 /// A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub
7795 /// Enterprise).
7796 Github,
7797 /// A Bitbucket Server-hosted repo.
7798 BitbucketServer,
7799 /// A GitLab-hosted repo.
7800 Gitlab,
7801 /// If set, the enum was initialized with an unknown value.
7802 ///
7803 /// Applications can examine the value using [RepoType::value] or
7804 /// [RepoType::name].
7805 UnknownValue(repo_type::UnknownValue),
7806 }
7807
7808 #[doc(hidden)]
7809 pub mod repo_type {
7810 #[allow(unused_imports)]
7811 use super::*;
7812 #[derive(Clone, Debug, PartialEq)]
7813 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7814 }
7815
7816 impl RepoType {
7817 /// Gets the enum value.
7818 ///
7819 /// Returns `None` if the enum contains an unknown value deserialized from
7820 /// the string representation of enums.
7821 pub fn value(&self) -> std::option::Option<i32> {
7822 match self {
7823 Self::Unknown => std::option::Option::Some(0),
7824 Self::CloudSourceRepositories => std::option::Option::Some(1),
7825 Self::Github => std::option::Option::Some(2),
7826 Self::BitbucketServer => std::option::Option::Some(3),
7827 Self::Gitlab => std::option::Option::Some(4),
7828 Self::UnknownValue(u) => u.0.value(),
7829 }
7830 }
7831
7832 /// Gets the enum value as a string.
7833 ///
7834 /// Returns `None` if the enum contains an unknown value deserialized from
7835 /// the integer representation of enums.
7836 pub fn name(&self) -> std::option::Option<&str> {
7837 match self {
7838 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7839 Self::CloudSourceRepositories => {
7840 std::option::Option::Some("CLOUD_SOURCE_REPOSITORIES")
7841 }
7842 Self::Github => std::option::Option::Some("GITHUB"),
7843 Self::BitbucketServer => std::option::Option::Some("BITBUCKET_SERVER"),
7844 Self::Gitlab => std::option::Option::Some("GITLAB"),
7845 Self::UnknownValue(u) => u.0.name(),
7846 }
7847 }
7848 }
7849
7850 impl std::default::Default for RepoType {
7851 fn default() -> Self {
7852 use std::convert::From;
7853 Self::from(0)
7854 }
7855 }
7856
7857 impl std::fmt::Display for RepoType {
7858 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7859 wkt::internal::display_enum(f, self.name(), self.value())
7860 }
7861 }
7862
7863 impl std::convert::From<i32> for RepoType {
7864 fn from(value: i32) -> Self {
7865 match value {
7866 0 => Self::Unknown,
7867 1 => Self::CloudSourceRepositories,
7868 2 => Self::Github,
7869 3 => Self::BitbucketServer,
7870 4 => Self::Gitlab,
7871 _ => Self::UnknownValue(repo_type::UnknownValue(
7872 wkt::internal::UnknownEnumValue::Integer(value),
7873 )),
7874 }
7875 }
7876 }
7877
7878 impl std::convert::From<&str> for RepoType {
7879 fn from(value: &str) -> Self {
7880 use std::string::ToString;
7881 match value {
7882 "UNKNOWN" => Self::Unknown,
7883 "CLOUD_SOURCE_REPOSITORIES" => Self::CloudSourceRepositories,
7884 "GITHUB" => Self::Github,
7885 "BITBUCKET_SERVER" => Self::BitbucketServer,
7886 "GITLAB" => Self::Gitlab,
7887 _ => Self::UnknownValue(repo_type::UnknownValue(
7888 wkt::internal::UnknownEnumValue::String(value.to_string()),
7889 )),
7890 }
7891 }
7892 }
7893
7894 impl serde::ser::Serialize for RepoType {
7895 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7896 where
7897 S: serde::Serializer,
7898 {
7899 match self {
7900 Self::Unknown => serializer.serialize_i32(0),
7901 Self::CloudSourceRepositories => serializer.serialize_i32(1),
7902 Self::Github => serializer.serialize_i32(2),
7903 Self::BitbucketServer => serializer.serialize_i32(3),
7904 Self::Gitlab => serializer.serialize_i32(4),
7905 Self::UnknownValue(u) => u.0.serialize(serializer),
7906 }
7907 }
7908 }
7909
7910 impl<'de> serde::de::Deserialize<'de> for RepoType {
7911 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7912 where
7913 D: serde::Deserializer<'de>,
7914 {
7915 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepoType>::new(
7916 ".google.devtools.cloudbuild.v1.GitFileSource.RepoType",
7917 ))
7918 }
7919 }
7920
7921 /// The source of the SCM repo.
7922 #[derive(Clone, Debug, PartialEq)]
7923 #[non_exhaustive]
7924 pub enum Source {
7925 /// The fully qualified resource name of the Repos API repository.
7926 /// Either URI or repository can be specified.
7927 /// If unspecified, the repo from which the trigger invocation originated is
7928 /// assumed to be the repo from which to read the specified path.
7929 Repository(std::string::String),
7930 }
7931
7932 /// The resource name of the enterprise config that should be applied
7933 /// to this source.
7934 #[derive(Clone, Debug, PartialEq)]
7935 #[non_exhaustive]
7936 pub enum EnterpriseConfig {
7937 /// The full resource name of the github enterprise config.
7938 /// Format:
7939 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7940 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7941 GithubEnterpriseConfig(std::string::String),
7942 }
7943}
7944
7945/// Configuration for an automated build in response to source repository
7946/// changes.
7947#[derive(Clone, Default, PartialEq)]
7948#[non_exhaustive]
7949pub struct BuildTrigger {
7950 /// The `Trigger` name with format:
7951 /// `projects/{project}/locations/{location}/triggers/{trigger}`, where
7952 /// {trigger} is a unique identifier generated by the service.
7953 pub resource_name: std::string::String,
7954
7955 /// Output only. Unique identifier of the trigger.
7956 pub id: std::string::String,
7957
7958 /// Human-readable description of this trigger.
7959 pub description: std::string::String,
7960
7961 /// User-assigned name of the trigger. Must be unique within the project.
7962 /// Trigger names must meet the following requirements:
7963 ///
7964 /// + They must contain only alphanumeric characters and dashes.
7965 /// + They can be 1-64 characters long.
7966 /// + They must begin and end with an alphanumeric character.
7967 pub name: std::string::String,
7968
7969 /// Tags for annotation of a `BuildTrigger`
7970 pub tags: std::vec::Vec<std::string::String>,
7971
7972 /// Template describing the types of source changes to trigger a build.
7973 ///
7974 /// Branch and tag names in trigger templates are interpreted as regular
7975 /// expressions. Any branch or tag change that matches that regular expression
7976 /// will trigger a build.
7977 ///
7978 /// Mutually exclusive with `github`.
7979 pub trigger_template: std::option::Option<crate::model::RepoSource>,
7980
7981 /// GitHubEventsConfig describes the configuration of a trigger that creates
7982 /// a build whenever a GitHub event is received.
7983 ///
7984 /// Mutually exclusive with `trigger_template`.
7985 pub github: std::option::Option<crate::model::GitHubEventsConfig>,
7986
7987 /// PubsubConfig describes the configuration of a trigger that
7988 /// creates a build whenever a Pub/Sub message is published.
7989 pub pubsub_config: std::option::Option<crate::model::PubsubConfig>,
7990
7991 /// WebhookConfig describes the configuration of a trigger that
7992 /// creates a build whenever a webhook is sent to a trigger's webhook URL.
7993 pub webhook_config: std::option::Option<crate::model::WebhookConfig>,
7994
7995 /// Output only. Time when the trigger was created.
7996 pub create_time: std::option::Option<wkt::Timestamp>,
7997
7998 /// If true, the trigger will never automatically execute a build.
7999 pub disabled: bool,
8000
8001 /// Substitutions for Build resource. The keys must match the following
8002 /// regular expression: `^_[A-Z0-9_]+$`.
8003 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
8004
8005 /// ignored_files and included_files are file glob matches using
8006 /// <https://golang.org/pkg/path/filepath/#Match> extended with support for "**".
8007 ///
8008 /// If ignored_files and changed files are both empty, then they are
8009 /// not used to determine whether or not to trigger a build.
8010 ///
8011 /// If ignored_files is not empty, then we ignore any files that match
8012 /// any of the ignored_file globs. If the change has no files that are
8013 /// outside of the ignored_files globs, then we do not trigger a build.
8014 pub ignored_files: std::vec::Vec<std::string::String>,
8015
8016 /// If any of the files altered in the commit pass the ignored_files
8017 /// filter and included_files is empty, then as far as this filter is
8018 /// concerned, we should trigger the build.
8019 ///
8020 /// If any of the files altered in the commit pass the ignored_files
8021 /// filter and included_files is not empty, then we make sure that at
8022 /// least one of those files matches a included_files glob. If not,
8023 /// then we do not trigger a build.
8024 pub included_files: std::vec::Vec<std::string::String>,
8025
8026 /// Optional. A Common Expression Language string.
8027 pub filter: std::string::String,
8028
8029 /// The repo and ref of the repository from which to build. This field
8030 /// is used only for those triggers that do not respond to SCM events.
8031 /// Triggers that respond to such events build source at whatever commit
8032 /// caused the event.
8033 /// This field is currently only used by Webhook, Pub/Sub, Manual, and Cron
8034 /// triggers.
8035 pub source_to_build: std::option::Option<crate::model::GitRepoSource>,
8036
8037 /// The service account used for all user-controlled operations including
8038 /// UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
8039 /// If no service account is set and the legacy Cloud Build service account
8040 /// (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the
8041 /// project then it will be used instead.
8042 /// Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
8043 pub service_account: std::string::String,
8044
8045 /// The configuration of a trigger that creates a build whenever an event from
8046 /// Repo API is received.
8047 pub repository_event_config: std::option::Option<crate::model::RepositoryEventConfig>,
8048
8049 /// Template describing the Build request to make when the trigger is matched.
8050 /// At least one of the template fields must be provided.
8051 pub build_template: std::option::Option<crate::model::build_trigger::BuildTemplate>,
8052
8053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8054}
8055
8056impl BuildTrigger {
8057 pub fn new() -> Self {
8058 std::default::Default::default()
8059 }
8060
8061 /// Sets the value of [resource_name][crate::model::BuildTrigger::resource_name].
8062 ///
8063 /// # Example
8064 /// ```ignore,no_run
8065 /// # use google_cloud_build_v1::model::BuildTrigger;
8066 /// let x = BuildTrigger::new().set_resource_name("example");
8067 /// ```
8068 pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8069 self.resource_name = v.into();
8070 self
8071 }
8072
8073 /// Sets the value of [id][crate::model::BuildTrigger::id].
8074 ///
8075 /// # Example
8076 /// ```ignore,no_run
8077 /// # use google_cloud_build_v1::model::BuildTrigger;
8078 /// let x = BuildTrigger::new().set_id("example");
8079 /// ```
8080 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8081 self.id = v.into();
8082 self
8083 }
8084
8085 /// Sets the value of [description][crate::model::BuildTrigger::description].
8086 ///
8087 /// # Example
8088 /// ```ignore,no_run
8089 /// # use google_cloud_build_v1::model::BuildTrigger;
8090 /// let x = BuildTrigger::new().set_description("example");
8091 /// ```
8092 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8093 self.description = v.into();
8094 self
8095 }
8096
8097 /// Sets the value of [name][crate::model::BuildTrigger::name].
8098 ///
8099 /// # Example
8100 /// ```ignore,no_run
8101 /// # use google_cloud_build_v1::model::BuildTrigger;
8102 /// let x = BuildTrigger::new().set_name("example");
8103 /// ```
8104 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8105 self.name = v.into();
8106 self
8107 }
8108
8109 /// Sets the value of [tags][crate::model::BuildTrigger::tags].
8110 ///
8111 /// # Example
8112 /// ```ignore,no_run
8113 /// # use google_cloud_build_v1::model::BuildTrigger;
8114 /// let x = BuildTrigger::new().set_tags(["a", "b", "c"]);
8115 /// ```
8116 pub fn set_tags<T, V>(mut self, v: T) -> Self
8117 where
8118 T: std::iter::IntoIterator<Item = V>,
8119 V: std::convert::Into<std::string::String>,
8120 {
8121 use std::iter::Iterator;
8122 self.tags = v.into_iter().map(|i| i.into()).collect();
8123 self
8124 }
8125
8126 /// Sets the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8127 ///
8128 /// # Example
8129 /// ```ignore,no_run
8130 /// # use google_cloud_build_v1::model::BuildTrigger;
8131 /// use google_cloud_build_v1::model::RepoSource;
8132 /// let x = BuildTrigger::new().set_trigger_template(RepoSource::default()/* use setters */);
8133 /// ```
8134 pub fn set_trigger_template<T>(mut self, v: T) -> Self
8135 where
8136 T: std::convert::Into<crate::model::RepoSource>,
8137 {
8138 self.trigger_template = std::option::Option::Some(v.into());
8139 self
8140 }
8141
8142 /// Sets or clears the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8143 ///
8144 /// # Example
8145 /// ```ignore,no_run
8146 /// # use google_cloud_build_v1::model::BuildTrigger;
8147 /// use google_cloud_build_v1::model::RepoSource;
8148 /// let x = BuildTrigger::new().set_or_clear_trigger_template(Some(RepoSource::default()/* use setters */));
8149 /// let x = BuildTrigger::new().set_or_clear_trigger_template(None::<RepoSource>);
8150 /// ```
8151 pub fn set_or_clear_trigger_template<T>(mut self, v: std::option::Option<T>) -> Self
8152 where
8153 T: std::convert::Into<crate::model::RepoSource>,
8154 {
8155 self.trigger_template = v.map(|x| x.into());
8156 self
8157 }
8158
8159 /// Sets the value of [github][crate::model::BuildTrigger::github].
8160 ///
8161 /// # Example
8162 /// ```ignore,no_run
8163 /// # use google_cloud_build_v1::model::BuildTrigger;
8164 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8165 /// let x = BuildTrigger::new().set_github(GitHubEventsConfig::default()/* use setters */);
8166 /// ```
8167 pub fn set_github<T>(mut self, v: T) -> Self
8168 where
8169 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8170 {
8171 self.github = std::option::Option::Some(v.into());
8172 self
8173 }
8174
8175 /// Sets or clears the value of [github][crate::model::BuildTrigger::github].
8176 ///
8177 /// # Example
8178 /// ```ignore,no_run
8179 /// # use google_cloud_build_v1::model::BuildTrigger;
8180 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8181 /// let x = BuildTrigger::new().set_or_clear_github(Some(GitHubEventsConfig::default()/* use setters */));
8182 /// let x = BuildTrigger::new().set_or_clear_github(None::<GitHubEventsConfig>);
8183 /// ```
8184 pub fn set_or_clear_github<T>(mut self, v: std::option::Option<T>) -> Self
8185 where
8186 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8187 {
8188 self.github = v.map(|x| x.into());
8189 self
8190 }
8191
8192 /// Sets the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8193 ///
8194 /// # Example
8195 /// ```ignore,no_run
8196 /// # use google_cloud_build_v1::model::BuildTrigger;
8197 /// use google_cloud_build_v1::model::PubsubConfig;
8198 /// let x = BuildTrigger::new().set_pubsub_config(PubsubConfig::default()/* use setters */);
8199 /// ```
8200 pub fn set_pubsub_config<T>(mut self, v: T) -> Self
8201 where
8202 T: std::convert::Into<crate::model::PubsubConfig>,
8203 {
8204 self.pubsub_config = std::option::Option::Some(v.into());
8205 self
8206 }
8207
8208 /// Sets or clears the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8209 ///
8210 /// # Example
8211 /// ```ignore,no_run
8212 /// # use google_cloud_build_v1::model::BuildTrigger;
8213 /// use google_cloud_build_v1::model::PubsubConfig;
8214 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(Some(PubsubConfig::default()/* use setters */));
8215 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(None::<PubsubConfig>);
8216 /// ```
8217 pub fn set_or_clear_pubsub_config<T>(mut self, v: std::option::Option<T>) -> Self
8218 where
8219 T: std::convert::Into<crate::model::PubsubConfig>,
8220 {
8221 self.pubsub_config = v.map(|x| x.into());
8222 self
8223 }
8224
8225 /// Sets the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8226 ///
8227 /// # Example
8228 /// ```ignore,no_run
8229 /// # use google_cloud_build_v1::model::BuildTrigger;
8230 /// use google_cloud_build_v1::model::WebhookConfig;
8231 /// let x = BuildTrigger::new().set_webhook_config(WebhookConfig::default()/* use setters */);
8232 /// ```
8233 pub fn set_webhook_config<T>(mut self, v: T) -> Self
8234 where
8235 T: std::convert::Into<crate::model::WebhookConfig>,
8236 {
8237 self.webhook_config = std::option::Option::Some(v.into());
8238 self
8239 }
8240
8241 /// Sets or clears the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8242 ///
8243 /// # Example
8244 /// ```ignore,no_run
8245 /// # use google_cloud_build_v1::model::BuildTrigger;
8246 /// use google_cloud_build_v1::model::WebhookConfig;
8247 /// let x = BuildTrigger::new().set_or_clear_webhook_config(Some(WebhookConfig::default()/* use setters */));
8248 /// let x = BuildTrigger::new().set_or_clear_webhook_config(None::<WebhookConfig>);
8249 /// ```
8250 pub fn set_or_clear_webhook_config<T>(mut self, v: std::option::Option<T>) -> Self
8251 where
8252 T: std::convert::Into<crate::model::WebhookConfig>,
8253 {
8254 self.webhook_config = v.map(|x| x.into());
8255 self
8256 }
8257
8258 /// Sets the value of [create_time][crate::model::BuildTrigger::create_time].
8259 ///
8260 /// # Example
8261 /// ```ignore,no_run
8262 /// # use google_cloud_build_v1::model::BuildTrigger;
8263 /// use wkt::Timestamp;
8264 /// let x = BuildTrigger::new().set_create_time(Timestamp::default()/* use setters */);
8265 /// ```
8266 pub fn set_create_time<T>(mut self, v: T) -> Self
8267 where
8268 T: std::convert::Into<wkt::Timestamp>,
8269 {
8270 self.create_time = std::option::Option::Some(v.into());
8271 self
8272 }
8273
8274 /// Sets or clears the value of [create_time][crate::model::BuildTrigger::create_time].
8275 ///
8276 /// # Example
8277 /// ```ignore,no_run
8278 /// # use google_cloud_build_v1::model::BuildTrigger;
8279 /// use wkt::Timestamp;
8280 /// let x = BuildTrigger::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8281 /// let x = BuildTrigger::new().set_or_clear_create_time(None::<Timestamp>);
8282 /// ```
8283 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8284 where
8285 T: std::convert::Into<wkt::Timestamp>,
8286 {
8287 self.create_time = v.map(|x| x.into());
8288 self
8289 }
8290
8291 /// Sets the value of [disabled][crate::model::BuildTrigger::disabled].
8292 ///
8293 /// # Example
8294 /// ```ignore,no_run
8295 /// # use google_cloud_build_v1::model::BuildTrigger;
8296 /// let x = BuildTrigger::new().set_disabled(true);
8297 /// ```
8298 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8299 self.disabled = v.into();
8300 self
8301 }
8302
8303 /// Sets the value of [substitutions][crate::model::BuildTrigger::substitutions].
8304 ///
8305 /// # Example
8306 /// ```ignore,no_run
8307 /// # use google_cloud_build_v1::model::BuildTrigger;
8308 /// let x = BuildTrigger::new().set_substitutions([
8309 /// ("key0", "abc"),
8310 /// ("key1", "xyz"),
8311 /// ]);
8312 /// ```
8313 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
8314 where
8315 T: std::iter::IntoIterator<Item = (K, V)>,
8316 K: std::convert::Into<std::string::String>,
8317 V: std::convert::Into<std::string::String>,
8318 {
8319 use std::iter::Iterator;
8320 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8321 self
8322 }
8323
8324 /// Sets the value of [ignored_files][crate::model::BuildTrigger::ignored_files].
8325 ///
8326 /// # Example
8327 /// ```ignore,no_run
8328 /// # use google_cloud_build_v1::model::BuildTrigger;
8329 /// let x = BuildTrigger::new().set_ignored_files(["a", "b", "c"]);
8330 /// ```
8331 pub fn set_ignored_files<T, V>(mut self, v: T) -> Self
8332 where
8333 T: std::iter::IntoIterator<Item = V>,
8334 V: std::convert::Into<std::string::String>,
8335 {
8336 use std::iter::Iterator;
8337 self.ignored_files = v.into_iter().map(|i| i.into()).collect();
8338 self
8339 }
8340
8341 /// Sets the value of [included_files][crate::model::BuildTrigger::included_files].
8342 ///
8343 /// # Example
8344 /// ```ignore,no_run
8345 /// # use google_cloud_build_v1::model::BuildTrigger;
8346 /// let x = BuildTrigger::new().set_included_files(["a", "b", "c"]);
8347 /// ```
8348 pub fn set_included_files<T, V>(mut self, v: T) -> Self
8349 where
8350 T: std::iter::IntoIterator<Item = V>,
8351 V: std::convert::Into<std::string::String>,
8352 {
8353 use std::iter::Iterator;
8354 self.included_files = v.into_iter().map(|i| i.into()).collect();
8355 self
8356 }
8357
8358 /// Sets the value of [filter][crate::model::BuildTrigger::filter].
8359 ///
8360 /// # Example
8361 /// ```ignore,no_run
8362 /// # use google_cloud_build_v1::model::BuildTrigger;
8363 /// let x = BuildTrigger::new().set_filter("example");
8364 /// ```
8365 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8366 self.filter = v.into();
8367 self
8368 }
8369
8370 /// Sets the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8371 ///
8372 /// # Example
8373 /// ```ignore,no_run
8374 /// # use google_cloud_build_v1::model::BuildTrigger;
8375 /// use google_cloud_build_v1::model::GitRepoSource;
8376 /// let x = BuildTrigger::new().set_source_to_build(GitRepoSource::default()/* use setters */);
8377 /// ```
8378 pub fn set_source_to_build<T>(mut self, v: T) -> Self
8379 where
8380 T: std::convert::Into<crate::model::GitRepoSource>,
8381 {
8382 self.source_to_build = std::option::Option::Some(v.into());
8383 self
8384 }
8385
8386 /// Sets or clears the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8387 ///
8388 /// # Example
8389 /// ```ignore,no_run
8390 /// # use google_cloud_build_v1::model::BuildTrigger;
8391 /// use google_cloud_build_v1::model::GitRepoSource;
8392 /// let x = BuildTrigger::new().set_or_clear_source_to_build(Some(GitRepoSource::default()/* use setters */));
8393 /// let x = BuildTrigger::new().set_or_clear_source_to_build(None::<GitRepoSource>);
8394 /// ```
8395 pub fn set_or_clear_source_to_build<T>(mut self, v: std::option::Option<T>) -> Self
8396 where
8397 T: std::convert::Into<crate::model::GitRepoSource>,
8398 {
8399 self.source_to_build = v.map(|x| x.into());
8400 self
8401 }
8402
8403 /// Sets the value of [service_account][crate::model::BuildTrigger::service_account].
8404 ///
8405 /// # Example
8406 /// ```ignore,no_run
8407 /// # use google_cloud_build_v1::model::BuildTrigger;
8408 /// let x = BuildTrigger::new().set_service_account("example");
8409 /// ```
8410 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8411 self.service_account = v.into();
8412 self
8413 }
8414
8415 /// Sets the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8416 ///
8417 /// # Example
8418 /// ```ignore,no_run
8419 /// # use google_cloud_build_v1::model::BuildTrigger;
8420 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8421 /// let x = BuildTrigger::new().set_repository_event_config(RepositoryEventConfig::default()/* use setters */);
8422 /// ```
8423 pub fn set_repository_event_config<T>(mut self, v: T) -> Self
8424 where
8425 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8426 {
8427 self.repository_event_config = std::option::Option::Some(v.into());
8428 self
8429 }
8430
8431 /// Sets or clears the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8432 ///
8433 /// # Example
8434 /// ```ignore,no_run
8435 /// # use google_cloud_build_v1::model::BuildTrigger;
8436 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8437 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(Some(RepositoryEventConfig::default()/* use setters */));
8438 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(None::<RepositoryEventConfig>);
8439 /// ```
8440 pub fn set_or_clear_repository_event_config<T>(mut self, v: std::option::Option<T>) -> Self
8441 where
8442 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8443 {
8444 self.repository_event_config = v.map(|x| x.into());
8445 self
8446 }
8447
8448 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template].
8449 ///
8450 /// Note that all the setters affecting `build_template` are mutually
8451 /// exclusive.
8452 ///
8453 /// # Example
8454 /// ```ignore,no_run
8455 /// # use google_cloud_build_v1::model::BuildTrigger;
8456 /// use google_cloud_build_v1::model::build_trigger::BuildTemplate;
8457 /// let x = BuildTrigger::new().set_build_template(Some(BuildTemplate::Autodetect(true)));
8458 /// ```
8459 pub fn set_build_template<
8460 T: std::convert::Into<std::option::Option<crate::model::build_trigger::BuildTemplate>>,
8461 >(
8462 mut self,
8463 v: T,
8464 ) -> Self {
8465 self.build_template = v.into();
8466 self
8467 }
8468
8469 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8470 /// if it holds a `Autodetect`, `None` if the field is not set or
8471 /// holds a different branch.
8472 pub fn autodetect(&self) -> std::option::Option<&bool> {
8473 #[allow(unreachable_patterns)]
8474 self.build_template.as_ref().and_then(|v| match v {
8475 crate::model::build_trigger::BuildTemplate::Autodetect(v) => {
8476 std::option::Option::Some(v)
8477 }
8478 _ => std::option::Option::None,
8479 })
8480 }
8481
8482 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8483 /// to hold a `Autodetect`.
8484 ///
8485 /// Note that all the setters affecting `build_template` are
8486 /// mutually exclusive.
8487 ///
8488 /// # Example
8489 /// ```ignore,no_run
8490 /// # use google_cloud_build_v1::model::BuildTrigger;
8491 /// let x = BuildTrigger::new().set_autodetect(true);
8492 /// assert!(x.autodetect().is_some());
8493 /// assert!(x.build().is_none());
8494 /// assert!(x.filename().is_none());
8495 /// assert!(x.git_file_source().is_none());
8496 /// ```
8497 pub fn set_autodetect<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8498 self.build_template = std::option::Option::Some(
8499 crate::model::build_trigger::BuildTemplate::Autodetect(v.into()),
8500 );
8501 self
8502 }
8503
8504 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8505 /// if it holds a `Build`, `None` if the field is not set or
8506 /// holds a different branch.
8507 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::Build>> {
8508 #[allow(unreachable_patterns)]
8509 self.build_template.as_ref().and_then(|v| match v {
8510 crate::model::build_trigger::BuildTemplate::Build(v) => std::option::Option::Some(v),
8511 _ => std::option::Option::None,
8512 })
8513 }
8514
8515 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8516 /// to hold a `Build`.
8517 ///
8518 /// Note that all the setters affecting `build_template` are
8519 /// mutually exclusive.
8520 ///
8521 /// # Example
8522 /// ```ignore,no_run
8523 /// # use google_cloud_build_v1::model::BuildTrigger;
8524 /// use google_cloud_build_v1::model::Build;
8525 /// let x = BuildTrigger::new().set_build(Build::default()/* use setters */);
8526 /// assert!(x.build().is_some());
8527 /// assert!(x.autodetect().is_none());
8528 /// assert!(x.filename().is_none());
8529 /// assert!(x.git_file_source().is_none());
8530 /// ```
8531 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::Build>>>(
8532 mut self,
8533 v: T,
8534 ) -> Self {
8535 self.build_template =
8536 std::option::Option::Some(crate::model::build_trigger::BuildTemplate::Build(v.into()));
8537 self
8538 }
8539
8540 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8541 /// if it holds a `Filename`, `None` if the field is not set or
8542 /// holds a different branch.
8543 pub fn filename(&self) -> std::option::Option<&std::string::String> {
8544 #[allow(unreachable_patterns)]
8545 self.build_template.as_ref().and_then(|v| match v {
8546 crate::model::build_trigger::BuildTemplate::Filename(v) => std::option::Option::Some(v),
8547 _ => std::option::Option::None,
8548 })
8549 }
8550
8551 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8552 /// to hold a `Filename`.
8553 ///
8554 /// Note that all the setters affecting `build_template` are
8555 /// mutually exclusive.
8556 ///
8557 /// # Example
8558 /// ```ignore,no_run
8559 /// # use google_cloud_build_v1::model::BuildTrigger;
8560 /// let x = BuildTrigger::new().set_filename("example");
8561 /// assert!(x.filename().is_some());
8562 /// assert!(x.autodetect().is_none());
8563 /// assert!(x.build().is_none());
8564 /// assert!(x.git_file_source().is_none());
8565 /// ```
8566 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8567 self.build_template = std::option::Option::Some(
8568 crate::model::build_trigger::BuildTemplate::Filename(v.into()),
8569 );
8570 self
8571 }
8572
8573 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8574 /// if it holds a `GitFileSource`, `None` if the field is not set or
8575 /// holds a different branch.
8576 pub fn git_file_source(
8577 &self,
8578 ) -> std::option::Option<&std::boxed::Box<crate::model::GitFileSource>> {
8579 #[allow(unreachable_patterns)]
8580 self.build_template.as_ref().and_then(|v| match v {
8581 crate::model::build_trigger::BuildTemplate::GitFileSource(v) => {
8582 std::option::Option::Some(v)
8583 }
8584 _ => std::option::Option::None,
8585 })
8586 }
8587
8588 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8589 /// to hold a `GitFileSource`.
8590 ///
8591 /// Note that all the setters affecting `build_template` are
8592 /// mutually exclusive.
8593 ///
8594 /// # Example
8595 /// ```ignore,no_run
8596 /// # use google_cloud_build_v1::model::BuildTrigger;
8597 /// use google_cloud_build_v1::model::GitFileSource;
8598 /// let x = BuildTrigger::new().set_git_file_source(GitFileSource::default()/* use setters */);
8599 /// assert!(x.git_file_source().is_some());
8600 /// assert!(x.autodetect().is_none());
8601 /// assert!(x.build().is_none());
8602 /// assert!(x.filename().is_none());
8603 /// ```
8604 pub fn set_git_file_source<
8605 T: std::convert::Into<std::boxed::Box<crate::model::GitFileSource>>,
8606 >(
8607 mut self,
8608 v: T,
8609 ) -> Self {
8610 self.build_template = std::option::Option::Some(
8611 crate::model::build_trigger::BuildTemplate::GitFileSource(v.into()),
8612 );
8613 self
8614 }
8615}
8616
8617impl wkt::message::Message for BuildTrigger {
8618 fn typename() -> &'static str {
8619 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildTrigger"
8620 }
8621}
8622
8623/// Defines additional types related to [BuildTrigger].
8624pub mod build_trigger {
8625 #[allow(unused_imports)]
8626 use super::*;
8627
8628 /// Template describing the Build request to make when the trigger is matched.
8629 /// At least one of the template fields must be provided.
8630 #[derive(Clone, Debug, PartialEq)]
8631 #[non_exhaustive]
8632 pub enum BuildTemplate {
8633 /// Autodetect build configuration. The following precedence is used (case
8634 /// insensitive):
8635 ///
8636 /// 1. cloudbuild.yaml
8637 /// 1. cloudbuild.yml
8638 /// 1. cloudbuild.json
8639 /// 1. Dockerfile
8640 ///
8641 /// Currently only available for GitHub App Triggers.
8642 Autodetect(bool),
8643 /// Contents of the build template.
8644 Build(std::boxed::Box<crate::model::Build>),
8645 /// Path, from the source root, to the build configuration file
8646 /// (i.e. cloudbuild.yaml).
8647 Filename(std::string::String),
8648 /// The file source describing the local or remote Build template.
8649 GitFileSource(std::boxed::Box<crate::model::GitFileSource>),
8650 }
8651}
8652
8653/// The configuration of a trigger that creates a build whenever an event from
8654/// Repo API is received.
8655#[derive(Clone, Default, PartialEq)]
8656#[non_exhaustive]
8657pub struct RepositoryEventConfig {
8658 /// The resource name of the Repo API resource.
8659 pub repository: std::string::String,
8660
8661 /// Output only. The type of the SCM vendor the repository points to.
8662 pub repository_type: crate::model::repository_event_config::RepositoryType,
8663
8664 /// The types of filter to trigger a build.
8665 pub filter: std::option::Option<crate::model::repository_event_config::Filter>,
8666
8667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8668}
8669
8670impl RepositoryEventConfig {
8671 pub fn new() -> Self {
8672 std::default::Default::default()
8673 }
8674
8675 /// Sets the value of [repository][crate::model::RepositoryEventConfig::repository].
8676 ///
8677 /// # Example
8678 /// ```ignore,no_run
8679 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8680 /// let x = RepositoryEventConfig::new().set_repository("example");
8681 /// ```
8682 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8683 self.repository = v.into();
8684 self
8685 }
8686
8687 /// Sets the value of [repository_type][crate::model::RepositoryEventConfig::repository_type].
8688 ///
8689 /// # Example
8690 /// ```ignore,no_run
8691 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8692 /// use google_cloud_build_v1::model::repository_event_config::RepositoryType;
8693 /// let x0 = RepositoryEventConfig::new().set_repository_type(RepositoryType::Github);
8694 /// let x1 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GithubEnterprise);
8695 /// let x2 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GitlabEnterprise);
8696 /// ```
8697 pub fn set_repository_type<
8698 T: std::convert::Into<crate::model::repository_event_config::RepositoryType>,
8699 >(
8700 mut self,
8701 v: T,
8702 ) -> Self {
8703 self.repository_type = v.into();
8704 self
8705 }
8706
8707 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter].
8708 ///
8709 /// Note that all the setters affecting `filter` are mutually
8710 /// exclusive.
8711 ///
8712 /// # Example
8713 /// ```ignore,no_run
8714 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8715 /// use google_cloud_build_v1::model::PullRequestFilter;
8716 /// let x = RepositoryEventConfig::new().set_filter(Some(
8717 /// google_cloud_build_v1::model::repository_event_config::Filter::PullRequest(PullRequestFilter::default().into())));
8718 /// ```
8719 pub fn set_filter<
8720 T: std::convert::Into<std::option::Option<crate::model::repository_event_config::Filter>>,
8721 >(
8722 mut self,
8723 v: T,
8724 ) -> Self {
8725 self.filter = v.into();
8726 self
8727 }
8728
8729 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8730 /// if it holds a `PullRequest`, `None` if the field is not set or
8731 /// holds a different branch.
8732 pub fn pull_request(
8733 &self,
8734 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
8735 #[allow(unreachable_patterns)]
8736 self.filter.as_ref().and_then(|v| match v {
8737 crate::model::repository_event_config::Filter::PullRequest(v) => {
8738 std::option::Option::Some(v)
8739 }
8740 _ => std::option::Option::None,
8741 })
8742 }
8743
8744 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8745 /// to hold a `PullRequest`.
8746 ///
8747 /// Note that all the setters affecting `filter` are
8748 /// mutually exclusive.
8749 ///
8750 /// # Example
8751 /// ```ignore,no_run
8752 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8753 /// use google_cloud_build_v1::model::PullRequestFilter;
8754 /// let x = RepositoryEventConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
8755 /// assert!(x.pull_request().is_some());
8756 /// assert!(x.push().is_none());
8757 /// ```
8758 pub fn set_pull_request<
8759 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
8760 >(
8761 mut self,
8762 v: T,
8763 ) -> Self {
8764 self.filter = std::option::Option::Some(
8765 crate::model::repository_event_config::Filter::PullRequest(v.into()),
8766 );
8767 self
8768 }
8769
8770 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8771 /// if it holds a `Push`, `None` if the field is not set or
8772 /// holds a different branch.
8773 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
8774 #[allow(unreachable_patterns)]
8775 self.filter.as_ref().and_then(|v| match v {
8776 crate::model::repository_event_config::Filter::Push(v) => std::option::Option::Some(v),
8777 _ => std::option::Option::None,
8778 })
8779 }
8780
8781 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8782 /// to hold a `Push`.
8783 ///
8784 /// Note that all the setters affecting `filter` are
8785 /// mutually exclusive.
8786 ///
8787 /// # Example
8788 /// ```ignore,no_run
8789 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8790 /// use google_cloud_build_v1::model::PushFilter;
8791 /// let x = RepositoryEventConfig::new().set_push(PushFilter::default()/* use setters */);
8792 /// assert!(x.push().is_some());
8793 /// assert!(x.pull_request().is_none());
8794 /// ```
8795 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
8796 mut self,
8797 v: T,
8798 ) -> Self {
8799 self.filter = std::option::Option::Some(
8800 crate::model::repository_event_config::Filter::Push(v.into()),
8801 );
8802 self
8803 }
8804}
8805
8806impl wkt::message::Message for RepositoryEventConfig {
8807 fn typename() -> &'static str {
8808 "type.googleapis.com/google.devtools.cloudbuild.v1.RepositoryEventConfig"
8809 }
8810}
8811
8812/// Defines additional types related to [RepositoryEventConfig].
8813pub mod repository_event_config {
8814 #[allow(unused_imports)]
8815 use super::*;
8816
8817 /// All possible SCM repo types from Repo API.
8818 ///
8819 /// # Working with unknown values
8820 ///
8821 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8822 /// additional enum variants at any time. Adding new variants is not considered
8823 /// a breaking change. Applications should write their code in anticipation of:
8824 ///
8825 /// - New values appearing in future releases of the client library, **and**
8826 /// - New values received dynamically, without application changes.
8827 ///
8828 /// Please consult the [Working with enums] section in the user guide for some
8829 /// guidelines.
8830 ///
8831 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8832 #[derive(Clone, Debug, PartialEq)]
8833 #[non_exhaustive]
8834 pub enum RepositoryType {
8835 /// If unspecified, RepositoryType defaults to GITHUB.
8836 Unspecified,
8837 /// The SCM repo is GITHUB.
8838 Github,
8839 /// The SCM repo is GITHUB Enterprise.
8840 GithubEnterprise,
8841 /// The SCM repo is GITLAB Enterprise.
8842 GitlabEnterprise,
8843 /// If set, the enum was initialized with an unknown value.
8844 ///
8845 /// Applications can examine the value using [RepositoryType::value] or
8846 /// [RepositoryType::name].
8847 UnknownValue(repository_type::UnknownValue),
8848 }
8849
8850 #[doc(hidden)]
8851 pub mod repository_type {
8852 #[allow(unused_imports)]
8853 use super::*;
8854 #[derive(Clone, Debug, PartialEq)]
8855 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8856 }
8857
8858 impl RepositoryType {
8859 /// Gets the enum value.
8860 ///
8861 /// Returns `None` if the enum contains an unknown value deserialized from
8862 /// the string representation of enums.
8863 pub fn value(&self) -> std::option::Option<i32> {
8864 match self {
8865 Self::Unspecified => std::option::Option::Some(0),
8866 Self::Github => std::option::Option::Some(1),
8867 Self::GithubEnterprise => std::option::Option::Some(2),
8868 Self::GitlabEnterprise => std::option::Option::Some(3),
8869 Self::UnknownValue(u) => u.0.value(),
8870 }
8871 }
8872
8873 /// Gets the enum value as a string.
8874 ///
8875 /// Returns `None` if the enum contains an unknown value deserialized from
8876 /// the integer representation of enums.
8877 pub fn name(&self) -> std::option::Option<&str> {
8878 match self {
8879 Self::Unspecified => std::option::Option::Some("REPOSITORY_TYPE_UNSPECIFIED"),
8880 Self::Github => std::option::Option::Some("GITHUB"),
8881 Self::GithubEnterprise => std::option::Option::Some("GITHUB_ENTERPRISE"),
8882 Self::GitlabEnterprise => std::option::Option::Some("GITLAB_ENTERPRISE"),
8883 Self::UnknownValue(u) => u.0.name(),
8884 }
8885 }
8886 }
8887
8888 impl std::default::Default for RepositoryType {
8889 fn default() -> Self {
8890 use std::convert::From;
8891 Self::from(0)
8892 }
8893 }
8894
8895 impl std::fmt::Display for RepositoryType {
8896 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8897 wkt::internal::display_enum(f, self.name(), self.value())
8898 }
8899 }
8900
8901 impl std::convert::From<i32> for RepositoryType {
8902 fn from(value: i32) -> Self {
8903 match value {
8904 0 => Self::Unspecified,
8905 1 => Self::Github,
8906 2 => Self::GithubEnterprise,
8907 3 => Self::GitlabEnterprise,
8908 _ => Self::UnknownValue(repository_type::UnknownValue(
8909 wkt::internal::UnknownEnumValue::Integer(value),
8910 )),
8911 }
8912 }
8913 }
8914
8915 impl std::convert::From<&str> for RepositoryType {
8916 fn from(value: &str) -> Self {
8917 use std::string::ToString;
8918 match value {
8919 "REPOSITORY_TYPE_UNSPECIFIED" => Self::Unspecified,
8920 "GITHUB" => Self::Github,
8921 "GITHUB_ENTERPRISE" => Self::GithubEnterprise,
8922 "GITLAB_ENTERPRISE" => Self::GitlabEnterprise,
8923 _ => Self::UnknownValue(repository_type::UnknownValue(
8924 wkt::internal::UnknownEnumValue::String(value.to_string()),
8925 )),
8926 }
8927 }
8928 }
8929
8930 impl serde::ser::Serialize for RepositoryType {
8931 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8932 where
8933 S: serde::Serializer,
8934 {
8935 match self {
8936 Self::Unspecified => serializer.serialize_i32(0),
8937 Self::Github => serializer.serialize_i32(1),
8938 Self::GithubEnterprise => serializer.serialize_i32(2),
8939 Self::GitlabEnterprise => serializer.serialize_i32(3),
8940 Self::UnknownValue(u) => u.0.serialize(serializer),
8941 }
8942 }
8943 }
8944
8945 impl<'de> serde::de::Deserialize<'de> for RepositoryType {
8946 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8947 where
8948 D: serde::Deserializer<'de>,
8949 {
8950 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepositoryType>::new(
8951 ".google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType",
8952 ))
8953 }
8954 }
8955
8956 /// The types of filter to trigger a build.
8957 #[derive(Clone, Debug, PartialEq)]
8958 #[non_exhaustive]
8959 pub enum Filter {
8960 /// Filter to match changes in pull requests.
8961 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
8962 /// Filter to match changes in refs like branches, tags.
8963 Push(std::boxed::Box<crate::model::PushFilter>),
8964 }
8965}
8966
8967/// GitHubEventsConfig describes the configuration of a trigger that creates a
8968/// build whenever a GitHub event is received.
8969#[derive(Clone, Default, PartialEq)]
8970#[non_exhaustive]
8971pub struct GitHubEventsConfig {
8972 /// The installationID that emits the GitHub event.
8973 #[deprecated]
8974 pub installation_id: i64,
8975
8976 /// Owner of the repository. For example: The owner for
8977 /// <https://github.com/googlecloudplatform/cloud-builders> is
8978 /// "googlecloudplatform".
8979 pub owner: std::string::String,
8980
8981 /// Name of the repository. For example: The name for
8982 /// <https://github.com/googlecloudplatform/cloud-builders> is "cloud-builders".
8983 pub name: std::string::String,
8984
8985 /// Filter describing the types of events to trigger a build.
8986 /// Currently supported event types: push, pull_request.
8987 pub event: std::option::Option<crate::model::git_hub_events_config::Event>,
8988
8989 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8990}
8991
8992impl GitHubEventsConfig {
8993 pub fn new() -> Self {
8994 std::default::Default::default()
8995 }
8996
8997 /// Sets the value of [installation_id][crate::model::GitHubEventsConfig::installation_id].
8998 ///
8999 /// # Example
9000 /// ```ignore,no_run
9001 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9002 /// let x = GitHubEventsConfig::new().set_installation_id(42);
9003 /// ```
9004 #[deprecated]
9005 pub fn set_installation_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9006 self.installation_id = v.into();
9007 self
9008 }
9009
9010 /// Sets the value of [owner][crate::model::GitHubEventsConfig::owner].
9011 ///
9012 /// # Example
9013 /// ```ignore,no_run
9014 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9015 /// let x = GitHubEventsConfig::new().set_owner("example");
9016 /// ```
9017 pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9018 self.owner = v.into();
9019 self
9020 }
9021
9022 /// Sets the value of [name][crate::model::GitHubEventsConfig::name].
9023 ///
9024 /// # Example
9025 /// ```ignore,no_run
9026 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9027 /// let x = GitHubEventsConfig::new().set_name("example");
9028 /// ```
9029 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9030 self.name = v.into();
9031 self
9032 }
9033
9034 /// Sets the value of [event][crate::model::GitHubEventsConfig::event].
9035 ///
9036 /// Note that all the setters affecting `event` are mutually
9037 /// exclusive.
9038 ///
9039 /// # Example
9040 /// ```ignore,no_run
9041 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9042 /// use google_cloud_build_v1::model::PullRequestFilter;
9043 /// let x = GitHubEventsConfig::new().set_event(Some(
9044 /// google_cloud_build_v1::model::git_hub_events_config::Event::PullRequest(PullRequestFilter::default().into())));
9045 /// ```
9046 pub fn set_event<
9047 T: std::convert::Into<std::option::Option<crate::model::git_hub_events_config::Event>>,
9048 >(
9049 mut self,
9050 v: T,
9051 ) -> Self {
9052 self.event = v.into();
9053 self
9054 }
9055
9056 /// The value of [event][crate::model::GitHubEventsConfig::event]
9057 /// if it holds a `PullRequest`, `None` if the field is not set or
9058 /// holds a different branch.
9059 pub fn pull_request(
9060 &self,
9061 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
9062 #[allow(unreachable_patterns)]
9063 self.event.as_ref().and_then(|v| match v {
9064 crate::model::git_hub_events_config::Event::PullRequest(v) => {
9065 std::option::Option::Some(v)
9066 }
9067 _ => std::option::Option::None,
9068 })
9069 }
9070
9071 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9072 /// to hold a `PullRequest`.
9073 ///
9074 /// Note that all the setters affecting `event` are
9075 /// mutually exclusive.
9076 ///
9077 /// # Example
9078 /// ```ignore,no_run
9079 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9080 /// use google_cloud_build_v1::model::PullRequestFilter;
9081 /// let x = GitHubEventsConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
9082 /// assert!(x.pull_request().is_some());
9083 /// assert!(x.push().is_none());
9084 /// ```
9085 pub fn set_pull_request<
9086 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
9087 >(
9088 mut self,
9089 v: T,
9090 ) -> Self {
9091 self.event = std::option::Option::Some(
9092 crate::model::git_hub_events_config::Event::PullRequest(v.into()),
9093 );
9094 self
9095 }
9096
9097 /// The value of [event][crate::model::GitHubEventsConfig::event]
9098 /// if it holds a `Push`, `None` if the field is not set or
9099 /// holds a different branch.
9100 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
9101 #[allow(unreachable_patterns)]
9102 self.event.as_ref().and_then(|v| match v {
9103 crate::model::git_hub_events_config::Event::Push(v) => std::option::Option::Some(v),
9104 _ => std::option::Option::None,
9105 })
9106 }
9107
9108 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9109 /// to hold a `Push`.
9110 ///
9111 /// Note that all the setters affecting `event` are
9112 /// mutually exclusive.
9113 ///
9114 /// # Example
9115 /// ```ignore,no_run
9116 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9117 /// use google_cloud_build_v1::model::PushFilter;
9118 /// let x = GitHubEventsConfig::new().set_push(PushFilter::default()/* use setters */);
9119 /// assert!(x.push().is_some());
9120 /// assert!(x.pull_request().is_none());
9121 /// ```
9122 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
9123 mut self,
9124 v: T,
9125 ) -> Self {
9126 self.event =
9127 std::option::Option::Some(crate::model::git_hub_events_config::Event::Push(v.into()));
9128 self
9129 }
9130}
9131
9132impl wkt::message::Message for GitHubEventsConfig {
9133 fn typename() -> &'static str {
9134 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEventsConfig"
9135 }
9136}
9137
9138/// Defines additional types related to [GitHubEventsConfig].
9139pub mod git_hub_events_config {
9140 #[allow(unused_imports)]
9141 use super::*;
9142
9143 /// Filter describing the types of events to trigger a build.
9144 /// Currently supported event types: push, pull_request.
9145 #[derive(Clone, Debug, PartialEq)]
9146 #[non_exhaustive]
9147 pub enum Event {
9148 /// filter to match changes in pull requests.
9149 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9150 /// filter to match changes in refs like branches, tags.
9151 Push(std::boxed::Box<crate::model::PushFilter>),
9152 }
9153}
9154
9155/// PubsubConfig describes the configuration of a trigger that
9156/// creates a build whenever a Pub/Sub message is published.
9157#[derive(Clone, Default, PartialEq)]
9158#[non_exhaustive]
9159pub struct PubsubConfig {
9160 /// Output only. Name of the subscription. Format is
9161 /// `projects/{project}/subscriptions/{subscription}`.
9162 pub subscription: std::string::String,
9163
9164 /// Optional. The name of the topic from which this subscription is receiving
9165 /// messages. Format is `projects/{project}/topics/{topic}`.
9166 pub topic: std::string::String,
9167
9168 /// Service account that will make the push request.
9169 pub service_account_email: std::string::String,
9170
9171 /// Potential issues with the underlying Pub/Sub subscription configuration.
9172 /// Only populated on get requests.
9173 pub state: crate::model::pubsub_config::State,
9174
9175 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9176}
9177
9178impl PubsubConfig {
9179 pub fn new() -> Self {
9180 std::default::Default::default()
9181 }
9182
9183 /// Sets the value of [subscription][crate::model::PubsubConfig::subscription].
9184 ///
9185 /// # Example
9186 /// ```ignore,no_run
9187 /// # use google_cloud_build_v1::model::PubsubConfig;
9188 /// let x = PubsubConfig::new().set_subscription("example");
9189 /// ```
9190 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9191 self.subscription = v.into();
9192 self
9193 }
9194
9195 /// Sets the value of [topic][crate::model::PubsubConfig::topic].
9196 ///
9197 /// # Example
9198 /// ```ignore,no_run
9199 /// # use google_cloud_build_v1::model::PubsubConfig;
9200 /// let x = PubsubConfig::new().set_topic("example");
9201 /// ```
9202 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9203 self.topic = v.into();
9204 self
9205 }
9206
9207 /// Sets the value of [service_account_email][crate::model::PubsubConfig::service_account_email].
9208 ///
9209 /// # Example
9210 /// ```ignore,no_run
9211 /// # use google_cloud_build_v1::model::PubsubConfig;
9212 /// let x = PubsubConfig::new().set_service_account_email("example");
9213 /// ```
9214 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
9215 mut self,
9216 v: T,
9217 ) -> Self {
9218 self.service_account_email = v.into();
9219 self
9220 }
9221
9222 /// Sets the value of [state][crate::model::PubsubConfig::state].
9223 ///
9224 /// # Example
9225 /// ```ignore,no_run
9226 /// # use google_cloud_build_v1::model::PubsubConfig;
9227 /// use google_cloud_build_v1::model::pubsub_config::State;
9228 /// let x0 = PubsubConfig::new().set_state(State::Ok);
9229 /// let x1 = PubsubConfig::new().set_state(State::SubscriptionDeleted);
9230 /// let x2 = PubsubConfig::new().set_state(State::TopicDeleted);
9231 /// ```
9232 pub fn set_state<T: std::convert::Into<crate::model::pubsub_config::State>>(
9233 mut self,
9234 v: T,
9235 ) -> Self {
9236 self.state = v.into();
9237 self
9238 }
9239}
9240
9241impl wkt::message::Message for PubsubConfig {
9242 fn typename() -> &'static str {
9243 "type.googleapis.com/google.devtools.cloudbuild.v1.PubsubConfig"
9244 }
9245}
9246
9247/// Defines additional types related to [PubsubConfig].
9248pub mod pubsub_config {
9249 #[allow(unused_imports)]
9250 use super::*;
9251
9252 /// Enumerates potential issues with the underlying Pub/Sub subscription
9253 /// configuration.
9254 ///
9255 /// # Working with unknown values
9256 ///
9257 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9258 /// additional enum variants at any time. Adding new variants is not considered
9259 /// a breaking change. Applications should write their code in anticipation of:
9260 ///
9261 /// - New values appearing in future releases of the client library, **and**
9262 /// - New values received dynamically, without application changes.
9263 ///
9264 /// Please consult the [Working with enums] section in the user guide for some
9265 /// guidelines.
9266 ///
9267 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9268 #[derive(Clone, Debug, PartialEq)]
9269 #[non_exhaustive]
9270 pub enum State {
9271 /// The subscription configuration has not been checked.
9272 Unspecified,
9273 /// The Pub/Sub subscription is properly configured.
9274 Ok,
9275 /// The subscription has been deleted.
9276 SubscriptionDeleted,
9277 /// The topic has been deleted.
9278 TopicDeleted,
9279 /// Some of the subscription's field are misconfigured.
9280 SubscriptionMisconfigured,
9281 /// If set, the enum was initialized with an unknown value.
9282 ///
9283 /// Applications can examine the value using [State::value] or
9284 /// [State::name].
9285 UnknownValue(state::UnknownValue),
9286 }
9287
9288 #[doc(hidden)]
9289 pub mod state {
9290 #[allow(unused_imports)]
9291 use super::*;
9292 #[derive(Clone, Debug, PartialEq)]
9293 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9294 }
9295
9296 impl State {
9297 /// Gets the enum value.
9298 ///
9299 /// Returns `None` if the enum contains an unknown value deserialized from
9300 /// the string representation of enums.
9301 pub fn value(&self) -> std::option::Option<i32> {
9302 match self {
9303 Self::Unspecified => std::option::Option::Some(0),
9304 Self::Ok => std::option::Option::Some(1),
9305 Self::SubscriptionDeleted => std::option::Option::Some(2),
9306 Self::TopicDeleted => std::option::Option::Some(3),
9307 Self::SubscriptionMisconfigured => std::option::Option::Some(4),
9308 Self::UnknownValue(u) => u.0.value(),
9309 }
9310 }
9311
9312 /// Gets the enum value as a string.
9313 ///
9314 /// Returns `None` if the enum contains an unknown value deserialized from
9315 /// the integer representation of enums.
9316 pub fn name(&self) -> std::option::Option<&str> {
9317 match self {
9318 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9319 Self::Ok => std::option::Option::Some("OK"),
9320 Self::SubscriptionDeleted => std::option::Option::Some("SUBSCRIPTION_DELETED"),
9321 Self::TopicDeleted => std::option::Option::Some("TOPIC_DELETED"),
9322 Self::SubscriptionMisconfigured => {
9323 std::option::Option::Some("SUBSCRIPTION_MISCONFIGURED")
9324 }
9325 Self::UnknownValue(u) => u.0.name(),
9326 }
9327 }
9328 }
9329
9330 impl std::default::Default for State {
9331 fn default() -> Self {
9332 use std::convert::From;
9333 Self::from(0)
9334 }
9335 }
9336
9337 impl std::fmt::Display for State {
9338 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9339 wkt::internal::display_enum(f, self.name(), self.value())
9340 }
9341 }
9342
9343 impl std::convert::From<i32> for State {
9344 fn from(value: i32) -> Self {
9345 match value {
9346 0 => Self::Unspecified,
9347 1 => Self::Ok,
9348 2 => Self::SubscriptionDeleted,
9349 3 => Self::TopicDeleted,
9350 4 => Self::SubscriptionMisconfigured,
9351 _ => Self::UnknownValue(state::UnknownValue(
9352 wkt::internal::UnknownEnumValue::Integer(value),
9353 )),
9354 }
9355 }
9356 }
9357
9358 impl std::convert::From<&str> for State {
9359 fn from(value: &str) -> Self {
9360 use std::string::ToString;
9361 match value {
9362 "STATE_UNSPECIFIED" => Self::Unspecified,
9363 "OK" => Self::Ok,
9364 "SUBSCRIPTION_DELETED" => Self::SubscriptionDeleted,
9365 "TOPIC_DELETED" => Self::TopicDeleted,
9366 "SUBSCRIPTION_MISCONFIGURED" => Self::SubscriptionMisconfigured,
9367 _ => Self::UnknownValue(state::UnknownValue(
9368 wkt::internal::UnknownEnumValue::String(value.to_string()),
9369 )),
9370 }
9371 }
9372 }
9373
9374 impl serde::ser::Serialize for State {
9375 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9376 where
9377 S: serde::Serializer,
9378 {
9379 match self {
9380 Self::Unspecified => serializer.serialize_i32(0),
9381 Self::Ok => serializer.serialize_i32(1),
9382 Self::SubscriptionDeleted => serializer.serialize_i32(2),
9383 Self::TopicDeleted => serializer.serialize_i32(3),
9384 Self::SubscriptionMisconfigured => serializer.serialize_i32(4),
9385 Self::UnknownValue(u) => u.0.serialize(serializer),
9386 }
9387 }
9388 }
9389
9390 impl<'de> serde::de::Deserialize<'de> for State {
9391 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9392 where
9393 D: serde::Deserializer<'de>,
9394 {
9395 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9396 ".google.devtools.cloudbuild.v1.PubsubConfig.State",
9397 ))
9398 }
9399 }
9400}
9401
9402/// WebhookConfig describes the configuration of a trigger that
9403/// creates a build whenever a webhook is sent to a trigger's webhook URL.
9404#[derive(Clone, Default, PartialEq)]
9405#[non_exhaustive]
9406pub struct WebhookConfig {
9407 /// Potential issues with the underlying Pub/Sub subscription configuration.
9408 /// Only populated on get requests.
9409 pub state: crate::model::webhook_config::State,
9410
9411 /// Auth method specifies how the webhook authenticates with GCP.
9412 pub auth_method: std::option::Option<crate::model::webhook_config::AuthMethod>,
9413
9414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9415}
9416
9417impl WebhookConfig {
9418 pub fn new() -> Self {
9419 std::default::Default::default()
9420 }
9421
9422 /// Sets the value of [state][crate::model::WebhookConfig::state].
9423 ///
9424 /// # Example
9425 /// ```ignore,no_run
9426 /// # use google_cloud_build_v1::model::WebhookConfig;
9427 /// use google_cloud_build_v1::model::webhook_config::State;
9428 /// let x0 = WebhookConfig::new().set_state(State::Ok);
9429 /// let x1 = WebhookConfig::new().set_state(State::SecretDeleted);
9430 /// ```
9431 pub fn set_state<T: std::convert::Into<crate::model::webhook_config::State>>(
9432 mut self,
9433 v: T,
9434 ) -> Self {
9435 self.state = v.into();
9436 self
9437 }
9438
9439 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method].
9440 ///
9441 /// Note that all the setters affecting `auth_method` are mutually
9442 /// exclusive.
9443 ///
9444 /// # Example
9445 /// ```ignore,no_run
9446 /// # use google_cloud_build_v1::model::WebhookConfig;
9447 /// use google_cloud_build_v1::model::webhook_config::AuthMethod;
9448 /// let x = WebhookConfig::new().set_auth_method(Some(AuthMethod::Secret("example".to_string())));
9449 /// ```
9450 pub fn set_auth_method<
9451 T: std::convert::Into<std::option::Option<crate::model::webhook_config::AuthMethod>>,
9452 >(
9453 mut self,
9454 v: T,
9455 ) -> Self {
9456 self.auth_method = v.into();
9457 self
9458 }
9459
9460 /// The value of [auth_method][crate::model::WebhookConfig::auth_method]
9461 /// if it holds a `Secret`, `None` if the field is not set or
9462 /// holds a different branch.
9463 pub fn secret(&self) -> std::option::Option<&std::string::String> {
9464 #[allow(unreachable_patterns)]
9465 self.auth_method.as_ref().and_then(|v| match v {
9466 crate::model::webhook_config::AuthMethod::Secret(v) => std::option::Option::Some(v),
9467 _ => std::option::Option::None,
9468 })
9469 }
9470
9471 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method]
9472 /// to hold a `Secret`.
9473 ///
9474 /// Note that all the setters affecting `auth_method` are
9475 /// mutually exclusive.
9476 ///
9477 /// # Example
9478 /// ```ignore,no_run
9479 /// # use google_cloud_build_v1::model::WebhookConfig;
9480 /// let x = WebhookConfig::new().set_secret("example");
9481 /// assert!(x.secret().is_some());
9482 /// ```
9483 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9484 self.auth_method =
9485 std::option::Option::Some(crate::model::webhook_config::AuthMethod::Secret(v.into()));
9486 self
9487 }
9488}
9489
9490impl wkt::message::Message for WebhookConfig {
9491 fn typename() -> &'static str {
9492 "type.googleapis.com/google.devtools.cloudbuild.v1.WebhookConfig"
9493 }
9494}
9495
9496/// Defines additional types related to [WebhookConfig].
9497pub mod webhook_config {
9498 #[allow(unused_imports)]
9499 use super::*;
9500
9501 /// Enumerates potential issues with the Secret Manager secret provided by the
9502 /// user.
9503 ///
9504 /// # Working with unknown values
9505 ///
9506 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9507 /// additional enum variants at any time. Adding new variants is not considered
9508 /// a breaking change. Applications should write their code in anticipation of:
9509 ///
9510 /// - New values appearing in future releases of the client library, **and**
9511 /// - New values received dynamically, without application changes.
9512 ///
9513 /// Please consult the [Working with enums] section in the user guide for some
9514 /// guidelines.
9515 ///
9516 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9517 #[derive(Clone, Debug, PartialEq)]
9518 #[non_exhaustive]
9519 pub enum State {
9520 /// The webhook auth configuration not been checked.
9521 Unspecified,
9522 /// The auth configuration is properly setup.
9523 Ok,
9524 /// The secret provided in auth_method has been deleted.
9525 SecretDeleted,
9526 /// If set, the enum was initialized with an unknown value.
9527 ///
9528 /// Applications can examine the value using [State::value] or
9529 /// [State::name].
9530 UnknownValue(state::UnknownValue),
9531 }
9532
9533 #[doc(hidden)]
9534 pub mod state {
9535 #[allow(unused_imports)]
9536 use super::*;
9537 #[derive(Clone, Debug, PartialEq)]
9538 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9539 }
9540
9541 impl State {
9542 /// Gets the enum value.
9543 ///
9544 /// Returns `None` if the enum contains an unknown value deserialized from
9545 /// the string representation of enums.
9546 pub fn value(&self) -> std::option::Option<i32> {
9547 match self {
9548 Self::Unspecified => std::option::Option::Some(0),
9549 Self::Ok => std::option::Option::Some(1),
9550 Self::SecretDeleted => std::option::Option::Some(2),
9551 Self::UnknownValue(u) => u.0.value(),
9552 }
9553 }
9554
9555 /// Gets the enum value as a string.
9556 ///
9557 /// Returns `None` if the enum contains an unknown value deserialized from
9558 /// the integer representation of enums.
9559 pub fn name(&self) -> std::option::Option<&str> {
9560 match self {
9561 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9562 Self::Ok => std::option::Option::Some("OK"),
9563 Self::SecretDeleted => std::option::Option::Some("SECRET_DELETED"),
9564 Self::UnknownValue(u) => u.0.name(),
9565 }
9566 }
9567 }
9568
9569 impl std::default::Default for State {
9570 fn default() -> Self {
9571 use std::convert::From;
9572 Self::from(0)
9573 }
9574 }
9575
9576 impl std::fmt::Display for State {
9577 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9578 wkt::internal::display_enum(f, self.name(), self.value())
9579 }
9580 }
9581
9582 impl std::convert::From<i32> for State {
9583 fn from(value: i32) -> Self {
9584 match value {
9585 0 => Self::Unspecified,
9586 1 => Self::Ok,
9587 2 => Self::SecretDeleted,
9588 _ => Self::UnknownValue(state::UnknownValue(
9589 wkt::internal::UnknownEnumValue::Integer(value),
9590 )),
9591 }
9592 }
9593 }
9594
9595 impl std::convert::From<&str> for State {
9596 fn from(value: &str) -> Self {
9597 use std::string::ToString;
9598 match value {
9599 "STATE_UNSPECIFIED" => Self::Unspecified,
9600 "OK" => Self::Ok,
9601 "SECRET_DELETED" => Self::SecretDeleted,
9602 _ => Self::UnknownValue(state::UnknownValue(
9603 wkt::internal::UnknownEnumValue::String(value.to_string()),
9604 )),
9605 }
9606 }
9607 }
9608
9609 impl serde::ser::Serialize for State {
9610 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9611 where
9612 S: serde::Serializer,
9613 {
9614 match self {
9615 Self::Unspecified => serializer.serialize_i32(0),
9616 Self::Ok => serializer.serialize_i32(1),
9617 Self::SecretDeleted => serializer.serialize_i32(2),
9618 Self::UnknownValue(u) => u.0.serialize(serializer),
9619 }
9620 }
9621 }
9622
9623 impl<'de> serde::de::Deserialize<'de> for State {
9624 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9625 where
9626 D: serde::Deserializer<'de>,
9627 {
9628 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9629 ".google.devtools.cloudbuild.v1.WebhookConfig.State",
9630 ))
9631 }
9632 }
9633
9634 /// Auth method specifies how the webhook authenticates with GCP.
9635 #[derive(Clone, Debug, PartialEq)]
9636 #[non_exhaustive]
9637 pub enum AuthMethod {
9638 /// Required. Resource name for the secret required as a URL parameter.
9639 Secret(std::string::String),
9640 }
9641}
9642
9643/// PullRequestFilter contains filter properties for matching GitHub Pull
9644/// Requests.
9645#[derive(Clone, Default, PartialEq)]
9646#[non_exhaustive]
9647pub struct PullRequestFilter {
9648 /// If CommentControl is enabled, depending on the setting, builds may not
9649 /// fire until a repository writer comments `/gcbrun` on a pull
9650 /// request or `/gcbrun` is in the pull request description.
9651 /// Only PR comments that contain `/gcbrun` will trigger builds.
9652 ///
9653 /// If CommentControl is set to disabled, comments with `/gcbrun` from a user
9654 /// with repository write permission or above will
9655 /// still trigger builds to run.
9656 pub comment_control: crate::model::pull_request_filter::CommentControl,
9657
9658 /// If true, branches that do NOT match the git_ref will trigger a build.
9659 pub invert_regex: bool,
9660
9661 /// Target refs to match.
9662 /// A target ref is the git reference where the pull request will be applied.
9663 pub git_ref: std::option::Option<crate::model::pull_request_filter::GitRef>,
9664
9665 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9666}
9667
9668impl PullRequestFilter {
9669 pub fn new() -> Self {
9670 std::default::Default::default()
9671 }
9672
9673 /// Sets the value of [comment_control][crate::model::PullRequestFilter::comment_control].
9674 ///
9675 /// # Example
9676 /// ```ignore,no_run
9677 /// # use google_cloud_build_v1::model::PullRequestFilter;
9678 /// use google_cloud_build_v1::model::pull_request_filter::CommentControl;
9679 /// let x0 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabled);
9680 /// let x1 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabledForExternalContributorsOnly);
9681 /// ```
9682 pub fn set_comment_control<
9683 T: std::convert::Into<crate::model::pull_request_filter::CommentControl>,
9684 >(
9685 mut self,
9686 v: T,
9687 ) -> Self {
9688 self.comment_control = v.into();
9689 self
9690 }
9691
9692 /// Sets the value of [invert_regex][crate::model::PullRequestFilter::invert_regex].
9693 ///
9694 /// # Example
9695 /// ```ignore,no_run
9696 /// # use google_cloud_build_v1::model::PullRequestFilter;
9697 /// let x = PullRequestFilter::new().set_invert_regex(true);
9698 /// ```
9699 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9700 self.invert_regex = v.into();
9701 self
9702 }
9703
9704 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref].
9705 ///
9706 /// Note that all the setters affecting `git_ref` are mutually
9707 /// exclusive.
9708 ///
9709 /// # Example
9710 /// ```ignore,no_run
9711 /// # use google_cloud_build_v1::model::PullRequestFilter;
9712 /// use google_cloud_build_v1::model::pull_request_filter::GitRef;
9713 /// let x = PullRequestFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9714 /// ```
9715 pub fn set_git_ref<
9716 T: std::convert::Into<std::option::Option<crate::model::pull_request_filter::GitRef>>,
9717 >(
9718 mut self,
9719 v: T,
9720 ) -> Self {
9721 self.git_ref = v.into();
9722 self
9723 }
9724
9725 /// The value of [git_ref][crate::model::PullRequestFilter::git_ref]
9726 /// if it holds a `Branch`, `None` if the field is not set or
9727 /// holds a different branch.
9728 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9729 #[allow(unreachable_patterns)]
9730 self.git_ref.as_ref().and_then(|v| match v {
9731 crate::model::pull_request_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9732 _ => std::option::Option::None,
9733 })
9734 }
9735
9736 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref]
9737 /// to hold a `Branch`.
9738 ///
9739 /// Note that all the setters affecting `git_ref` are
9740 /// mutually exclusive.
9741 ///
9742 /// # Example
9743 /// ```ignore,no_run
9744 /// # use google_cloud_build_v1::model::PullRequestFilter;
9745 /// let x = PullRequestFilter::new().set_branch("example");
9746 /// assert!(x.branch().is_some());
9747 /// ```
9748 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9749 self.git_ref =
9750 std::option::Option::Some(crate::model::pull_request_filter::GitRef::Branch(v.into()));
9751 self
9752 }
9753}
9754
9755impl wkt::message::Message for PullRequestFilter {
9756 fn typename() -> &'static str {
9757 "type.googleapis.com/google.devtools.cloudbuild.v1.PullRequestFilter"
9758 }
9759}
9760
9761/// Defines additional types related to [PullRequestFilter].
9762pub mod pull_request_filter {
9763 #[allow(unused_imports)]
9764 use super::*;
9765
9766 /// Controls whether or not a `/gcbrun` comment is required from a user with
9767 /// repository write permission or above in order to
9768 /// trigger Build runs for pull requests. Pull Request update events differ
9769 /// between repo types.
9770 /// Check repo specific guides
9771 /// ([GitHub](https://cloud.google.com/build/docs/automating-builds/github/build-repos-from-github-enterprise#creating_a_github_enterprise_trigger),
9772 /// [Bitbucket](https://cloud.google.com/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-server#creating_a_bitbucket_server_trigger),
9773 /// [GitLab](https://cloud.google.com/build/docs/automating-builds/gitlab/build-repos-from-gitlab#creating_a_gitlab_trigger)
9774 /// for details.
9775 ///
9776 /// # Working with unknown values
9777 ///
9778 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9779 /// additional enum variants at any time. Adding new variants is not considered
9780 /// a breaking change. Applications should write their code in anticipation of:
9781 ///
9782 /// - New values appearing in future releases of the client library, **and**
9783 /// - New values received dynamically, without application changes.
9784 ///
9785 /// Please consult the [Working with enums] section in the user guide for some
9786 /// guidelines.
9787 ///
9788 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9789 #[derive(Clone, Debug, PartialEq)]
9790 #[non_exhaustive]
9791 pub enum CommentControl {
9792 /// Do not require `/gcbrun` comments from a user with repository write
9793 /// permission or above on pull requests before builds are triggered.
9794 /// Comments that contain `/gcbrun` will still fire builds so this should
9795 /// be thought of as comments not required.
9796 CommentsDisabled,
9797 /// Builds will only fire in response to pull requests if:
9798 ///
9799 /// 1. The pull request author has repository write permission or above and
9800 /// `/gcbrun` is in the PR description.
9801 /// 1. A user with repository writer permissions or above comments `/gcbrun`
9802 /// on a pull request authored by any user.
9803 CommentsEnabled,
9804 /// Builds will only fire in response to pull requests if:
9805 ///
9806 /// 1. The pull request author is a repository writer or above.
9807 /// 1. If the author does not have write permissions, a user with write
9808 /// permissions or above must comment `/gcbrun` in order to fire a build.
9809 CommentsEnabledForExternalContributorsOnly,
9810 /// If set, the enum was initialized with an unknown value.
9811 ///
9812 /// Applications can examine the value using [CommentControl::value] or
9813 /// [CommentControl::name].
9814 UnknownValue(comment_control::UnknownValue),
9815 }
9816
9817 #[doc(hidden)]
9818 pub mod comment_control {
9819 #[allow(unused_imports)]
9820 use super::*;
9821 #[derive(Clone, Debug, PartialEq)]
9822 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9823 }
9824
9825 impl CommentControl {
9826 /// Gets the enum value.
9827 ///
9828 /// Returns `None` if the enum contains an unknown value deserialized from
9829 /// the string representation of enums.
9830 pub fn value(&self) -> std::option::Option<i32> {
9831 match self {
9832 Self::CommentsDisabled => std::option::Option::Some(0),
9833 Self::CommentsEnabled => std::option::Option::Some(1),
9834 Self::CommentsEnabledForExternalContributorsOnly => std::option::Option::Some(2),
9835 Self::UnknownValue(u) => u.0.value(),
9836 }
9837 }
9838
9839 /// Gets the enum value as a string.
9840 ///
9841 /// Returns `None` if the enum contains an unknown value deserialized from
9842 /// the integer representation of enums.
9843 pub fn name(&self) -> std::option::Option<&str> {
9844 match self {
9845 Self::CommentsDisabled => std::option::Option::Some("COMMENTS_DISABLED"),
9846 Self::CommentsEnabled => std::option::Option::Some("COMMENTS_ENABLED"),
9847 Self::CommentsEnabledForExternalContributorsOnly => {
9848 std::option::Option::Some("COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY")
9849 }
9850 Self::UnknownValue(u) => u.0.name(),
9851 }
9852 }
9853 }
9854
9855 impl std::default::Default for CommentControl {
9856 fn default() -> Self {
9857 use std::convert::From;
9858 Self::from(0)
9859 }
9860 }
9861
9862 impl std::fmt::Display for CommentControl {
9863 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9864 wkt::internal::display_enum(f, self.name(), self.value())
9865 }
9866 }
9867
9868 impl std::convert::From<i32> for CommentControl {
9869 fn from(value: i32) -> Self {
9870 match value {
9871 0 => Self::CommentsDisabled,
9872 1 => Self::CommentsEnabled,
9873 2 => Self::CommentsEnabledForExternalContributorsOnly,
9874 _ => Self::UnknownValue(comment_control::UnknownValue(
9875 wkt::internal::UnknownEnumValue::Integer(value),
9876 )),
9877 }
9878 }
9879 }
9880
9881 impl std::convert::From<&str> for CommentControl {
9882 fn from(value: &str) -> Self {
9883 use std::string::ToString;
9884 match value {
9885 "COMMENTS_DISABLED" => Self::CommentsDisabled,
9886 "COMMENTS_ENABLED" => Self::CommentsEnabled,
9887 "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" => {
9888 Self::CommentsEnabledForExternalContributorsOnly
9889 }
9890 _ => Self::UnknownValue(comment_control::UnknownValue(
9891 wkt::internal::UnknownEnumValue::String(value.to_string()),
9892 )),
9893 }
9894 }
9895 }
9896
9897 impl serde::ser::Serialize for CommentControl {
9898 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9899 where
9900 S: serde::Serializer,
9901 {
9902 match self {
9903 Self::CommentsDisabled => serializer.serialize_i32(0),
9904 Self::CommentsEnabled => serializer.serialize_i32(1),
9905 Self::CommentsEnabledForExternalContributorsOnly => serializer.serialize_i32(2),
9906 Self::UnknownValue(u) => u.0.serialize(serializer),
9907 }
9908 }
9909 }
9910
9911 impl<'de> serde::de::Deserialize<'de> for CommentControl {
9912 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9913 where
9914 D: serde::Deserializer<'de>,
9915 {
9916 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommentControl>::new(
9917 ".google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl",
9918 ))
9919 }
9920 }
9921
9922 /// Target refs to match.
9923 /// A target ref is the git reference where the pull request will be applied.
9924 #[derive(Clone, Debug, PartialEq)]
9925 #[non_exhaustive]
9926 pub enum GitRef {
9927 /// Regex of branches to match.
9928 ///
9929 /// The syntax of the regular expressions accepted is the syntax accepted by
9930 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
9931 Branch(std::string::String),
9932 }
9933}
9934
9935/// Push contains filter properties for matching GitHub git pushes.
9936#[derive(Clone, Default, PartialEq)]
9937#[non_exhaustive]
9938pub struct PushFilter {
9939 /// When true, only trigger a build if the revision regex does NOT match the
9940 /// git_ref regex.
9941 pub invert_regex: bool,
9942
9943 /// Modified refs to match.
9944 /// A modified refs are the refs modified by a git push operation.
9945 pub git_ref: std::option::Option<crate::model::push_filter::GitRef>,
9946
9947 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9948}
9949
9950impl PushFilter {
9951 pub fn new() -> Self {
9952 std::default::Default::default()
9953 }
9954
9955 /// Sets the value of [invert_regex][crate::model::PushFilter::invert_regex].
9956 ///
9957 /// # Example
9958 /// ```ignore,no_run
9959 /// # use google_cloud_build_v1::model::PushFilter;
9960 /// let x = PushFilter::new().set_invert_regex(true);
9961 /// ```
9962 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9963 self.invert_regex = v.into();
9964 self
9965 }
9966
9967 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref].
9968 ///
9969 /// Note that all the setters affecting `git_ref` are mutually
9970 /// exclusive.
9971 ///
9972 /// # Example
9973 /// ```ignore,no_run
9974 /// # use google_cloud_build_v1::model::PushFilter;
9975 /// use google_cloud_build_v1::model::push_filter::GitRef;
9976 /// let x = PushFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9977 /// ```
9978 pub fn set_git_ref<
9979 T: std::convert::Into<std::option::Option<crate::model::push_filter::GitRef>>,
9980 >(
9981 mut self,
9982 v: T,
9983 ) -> Self {
9984 self.git_ref = v.into();
9985 self
9986 }
9987
9988 /// The value of [git_ref][crate::model::PushFilter::git_ref]
9989 /// if it holds a `Branch`, `None` if the field is not set or
9990 /// holds a different branch.
9991 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9992 #[allow(unreachable_patterns)]
9993 self.git_ref.as_ref().and_then(|v| match v {
9994 crate::model::push_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9995 _ => std::option::Option::None,
9996 })
9997 }
9998
9999 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10000 /// to hold a `Branch`.
10001 ///
10002 /// Note that all the setters affecting `git_ref` are
10003 /// mutually exclusive.
10004 ///
10005 /// # Example
10006 /// ```ignore,no_run
10007 /// # use google_cloud_build_v1::model::PushFilter;
10008 /// let x = PushFilter::new().set_branch("example");
10009 /// assert!(x.branch().is_some());
10010 /// assert!(x.tag().is_none());
10011 /// ```
10012 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10013 self.git_ref =
10014 std::option::Option::Some(crate::model::push_filter::GitRef::Branch(v.into()));
10015 self
10016 }
10017
10018 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10019 /// if it holds a `Tag`, `None` if the field is not set or
10020 /// holds a different branch.
10021 pub fn tag(&self) -> std::option::Option<&std::string::String> {
10022 #[allow(unreachable_patterns)]
10023 self.git_ref.as_ref().and_then(|v| match v {
10024 crate::model::push_filter::GitRef::Tag(v) => std::option::Option::Some(v),
10025 _ => std::option::Option::None,
10026 })
10027 }
10028
10029 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10030 /// to hold a `Tag`.
10031 ///
10032 /// Note that all the setters affecting `git_ref` are
10033 /// mutually exclusive.
10034 ///
10035 /// # Example
10036 /// ```ignore,no_run
10037 /// # use google_cloud_build_v1::model::PushFilter;
10038 /// let x = PushFilter::new().set_tag("example");
10039 /// assert!(x.tag().is_some());
10040 /// assert!(x.branch().is_none());
10041 /// ```
10042 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10043 self.git_ref = std::option::Option::Some(crate::model::push_filter::GitRef::Tag(v.into()));
10044 self
10045 }
10046}
10047
10048impl wkt::message::Message for PushFilter {
10049 fn typename() -> &'static str {
10050 "type.googleapis.com/google.devtools.cloudbuild.v1.PushFilter"
10051 }
10052}
10053
10054/// Defines additional types related to [PushFilter].
10055pub mod push_filter {
10056 #[allow(unused_imports)]
10057 use super::*;
10058
10059 /// Modified refs to match.
10060 /// A modified refs are the refs modified by a git push operation.
10061 #[derive(Clone, Debug, PartialEq)]
10062 #[non_exhaustive]
10063 pub enum GitRef {
10064 /// Regexes matching branches to build.
10065 ///
10066 /// The syntax of the regular expressions accepted is the syntax accepted by
10067 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10068 Branch(std::string::String),
10069 /// Regexes matching tags to build.
10070 ///
10071 /// The syntax of the regular expressions accepted is the syntax accepted by
10072 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10073 Tag(std::string::String),
10074 }
10075}
10076
10077/// Request to create a new `BuildTrigger`.
10078#[derive(Clone, Default, PartialEq)]
10079#[non_exhaustive]
10080pub struct CreateBuildTriggerRequest {
10081 /// The parent resource where this trigger will be created.
10082 /// Format: `projects/{project}/locations/{location}`
10083 pub parent: std::string::String,
10084
10085 /// Required. ID of the project for which to configure automatic builds.
10086 pub project_id: std::string::String,
10087
10088 /// Required. `BuildTrigger` to create.
10089 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10090
10091 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10092}
10093
10094impl CreateBuildTriggerRequest {
10095 pub fn new() -> Self {
10096 std::default::Default::default()
10097 }
10098
10099 /// Sets the value of [parent][crate::model::CreateBuildTriggerRequest::parent].
10100 ///
10101 /// # Example
10102 /// ```ignore,no_run
10103 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10104 /// let x = CreateBuildTriggerRequest::new().set_parent("example");
10105 /// ```
10106 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10107 self.parent = v.into();
10108 self
10109 }
10110
10111 /// Sets the value of [project_id][crate::model::CreateBuildTriggerRequest::project_id].
10112 ///
10113 /// # Example
10114 /// ```ignore,no_run
10115 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10116 /// let x = CreateBuildTriggerRequest::new().set_project_id("example");
10117 /// ```
10118 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10119 self.project_id = v.into();
10120 self
10121 }
10122
10123 /// Sets the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10124 ///
10125 /// # Example
10126 /// ```ignore,no_run
10127 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10128 /// use google_cloud_build_v1::model::BuildTrigger;
10129 /// let x = CreateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10130 /// ```
10131 pub fn set_trigger<T>(mut self, v: T) -> Self
10132 where
10133 T: std::convert::Into<crate::model::BuildTrigger>,
10134 {
10135 self.trigger = std::option::Option::Some(v.into());
10136 self
10137 }
10138
10139 /// Sets or clears the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10140 ///
10141 /// # Example
10142 /// ```ignore,no_run
10143 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10144 /// use google_cloud_build_v1::model::BuildTrigger;
10145 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10146 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10147 /// ```
10148 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10149 where
10150 T: std::convert::Into<crate::model::BuildTrigger>,
10151 {
10152 self.trigger = v.map(|x| x.into());
10153 self
10154 }
10155}
10156
10157impl wkt::message::Message for CreateBuildTriggerRequest {
10158 fn typename() -> &'static str {
10159 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildTriggerRequest"
10160 }
10161}
10162
10163/// Returns the `BuildTrigger` with the specified ID.
10164#[derive(Clone, Default, PartialEq)]
10165#[non_exhaustive]
10166pub struct GetBuildTriggerRequest {
10167 /// The name of the `Trigger` to retrieve.
10168 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10169 pub name: std::string::String,
10170
10171 /// Required. ID of the project that owns the trigger.
10172 pub project_id: std::string::String,
10173
10174 /// Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
10175 pub trigger_id: std::string::String,
10176
10177 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10178}
10179
10180impl GetBuildTriggerRequest {
10181 pub fn new() -> Self {
10182 std::default::Default::default()
10183 }
10184
10185 /// Sets the value of [name][crate::model::GetBuildTriggerRequest::name].
10186 ///
10187 /// # Example
10188 /// ```ignore,no_run
10189 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10190 /// let x = GetBuildTriggerRequest::new().set_name("example");
10191 /// ```
10192 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10193 self.name = v.into();
10194 self
10195 }
10196
10197 /// Sets the value of [project_id][crate::model::GetBuildTriggerRequest::project_id].
10198 ///
10199 /// # Example
10200 /// ```ignore,no_run
10201 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10202 /// let x = GetBuildTriggerRequest::new().set_project_id("example");
10203 /// ```
10204 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10205 self.project_id = v.into();
10206 self
10207 }
10208
10209 /// Sets the value of [trigger_id][crate::model::GetBuildTriggerRequest::trigger_id].
10210 ///
10211 /// # Example
10212 /// ```ignore,no_run
10213 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10214 /// let x = GetBuildTriggerRequest::new().set_trigger_id("example");
10215 /// ```
10216 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10217 self.trigger_id = v.into();
10218 self
10219 }
10220}
10221
10222impl wkt::message::Message for GetBuildTriggerRequest {
10223 fn typename() -> &'static str {
10224 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildTriggerRequest"
10225 }
10226}
10227
10228/// Request to list existing `BuildTriggers`.
10229#[derive(Clone, Default, PartialEq)]
10230#[non_exhaustive]
10231pub struct ListBuildTriggersRequest {
10232 /// The parent of the collection of `Triggers`.
10233 /// Format: `projects/{project}/locations/{location}`
10234 pub parent: std::string::String,
10235
10236 /// Required. ID of the project for which to list BuildTriggers.
10237 pub project_id: std::string::String,
10238
10239 /// Number of results to return in the list.
10240 pub page_size: i32,
10241
10242 /// Token to provide to skip to a particular spot in the list.
10243 pub page_token: std::string::String,
10244
10245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10246}
10247
10248impl ListBuildTriggersRequest {
10249 pub fn new() -> Self {
10250 std::default::Default::default()
10251 }
10252
10253 /// Sets the value of [parent][crate::model::ListBuildTriggersRequest::parent].
10254 ///
10255 /// # Example
10256 /// ```ignore,no_run
10257 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10258 /// let x = ListBuildTriggersRequest::new().set_parent("example");
10259 /// ```
10260 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10261 self.parent = v.into();
10262 self
10263 }
10264
10265 /// Sets the value of [project_id][crate::model::ListBuildTriggersRequest::project_id].
10266 ///
10267 /// # Example
10268 /// ```ignore,no_run
10269 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10270 /// let x = ListBuildTriggersRequest::new().set_project_id("example");
10271 /// ```
10272 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10273 self.project_id = v.into();
10274 self
10275 }
10276
10277 /// Sets the value of [page_size][crate::model::ListBuildTriggersRequest::page_size].
10278 ///
10279 /// # Example
10280 /// ```ignore,no_run
10281 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10282 /// let x = ListBuildTriggersRequest::new().set_page_size(42);
10283 /// ```
10284 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10285 self.page_size = v.into();
10286 self
10287 }
10288
10289 /// Sets the value of [page_token][crate::model::ListBuildTriggersRequest::page_token].
10290 ///
10291 /// # Example
10292 /// ```ignore,no_run
10293 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10294 /// let x = ListBuildTriggersRequest::new().set_page_token("example");
10295 /// ```
10296 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10297 self.page_token = v.into();
10298 self
10299 }
10300}
10301
10302impl wkt::message::Message for ListBuildTriggersRequest {
10303 fn typename() -> &'static str {
10304 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersRequest"
10305 }
10306}
10307
10308/// Response containing existing `BuildTriggers`.
10309#[derive(Clone, Default, PartialEq)]
10310#[non_exhaustive]
10311pub struct ListBuildTriggersResponse {
10312 /// `BuildTriggers` for the project, sorted by `create_time` descending.
10313 pub triggers: std::vec::Vec<crate::model::BuildTrigger>,
10314
10315 /// Token to receive the next page of results.
10316 pub next_page_token: std::string::String,
10317
10318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10319}
10320
10321impl ListBuildTriggersResponse {
10322 pub fn new() -> Self {
10323 std::default::Default::default()
10324 }
10325
10326 /// Sets the value of [triggers][crate::model::ListBuildTriggersResponse::triggers].
10327 ///
10328 /// # Example
10329 /// ```ignore,no_run
10330 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10331 /// use google_cloud_build_v1::model::BuildTrigger;
10332 /// let x = ListBuildTriggersResponse::new()
10333 /// .set_triggers([
10334 /// BuildTrigger::default()/* use setters */,
10335 /// BuildTrigger::default()/* use (different) setters */,
10336 /// ]);
10337 /// ```
10338 pub fn set_triggers<T, V>(mut self, v: T) -> Self
10339 where
10340 T: std::iter::IntoIterator<Item = V>,
10341 V: std::convert::Into<crate::model::BuildTrigger>,
10342 {
10343 use std::iter::Iterator;
10344 self.triggers = v.into_iter().map(|i| i.into()).collect();
10345 self
10346 }
10347
10348 /// Sets the value of [next_page_token][crate::model::ListBuildTriggersResponse::next_page_token].
10349 ///
10350 /// # Example
10351 /// ```ignore,no_run
10352 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10353 /// let x = ListBuildTriggersResponse::new().set_next_page_token("example");
10354 /// ```
10355 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10356 self.next_page_token = v.into();
10357 self
10358 }
10359}
10360
10361impl wkt::message::Message for ListBuildTriggersResponse {
10362 fn typename() -> &'static str {
10363 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersResponse"
10364 }
10365}
10366
10367#[doc(hidden)]
10368impl gax::paginator::internal::PageableResponse for ListBuildTriggersResponse {
10369 type PageItem = crate::model::BuildTrigger;
10370
10371 fn items(self) -> std::vec::Vec<Self::PageItem> {
10372 self.triggers
10373 }
10374
10375 fn next_page_token(&self) -> std::string::String {
10376 use std::clone::Clone;
10377 self.next_page_token.clone()
10378 }
10379}
10380
10381/// Request to delete a `BuildTrigger`.
10382#[derive(Clone, Default, PartialEq)]
10383#[non_exhaustive]
10384pub struct DeleteBuildTriggerRequest {
10385 /// The name of the `Trigger` to delete.
10386 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10387 pub name: std::string::String,
10388
10389 /// Required. ID of the project that owns the trigger.
10390 pub project_id: std::string::String,
10391
10392 /// Required. ID of the `BuildTrigger` to delete.
10393 pub trigger_id: std::string::String,
10394
10395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10396}
10397
10398impl DeleteBuildTriggerRequest {
10399 pub fn new() -> Self {
10400 std::default::Default::default()
10401 }
10402
10403 /// Sets the value of [name][crate::model::DeleteBuildTriggerRequest::name].
10404 ///
10405 /// # Example
10406 /// ```ignore,no_run
10407 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10408 /// let x = DeleteBuildTriggerRequest::new().set_name("example");
10409 /// ```
10410 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10411 self.name = v.into();
10412 self
10413 }
10414
10415 /// Sets the value of [project_id][crate::model::DeleteBuildTriggerRequest::project_id].
10416 ///
10417 /// # Example
10418 /// ```ignore,no_run
10419 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10420 /// let x = DeleteBuildTriggerRequest::new().set_project_id("example");
10421 /// ```
10422 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10423 self.project_id = v.into();
10424 self
10425 }
10426
10427 /// Sets the value of [trigger_id][crate::model::DeleteBuildTriggerRequest::trigger_id].
10428 ///
10429 /// # Example
10430 /// ```ignore,no_run
10431 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10432 /// let x = DeleteBuildTriggerRequest::new().set_trigger_id("example");
10433 /// ```
10434 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10435 self.trigger_id = v.into();
10436 self
10437 }
10438}
10439
10440impl wkt::message::Message for DeleteBuildTriggerRequest {
10441 fn typename() -> &'static str {
10442 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest"
10443 }
10444}
10445
10446/// Request to update an existing `BuildTrigger`.
10447#[derive(Clone, Default, PartialEq)]
10448#[non_exhaustive]
10449pub struct UpdateBuildTriggerRequest {
10450 /// Required. ID of the project that owns the trigger.
10451 pub project_id: std::string::String,
10452
10453 /// Required. ID of the `BuildTrigger` to update.
10454 pub trigger_id: std::string::String,
10455
10456 /// Required. `BuildTrigger` to update.
10457 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10458
10459 /// Update mask for the resource. If this is set,
10460 /// the server will only update the fields specified in the field mask.
10461 /// Otherwise, a full update of the mutable resource fields will be performed.
10462 pub update_mask: std::option::Option<wkt::FieldMask>,
10463
10464 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10465}
10466
10467impl UpdateBuildTriggerRequest {
10468 pub fn new() -> Self {
10469 std::default::Default::default()
10470 }
10471
10472 /// Sets the value of [project_id][crate::model::UpdateBuildTriggerRequest::project_id].
10473 ///
10474 /// # Example
10475 /// ```ignore,no_run
10476 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10477 /// let x = UpdateBuildTriggerRequest::new().set_project_id("example");
10478 /// ```
10479 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10480 self.project_id = v.into();
10481 self
10482 }
10483
10484 /// Sets the value of [trigger_id][crate::model::UpdateBuildTriggerRequest::trigger_id].
10485 ///
10486 /// # Example
10487 /// ```ignore,no_run
10488 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10489 /// let x = UpdateBuildTriggerRequest::new().set_trigger_id("example");
10490 /// ```
10491 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10492 self.trigger_id = v.into();
10493 self
10494 }
10495
10496 /// Sets the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10497 ///
10498 /// # Example
10499 /// ```ignore,no_run
10500 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10501 /// use google_cloud_build_v1::model::BuildTrigger;
10502 /// let x = UpdateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10503 /// ```
10504 pub fn set_trigger<T>(mut self, v: T) -> Self
10505 where
10506 T: std::convert::Into<crate::model::BuildTrigger>,
10507 {
10508 self.trigger = std::option::Option::Some(v.into());
10509 self
10510 }
10511
10512 /// Sets or clears the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10513 ///
10514 /// # Example
10515 /// ```ignore,no_run
10516 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10517 /// use google_cloud_build_v1::model::BuildTrigger;
10518 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10519 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10520 /// ```
10521 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10522 where
10523 T: std::convert::Into<crate::model::BuildTrigger>,
10524 {
10525 self.trigger = v.map(|x| x.into());
10526 self
10527 }
10528
10529 /// Sets the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10530 ///
10531 /// # Example
10532 /// ```ignore,no_run
10533 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10534 /// use wkt::FieldMask;
10535 /// let x = UpdateBuildTriggerRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10536 /// ```
10537 pub fn set_update_mask<T>(mut self, v: T) -> Self
10538 where
10539 T: std::convert::Into<wkt::FieldMask>,
10540 {
10541 self.update_mask = std::option::Option::Some(v.into());
10542 self
10543 }
10544
10545 /// Sets or clears the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10546 ///
10547 /// # Example
10548 /// ```ignore,no_run
10549 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10550 /// use wkt::FieldMask;
10551 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10552 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10553 /// ```
10554 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10555 where
10556 T: std::convert::Into<wkt::FieldMask>,
10557 {
10558 self.update_mask = v.map(|x| x.into());
10559 self
10560 }
10561}
10562
10563impl wkt::message::Message for UpdateBuildTriggerRequest {
10564 fn typename() -> &'static str {
10565 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest"
10566 }
10567}
10568
10569/// Optional arguments to enable specific features of builds.
10570#[derive(Clone, Default, PartialEq)]
10571#[non_exhaustive]
10572pub struct BuildOptions {
10573 /// Requested hash for SourceProvenance.
10574 pub source_provenance_hash: std::vec::Vec<crate::model::hash::HashType>,
10575
10576 /// Requested verifiability options.
10577 pub requested_verify_option: crate::model::build_options::VerifyOption,
10578
10579 /// Compute Engine machine type on which to run the build.
10580 pub machine_type: crate::model::build_options::MachineType,
10581
10582 /// Requested disk size for the VM that runs the build. Note that this is *NOT*
10583 /// "disk free"; some of the space will be used by the operating system and
10584 /// build utilities. Also note that this is the minimum disk size that will be
10585 /// allocated for the build -- the build may run with a larger disk than
10586 /// requested. At present, the maximum disk size is 4000GB; builds that request
10587 /// more than the maximum are rejected with an error.
10588 pub disk_size_gb: i64,
10589
10590 /// Option to specify behavior when there is an error in the substitution
10591 /// checks.
10592 ///
10593 /// NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot
10594 /// be overridden in the build configuration file.
10595 pub substitution_option: crate::model::build_options::SubstitutionOption,
10596
10597 /// Option to specify whether or not to apply bash style string
10598 /// operations to the substitutions.
10599 ///
10600 /// NOTE: this is always enabled for triggered builds and cannot be
10601 /// overridden in the build configuration file.
10602 pub dynamic_substitutions: bool,
10603
10604 /// Option to include built-in and custom substitutions as env variables
10605 /// for all build steps.
10606 pub automap_substitutions: bool,
10607
10608 /// Option to define build log streaming behavior to Cloud
10609 /// Storage.
10610 pub log_streaming_option: crate::model::build_options::LogStreamingOption,
10611
10612 /// This field deprecated; please use `pool.name` instead.
10613 #[deprecated]
10614 pub worker_pool: std::string::String,
10615
10616 /// Optional. Specification for execution on a `WorkerPool`.
10617 ///
10618 /// See [running builds in a private
10619 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10620 /// for more information.
10621 pub pool: std::option::Option<crate::model::build_options::PoolOption>,
10622
10623 /// Option to specify the logging mode, which determines if and where build
10624 /// logs are stored.
10625 pub logging: crate::model::build_options::LoggingMode,
10626
10627 /// A list of global environment variable definitions that will exist for all
10628 /// build steps in this build. If a variable is defined in both globally and in
10629 /// a build step, the variable will use the build step value.
10630 ///
10631 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
10632 /// being given the value "VALUE".
10633 pub env: std::vec::Vec<std::string::String>,
10634
10635 /// A list of global environment variables, which are encrypted using a Cloud
10636 /// Key Management Service crypto key. These values must be specified in the
10637 /// build's `Secret`. These variables will be available to all build steps
10638 /// in this build.
10639 pub secret_env: std::vec::Vec<std::string::String>,
10640
10641 /// Global list of volumes to mount for ALL build steps
10642 ///
10643 /// Each volume is created as an empty volume prior to starting the build
10644 /// process. Upon completion of the build, volumes and their contents are
10645 /// discarded. Global volume names and paths cannot conflict with the volumes
10646 /// defined a build step.
10647 ///
10648 /// Using a global volume in a build with only one step is not valid as
10649 /// it is indicative of a build request with an incorrect configuration.
10650 pub volumes: std::vec::Vec<crate::model::Volume>,
10651
10652 /// Optional. Option to specify how default logs buckets are setup.
10653 pub default_logs_bucket_behavior: crate::model::build_options::DefaultLogsBucketBehavior,
10654
10655 /// Optional. Option to specify whether structured logging is enabled.
10656 ///
10657 /// If true, JSON-formatted logs are parsed as structured logs.
10658 pub enable_structured_logging: bool,
10659
10660 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10661}
10662
10663impl BuildOptions {
10664 pub fn new() -> Self {
10665 std::default::Default::default()
10666 }
10667
10668 /// Sets the value of [source_provenance_hash][crate::model::BuildOptions::source_provenance_hash].
10669 ///
10670 /// # Example
10671 /// ```ignore,no_run
10672 /// # use google_cloud_build_v1::model::BuildOptions;
10673 /// use google_cloud_build_v1::model::hash::HashType;
10674 /// let x = BuildOptions::new().set_source_provenance_hash([
10675 /// HashType::Sha256,
10676 /// HashType::Md5,
10677 /// HashType::GoModuleH1,
10678 /// ]);
10679 /// ```
10680 pub fn set_source_provenance_hash<T, V>(mut self, v: T) -> Self
10681 where
10682 T: std::iter::IntoIterator<Item = V>,
10683 V: std::convert::Into<crate::model::hash::HashType>,
10684 {
10685 use std::iter::Iterator;
10686 self.source_provenance_hash = v.into_iter().map(|i| i.into()).collect();
10687 self
10688 }
10689
10690 /// Sets the value of [requested_verify_option][crate::model::BuildOptions::requested_verify_option].
10691 ///
10692 /// # Example
10693 /// ```ignore,no_run
10694 /// # use google_cloud_build_v1::model::BuildOptions;
10695 /// use google_cloud_build_v1::model::build_options::VerifyOption;
10696 /// let x0 = BuildOptions::new().set_requested_verify_option(VerifyOption::Verified);
10697 /// ```
10698 pub fn set_requested_verify_option<
10699 T: std::convert::Into<crate::model::build_options::VerifyOption>,
10700 >(
10701 mut self,
10702 v: T,
10703 ) -> Self {
10704 self.requested_verify_option = v.into();
10705 self
10706 }
10707
10708 /// Sets the value of [machine_type][crate::model::BuildOptions::machine_type].
10709 ///
10710 /// # Example
10711 /// ```ignore,no_run
10712 /// # use google_cloud_build_v1::model::BuildOptions;
10713 /// use google_cloud_build_v1::model::build_options::MachineType;
10714 /// let x0 = BuildOptions::new().set_machine_type(MachineType::N1Highcpu8);
10715 /// let x1 = BuildOptions::new().set_machine_type(MachineType::N1Highcpu32);
10716 /// let x2 = BuildOptions::new().set_machine_type(MachineType::E2Highcpu8);
10717 /// ```
10718 pub fn set_machine_type<T: std::convert::Into<crate::model::build_options::MachineType>>(
10719 mut self,
10720 v: T,
10721 ) -> Self {
10722 self.machine_type = v.into();
10723 self
10724 }
10725
10726 /// Sets the value of [disk_size_gb][crate::model::BuildOptions::disk_size_gb].
10727 ///
10728 /// # Example
10729 /// ```ignore,no_run
10730 /// # use google_cloud_build_v1::model::BuildOptions;
10731 /// let x = BuildOptions::new().set_disk_size_gb(42);
10732 /// ```
10733 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10734 self.disk_size_gb = v.into();
10735 self
10736 }
10737
10738 /// Sets the value of [substitution_option][crate::model::BuildOptions::substitution_option].
10739 ///
10740 /// # Example
10741 /// ```ignore,no_run
10742 /// # use google_cloud_build_v1::model::BuildOptions;
10743 /// use google_cloud_build_v1::model::build_options::SubstitutionOption;
10744 /// let x0 = BuildOptions::new().set_substitution_option(SubstitutionOption::AllowLoose);
10745 /// ```
10746 pub fn set_substitution_option<
10747 T: std::convert::Into<crate::model::build_options::SubstitutionOption>,
10748 >(
10749 mut self,
10750 v: T,
10751 ) -> Self {
10752 self.substitution_option = v.into();
10753 self
10754 }
10755
10756 /// Sets the value of [dynamic_substitutions][crate::model::BuildOptions::dynamic_substitutions].
10757 ///
10758 /// # Example
10759 /// ```ignore,no_run
10760 /// # use google_cloud_build_v1::model::BuildOptions;
10761 /// let x = BuildOptions::new().set_dynamic_substitutions(true);
10762 /// ```
10763 pub fn set_dynamic_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10764 self.dynamic_substitutions = v.into();
10765 self
10766 }
10767
10768 /// Sets the value of [automap_substitutions][crate::model::BuildOptions::automap_substitutions].
10769 ///
10770 /// # Example
10771 /// ```ignore,no_run
10772 /// # use google_cloud_build_v1::model::BuildOptions;
10773 /// let x = BuildOptions::new().set_automap_substitutions(true);
10774 /// ```
10775 pub fn set_automap_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10776 self.automap_substitutions = v.into();
10777 self
10778 }
10779
10780 /// Sets the value of [log_streaming_option][crate::model::BuildOptions::log_streaming_option].
10781 ///
10782 /// # Example
10783 /// ```ignore,no_run
10784 /// # use google_cloud_build_v1::model::BuildOptions;
10785 /// use google_cloud_build_v1::model::build_options::LogStreamingOption;
10786 /// let x0 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOn);
10787 /// let x1 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOff);
10788 /// ```
10789 pub fn set_log_streaming_option<
10790 T: std::convert::Into<crate::model::build_options::LogStreamingOption>,
10791 >(
10792 mut self,
10793 v: T,
10794 ) -> Self {
10795 self.log_streaming_option = v.into();
10796 self
10797 }
10798
10799 /// Sets the value of [worker_pool][crate::model::BuildOptions::worker_pool].
10800 ///
10801 /// # Example
10802 /// ```ignore,no_run
10803 /// # use google_cloud_build_v1::model::BuildOptions;
10804 /// let x = BuildOptions::new().set_worker_pool("example");
10805 /// ```
10806 #[deprecated]
10807 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10808 self.worker_pool = v.into();
10809 self
10810 }
10811
10812 /// Sets the value of [pool][crate::model::BuildOptions::pool].
10813 ///
10814 /// # Example
10815 /// ```ignore,no_run
10816 /// # use google_cloud_build_v1::model::BuildOptions;
10817 /// use google_cloud_build_v1::model::build_options::PoolOption;
10818 /// let x = BuildOptions::new().set_pool(PoolOption::default()/* use setters */);
10819 /// ```
10820 pub fn set_pool<T>(mut self, v: T) -> Self
10821 where
10822 T: std::convert::Into<crate::model::build_options::PoolOption>,
10823 {
10824 self.pool = std::option::Option::Some(v.into());
10825 self
10826 }
10827
10828 /// Sets or clears the value of [pool][crate::model::BuildOptions::pool].
10829 ///
10830 /// # Example
10831 /// ```ignore,no_run
10832 /// # use google_cloud_build_v1::model::BuildOptions;
10833 /// use google_cloud_build_v1::model::build_options::PoolOption;
10834 /// let x = BuildOptions::new().set_or_clear_pool(Some(PoolOption::default()/* use setters */));
10835 /// let x = BuildOptions::new().set_or_clear_pool(None::<PoolOption>);
10836 /// ```
10837 pub fn set_or_clear_pool<T>(mut self, v: std::option::Option<T>) -> Self
10838 where
10839 T: std::convert::Into<crate::model::build_options::PoolOption>,
10840 {
10841 self.pool = v.map(|x| x.into());
10842 self
10843 }
10844
10845 /// Sets the value of [logging][crate::model::BuildOptions::logging].
10846 ///
10847 /// # Example
10848 /// ```ignore,no_run
10849 /// # use google_cloud_build_v1::model::BuildOptions;
10850 /// use google_cloud_build_v1::model::build_options::LoggingMode;
10851 /// let x0 = BuildOptions::new().set_logging(LoggingMode::Legacy);
10852 /// let x1 = BuildOptions::new().set_logging(LoggingMode::GcsOnly);
10853 /// let x2 = BuildOptions::new().set_logging(LoggingMode::CloudLoggingOnly);
10854 /// ```
10855 pub fn set_logging<T: std::convert::Into<crate::model::build_options::LoggingMode>>(
10856 mut self,
10857 v: T,
10858 ) -> Self {
10859 self.logging = v.into();
10860 self
10861 }
10862
10863 /// Sets the value of [env][crate::model::BuildOptions::env].
10864 ///
10865 /// # Example
10866 /// ```ignore,no_run
10867 /// # use google_cloud_build_v1::model::BuildOptions;
10868 /// let x = BuildOptions::new().set_env(["a", "b", "c"]);
10869 /// ```
10870 pub fn set_env<T, V>(mut self, v: T) -> Self
10871 where
10872 T: std::iter::IntoIterator<Item = V>,
10873 V: std::convert::Into<std::string::String>,
10874 {
10875 use std::iter::Iterator;
10876 self.env = v.into_iter().map(|i| i.into()).collect();
10877 self
10878 }
10879
10880 /// Sets the value of [secret_env][crate::model::BuildOptions::secret_env].
10881 ///
10882 /// # Example
10883 /// ```ignore,no_run
10884 /// # use google_cloud_build_v1::model::BuildOptions;
10885 /// let x = BuildOptions::new().set_secret_env(["a", "b", "c"]);
10886 /// ```
10887 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
10888 where
10889 T: std::iter::IntoIterator<Item = V>,
10890 V: std::convert::Into<std::string::String>,
10891 {
10892 use std::iter::Iterator;
10893 self.secret_env = v.into_iter().map(|i| i.into()).collect();
10894 self
10895 }
10896
10897 /// Sets the value of [volumes][crate::model::BuildOptions::volumes].
10898 ///
10899 /// # Example
10900 /// ```ignore,no_run
10901 /// # use google_cloud_build_v1::model::BuildOptions;
10902 /// use google_cloud_build_v1::model::Volume;
10903 /// let x = BuildOptions::new()
10904 /// .set_volumes([
10905 /// Volume::default()/* use setters */,
10906 /// Volume::default()/* use (different) setters */,
10907 /// ]);
10908 /// ```
10909 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10910 where
10911 T: std::iter::IntoIterator<Item = V>,
10912 V: std::convert::Into<crate::model::Volume>,
10913 {
10914 use std::iter::Iterator;
10915 self.volumes = v.into_iter().map(|i| i.into()).collect();
10916 self
10917 }
10918
10919 /// Sets the value of [default_logs_bucket_behavior][crate::model::BuildOptions::default_logs_bucket_behavior].
10920 ///
10921 /// # Example
10922 /// ```ignore,no_run
10923 /// # use google_cloud_build_v1::model::BuildOptions;
10924 /// use google_cloud_build_v1::model::build_options::DefaultLogsBucketBehavior;
10925 /// let x0 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::RegionalUserOwnedBucket);
10926 /// let x1 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::LegacyBucket);
10927 /// ```
10928 pub fn set_default_logs_bucket_behavior<
10929 T: std::convert::Into<crate::model::build_options::DefaultLogsBucketBehavior>,
10930 >(
10931 mut self,
10932 v: T,
10933 ) -> Self {
10934 self.default_logs_bucket_behavior = v.into();
10935 self
10936 }
10937
10938 /// Sets the value of [enable_structured_logging][crate::model::BuildOptions::enable_structured_logging].
10939 ///
10940 /// # Example
10941 /// ```ignore,no_run
10942 /// # use google_cloud_build_v1::model::BuildOptions;
10943 /// let x = BuildOptions::new().set_enable_structured_logging(true);
10944 /// ```
10945 pub fn set_enable_structured_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10946 self.enable_structured_logging = v.into();
10947 self
10948 }
10949}
10950
10951impl wkt::message::Message for BuildOptions {
10952 fn typename() -> &'static str {
10953 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions"
10954 }
10955}
10956
10957/// Defines additional types related to [BuildOptions].
10958pub mod build_options {
10959 #[allow(unused_imports)]
10960 use super::*;
10961
10962 /// Details about how a build should be executed on a `WorkerPool`.
10963 ///
10964 /// See [running builds in a private
10965 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10966 /// for more information.
10967 #[derive(Clone, Default, PartialEq)]
10968 #[non_exhaustive]
10969 pub struct PoolOption {
10970 /// The `WorkerPool` resource to execute the build on.
10971 /// You must have `cloudbuild.workerpools.use` on the project hosting the
10972 /// WorkerPool.
10973 ///
10974 /// Format projects/{project}/locations/{location}/workerPools/{workerPoolId}
10975 pub name: std::string::String,
10976
10977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10978 }
10979
10980 impl PoolOption {
10981 pub fn new() -> Self {
10982 std::default::Default::default()
10983 }
10984
10985 /// Sets the value of [name][crate::model::build_options::PoolOption::name].
10986 ///
10987 /// # Example
10988 /// ```ignore,no_run
10989 /// # use google_cloud_build_v1::model::build_options::PoolOption;
10990 /// let x = PoolOption::new().set_name("example");
10991 /// ```
10992 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10993 self.name = v.into();
10994 self
10995 }
10996 }
10997
10998 impl wkt::message::Message for PoolOption {
10999 fn typename() -> &'static str {
11000 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions.PoolOption"
11001 }
11002 }
11003
11004 /// Specifies the manner in which the build should be verified, if at all.
11005 ///
11006 /// If a verified build is requested, and any part of the process to generate
11007 /// and upload provenance fails, the build will also fail.
11008 ///
11009 /// If the build does not request verification then that process may occur, but
11010 /// is not guaranteed to. If it does occur and fails, the build will not fail.
11011 ///
11012 /// For more information, see [Viewing Build
11013 /// Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance).
11014 ///
11015 /// # Working with unknown values
11016 ///
11017 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11018 /// additional enum variants at any time. Adding new variants is not considered
11019 /// a breaking change. Applications should write their code in anticipation of:
11020 ///
11021 /// - New values appearing in future releases of the client library, **and**
11022 /// - New values received dynamically, without application changes.
11023 ///
11024 /// Please consult the [Working with enums] section in the user guide for some
11025 /// guidelines.
11026 ///
11027 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11028 #[derive(Clone, Debug, PartialEq)]
11029 #[non_exhaustive]
11030 pub enum VerifyOption {
11031 /// Not a verifiable build (the default).
11032 NotVerified,
11033 /// Build must be verified.
11034 Verified,
11035 /// If set, the enum was initialized with an unknown value.
11036 ///
11037 /// Applications can examine the value using [VerifyOption::value] or
11038 /// [VerifyOption::name].
11039 UnknownValue(verify_option::UnknownValue),
11040 }
11041
11042 #[doc(hidden)]
11043 pub mod verify_option {
11044 #[allow(unused_imports)]
11045 use super::*;
11046 #[derive(Clone, Debug, PartialEq)]
11047 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11048 }
11049
11050 impl VerifyOption {
11051 /// Gets the enum value.
11052 ///
11053 /// Returns `None` if the enum contains an unknown value deserialized from
11054 /// the string representation of enums.
11055 pub fn value(&self) -> std::option::Option<i32> {
11056 match self {
11057 Self::NotVerified => std::option::Option::Some(0),
11058 Self::Verified => std::option::Option::Some(1),
11059 Self::UnknownValue(u) => u.0.value(),
11060 }
11061 }
11062
11063 /// Gets the enum value as a string.
11064 ///
11065 /// Returns `None` if the enum contains an unknown value deserialized from
11066 /// the integer representation of enums.
11067 pub fn name(&self) -> std::option::Option<&str> {
11068 match self {
11069 Self::NotVerified => std::option::Option::Some("NOT_VERIFIED"),
11070 Self::Verified => std::option::Option::Some("VERIFIED"),
11071 Self::UnknownValue(u) => u.0.name(),
11072 }
11073 }
11074 }
11075
11076 impl std::default::Default for VerifyOption {
11077 fn default() -> Self {
11078 use std::convert::From;
11079 Self::from(0)
11080 }
11081 }
11082
11083 impl std::fmt::Display for VerifyOption {
11084 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11085 wkt::internal::display_enum(f, self.name(), self.value())
11086 }
11087 }
11088
11089 impl std::convert::From<i32> for VerifyOption {
11090 fn from(value: i32) -> Self {
11091 match value {
11092 0 => Self::NotVerified,
11093 1 => Self::Verified,
11094 _ => Self::UnknownValue(verify_option::UnknownValue(
11095 wkt::internal::UnknownEnumValue::Integer(value),
11096 )),
11097 }
11098 }
11099 }
11100
11101 impl std::convert::From<&str> for VerifyOption {
11102 fn from(value: &str) -> Self {
11103 use std::string::ToString;
11104 match value {
11105 "NOT_VERIFIED" => Self::NotVerified,
11106 "VERIFIED" => Self::Verified,
11107 _ => Self::UnknownValue(verify_option::UnknownValue(
11108 wkt::internal::UnknownEnumValue::String(value.to_string()),
11109 )),
11110 }
11111 }
11112 }
11113
11114 impl serde::ser::Serialize for VerifyOption {
11115 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11116 where
11117 S: serde::Serializer,
11118 {
11119 match self {
11120 Self::NotVerified => serializer.serialize_i32(0),
11121 Self::Verified => serializer.serialize_i32(1),
11122 Self::UnknownValue(u) => u.0.serialize(serializer),
11123 }
11124 }
11125 }
11126
11127 impl<'de> serde::de::Deserialize<'de> for VerifyOption {
11128 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11129 where
11130 D: serde::Deserializer<'de>,
11131 {
11132 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerifyOption>::new(
11133 ".google.devtools.cloudbuild.v1.BuildOptions.VerifyOption",
11134 ))
11135 }
11136 }
11137
11138 /// Supported Compute Engine machine types.
11139 /// For more information, see [Machine
11140 /// types](https://cloud.google.com/compute/docs/machine-types).
11141 ///
11142 /// # Working with unknown values
11143 ///
11144 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11145 /// additional enum variants at any time. Adding new variants is not considered
11146 /// a breaking change. Applications should write their code in anticipation of:
11147 ///
11148 /// - New values appearing in future releases of the client library, **and**
11149 /// - New values received dynamically, without application changes.
11150 ///
11151 /// Please consult the [Working with enums] section in the user guide for some
11152 /// guidelines.
11153 ///
11154 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11155 #[derive(Clone, Debug, PartialEq)]
11156 #[non_exhaustive]
11157 pub enum MachineType {
11158 /// Standard machine type.
11159 Unspecified,
11160 /// Highcpu machine with 8 CPUs.
11161 N1Highcpu8,
11162 /// Highcpu machine with 32 CPUs.
11163 N1Highcpu32,
11164 /// Highcpu e2 machine with 8 CPUs.
11165 E2Highcpu8,
11166 /// Highcpu e2 machine with 32 CPUs.
11167 E2Highcpu32,
11168 /// E2 machine with 1 CPU.
11169 E2Medium,
11170 /// If set, the enum was initialized with an unknown value.
11171 ///
11172 /// Applications can examine the value using [MachineType::value] or
11173 /// [MachineType::name].
11174 UnknownValue(machine_type::UnknownValue),
11175 }
11176
11177 #[doc(hidden)]
11178 pub mod machine_type {
11179 #[allow(unused_imports)]
11180 use super::*;
11181 #[derive(Clone, Debug, PartialEq)]
11182 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11183 }
11184
11185 impl MachineType {
11186 /// Gets the enum value.
11187 ///
11188 /// Returns `None` if the enum contains an unknown value deserialized from
11189 /// the string representation of enums.
11190 pub fn value(&self) -> std::option::Option<i32> {
11191 match self {
11192 Self::Unspecified => std::option::Option::Some(0),
11193 Self::N1Highcpu8 => std::option::Option::Some(1),
11194 Self::N1Highcpu32 => std::option::Option::Some(2),
11195 Self::E2Highcpu8 => std::option::Option::Some(5),
11196 Self::E2Highcpu32 => std::option::Option::Some(6),
11197 Self::E2Medium => std::option::Option::Some(7),
11198 Self::UnknownValue(u) => u.0.value(),
11199 }
11200 }
11201
11202 /// Gets the enum value as a string.
11203 ///
11204 /// Returns `None` if the enum contains an unknown value deserialized from
11205 /// the integer representation of enums.
11206 pub fn name(&self) -> std::option::Option<&str> {
11207 match self {
11208 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
11209 Self::N1Highcpu8 => std::option::Option::Some("N1_HIGHCPU_8"),
11210 Self::N1Highcpu32 => std::option::Option::Some("N1_HIGHCPU_32"),
11211 Self::E2Highcpu8 => std::option::Option::Some("E2_HIGHCPU_8"),
11212 Self::E2Highcpu32 => std::option::Option::Some("E2_HIGHCPU_32"),
11213 Self::E2Medium => std::option::Option::Some("E2_MEDIUM"),
11214 Self::UnknownValue(u) => u.0.name(),
11215 }
11216 }
11217 }
11218
11219 impl std::default::Default for MachineType {
11220 fn default() -> Self {
11221 use std::convert::From;
11222 Self::from(0)
11223 }
11224 }
11225
11226 impl std::fmt::Display for MachineType {
11227 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11228 wkt::internal::display_enum(f, self.name(), self.value())
11229 }
11230 }
11231
11232 impl std::convert::From<i32> for MachineType {
11233 fn from(value: i32) -> Self {
11234 match value {
11235 0 => Self::Unspecified,
11236 1 => Self::N1Highcpu8,
11237 2 => Self::N1Highcpu32,
11238 5 => Self::E2Highcpu8,
11239 6 => Self::E2Highcpu32,
11240 7 => Self::E2Medium,
11241 _ => Self::UnknownValue(machine_type::UnknownValue(
11242 wkt::internal::UnknownEnumValue::Integer(value),
11243 )),
11244 }
11245 }
11246 }
11247
11248 impl std::convert::From<&str> for MachineType {
11249 fn from(value: &str) -> Self {
11250 use std::string::ToString;
11251 match value {
11252 "UNSPECIFIED" => Self::Unspecified,
11253 "N1_HIGHCPU_8" => Self::N1Highcpu8,
11254 "N1_HIGHCPU_32" => Self::N1Highcpu32,
11255 "E2_HIGHCPU_8" => Self::E2Highcpu8,
11256 "E2_HIGHCPU_32" => Self::E2Highcpu32,
11257 "E2_MEDIUM" => Self::E2Medium,
11258 _ => Self::UnknownValue(machine_type::UnknownValue(
11259 wkt::internal::UnknownEnumValue::String(value.to_string()),
11260 )),
11261 }
11262 }
11263 }
11264
11265 impl serde::ser::Serialize for MachineType {
11266 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11267 where
11268 S: serde::Serializer,
11269 {
11270 match self {
11271 Self::Unspecified => serializer.serialize_i32(0),
11272 Self::N1Highcpu8 => serializer.serialize_i32(1),
11273 Self::N1Highcpu32 => serializer.serialize_i32(2),
11274 Self::E2Highcpu8 => serializer.serialize_i32(5),
11275 Self::E2Highcpu32 => serializer.serialize_i32(6),
11276 Self::E2Medium => serializer.serialize_i32(7),
11277 Self::UnknownValue(u) => u.0.serialize(serializer),
11278 }
11279 }
11280 }
11281
11282 impl<'de> serde::de::Deserialize<'de> for MachineType {
11283 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11284 where
11285 D: serde::Deserializer<'de>,
11286 {
11287 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MachineType>::new(
11288 ".google.devtools.cloudbuild.v1.BuildOptions.MachineType",
11289 ))
11290 }
11291 }
11292
11293 /// Specifies the behavior when there is an error in the substitution checks.
11294 ///
11295 /// # Working with unknown values
11296 ///
11297 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11298 /// additional enum variants at any time. Adding new variants is not considered
11299 /// a breaking change. Applications should write their code in anticipation of:
11300 ///
11301 /// - New values appearing in future releases of the client library, **and**
11302 /// - New values received dynamically, without application changes.
11303 ///
11304 /// Please consult the [Working with enums] section in the user guide for some
11305 /// guidelines.
11306 ///
11307 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11308 #[derive(Clone, Debug, PartialEq)]
11309 #[non_exhaustive]
11310 pub enum SubstitutionOption {
11311 /// Fails the build if error in substitutions checks, like missing
11312 /// a substitution in the template or in the map.
11313 MustMatch,
11314 /// Do not fail the build if error in substitutions checks.
11315 AllowLoose,
11316 /// If set, the enum was initialized with an unknown value.
11317 ///
11318 /// Applications can examine the value using [SubstitutionOption::value] or
11319 /// [SubstitutionOption::name].
11320 UnknownValue(substitution_option::UnknownValue),
11321 }
11322
11323 #[doc(hidden)]
11324 pub mod substitution_option {
11325 #[allow(unused_imports)]
11326 use super::*;
11327 #[derive(Clone, Debug, PartialEq)]
11328 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11329 }
11330
11331 impl SubstitutionOption {
11332 /// Gets the enum value.
11333 ///
11334 /// Returns `None` if the enum contains an unknown value deserialized from
11335 /// the string representation of enums.
11336 pub fn value(&self) -> std::option::Option<i32> {
11337 match self {
11338 Self::MustMatch => std::option::Option::Some(0),
11339 Self::AllowLoose => std::option::Option::Some(1),
11340 Self::UnknownValue(u) => u.0.value(),
11341 }
11342 }
11343
11344 /// Gets the enum value as a string.
11345 ///
11346 /// Returns `None` if the enum contains an unknown value deserialized from
11347 /// the integer representation of enums.
11348 pub fn name(&self) -> std::option::Option<&str> {
11349 match self {
11350 Self::MustMatch => std::option::Option::Some("MUST_MATCH"),
11351 Self::AllowLoose => std::option::Option::Some("ALLOW_LOOSE"),
11352 Self::UnknownValue(u) => u.0.name(),
11353 }
11354 }
11355 }
11356
11357 impl std::default::Default for SubstitutionOption {
11358 fn default() -> Self {
11359 use std::convert::From;
11360 Self::from(0)
11361 }
11362 }
11363
11364 impl std::fmt::Display for SubstitutionOption {
11365 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11366 wkt::internal::display_enum(f, self.name(), self.value())
11367 }
11368 }
11369
11370 impl std::convert::From<i32> for SubstitutionOption {
11371 fn from(value: i32) -> Self {
11372 match value {
11373 0 => Self::MustMatch,
11374 1 => Self::AllowLoose,
11375 _ => Self::UnknownValue(substitution_option::UnknownValue(
11376 wkt::internal::UnknownEnumValue::Integer(value),
11377 )),
11378 }
11379 }
11380 }
11381
11382 impl std::convert::From<&str> for SubstitutionOption {
11383 fn from(value: &str) -> Self {
11384 use std::string::ToString;
11385 match value {
11386 "MUST_MATCH" => Self::MustMatch,
11387 "ALLOW_LOOSE" => Self::AllowLoose,
11388 _ => Self::UnknownValue(substitution_option::UnknownValue(
11389 wkt::internal::UnknownEnumValue::String(value.to_string()),
11390 )),
11391 }
11392 }
11393 }
11394
11395 impl serde::ser::Serialize for SubstitutionOption {
11396 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11397 where
11398 S: serde::Serializer,
11399 {
11400 match self {
11401 Self::MustMatch => serializer.serialize_i32(0),
11402 Self::AllowLoose => serializer.serialize_i32(1),
11403 Self::UnknownValue(u) => u.0.serialize(serializer),
11404 }
11405 }
11406 }
11407
11408 impl<'de> serde::de::Deserialize<'de> for SubstitutionOption {
11409 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11410 where
11411 D: serde::Deserializer<'de>,
11412 {
11413 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SubstitutionOption>::new(
11414 ".google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption",
11415 ))
11416 }
11417 }
11418
11419 /// Specifies the behavior when writing build logs to Cloud Storage.
11420 ///
11421 /// # Working with unknown values
11422 ///
11423 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11424 /// additional enum variants at any time. Adding new variants is not considered
11425 /// a breaking change. Applications should write their code in anticipation of:
11426 ///
11427 /// - New values appearing in future releases of the client library, **and**
11428 /// - New values received dynamically, without application changes.
11429 ///
11430 /// Please consult the [Working with enums] section in the user guide for some
11431 /// guidelines.
11432 ///
11433 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11434 #[derive(Clone, Debug, PartialEq)]
11435 #[non_exhaustive]
11436 pub enum LogStreamingOption {
11437 /// Service may automatically determine build log streaming behavior.
11438 StreamDefault,
11439 /// Build logs should be streamed to Cloud Storage.
11440 StreamOn,
11441 /// Build logs should not be streamed to Cloud Storage; they will be
11442 /// written when the build is completed.
11443 StreamOff,
11444 /// If set, the enum was initialized with an unknown value.
11445 ///
11446 /// Applications can examine the value using [LogStreamingOption::value] or
11447 /// [LogStreamingOption::name].
11448 UnknownValue(log_streaming_option::UnknownValue),
11449 }
11450
11451 #[doc(hidden)]
11452 pub mod log_streaming_option {
11453 #[allow(unused_imports)]
11454 use super::*;
11455 #[derive(Clone, Debug, PartialEq)]
11456 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11457 }
11458
11459 impl LogStreamingOption {
11460 /// Gets the enum value.
11461 ///
11462 /// Returns `None` if the enum contains an unknown value deserialized from
11463 /// the string representation of enums.
11464 pub fn value(&self) -> std::option::Option<i32> {
11465 match self {
11466 Self::StreamDefault => std::option::Option::Some(0),
11467 Self::StreamOn => std::option::Option::Some(1),
11468 Self::StreamOff => std::option::Option::Some(2),
11469 Self::UnknownValue(u) => u.0.value(),
11470 }
11471 }
11472
11473 /// Gets the enum value as a string.
11474 ///
11475 /// Returns `None` if the enum contains an unknown value deserialized from
11476 /// the integer representation of enums.
11477 pub fn name(&self) -> std::option::Option<&str> {
11478 match self {
11479 Self::StreamDefault => std::option::Option::Some("STREAM_DEFAULT"),
11480 Self::StreamOn => std::option::Option::Some("STREAM_ON"),
11481 Self::StreamOff => std::option::Option::Some("STREAM_OFF"),
11482 Self::UnknownValue(u) => u.0.name(),
11483 }
11484 }
11485 }
11486
11487 impl std::default::Default for LogStreamingOption {
11488 fn default() -> Self {
11489 use std::convert::From;
11490 Self::from(0)
11491 }
11492 }
11493
11494 impl std::fmt::Display for LogStreamingOption {
11495 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11496 wkt::internal::display_enum(f, self.name(), self.value())
11497 }
11498 }
11499
11500 impl std::convert::From<i32> for LogStreamingOption {
11501 fn from(value: i32) -> Self {
11502 match value {
11503 0 => Self::StreamDefault,
11504 1 => Self::StreamOn,
11505 2 => Self::StreamOff,
11506 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11507 wkt::internal::UnknownEnumValue::Integer(value),
11508 )),
11509 }
11510 }
11511 }
11512
11513 impl std::convert::From<&str> for LogStreamingOption {
11514 fn from(value: &str) -> Self {
11515 use std::string::ToString;
11516 match value {
11517 "STREAM_DEFAULT" => Self::StreamDefault,
11518 "STREAM_ON" => Self::StreamOn,
11519 "STREAM_OFF" => Self::StreamOff,
11520 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11521 wkt::internal::UnknownEnumValue::String(value.to_string()),
11522 )),
11523 }
11524 }
11525 }
11526
11527 impl serde::ser::Serialize for LogStreamingOption {
11528 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11529 where
11530 S: serde::Serializer,
11531 {
11532 match self {
11533 Self::StreamDefault => serializer.serialize_i32(0),
11534 Self::StreamOn => serializer.serialize_i32(1),
11535 Self::StreamOff => serializer.serialize_i32(2),
11536 Self::UnknownValue(u) => u.0.serialize(serializer),
11537 }
11538 }
11539 }
11540
11541 impl<'de> serde::de::Deserialize<'de> for LogStreamingOption {
11542 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11543 where
11544 D: serde::Deserializer<'de>,
11545 {
11546 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogStreamingOption>::new(
11547 ".google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption",
11548 ))
11549 }
11550 }
11551
11552 /// Specifies the logging mode.
11553 ///
11554 /// # Working with unknown values
11555 ///
11556 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11557 /// additional enum variants at any time. Adding new variants is not considered
11558 /// a breaking change. Applications should write their code in anticipation of:
11559 ///
11560 /// - New values appearing in future releases of the client library, **and**
11561 /// - New values received dynamically, without application changes.
11562 ///
11563 /// Please consult the [Working with enums] section in the user guide for some
11564 /// guidelines.
11565 ///
11566 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11567 #[derive(Clone, Debug, PartialEq)]
11568 #[non_exhaustive]
11569 pub enum LoggingMode {
11570 /// The service determines the logging mode. The default is `LEGACY`. Do not
11571 /// rely on the default logging behavior as it may change in the future.
11572 LoggingUnspecified,
11573 /// Build logs are stored in Cloud Logging and Cloud Storage.
11574 Legacy,
11575 /// Build logs are stored in Cloud Storage.
11576 GcsOnly,
11577 /// This option is the same as CLOUD_LOGGING_ONLY.
11578 #[deprecated]
11579 StackdriverOnly,
11580 /// Build logs are stored in Cloud Logging. Selecting this option will not
11581 /// allow [logs
11582 /// streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log).
11583 CloudLoggingOnly,
11584 /// Turn off all logging. No build logs will be captured.
11585 None,
11586 /// If set, the enum was initialized with an unknown value.
11587 ///
11588 /// Applications can examine the value using [LoggingMode::value] or
11589 /// [LoggingMode::name].
11590 UnknownValue(logging_mode::UnknownValue),
11591 }
11592
11593 #[doc(hidden)]
11594 pub mod logging_mode {
11595 #[allow(unused_imports)]
11596 use super::*;
11597 #[derive(Clone, Debug, PartialEq)]
11598 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11599 }
11600
11601 impl LoggingMode {
11602 /// Gets the enum value.
11603 ///
11604 /// Returns `None` if the enum contains an unknown value deserialized from
11605 /// the string representation of enums.
11606 pub fn value(&self) -> std::option::Option<i32> {
11607 match self {
11608 Self::LoggingUnspecified => std::option::Option::Some(0),
11609 Self::Legacy => std::option::Option::Some(1),
11610 Self::GcsOnly => std::option::Option::Some(2),
11611 Self::StackdriverOnly => std::option::Option::Some(3),
11612 Self::CloudLoggingOnly => std::option::Option::Some(5),
11613 Self::None => std::option::Option::Some(4),
11614 Self::UnknownValue(u) => u.0.value(),
11615 }
11616 }
11617
11618 /// Gets the enum value as a string.
11619 ///
11620 /// Returns `None` if the enum contains an unknown value deserialized from
11621 /// the integer representation of enums.
11622 pub fn name(&self) -> std::option::Option<&str> {
11623 match self {
11624 Self::LoggingUnspecified => std::option::Option::Some("LOGGING_UNSPECIFIED"),
11625 Self::Legacy => std::option::Option::Some("LEGACY"),
11626 Self::GcsOnly => std::option::Option::Some("GCS_ONLY"),
11627 Self::StackdriverOnly => std::option::Option::Some("STACKDRIVER_ONLY"),
11628 Self::CloudLoggingOnly => std::option::Option::Some("CLOUD_LOGGING_ONLY"),
11629 Self::None => std::option::Option::Some("NONE"),
11630 Self::UnknownValue(u) => u.0.name(),
11631 }
11632 }
11633 }
11634
11635 impl std::default::Default for LoggingMode {
11636 fn default() -> Self {
11637 use std::convert::From;
11638 Self::from(0)
11639 }
11640 }
11641
11642 impl std::fmt::Display for LoggingMode {
11643 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11644 wkt::internal::display_enum(f, self.name(), self.value())
11645 }
11646 }
11647
11648 impl std::convert::From<i32> for LoggingMode {
11649 fn from(value: i32) -> Self {
11650 match value {
11651 0 => Self::LoggingUnspecified,
11652 1 => Self::Legacy,
11653 2 => Self::GcsOnly,
11654 3 => Self::StackdriverOnly,
11655 4 => Self::None,
11656 5 => Self::CloudLoggingOnly,
11657 _ => Self::UnknownValue(logging_mode::UnknownValue(
11658 wkt::internal::UnknownEnumValue::Integer(value),
11659 )),
11660 }
11661 }
11662 }
11663
11664 impl std::convert::From<&str> for LoggingMode {
11665 fn from(value: &str) -> Self {
11666 use std::string::ToString;
11667 match value {
11668 "LOGGING_UNSPECIFIED" => Self::LoggingUnspecified,
11669 "LEGACY" => Self::Legacy,
11670 "GCS_ONLY" => Self::GcsOnly,
11671 "STACKDRIVER_ONLY" => Self::StackdriverOnly,
11672 "CLOUD_LOGGING_ONLY" => Self::CloudLoggingOnly,
11673 "NONE" => Self::None,
11674 _ => Self::UnknownValue(logging_mode::UnknownValue(
11675 wkt::internal::UnknownEnumValue::String(value.to_string()),
11676 )),
11677 }
11678 }
11679 }
11680
11681 impl serde::ser::Serialize for LoggingMode {
11682 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11683 where
11684 S: serde::Serializer,
11685 {
11686 match self {
11687 Self::LoggingUnspecified => serializer.serialize_i32(0),
11688 Self::Legacy => serializer.serialize_i32(1),
11689 Self::GcsOnly => serializer.serialize_i32(2),
11690 Self::StackdriverOnly => serializer.serialize_i32(3),
11691 Self::CloudLoggingOnly => serializer.serialize_i32(5),
11692 Self::None => serializer.serialize_i32(4),
11693 Self::UnknownValue(u) => u.0.serialize(serializer),
11694 }
11695 }
11696 }
11697
11698 impl<'de> serde::de::Deserialize<'de> for LoggingMode {
11699 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11700 where
11701 D: serde::Deserializer<'de>,
11702 {
11703 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggingMode>::new(
11704 ".google.devtools.cloudbuild.v1.BuildOptions.LoggingMode",
11705 ))
11706 }
11707 }
11708
11709 /// Default Cloud Storage log bucket behavior options.
11710 ///
11711 /// # Working with unknown values
11712 ///
11713 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11714 /// additional enum variants at any time. Adding new variants is not considered
11715 /// a breaking change. Applications should write their code in anticipation of:
11716 ///
11717 /// - New values appearing in future releases of the client library, **and**
11718 /// - New values received dynamically, without application changes.
11719 ///
11720 /// Please consult the [Working with enums] section in the user guide for some
11721 /// guidelines.
11722 ///
11723 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11724 #[derive(Clone, Debug, PartialEq)]
11725 #[non_exhaustive]
11726 pub enum DefaultLogsBucketBehavior {
11727 /// Unspecified.
11728 Unspecified,
11729 /// Bucket is located in user-owned project in the same region as the
11730 /// build. The builder service account must have access to create and write
11731 /// to Cloud Storage buckets in the build project.
11732 RegionalUserOwnedBucket,
11733 /// Bucket is located in a Google-owned project and is not regionalized.
11734 LegacyBucket,
11735 /// If set, the enum was initialized with an unknown value.
11736 ///
11737 /// Applications can examine the value using [DefaultLogsBucketBehavior::value] or
11738 /// [DefaultLogsBucketBehavior::name].
11739 UnknownValue(default_logs_bucket_behavior::UnknownValue),
11740 }
11741
11742 #[doc(hidden)]
11743 pub mod default_logs_bucket_behavior {
11744 #[allow(unused_imports)]
11745 use super::*;
11746 #[derive(Clone, Debug, PartialEq)]
11747 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11748 }
11749
11750 impl DefaultLogsBucketBehavior {
11751 /// Gets the enum value.
11752 ///
11753 /// Returns `None` if the enum contains an unknown value deserialized from
11754 /// the string representation of enums.
11755 pub fn value(&self) -> std::option::Option<i32> {
11756 match self {
11757 Self::Unspecified => std::option::Option::Some(0),
11758 Self::RegionalUserOwnedBucket => std::option::Option::Some(1),
11759 Self::LegacyBucket => std::option::Option::Some(2),
11760 Self::UnknownValue(u) => u.0.value(),
11761 }
11762 }
11763
11764 /// Gets the enum value as a string.
11765 ///
11766 /// Returns `None` if the enum contains an unknown value deserialized from
11767 /// the integer representation of enums.
11768 pub fn name(&self) -> std::option::Option<&str> {
11769 match self {
11770 Self::Unspecified => {
11771 std::option::Option::Some("DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED")
11772 }
11773 Self::RegionalUserOwnedBucket => {
11774 std::option::Option::Some("REGIONAL_USER_OWNED_BUCKET")
11775 }
11776 Self::LegacyBucket => std::option::Option::Some("LEGACY_BUCKET"),
11777 Self::UnknownValue(u) => u.0.name(),
11778 }
11779 }
11780 }
11781
11782 impl std::default::Default for DefaultLogsBucketBehavior {
11783 fn default() -> Self {
11784 use std::convert::From;
11785 Self::from(0)
11786 }
11787 }
11788
11789 impl std::fmt::Display for DefaultLogsBucketBehavior {
11790 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11791 wkt::internal::display_enum(f, self.name(), self.value())
11792 }
11793 }
11794
11795 impl std::convert::From<i32> for DefaultLogsBucketBehavior {
11796 fn from(value: i32) -> Self {
11797 match value {
11798 0 => Self::Unspecified,
11799 1 => Self::RegionalUserOwnedBucket,
11800 2 => Self::LegacyBucket,
11801 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11802 wkt::internal::UnknownEnumValue::Integer(value),
11803 )),
11804 }
11805 }
11806 }
11807
11808 impl std::convert::From<&str> for DefaultLogsBucketBehavior {
11809 fn from(value: &str) -> Self {
11810 use std::string::ToString;
11811 match value {
11812 "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11813 "REGIONAL_USER_OWNED_BUCKET" => Self::RegionalUserOwnedBucket,
11814 "LEGACY_BUCKET" => Self::LegacyBucket,
11815 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11816 wkt::internal::UnknownEnumValue::String(value.to_string()),
11817 )),
11818 }
11819 }
11820 }
11821
11822 impl serde::ser::Serialize for DefaultLogsBucketBehavior {
11823 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11824 where
11825 S: serde::Serializer,
11826 {
11827 match self {
11828 Self::Unspecified => serializer.serialize_i32(0),
11829 Self::RegionalUserOwnedBucket => serializer.serialize_i32(1),
11830 Self::LegacyBucket => serializer.serialize_i32(2),
11831 Self::UnknownValue(u) => u.0.serialize(serializer),
11832 }
11833 }
11834 }
11835
11836 impl<'de> serde::de::Deserialize<'de> for DefaultLogsBucketBehavior {
11837 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11838 where
11839 D: serde::Deserializer<'de>,
11840 {
11841 deserializer.deserialize_any(
11842 wkt::internal::EnumVisitor::<DefaultLogsBucketBehavior>::new(
11843 ".google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior",
11844 ),
11845 )
11846 }
11847 }
11848}
11849
11850/// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by
11851/// the ReceiveTriggerWebhook method.
11852#[derive(Clone, Default, PartialEq)]
11853#[non_exhaustive]
11854pub struct ReceiveTriggerWebhookRequest {
11855 /// The name of the `ReceiveTriggerWebhook` to retrieve.
11856 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
11857 pub name: std::string::String,
11858
11859 /// HTTP request body.
11860 pub body: std::option::Option<api::model::HttpBody>,
11861
11862 /// Project in which the specified trigger lives
11863 pub project_id: std::string::String,
11864
11865 /// Name of the trigger to run the payload against
11866 pub trigger: std::string::String,
11867
11868 /// Secret token used for authorization if an OAuth token isn't provided.
11869 pub secret: std::string::String,
11870
11871 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11872}
11873
11874impl ReceiveTriggerWebhookRequest {
11875 pub fn new() -> Self {
11876 std::default::Default::default()
11877 }
11878
11879 /// Sets the value of [name][crate::model::ReceiveTriggerWebhookRequest::name].
11880 ///
11881 /// # Example
11882 /// ```ignore,no_run
11883 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11884 /// let x = ReceiveTriggerWebhookRequest::new().set_name("example");
11885 /// ```
11886 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11887 self.name = v.into();
11888 self
11889 }
11890
11891 /// Sets the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
11892 ///
11893 /// # Example
11894 /// ```ignore,no_run
11895 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11896 /// use api::model::HttpBody;
11897 /// let x = ReceiveTriggerWebhookRequest::new().set_body(HttpBody::default()/* use setters */);
11898 /// ```
11899 pub fn set_body<T>(mut self, v: T) -> Self
11900 where
11901 T: std::convert::Into<api::model::HttpBody>,
11902 {
11903 self.body = std::option::Option::Some(v.into());
11904 self
11905 }
11906
11907 /// Sets or clears the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
11908 ///
11909 /// # Example
11910 /// ```ignore,no_run
11911 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11912 /// use api::model::HttpBody;
11913 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(Some(HttpBody::default()/* use setters */));
11914 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(None::<HttpBody>);
11915 /// ```
11916 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
11917 where
11918 T: std::convert::Into<api::model::HttpBody>,
11919 {
11920 self.body = v.map(|x| x.into());
11921 self
11922 }
11923
11924 /// Sets the value of [project_id][crate::model::ReceiveTriggerWebhookRequest::project_id].
11925 ///
11926 /// # Example
11927 /// ```ignore,no_run
11928 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11929 /// let x = ReceiveTriggerWebhookRequest::new().set_project_id("example");
11930 /// ```
11931 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11932 self.project_id = v.into();
11933 self
11934 }
11935
11936 /// Sets the value of [trigger][crate::model::ReceiveTriggerWebhookRequest::trigger].
11937 ///
11938 /// # Example
11939 /// ```ignore,no_run
11940 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11941 /// let x = ReceiveTriggerWebhookRequest::new().set_trigger("example");
11942 /// ```
11943 pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11944 self.trigger = v.into();
11945 self
11946 }
11947
11948 /// Sets the value of [secret][crate::model::ReceiveTriggerWebhookRequest::secret].
11949 ///
11950 /// # Example
11951 /// ```ignore,no_run
11952 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11953 /// let x = ReceiveTriggerWebhookRequest::new().set_secret("example");
11954 /// ```
11955 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11956 self.secret = v.into();
11957 self
11958 }
11959}
11960
11961impl wkt::message::Message for ReceiveTriggerWebhookRequest {
11962 fn typename() -> &'static str {
11963 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest"
11964 }
11965}
11966
11967/// ReceiveTriggerWebhookResponse [Experimental] is the response object for the
11968/// ReceiveTriggerWebhook method.
11969#[derive(Clone, Default, PartialEq)]
11970#[non_exhaustive]
11971pub struct ReceiveTriggerWebhookResponse {
11972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11973}
11974
11975impl ReceiveTriggerWebhookResponse {
11976 pub fn new() -> Self {
11977 std::default::Default::default()
11978 }
11979}
11980
11981impl wkt::message::Message for ReceiveTriggerWebhookResponse {
11982 fn typename() -> &'static str {
11983 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse"
11984 }
11985}
11986
11987/// GitHubEnterpriseConfig represents a configuration for a GitHub Enterprise
11988/// server.
11989#[derive(Clone, Default, PartialEq)]
11990#[non_exhaustive]
11991pub struct GitHubEnterpriseConfig {
11992 /// The full resource name for the GitHubEnterpriseConfig
11993 /// For example:
11994 /// "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}"
11995 pub name: std::string::String,
11996
11997 /// The URL of the github enterprise host the configuration is for.
11998 pub host_url: std::string::String,
11999
12000 /// Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise
12001 /// server.
12002 pub app_id: i64,
12003
12004 /// Output only. Time when the installation was associated with the project.
12005 pub create_time: std::option::Option<wkt::Timestamp>,
12006
12007 /// The key that should be attached to webhook calls to the ReceiveWebhook
12008 /// endpoint.
12009 pub webhook_key: std::string::String,
12010
12011 /// Optional. The network to be used when reaching out to the GitHub
12012 /// Enterprise server. The VPC network must be enabled for private
12013 /// service connection. This should be set if the GitHub Enterprise server is
12014 /// hosted on-premises and not reachable by public internet.
12015 /// If this field is left empty, no network peering will occur and calls to
12016 /// the GitHub Enterprise server will be made over the public internet.
12017 /// Must be in the format
12018 /// `projects/{project}/global/networks/{network}`, where {project}
12019 /// is a project number or id and {network} is the name of a
12020 /// VPC network in the project.
12021 pub peered_network: std::string::String,
12022
12023 /// Optional. Names of secrets in Secret Manager.
12024 pub secrets: std::option::Option<crate::model::GitHubEnterpriseSecrets>,
12025
12026 /// Optional. Name to display for this config.
12027 pub display_name: std::string::String,
12028
12029 /// Optional. SSL certificate to use for requests to GitHub Enterprise.
12030 pub ssl_ca: std::string::String,
12031
12032 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12033}
12034
12035impl GitHubEnterpriseConfig {
12036 pub fn new() -> Self {
12037 std::default::Default::default()
12038 }
12039
12040 /// Sets the value of [name][crate::model::GitHubEnterpriseConfig::name].
12041 ///
12042 /// # Example
12043 /// ```ignore,no_run
12044 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12045 /// let x = GitHubEnterpriseConfig::new().set_name("example");
12046 /// ```
12047 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12048 self.name = v.into();
12049 self
12050 }
12051
12052 /// Sets the value of [host_url][crate::model::GitHubEnterpriseConfig::host_url].
12053 ///
12054 /// # Example
12055 /// ```ignore,no_run
12056 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12057 /// let x = GitHubEnterpriseConfig::new().set_host_url("example");
12058 /// ```
12059 pub fn set_host_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12060 self.host_url = v.into();
12061 self
12062 }
12063
12064 /// Sets the value of [app_id][crate::model::GitHubEnterpriseConfig::app_id].
12065 ///
12066 /// # Example
12067 /// ```ignore,no_run
12068 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12069 /// let x = GitHubEnterpriseConfig::new().set_app_id(42);
12070 /// ```
12071 pub fn set_app_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12072 self.app_id = v.into();
12073 self
12074 }
12075
12076 /// Sets the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12077 ///
12078 /// # Example
12079 /// ```ignore,no_run
12080 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12081 /// use wkt::Timestamp;
12082 /// let x = GitHubEnterpriseConfig::new().set_create_time(Timestamp::default()/* use setters */);
12083 /// ```
12084 pub fn set_create_time<T>(mut self, v: T) -> Self
12085 where
12086 T: std::convert::Into<wkt::Timestamp>,
12087 {
12088 self.create_time = std::option::Option::Some(v.into());
12089 self
12090 }
12091
12092 /// Sets or clears the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12093 ///
12094 /// # Example
12095 /// ```ignore,no_run
12096 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12097 /// use wkt::Timestamp;
12098 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12099 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(None::<Timestamp>);
12100 /// ```
12101 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12102 where
12103 T: std::convert::Into<wkt::Timestamp>,
12104 {
12105 self.create_time = v.map(|x| x.into());
12106 self
12107 }
12108
12109 /// Sets the value of [webhook_key][crate::model::GitHubEnterpriseConfig::webhook_key].
12110 ///
12111 /// # Example
12112 /// ```ignore,no_run
12113 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12114 /// let x = GitHubEnterpriseConfig::new().set_webhook_key("example");
12115 /// ```
12116 pub fn set_webhook_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12117 self.webhook_key = v.into();
12118 self
12119 }
12120
12121 /// Sets the value of [peered_network][crate::model::GitHubEnterpriseConfig::peered_network].
12122 ///
12123 /// # Example
12124 /// ```ignore,no_run
12125 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12126 /// let x = GitHubEnterpriseConfig::new().set_peered_network("example");
12127 /// ```
12128 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12129 self.peered_network = v.into();
12130 self
12131 }
12132
12133 /// Sets the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12134 ///
12135 /// # Example
12136 /// ```ignore,no_run
12137 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12138 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12139 /// let x = GitHubEnterpriseConfig::new().set_secrets(GitHubEnterpriseSecrets::default()/* use setters */);
12140 /// ```
12141 pub fn set_secrets<T>(mut self, v: T) -> Self
12142 where
12143 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12144 {
12145 self.secrets = std::option::Option::Some(v.into());
12146 self
12147 }
12148
12149 /// Sets or clears the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12150 ///
12151 /// # Example
12152 /// ```ignore,no_run
12153 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12154 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12155 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(Some(GitHubEnterpriseSecrets::default()/* use setters */));
12156 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(None::<GitHubEnterpriseSecrets>);
12157 /// ```
12158 pub fn set_or_clear_secrets<T>(mut self, v: std::option::Option<T>) -> Self
12159 where
12160 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12161 {
12162 self.secrets = v.map(|x| x.into());
12163 self
12164 }
12165
12166 /// Sets the value of [display_name][crate::model::GitHubEnterpriseConfig::display_name].
12167 ///
12168 /// # Example
12169 /// ```ignore,no_run
12170 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12171 /// let x = GitHubEnterpriseConfig::new().set_display_name("example");
12172 /// ```
12173 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12174 self.display_name = v.into();
12175 self
12176 }
12177
12178 /// Sets the value of [ssl_ca][crate::model::GitHubEnterpriseConfig::ssl_ca].
12179 ///
12180 /// # Example
12181 /// ```ignore,no_run
12182 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12183 /// let x = GitHubEnterpriseConfig::new().set_ssl_ca("example");
12184 /// ```
12185 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12186 self.ssl_ca = v.into();
12187 self
12188 }
12189}
12190
12191impl wkt::message::Message for GitHubEnterpriseConfig {
12192 fn typename() -> &'static str {
12193 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseConfig"
12194 }
12195}
12196
12197/// GitHubEnterpriseSecrets represents the names of all necessary secrets in
12198/// Secret Manager for a GitHub Enterprise server.
12199/// Format is: projects/\<project number\>/secrets/\<secret name\>.
12200#[derive(Clone, Default, PartialEq)]
12201#[non_exhaustive]
12202pub struct GitHubEnterpriseSecrets {
12203 /// The resource name for the private key secret version.
12204 pub private_key_version_name: std::string::String,
12205
12206 /// The resource name for the webhook secret secret version in Secret Manager.
12207 pub webhook_secret_version_name: std::string::String,
12208
12209 /// The resource name for the OAuth secret secret version in Secret Manager.
12210 pub oauth_secret_version_name: std::string::String,
12211
12212 /// The resource name for the OAuth client ID secret version in Secret Manager.
12213 pub oauth_client_id_version_name: std::string::String,
12214
12215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12216}
12217
12218impl GitHubEnterpriseSecrets {
12219 pub fn new() -> Self {
12220 std::default::Default::default()
12221 }
12222
12223 /// Sets the value of [private_key_version_name][crate::model::GitHubEnterpriseSecrets::private_key_version_name].
12224 ///
12225 /// # Example
12226 /// ```ignore,no_run
12227 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12228 /// let x = GitHubEnterpriseSecrets::new().set_private_key_version_name("example");
12229 /// ```
12230 pub fn set_private_key_version_name<T: std::convert::Into<std::string::String>>(
12231 mut self,
12232 v: T,
12233 ) -> Self {
12234 self.private_key_version_name = v.into();
12235 self
12236 }
12237
12238 /// Sets the value of [webhook_secret_version_name][crate::model::GitHubEnterpriseSecrets::webhook_secret_version_name].
12239 ///
12240 /// # Example
12241 /// ```ignore,no_run
12242 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12243 /// let x = GitHubEnterpriseSecrets::new().set_webhook_secret_version_name("example");
12244 /// ```
12245 pub fn set_webhook_secret_version_name<T: std::convert::Into<std::string::String>>(
12246 mut self,
12247 v: T,
12248 ) -> Self {
12249 self.webhook_secret_version_name = v.into();
12250 self
12251 }
12252
12253 /// Sets the value of [oauth_secret_version_name][crate::model::GitHubEnterpriseSecrets::oauth_secret_version_name].
12254 ///
12255 /// # Example
12256 /// ```ignore,no_run
12257 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12258 /// let x = GitHubEnterpriseSecrets::new().set_oauth_secret_version_name("example");
12259 /// ```
12260 pub fn set_oauth_secret_version_name<T: std::convert::Into<std::string::String>>(
12261 mut self,
12262 v: T,
12263 ) -> Self {
12264 self.oauth_secret_version_name = v.into();
12265 self
12266 }
12267
12268 /// Sets the value of [oauth_client_id_version_name][crate::model::GitHubEnterpriseSecrets::oauth_client_id_version_name].
12269 ///
12270 /// # Example
12271 /// ```ignore,no_run
12272 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12273 /// let x = GitHubEnterpriseSecrets::new().set_oauth_client_id_version_name("example");
12274 /// ```
12275 pub fn set_oauth_client_id_version_name<T: std::convert::Into<std::string::String>>(
12276 mut self,
12277 v: T,
12278 ) -> Self {
12279 self.oauth_client_id_version_name = v.into();
12280 self
12281 }
12282}
12283
12284impl wkt::message::Message for GitHubEnterpriseSecrets {
12285 fn typename() -> &'static str {
12286 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets"
12287 }
12288}
12289
12290/// Configuration for a `WorkerPool`.
12291///
12292/// Cloud Build owns and maintains a pool of workers for general use and have no
12293/// access to a project's private network. By default, builds submitted to
12294/// Cloud Build will use a worker from this pool.
12295///
12296/// If your build needs access to resources on a private network,
12297/// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give
12298/// your builds access to any single VPC network that you
12299/// administer, including any on-prem resources connected to that VPC
12300/// network. For an overview of private pools, see
12301/// [Private pools
12302/// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview).
12303#[derive(Clone, Default, PartialEq)]
12304#[non_exhaustive]
12305pub struct WorkerPool {
12306 /// Output only. The resource name of the `WorkerPool`, with format
12307 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
12308 /// The value of `{worker_pool}` is provided by `worker_pool_id` in
12309 /// `CreateWorkerPool` request and the value of `{location}` is determined by
12310 /// the endpoint accessed.
12311 pub name: std::string::String,
12312
12313 /// A user-specified, human-readable name for the `WorkerPool`. If provided,
12314 /// this value must be 1-63 characters.
12315 pub display_name: std::string::String,
12316
12317 /// Output only. A unique identifier for the `WorkerPool`.
12318 pub uid: std::string::String,
12319
12320 /// User specified annotations. See <https://google.aip.dev/128#annotations>
12321 /// for more details such as format and size limitations.
12322 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12323
12324 /// Output only. Time at which the request to create the `WorkerPool` was
12325 /// received.
12326 pub create_time: std::option::Option<wkt::Timestamp>,
12327
12328 /// Output only. Time at which the request to update the `WorkerPool` was
12329 /// received.
12330 pub update_time: std::option::Option<wkt::Timestamp>,
12331
12332 /// Output only. Time at which the request to delete the `WorkerPool` was
12333 /// received.
12334 pub delete_time: std::option::Option<wkt::Timestamp>,
12335
12336 /// Output only. `WorkerPool` state.
12337 pub state: crate::model::worker_pool::State,
12338
12339 /// Output only. Checksum computed by the server. May be sent on update and
12340 /// delete requests to ensure that the client has an up-to-date value before
12341 /// proceeding.
12342 pub etag: std::string::String,
12343
12344 /// Configuration for the `WorkerPool`.
12345 pub config: std::option::Option<crate::model::worker_pool::Config>,
12346
12347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12348}
12349
12350impl WorkerPool {
12351 pub fn new() -> Self {
12352 std::default::Default::default()
12353 }
12354
12355 /// Sets the value of [name][crate::model::WorkerPool::name].
12356 ///
12357 /// # Example
12358 /// ```ignore,no_run
12359 /// # use google_cloud_build_v1::model::WorkerPool;
12360 /// let x = WorkerPool::new().set_name("example");
12361 /// ```
12362 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12363 self.name = v.into();
12364 self
12365 }
12366
12367 /// Sets the value of [display_name][crate::model::WorkerPool::display_name].
12368 ///
12369 /// # Example
12370 /// ```ignore,no_run
12371 /// # use google_cloud_build_v1::model::WorkerPool;
12372 /// let x = WorkerPool::new().set_display_name("example");
12373 /// ```
12374 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12375 self.display_name = v.into();
12376 self
12377 }
12378
12379 /// Sets the value of [uid][crate::model::WorkerPool::uid].
12380 ///
12381 /// # Example
12382 /// ```ignore,no_run
12383 /// # use google_cloud_build_v1::model::WorkerPool;
12384 /// let x = WorkerPool::new().set_uid("example");
12385 /// ```
12386 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12387 self.uid = v.into();
12388 self
12389 }
12390
12391 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
12392 ///
12393 /// # Example
12394 /// ```ignore,no_run
12395 /// # use google_cloud_build_v1::model::WorkerPool;
12396 /// let x = WorkerPool::new().set_annotations([
12397 /// ("key0", "abc"),
12398 /// ("key1", "xyz"),
12399 /// ]);
12400 /// ```
12401 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12402 where
12403 T: std::iter::IntoIterator<Item = (K, V)>,
12404 K: std::convert::Into<std::string::String>,
12405 V: std::convert::Into<std::string::String>,
12406 {
12407 use std::iter::Iterator;
12408 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12409 self
12410 }
12411
12412 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
12413 ///
12414 /// # Example
12415 /// ```ignore,no_run
12416 /// # use google_cloud_build_v1::model::WorkerPool;
12417 /// use wkt::Timestamp;
12418 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
12419 /// ```
12420 pub fn set_create_time<T>(mut self, v: T) -> Self
12421 where
12422 T: std::convert::Into<wkt::Timestamp>,
12423 {
12424 self.create_time = std::option::Option::Some(v.into());
12425 self
12426 }
12427
12428 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
12429 ///
12430 /// # Example
12431 /// ```ignore,no_run
12432 /// # use google_cloud_build_v1::model::WorkerPool;
12433 /// use wkt::Timestamp;
12434 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12435 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
12436 /// ```
12437 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12438 where
12439 T: std::convert::Into<wkt::Timestamp>,
12440 {
12441 self.create_time = v.map(|x| x.into());
12442 self
12443 }
12444
12445 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
12446 ///
12447 /// # Example
12448 /// ```ignore,no_run
12449 /// # use google_cloud_build_v1::model::WorkerPool;
12450 /// use wkt::Timestamp;
12451 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
12452 /// ```
12453 pub fn set_update_time<T>(mut self, v: T) -> Self
12454 where
12455 T: std::convert::Into<wkt::Timestamp>,
12456 {
12457 self.update_time = std::option::Option::Some(v.into());
12458 self
12459 }
12460
12461 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
12462 ///
12463 /// # Example
12464 /// ```ignore,no_run
12465 /// # use google_cloud_build_v1::model::WorkerPool;
12466 /// use wkt::Timestamp;
12467 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12468 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
12469 /// ```
12470 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12471 where
12472 T: std::convert::Into<wkt::Timestamp>,
12473 {
12474 self.update_time = v.map(|x| x.into());
12475 self
12476 }
12477
12478 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
12479 ///
12480 /// # Example
12481 /// ```ignore,no_run
12482 /// # use google_cloud_build_v1::model::WorkerPool;
12483 /// use wkt::Timestamp;
12484 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
12485 /// ```
12486 pub fn set_delete_time<T>(mut self, v: T) -> Self
12487 where
12488 T: std::convert::Into<wkt::Timestamp>,
12489 {
12490 self.delete_time = std::option::Option::Some(v.into());
12491 self
12492 }
12493
12494 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
12495 ///
12496 /// # Example
12497 /// ```ignore,no_run
12498 /// # use google_cloud_build_v1::model::WorkerPool;
12499 /// use wkt::Timestamp;
12500 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12501 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
12502 /// ```
12503 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12504 where
12505 T: std::convert::Into<wkt::Timestamp>,
12506 {
12507 self.delete_time = v.map(|x| x.into());
12508 self
12509 }
12510
12511 /// Sets the value of [state][crate::model::WorkerPool::state].
12512 ///
12513 /// # Example
12514 /// ```ignore,no_run
12515 /// # use google_cloud_build_v1::model::WorkerPool;
12516 /// use google_cloud_build_v1::model::worker_pool::State;
12517 /// let x0 = WorkerPool::new().set_state(State::Creating);
12518 /// let x1 = WorkerPool::new().set_state(State::Running);
12519 /// let x2 = WorkerPool::new().set_state(State::Deleting);
12520 /// ```
12521 pub fn set_state<T: std::convert::Into<crate::model::worker_pool::State>>(
12522 mut self,
12523 v: T,
12524 ) -> Self {
12525 self.state = v.into();
12526 self
12527 }
12528
12529 /// Sets the value of [etag][crate::model::WorkerPool::etag].
12530 ///
12531 /// # Example
12532 /// ```ignore,no_run
12533 /// # use google_cloud_build_v1::model::WorkerPool;
12534 /// let x = WorkerPool::new().set_etag("example");
12535 /// ```
12536 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12537 self.etag = v.into();
12538 self
12539 }
12540
12541 /// Sets the value of [config][crate::model::WorkerPool::config].
12542 ///
12543 /// Note that all the setters affecting `config` are mutually
12544 /// exclusive.
12545 ///
12546 /// # Example
12547 /// ```ignore,no_run
12548 /// # use google_cloud_build_v1::model::WorkerPool;
12549 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12550 /// let x = WorkerPool::new().set_config(Some(
12551 /// google_cloud_build_v1::model::worker_pool::Config::PrivatePoolV1Config(PrivatePoolV1Config::default().into())));
12552 /// ```
12553 pub fn set_config<
12554 T: std::convert::Into<std::option::Option<crate::model::worker_pool::Config>>,
12555 >(
12556 mut self,
12557 v: T,
12558 ) -> Self {
12559 self.config = v.into();
12560 self
12561 }
12562
12563 /// The value of [config][crate::model::WorkerPool::config]
12564 /// if it holds a `PrivatePoolV1Config`, `None` if the field is not set or
12565 /// holds a different branch.
12566 pub fn private_pool_v1_config(
12567 &self,
12568 ) -> std::option::Option<&std::boxed::Box<crate::model::PrivatePoolV1Config>> {
12569 #[allow(unreachable_patterns)]
12570 self.config.as_ref().and_then(|v| match v {
12571 crate::model::worker_pool::Config::PrivatePoolV1Config(v) => {
12572 std::option::Option::Some(v)
12573 }
12574 _ => std::option::Option::None,
12575 })
12576 }
12577
12578 /// Sets the value of [config][crate::model::WorkerPool::config]
12579 /// to hold a `PrivatePoolV1Config`.
12580 ///
12581 /// Note that all the setters affecting `config` are
12582 /// mutually exclusive.
12583 ///
12584 /// # Example
12585 /// ```ignore,no_run
12586 /// # use google_cloud_build_v1::model::WorkerPool;
12587 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12588 /// let x = WorkerPool::new().set_private_pool_v1_config(PrivatePoolV1Config::default()/* use setters */);
12589 /// assert!(x.private_pool_v1_config().is_some());
12590 /// ```
12591 pub fn set_private_pool_v1_config<
12592 T: std::convert::Into<std::boxed::Box<crate::model::PrivatePoolV1Config>>,
12593 >(
12594 mut self,
12595 v: T,
12596 ) -> Self {
12597 self.config = std::option::Option::Some(
12598 crate::model::worker_pool::Config::PrivatePoolV1Config(v.into()),
12599 );
12600 self
12601 }
12602}
12603
12604impl wkt::message::Message for WorkerPool {
12605 fn typename() -> &'static str {
12606 "type.googleapis.com/google.devtools.cloudbuild.v1.WorkerPool"
12607 }
12608}
12609
12610/// Defines additional types related to [WorkerPool].
12611pub mod worker_pool {
12612 #[allow(unused_imports)]
12613 use super::*;
12614
12615 /// State of the `WorkerPool`.
12616 ///
12617 /// # Working with unknown values
12618 ///
12619 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12620 /// additional enum variants at any time. Adding new variants is not considered
12621 /// a breaking change. Applications should write their code in anticipation of:
12622 ///
12623 /// - New values appearing in future releases of the client library, **and**
12624 /// - New values received dynamically, without application changes.
12625 ///
12626 /// Please consult the [Working with enums] section in the user guide for some
12627 /// guidelines.
12628 ///
12629 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12630 #[derive(Clone, Debug, PartialEq)]
12631 #[non_exhaustive]
12632 pub enum State {
12633 /// State of the `WorkerPool` is unknown.
12634 Unspecified,
12635 /// `WorkerPool` is being created.
12636 Creating,
12637 /// `WorkerPool` is running.
12638 Running,
12639 /// `WorkerPool` is being deleted: cancelling builds and draining workers.
12640 Deleting,
12641 /// `WorkerPool` is deleted.
12642 Deleted,
12643 /// `WorkerPool` is being updated; new builds cannot be run.
12644 Updating,
12645 /// If set, the enum was initialized with an unknown value.
12646 ///
12647 /// Applications can examine the value using [State::value] or
12648 /// [State::name].
12649 UnknownValue(state::UnknownValue),
12650 }
12651
12652 #[doc(hidden)]
12653 pub mod state {
12654 #[allow(unused_imports)]
12655 use super::*;
12656 #[derive(Clone, Debug, PartialEq)]
12657 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12658 }
12659
12660 impl State {
12661 /// Gets the enum value.
12662 ///
12663 /// Returns `None` if the enum contains an unknown value deserialized from
12664 /// the string representation of enums.
12665 pub fn value(&self) -> std::option::Option<i32> {
12666 match self {
12667 Self::Unspecified => std::option::Option::Some(0),
12668 Self::Creating => std::option::Option::Some(1),
12669 Self::Running => std::option::Option::Some(2),
12670 Self::Deleting => std::option::Option::Some(3),
12671 Self::Deleted => std::option::Option::Some(4),
12672 Self::Updating => std::option::Option::Some(5),
12673 Self::UnknownValue(u) => u.0.value(),
12674 }
12675 }
12676
12677 /// Gets the enum value as a string.
12678 ///
12679 /// Returns `None` if the enum contains an unknown value deserialized from
12680 /// the integer representation of enums.
12681 pub fn name(&self) -> std::option::Option<&str> {
12682 match self {
12683 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12684 Self::Creating => std::option::Option::Some("CREATING"),
12685 Self::Running => std::option::Option::Some("RUNNING"),
12686 Self::Deleting => std::option::Option::Some("DELETING"),
12687 Self::Deleted => std::option::Option::Some("DELETED"),
12688 Self::Updating => std::option::Option::Some("UPDATING"),
12689 Self::UnknownValue(u) => u.0.name(),
12690 }
12691 }
12692 }
12693
12694 impl std::default::Default for State {
12695 fn default() -> Self {
12696 use std::convert::From;
12697 Self::from(0)
12698 }
12699 }
12700
12701 impl std::fmt::Display for State {
12702 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12703 wkt::internal::display_enum(f, self.name(), self.value())
12704 }
12705 }
12706
12707 impl std::convert::From<i32> for State {
12708 fn from(value: i32) -> Self {
12709 match value {
12710 0 => Self::Unspecified,
12711 1 => Self::Creating,
12712 2 => Self::Running,
12713 3 => Self::Deleting,
12714 4 => Self::Deleted,
12715 5 => Self::Updating,
12716 _ => Self::UnknownValue(state::UnknownValue(
12717 wkt::internal::UnknownEnumValue::Integer(value),
12718 )),
12719 }
12720 }
12721 }
12722
12723 impl std::convert::From<&str> for State {
12724 fn from(value: &str) -> Self {
12725 use std::string::ToString;
12726 match value {
12727 "STATE_UNSPECIFIED" => Self::Unspecified,
12728 "CREATING" => Self::Creating,
12729 "RUNNING" => Self::Running,
12730 "DELETING" => Self::Deleting,
12731 "DELETED" => Self::Deleted,
12732 "UPDATING" => Self::Updating,
12733 _ => Self::UnknownValue(state::UnknownValue(
12734 wkt::internal::UnknownEnumValue::String(value.to_string()),
12735 )),
12736 }
12737 }
12738 }
12739
12740 impl serde::ser::Serialize for State {
12741 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12742 where
12743 S: serde::Serializer,
12744 {
12745 match self {
12746 Self::Unspecified => serializer.serialize_i32(0),
12747 Self::Creating => serializer.serialize_i32(1),
12748 Self::Running => serializer.serialize_i32(2),
12749 Self::Deleting => serializer.serialize_i32(3),
12750 Self::Deleted => serializer.serialize_i32(4),
12751 Self::Updating => serializer.serialize_i32(5),
12752 Self::UnknownValue(u) => u.0.serialize(serializer),
12753 }
12754 }
12755 }
12756
12757 impl<'de> serde::de::Deserialize<'de> for State {
12758 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12759 where
12760 D: serde::Deserializer<'de>,
12761 {
12762 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12763 ".google.devtools.cloudbuild.v1.WorkerPool.State",
12764 ))
12765 }
12766 }
12767
12768 /// Configuration for the `WorkerPool`.
12769 #[derive(Clone, Debug, PartialEq)]
12770 #[non_exhaustive]
12771 pub enum Config {
12772 /// Private Pool configuration.
12773 PrivatePoolV1Config(std::boxed::Box<crate::model::PrivatePoolV1Config>),
12774 }
12775}
12776
12777/// Configuration for a V1 `PrivatePool`.
12778#[derive(Clone, Default, PartialEq)]
12779#[non_exhaustive]
12780pub struct PrivatePoolV1Config {
12781 /// Machine configuration for the workers in the pool.
12782 pub worker_config: std::option::Option<crate::model::private_pool_v_1_config::WorkerConfig>,
12783
12784 /// Network configuration for the pool.
12785 pub network_config: std::option::Option<crate::model::private_pool_v_1_config::NetworkConfig>,
12786
12787 /// Immutable. Private Service Connect(PSC) Network configuration for the pool.
12788 pub private_service_connect:
12789 std::option::Option<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12790
12791 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12792}
12793
12794impl PrivatePoolV1Config {
12795 pub fn new() -> Self {
12796 std::default::Default::default()
12797 }
12798
12799 /// Sets the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12800 ///
12801 /// # Example
12802 /// ```ignore,no_run
12803 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12804 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12805 /// let x = PrivatePoolV1Config::new().set_worker_config(WorkerConfig::default()/* use setters */);
12806 /// ```
12807 pub fn set_worker_config<T>(mut self, v: T) -> Self
12808 where
12809 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12810 {
12811 self.worker_config = std::option::Option::Some(v.into());
12812 self
12813 }
12814
12815 /// Sets or clears the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12816 ///
12817 /// # Example
12818 /// ```ignore,no_run
12819 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12820 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12821 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(Some(WorkerConfig::default()/* use setters */));
12822 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(None::<WorkerConfig>);
12823 /// ```
12824 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
12825 where
12826 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12827 {
12828 self.worker_config = v.map(|x| x.into());
12829 self
12830 }
12831
12832 /// Sets the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12833 ///
12834 /// # Example
12835 /// ```ignore,no_run
12836 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12837 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12838 /// let x = PrivatePoolV1Config::new().set_network_config(NetworkConfig::default()/* use setters */);
12839 /// ```
12840 pub fn set_network_config<T>(mut self, v: T) -> Self
12841 where
12842 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12843 {
12844 self.network_config = std::option::Option::Some(v.into());
12845 self
12846 }
12847
12848 /// Sets or clears the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12849 ///
12850 /// # Example
12851 /// ```ignore,no_run
12852 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12853 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12854 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(Some(NetworkConfig::default()/* use setters */));
12855 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(None::<NetworkConfig>);
12856 /// ```
12857 pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
12858 where
12859 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12860 {
12861 self.network_config = v.map(|x| x.into());
12862 self
12863 }
12864
12865 /// Sets the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12866 ///
12867 /// # Example
12868 /// ```ignore,no_run
12869 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12870 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12871 /// let x = PrivatePoolV1Config::new().set_private_service_connect(PrivateServiceConnect::default()/* use setters */);
12872 /// ```
12873 pub fn set_private_service_connect<T>(mut self, v: T) -> Self
12874 where
12875 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12876 {
12877 self.private_service_connect = std::option::Option::Some(v.into());
12878 self
12879 }
12880
12881 /// Sets or clears the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12882 ///
12883 /// # Example
12884 /// ```ignore,no_run
12885 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12886 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12887 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(Some(PrivateServiceConnect::default()/* use setters */));
12888 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(None::<PrivateServiceConnect>);
12889 /// ```
12890 pub fn set_or_clear_private_service_connect<T>(mut self, v: std::option::Option<T>) -> Self
12891 where
12892 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12893 {
12894 self.private_service_connect = v.map(|x| x.into());
12895 self
12896 }
12897}
12898
12899impl wkt::message::Message for PrivatePoolV1Config {
12900 fn typename() -> &'static str {
12901 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config"
12902 }
12903}
12904
12905/// Defines additional types related to [PrivatePoolV1Config].
12906pub mod private_pool_v_1_config {
12907 #[allow(unused_imports)]
12908 use super::*;
12909
12910 /// Defines the configuration to be used for creating workers in
12911 /// the pool.
12912 #[derive(Clone, Default, PartialEq)]
12913 #[non_exhaustive]
12914 pub struct WorkerConfig {
12915 /// Optional. Machine type of a worker, such as `e2-medium`.
12916 /// See [Worker pool config
12917 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
12918 /// If left blank, Cloud Build will use a sensible default.
12919 pub machine_type: std::string::String,
12920
12921 /// Size of the disk attached to the worker, in GB.
12922 /// See [Worker pool config
12923 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
12924 /// Specify a value of up to 4000. If `0` is specified, Cloud Build will use
12925 /// a standard disk size.
12926 pub disk_size_gb: i64,
12927
12928 /// Optional. Enable nested virtualization on the worker, if supported by the
12929 /// machine type. By default, nested virtualization is disabled.
12930 pub enable_nested_virtualization: std::option::Option<bool>,
12931
12932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12933 }
12934
12935 impl WorkerConfig {
12936 pub fn new() -> Self {
12937 std::default::Default::default()
12938 }
12939
12940 /// Sets the value of [machine_type][crate::model::private_pool_v_1_config::WorkerConfig::machine_type].
12941 ///
12942 /// # Example
12943 /// ```ignore,no_run
12944 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12945 /// let x = WorkerConfig::new().set_machine_type("example");
12946 /// ```
12947 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
12948 mut self,
12949 v: T,
12950 ) -> Self {
12951 self.machine_type = v.into();
12952 self
12953 }
12954
12955 /// Sets the value of [disk_size_gb][crate::model::private_pool_v_1_config::WorkerConfig::disk_size_gb].
12956 ///
12957 /// # Example
12958 /// ```ignore,no_run
12959 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12960 /// let x = WorkerConfig::new().set_disk_size_gb(42);
12961 /// ```
12962 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12963 self.disk_size_gb = v.into();
12964 self
12965 }
12966
12967 /// Sets the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
12968 ///
12969 /// # Example
12970 /// ```ignore,no_run
12971 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12972 /// let x = WorkerConfig::new().set_enable_nested_virtualization(true);
12973 /// ```
12974 pub fn set_enable_nested_virtualization<T>(mut self, v: T) -> Self
12975 where
12976 T: std::convert::Into<bool>,
12977 {
12978 self.enable_nested_virtualization = std::option::Option::Some(v.into());
12979 self
12980 }
12981
12982 /// Sets or clears the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
12983 ///
12984 /// # Example
12985 /// ```ignore,no_run
12986 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12987 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(Some(false));
12988 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(None::<bool>);
12989 /// ```
12990 pub fn set_or_clear_enable_nested_virtualization<T>(
12991 mut self,
12992 v: std::option::Option<T>,
12993 ) -> Self
12994 where
12995 T: std::convert::Into<bool>,
12996 {
12997 self.enable_nested_virtualization = v.map(|x| x.into());
12998 self
12999 }
13000 }
13001
13002 impl wkt::message::Message for WorkerConfig {
13003 fn typename() -> &'static str {
13004 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.WorkerConfig"
13005 }
13006 }
13007
13008 /// Defines the network configuration for the pool.
13009 #[derive(Clone, Default, PartialEq)]
13010 #[non_exhaustive]
13011 pub struct NetworkConfig {
13012 /// Required. Immutable. The network definition that the workers are peered
13013 /// to. If this section is left empty, the workers will be peered to
13014 /// `WorkerPool.project_id` on the service producer network. Must be in the
13015 /// format `projects/{project}/global/networks/{network}`, where `{project}`
13016 /// is a project number, such as `12345`, and `{network}` is the name of a
13017 /// VPC network in the project. See
13018 /// [Understanding network configuration
13019 /// options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment)
13020 pub peered_network: std::string::String,
13021
13022 /// Option to configure network egress for the workers.
13023 pub egress_option: crate::model::private_pool_v_1_config::network_config::EgressOption,
13024
13025 /// Immutable. Subnet IP range within the peered network. This is specified
13026 /// in CIDR notation with a slash and the subnet prefix size. You can
13027 /// optionally specify an IP address before the subnet prefix value. e.g.
13028 /// `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a
13029 /// prefix size of 29 bits.
13030 /// `/16` would specify a prefix size of 16 bits, with an automatically
13031 /// determined IP within the peered VPC.
13032 /// If unspecified, a value of `/24` will be used.
13033 pub peered_network_ip_range: std::string::String,
13034
13035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13036 }
13037
13038 impl NetworkConfig {
13039 pub fn new() -> Self {
13040 std::default::Default::default()
13041 }
13042
13043 /// Sets the value of [peered_network][crate::model::private_pool_v_1_config::NetworkConfig::peered_network].
13044 ///
13045 /// # Example
13046 /// ```ignore,no_run
13047 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13048 /// let x = NetworkConfig::new().set_peered_network("example");
13049 /// ```
13050 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(
13051 mut self,
13052 v: T,
13053 ) -> Self {
13054 self.peered_network = v.into();
13055 self
13056 }
13057
13058 /// Sets the value of [egress_option][crate::model::private_pool_v_1_config::NetworkConfig::egress_option].
13059 ///
13060 /// # Example
13061 /// ```ignore,no_run
13062 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13063 /// use google_cloud_build_v1::model::private_pool_v_1_config::network_config::EgressOption;
13064 /// let x0 = NetworkConfig::new().set_egress_option(EgressOption::NoPublicEgress);
13065 /// let x1 = NetworkConfig::new().set_egress_option(EgressOption::PublicEgress);
13066 /// ```
13067 pub fn set_egress_option<
13068 T: std::convert::Into<crate::model::private_pool_v_1_config::network_config::EgressOption>,
13069 >(
13070 mut self,
13071 v: T,
13072 ) -> Self {
13073 self.egress_option = v.into();
13074 self
13075 }
13076
13077 /// Sets the value of [peered_network_ip_range][crate::model::private_pool_v_1_config::NetworkConfig::peered_network_ip_range].
13078 ///
13079 /// # Example
13080 /// ```ignore,no_run
13081 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13082 /// let x = NetworkConfig::new().set_peered_network_ip_range("example");
13083 /// ```
13084 pub fn set_peered_network_ip_range<T: std::convert::Into<std::string::String>>(
13085 mut self,
13086 v: T,
13087 ) -> Self {
13088 self.peered_network_ip_range = v.into();
13089 self
13090 }
13091 }
13092
13093 impl wkt::message::Message for NetworkConfig {
13094 fn typename() -> &'static str {
13095 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig"
13096 }
13097 }
13098
13099 /// Defines additional types related to [NetworkConfig].
13100 pub mod network_config {
13101 #[allow(unused_imports)]
13102 use super::*;
13103
13104 /// Defines the egress option for the pool.
13105 ///
13106 /// # Working with unknown values
13107 ///
13108 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13109 /// additional enum variants at any time. Adding new variants is not considered
13110 /// a breaking change. Applications should write their code in anticipation of:
13111 ///
13112 /// - New values appearing in future releases of the client library, **and**
13113 /// - New values received dynamically, without application changes.
13114 ///
13115 /// Please consult the [Working with enums] section in the user guide for some
13116 /// guidelines.
13117 ///
13118 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13119 #[derive(Clone, Debug, PartialEq)]
13120 #[non_exhaustive]
13121 pub enum EgressOption {
13122 /// If set, defaults to PUBLIC_EGRESS.
13123 Unspecified,
13124 /// If set, workers are created without any public address, which prevents
13125 /// network egress to public IPs unless a network proxy is configured.
13126 NoPublicEgress,
13127 /// If set, workers are created with a public address which allows for
13128 /// public internet egress.
13129 PublicEgress,
13130 /// If set, the enum was initialized with an unknown value.
13131 ///
13132 /// Applications can examine the value using [EgressOption::value] or
13133 /// [EgressOption::name].
13134 UnknownValue(egress_option::UnknownValue),
13135 }
13136
13137 #[doc(hidden)]
13138 pub mod egress_option {
13139 #[allow(unused_imports)]
13140 use super::*;
13141 #[derive(Clone, Debug, PartialEq)]
13142 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13143 }
13144
13145 impl EgressOption {
13146 /// Gets the enum value.
13147 ///
13148 /// Returns `None` if the enum contains an unknown value deserialized from
13149 /// the string representation of enums.
13150 pub fn value(&self) -> std::option::Option<i32> {
13151 match self {
13152 Self::Unspecified => std::option::Option::Some(0),
13153 Self::NoPublicEgress => std::option::Option::Some(1),
13154 Self::PublicEgress => std::option::Option::Some(2),
13155 Self::UnknownValue(u) => u.0.value(),
13156 }
13157 }
13158
13159 /// Gets the enum value as a string.
13160 ///
13161 /// Returns `None` if the enum contains an unknown value deserialized from
13162 /// the integer representation of enums.
13163 pub fn name(&self) -> std::option::Option<&str> {
13164 match self {
13165 Self::Unspecified => std::option::Option::Some("EGRESS_OPTION_UNSPECIFIED"),
13166 Self::NoPublicEgress => std::option::Option::Some("NO_PUBLIC_EGRESS"),
13167 Self::PublicEgress => std::option::Option::Some("PUBLIC_EGRESS"),
13168 Self::UnknownValue(u) => u.0.name(),
13169 }
13170 }
13171 }
13172
13173 impl std::default::Default for EgressOption {
13174 fn default() -> Self {
13175 use std::convert::From;
13176 Self::from(0)
13177 }
13178 }
13179
13180 impl std::fmt::Display for EgressOption {
13181 fn fmt(
13182 &self,
13183 f: &mut std::fmt::Formatter<'_>,
13184 ) -> std::result::Result<(), std::fmt::Error> {
13185 wkt::internal::display_enum(f, self.name(), self.value())
13186 }
13187 }
13188
13189 impl std::convert::From<i32> for EgressOption {
13190 fn from(value: i32) -> Self {
13191 match value {
13192 0 => Self::Unspecified,
13193 1 => Self::NoPublicEgress,
13194 2 => Self::PublicEgress,
13195 _ => Self::UnknownValue(egress_option::UnknownValue(
13196 wkt::internal::UnknownEnumValue::Integer(value),
13197 )),
13198 }
13199 }
13200 }
13201
13202 impl std::convert::From<&str> for EgressOption {
13203 fn from(value: &str) -> Self {
13204 use std::string::ToString;
13205 match value {
13206 "EGRESS_OPTION_UNSPECIFIED" => Self::Unspecified,
13207 "NO_PUBLIC_EGRESS" => Self::NoPublicEgress,
13208 "PUBLIC_EGRESS" => Self::PublicEgress,
13209 _ => Self::UnknownValue(egress_option::UnknownValue(
13210 wkt::internal::UnknownEnumValue::String(value.to_string()),
13211 )),
13212 }
13213 }
13214 }
13215
13216 impl serde::ser::Serialize for EgressOption {
13217 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13218 where
13219 S: serde::Serializer,
13220 {
13221 match self {
13222 Self::Unspecified => serializer.serialize_i32(0),
13223 Self::NoPublicEgress => serializer.serialize_i32(1),
13224 Self::PublicEgress => serializer.serialize_i32(2),
13225 Self::UnknownValue(u) => u.0.serialize(serializer),
13226 }
13227 }
13228 }
13229
13230 impl<'de> serde::de::Deserialize<'de> for EgressOption {
13231 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13232 where
13233 D: serde::Deserializer<'de>,
13234 {
13235 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EgressOption>::new(
13236 ".google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig.EgressOption",
13237 ))
13238 }
13239 }
13240 }
13241
13242 /// Defines the Private Service Connect network configuration for the pool.
13243 #[derive(Clone, Default, PartialEq)]
13244 #[non_exhaustive]
13245 pub struct PrivateServiceConnect {
13246 /// Required. Immutable. The network attachment that the worker network
13247 /// interface is peered to. Must be in the format
13248 /// `projects/{project}/regions/{region}/networkAttachments/{networkAttachment}`.
13249 /// The region of network attachment must be the same as the worker pool.
13250 /// See [Network
13251 /// Attachments](https://cloud.google.com/vpc/docs/about-network-attachments)
13252 pub network_attachment: std::string::String,
13253
13254 /// Required. Immutable. Disable public IP on the primary network interface.
13255 ///
13256 /// If true, workers are created without any public address, which prevents
13257 /// network egress to public IPs unless a network proxy is configured.
13258 /// If false, workers are created with a public address which allows for
13259 /// public internet egress. The public address only applies to traffic
13260 /// through the primary network interface.
13261 /// If `route_all_traffic` is set to true, all traffic will go through the
13262 /// non-primary network interface, this boolean has no effect.
13263 pub public_ip_address_disabled: bool,
13264
13265 /// Immutable. Route all traffic through PSC interface. Enable this if you
13266 /// want full control of traffic in the private pool. Configure Cloud NAT for
13267 /// the subnet of network attachment if you need to access public Internet.
13268 ///
13269 /// If false, Only route RFC 1918 (10.0.0.0/8, 172.16.0.0/12, and
13270 /// 192.168.0.0/16) and RFC 6598 (100.64.0.0/10) through PSC interface.
13271 pub route_all_traffic: bool,
13272
13273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13274 }
13275
13276 impl PrivateServiceConnect {
13277 pub fn new() -> Self {
13278 std::default::Default::default()
13279 }
13280
13281 /// Sets the value of [network_attachment][crate::model::private_pool_v_1_config::PrivateServiceConnect::network_attachment].
13282 ///
13283 /// # Example
13284 /// ```ignore,no_run
13285 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13286 /// let x = PrivateServiceConnect::new().set_network_attachment("example");
13287 /// ```
13288 pub fn set_network_attachment<T: std::convert::Into<std::string::String>>(
13289 mut self,
13290 v: T,
13291 ) -> Self {
13292 self.network_attachment = v.into();
13293 self
13294 }
13295
13296 /// Sets the value of [public_ip_address_disabled][crate::model::private_pool_v_1_config::PrivateServiceConnect::public_ip_address_disabled].
13297 ///
13298 /// # Example
13299 /// ```ignore,no_run
13300 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13301 /// let x = PrivateServiceConnect::new().set_public_ip_address_disabled(true);
13302 /// ```
13303 pub fn set_public_ip_address_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13304 self.public_ip_address_disabled = v.into();
13305 self
13306 }
13307
13308 /// Sets the value of [route_all_traffic][crate::model::private_pool_v_1_config::PrivateServiceConnect::route_all_traffic].
13309 ///
13310 /// # Example
13311 /// ```ignore,no_run
13312 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13313 /// let x = PrivateServiceConnect::new().set_route_all_traffic(true);
13314 /// ```
13315 pub fn set_route_all_traffic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13316 self.route_all_traffic = v.into();
13317 self
13318 }
13319 }
13320
13321 impl wkt::message::Message for PrivateServiceConnect {
13322 fn typename() -> &'static str {
13323 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.PrivateServiceConnect"
13324 }
13325 }
13326}
13327
13328/// Request to create a new `WorkerPool`.
13329#[derive(Clone, Default, PartialEq)]
13330#[non_exhaustive]
13331pub struct CreateWorkerPoolRequest {
13332 /// Required. The parent resource where this worker pool will be created.
13333 /// Format: `projects/{project}/locations/{location}`.
13334 pub parent: std::string::String,
13335
13336 /// Required. `WorkerPool` resource to create.
13337 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13338
13339 /// Required. Immutable. The ID to use for the `WorkerPool`, which will become
13340 /// the final component of the resource name.
13341 ///
13342 /// This value should be 1-63 characters, and valid characters
13343 /// are /[a-z][0-9]-/.
13344 pub worker_pool_id: std::string::String,
13345
13346 /// If set, validate the request and preview the response, but do not actually
13347 /// post it.
13348 pub validate_only: bool,
13349
13350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13351}
13352
13353impl CreateWorkerPoolRequest {
13354 pub fn new() -> Self {
13355 std::default::Default::default()
13356 }
13357
13358 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
13359 ///
13360 /// # Example
13361 /// ```ignore,no_run
13362 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13363 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
13364 /// ```
13365 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13366 self.parent = v.into();
13367 self
13368 }
13369
13370 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13371 ///
13372 /// # Example
13373 /// ```ignore,no_run
13374 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13375 /// use google_cloud_build_v1::model::WorkerPool;
13376 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13377 /// ```
13378 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13379 where
13380 T: std::convert::Into<crate::model::WorkerPool>,
13381 {
13382 self.worker_pool = std::option::Option::Some(v.into());
13383 self
13384 }
13385
13386 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13387 ///
13388 /// # Example
13389 /// ```ignore,no_run
13390 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13391 /// use google_cloud_build_v1::model::WorkerPool;
13392 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13393 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13394 /// ```
13395 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13396 where
13397 T: std::convert::Into<crate::model::WorkerPool>,
13398 {
13399 self.worker_pool = v.map(|x| x.into());
13400 self
13401 }
13402
13403 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
13404 ///
13405 /// # Example
13406 /// ```ignore,no_run
13407 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13408 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
13409 /// ```
13410 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13411 self.worker_pool_id = v.into();
13412 self
13413 }
13414
13415 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
13416 ///
13417 /// # Example
13418 /// ```ignore,no_run
13419 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13420 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
13421 /// ```
13422 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13423 self.validate_only = v.into();
13424 self
13425 }
13426}
13427
13428impl wkt::message::Message for CreateWorkerPoolRequest {
13429 fn typename() -> &'static str {
13430 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolRequest"
13431 }
13432}
13433
13434/// Request to get a `WorkerPool` with the specified name.
13435#[derive(Clone, Default, PartialEq)]
13436#[non_exhaustive]
13437pub struct GetWorkerPoolRequest {
13438 /// Required. The name of the `WorkerPool` to retrieve.
13439 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13440 pub name: std::string::String,
13441
13442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13443}
13444
13445impl GetWorkerPoolRequest {
13446 pub fn new() -> Self {
13447 std::default::Default::default()
13448 }
13449
13450 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
13451 ///
13452 /// # Example
13453 /// ```ignore,no_run
13454 /// # use google_cloud_build_v1::model::GetWorkerPoolRequest;
13455 /// let x = GetWorkerPoolRequest::new().set_name("example");
13456 /// ```
13457 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13458 self.name = v.into();
13459 self
13460 }
13461}
13462
13463impl wkt::message::Message for GetWorkerPoolRequest {
13464 fn typename() -> &'static str {
13465 "type.googleapis.com/google.devtools.cloudbuild.v1.GetWorkerPoolRequest"
13466 }
13467}
13468
13469/// Request to delete a `WorkerPool`.
13470#[derive(Clone, Default, PartialEq)]
13471#[non_exhaustive]
13472pub struct DeleteWorkerPoolRequest {
13473 /// Required. The name of the `WorkerPool` to delete.
13474 /// Format:
13475 /// `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13476 pub name: std::string::String,
13477
13478 /// Optional. If provided, it must match the server's etag on the workerpool
13479 /// for the request to be processed.
13480 pub etag: std::string::String,
13481
13482 /// If set to true, and the `WorkerPool` is not found, the request will succeed
13483 /// but no action will be taken on the server.
13484 pub allow_missing: bool,
13485
13486 /// If set, validate the request and preview the response, but do not actually
13487 /// post it.
13488 pub validate_only: bool,
13489
13490 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13491}
13492
13493impl DeleteWorkerPoolRequest {
13494 pub fn new() -> Self {
13495 std::default::Default::default()
13496 }
13497
13498 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
13499 ///
13500 /// # Example
13501 /// ```ignore,no_run
13502 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13503 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
13504 /// ```
13505 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13506 self.name = v.into();
13507 self
13508 }
13509
13510 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
13511 ///
13512 /// # Example
13513 /// ```ignore,no_run
13514 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13515 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
13516 /// ```
13517 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13518 self.etag = v.into();
13519 self
13520 }
13521
13522 /// Sets the value of [allow_missing][crate::model::DeleteWorkerPoolRequest::allow_missing].
13523 ///
13524 /// # Example
13525 /// ```ignore,no_run
13526 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13527 /// let x = DeleteWorkerPoolRequest::new().set_allow_missing(true);
13528 /// ```
13529 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13530 self.allow_missing = v.into();
13531 self
13532 }
13533
13534 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
13535 ///
13536 /// # Example
13537 /// ```ignore,no_run
13538 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13539 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
13540 /// ```
13541 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13542 self.validate_only = v.into();
13543 self
13544 }
13545}
13546
13547impl wkt::message::Message for DeleteWorkerPoolRequest {
13548 fn typename() -> &'static str {
13549 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest"
13550 }
13551}
13552
13553/// Request to update a `WorkerPool`.
13554#[derive(Clone, Default, PartialEq)]
13555#[non_exhaustive]
13556pub struct UpdateWorkerPoolRequest {
13557 /// Required. The `WorkerPool` to update.
13558 ///
13559 /// The `name` field is used to identify the `WorkerPool` to update.
13560 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13561 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13562
13563 /// Optional. A mask specifying which fields in `worker_pool` to update.
13564 pub update_mask: std::option::Option<wkt::FieldMask>,
13565
13566 /// If set, validate the request and preview the response, but do not actually
13567 /// post it.
13568 pub validate_only: bool,
13569
13570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13571}
13572
13573impl UpdateWorkerPoolRequest {
13574 pub fn new() -> Self {
13575 std::default::Default::default()
13576 }
13577
13578 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13579 ///
13580 /// # Example
13581 /// ```ignore,no_run
13582 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13583 /// use google_cloud_build_v1::model::WorkerPool;
13584 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13585 /// ```
13586 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13587 where
13588 T: std::convert::Into<crate::model::WorkerPool>,
13589 {
13590 self.worker_pool = std::option::Option::Some(v.into());
13591 self
13592 }
13593
13594 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13595 ///
13596 /// # Example
13597 /// ```ignore,no_run
13598 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13599 /// use google_cloud_build_v1::model::WorkerPool;
13600 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13601 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13602 /// ```
13603 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13604 where
13605 T: std::convert::Into<crate::model::WorkerPool>,
13606 {
13607 self.worker_pool = v.map(|x| x.into());
13608 self
13609 }
13610
13611 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13612 ///
13613 /// # Example
13614 /// ```ignore,no_run
13615 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13616 /// use wkt::FieldMask;
13617 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13618 /// ```
13619 pub fn set_update_mask<T>(mut self, v: T) -> Self
13620 where
13621 T: std::convert::Into<wkt::FieldMask>,
13622 {
13623 self.update_mask = std::option::Option::Some(v.into());
13624 self
13625 }
13626
13627 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13628 ///
13629 /// # Example
13630 /// ```ignore,no_run
13631 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13632 /// use wkt::FieldMask;
13633 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13634 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13635 /// ```
13636 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13637 where
13638 T: std::convert::Into<wkt::FieldMask>,
13639 {
13640 self.update_mask = v.map(|x| x.into());
13641 self
13642 }
13643
13644 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
13645 ///
13646 /// # Example
13647 /// ```ignore,no_run
13648 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13649 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
13650 /// ```
13651 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13652 self.validate_only = v.into();
13653 self
13654 }
13655}
13656
13657impl wkt::message::Message for UpdateWorkerPoolRequest {
13658 fn typename() -> &'static str {
13659 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest"
13660 }
13661}
13662
13663/// Request to list `WorkerPool`s.
13664#[derive(Clone, Default, PartialEq)]
13665#[non_exhaustive]
13666pub struct ListWorkerPoolsRequest {
13667 /// Required. The parent of the collection of `WorkerPools`.
13668 /// Format: `projects/{project}/locations/{location}`.
13669 pub parent: std::string::String,
13670
13671 /// The maximum number of `WorkerPool`s to return. The service may return
13672 /// fewer than this value. If omitted, the server will use a sensible default.
13673 pub page_size: i32,
13674
13675 /// A page token, received from a previous `ListWorkerPools` call. Provide this
13676 /// to retrieve the subsequent page.
13677 pub page_token: std::string::String,
13678
13679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13680}
13681
13682impl ListWorkerPoolsRequest {
13683 pub fn new() -> Self {
13684 std::default::Default::default()
13685 }
13686
13687 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
13688 ///
13689 /// # Example
13690 /// ```ignore,no_run
13691 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13692 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
13693 /// ```
13694 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13695 self.parent = v.into();
13696 self
13697 }
13698
13699 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
13700 ///
13701 /// # Example
13702 /// ```ignore,no_run
13703 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13704 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
13705 /// ```
13706 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13707 self.page_size = v.into();
13708 self
13709 }
13710
13711 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
13712 ///
13713 /// # Example
13714 /// ```ignore,no_run
13715 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13716 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
13717 /// ```
13718 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13719 self.page_token = v.into();
13720 self
13721 }
13722}
13723
13724impl wkt::message::Message for ListWorkerPoolsRequest {
13725 fn typename() -> &'static str {
13726 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsRequest"
13727 }
13728}
13729
13730/// Response containing existing `WorkerPools`.
13731#[derive(Clone, Default, PartialEq)]
13732#[non_exhaustive]
13733pub struct ListWorkerPoolsResponse {
13734 /// `WorkerPools` for the specified project.
13735 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
13736
13737 /// Continuation token used to page through large result sets. Provide this
13738 /// value in a subsequent ListWorkerPoolsRequest to return the next page of
13739 /// results.
13740 pub next_page_token: std::string::String,
13741
13742 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13743}
13744
13745impl ListWorkerPoolsResponse {
13746 pub fn new() -> Self {
13747 std::default::Default::default()
13748 }
13749
13750 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
13751 ///
13752 /// # Example
13753 /// ```ignore,no_run
13754 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13755 /// use google_cloud_build_v1::model::WorkerPool;
13756 /// let x = ListWorkerPoolsResponse::new()
13757 /// .set_worker_pools([
13758 /// WorkerPool::default()/* use setters */,
13759 /// WorkerPool::default()/* use (different) setters */,
13760 /// ]);
13761 /// ```
13762 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
13763 where
13764 T: std::iter::IntoIterator<Item = V>,
13765 V: std::convert::Into<crate::model::WorkerPool>,
13766 {
13767 use std::iter::Iterator;
13768 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
13769 self
13770 }
13771
13772 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
13773 ///
13774 /// # Example
13775 /// ```ignore,no_run
13776 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13777 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
13778 /// ```
13779 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13780 self.next_page_token = v.into();
13781 self
13782 }
13783}
13784
13785impl wkt::message::Message for ListWorkerPoolsResponse {
13786 fn typename() -> &'static str {
13787 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsResponse"
13788 }
13789}
13790
13791#[doc(hidden)]
13792impl gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
13793 type PageItem = crate::model::WorkerPool;
13794
13795 fn items(self) -> std::vec::Vec<Self::PageItem> {
13796 self.worker_pools
13797 }
13798
13799 fn next_page_token(&self) -> std::string::String {
13800 use std::clone::Clone;
13801 self.next_page_token.clone()
13802 }
13803}
13804
13805/// Metadata for the `CreateWorkerPool` operation.
13806#[derive(Clone, Default, PartialEq)]
13807#[non_exhaustive]
13808pub struct CreateWorkerPoolOperationMetadata {
13809 /// The resource name of the `WorkerPool` to create.
13810 /// Format:
13811 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13812 pub worker_pool: std::string::String,
13813
13814 /// Time the operation was created.
13815 pub create_time: std::option::Option<wkt::Timestamp>,
13816
13817 /// Time the operation was completed.
13818 pub complete_time: std::option::Option<wkt::Timestamp>,
13819
13820 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13821}
13822
13823impl CreateWorkerPoolOperationMetadata {
13824 pub fn new() -> Self {
13825 std::default::Default::default()
13826 }
13827
13828 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolOperationMetadata::worker_pool].
13829 ///
13830 /// # Example
13831 /// ```ignore,no_run
13832 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13833 /// let x = CreateWorkerPoolOperationMetadata::new().set_worker_pool("example");
13834 /// ```
13835 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13836 self.worker_pool = v.into();
13837 self
13838 }
13839
13840 /// Sets the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13841 ///
13842 /// # Example
13843 /// ```ignore,no_run
13844 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13845 /// use wkt::Timestamp;
13846 /// let x = CreateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
13847 /// ```
13848 pub fn set_create_time<T>(mut self, v: T) -> Self
13849 where
13850 T: std::convert::Into<wkt::Timestamp>,
13851 {
13852 self.create_time = std::option::Option::Some(v.into());
13853 self
13854 }
13855
13856 /// Sets or clears the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13857 ///
13858 /// # Example
13859 /// ```ignore,no_run
13860 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13861 /// use wkt::Timestamp;
13862 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13863 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
13864 /// ```
13865 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13866 where
13867 T: std::convert::Into<wkt::Timestamp>,
13868 {
13869 self.create_time = v.map(|x| x.into());
13870 self
13871 }
13872
13873 /// Sets the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
13874 ///
13875 /// # Example
13876 /// ```ignore,no_run
13877 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13878 /// use wkt::Timestamp;
13879 /// let x = CreateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
13880 /// ```
13881 pub fn set_complete_time<T>(mut self, v: T) -> Self
13882 where
13883 T: std::convert::Into<wkt::Timestamp>,
13884 {
13885 self.complete_time = std::option::Option::Some(v.into());
13886 self
13887 }
13888
13889 /// Sets or clears the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
13890 ///
13891 /// # Example
13892 /// ```ignore,no_run
13893 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13894 /// use wkt::Timestamp;
13895 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
13896 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
13897 /// ```
13898 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
13899 where
13900 T: std::convert::Into<wkt::Timestamp>,
13901 {
13902 self.complete_time = v.map(|x| x.into());
13903 self
13904 }
13905}
13906
13907impl wkt::message::Message for CreateWorkerPoolOperationMetadata {
13908 fn typename() -> &'static str {
13909 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata"
13910 }
13911}
13912
13913/// Metadata for the `UpdateWorkerPool` operation.
13914#[derive(Clone, Default, PartialEq)]
13915#[non_exhaustive]
13916pub struct UpdateWorkerPoolOperationMetadata {
13917 /// The resource name of the `WorkerPool` being updated.
13918 /// Format:
13919 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13920 pub worker_pool: std::string::String,
13921
13922 /// Time the operation was created.
13923 pub create_time: std::option::Option<wkt::Timestamp>,
13924
13925 /// Time the operation was completed.
13926 pub complete_time: std::option::Option<wkt::Timestamp>,
13927
13928 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13929}
13930
13931impl UpdateWorkerPoolOperationMetadata {
13932 pub fn new() -> Self {
13933 std::default::Default::default()
13934 }
13935
13936 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolOperationMetadata::worker_pool].
13937 ///
13938 /// # Example
13939 /// ```ignore,no_run
13940 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13941 /// let x = UpdateWorkerPoolOperationMetadata::new().set_worker_pool("example");
13942 /// ```
13943 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13944 self.worker_pool = v.into();
13945 self
13946 }
13947
13948 /// Sets the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
13949 ///
13950 /// # Example
13951 /// ```ignore,no_run
13952 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13953 /// use wkt::Timestamp;
13954 /// let x = UpdateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
13955 /// ```
13956 pub fn set_create_time<T>(mut self, v: T) -> Self
13957 where
13958 T: std::convert::Into<wkt::Timestamp>,
13959 {
13960 self.create_time = std::option::Option::Some(v.into());
13961 self
13962 }
13963
13964 /// Sets or clears the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
13965 ///
13966 /// # Example
13967 /// ```ignore,no_run
13968 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13969 /// use wkt::Timestamp;
13970 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13971 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
13972 /// ```
13973 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13974 where
13975 T: std::convert::Into<wkt::Timestamp>,
13976 {
13977 self.create_time = v.map(|x| x.into());
13978 self
13979 }
13980
13981 /// Sets the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
13982 ///
13983 /// # Example
13984 /// ```ignore,no_run
13985 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13986 /// use wkt::Timestamp;
13987 /// let x = UpdateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
13988 /// ```
13989 pub fn set_complete_time<T>(mut self, v: T) -> Self
13990 where
13991 T: std::convert::Into<wkt::Timestamp>,
13992 {
13993 self.complete_time = std::option::Option::Some(v.into());
13994 self
13995 }
13996
13997 /// Sets or clears the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
13998 ///
13999 /// # Example
14000 /// ```ignore,no_run
14001 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14002 /// use wkt::Timestamp;
14003 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14004 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14005 /// ```
14006 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14007 where
14008 T: std::convert::Into<wkt::Timestamp>,
14009 {
14010 self.complete_time = v.map(|x| x.into());
14011 self
14012 }
14013}
14014
14015impl wkt::message::Message for UpdateWorkerPoolOperationMetadata {
14016 fn typename() -> &'static str {
14017 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata"
14018 }
14019}
14020
14021/// Metadata for the `DeleteWorkerPool` operation.
14022#[derive(Clone, Default, PartialEq)]
14023#[non_exhaustive]
14024pub struct DeleteWorkerPoolOperationMetadata {
14025 /// The resource name of the `WorkerPool` being deleted.
14026 /// Format:
14027 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14028 pub worker_pool: std::string::String,
14029
14030 /// Time the operation was created.
14031 pub create_time: std::option::Option<wkt::Timestamp>,
14032
14033 /// Time the operation was completed.
14034 pub complete_time: std::option::Option<wkt::Timestamp>,
14035
14036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14037}
14038
14039impl DeleteWorkerPoolOperationMetadata {
14040 pub fn new() -> Self {
14041 std::default::Default::default()
14042 }
14043
14044 /// Sets the value of [worker_pool][crate::model::DeleteWorkerPoolOperationMetadata::worker_pool].
14045 ///
14046 /// # Example
14047 /// ```ignore,no_run
14048 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14049 /// let x = DeleteWorkerPoolOperationMetadata::new().set_worker_pool("example");
14050 /// ```
14051 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14052 self.worker_pool = v.into();
14053 self
14054 }
14055
14056 /// Sets the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14057 ///
14058 /// # Example
14059 /// ```ignore,no_run
14060 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14061 /// use wkt::Timestamp;
14062 /// let x = DeleteWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14063 /// ```
14064 pub fn set_create_time<T>(mut self, v: T) -> Self
14065 where
14066 T: std::convert::Into<wkt::Timestamp>,
14067 {
14068 self.create_time = std::option::Option::Some(v.into());
14069 self
14070 }
14071
14072 /// Sets or clears the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14073 ///
14074 /// # Example
14075 /// ```ignore,no_run
14076 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14077 /// use wkt::Timestamp;
14078 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14079 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14080 /// ```
14081 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14082 where
14083 T: std::convert::Into<wkt::Timestamp>,
14084 {
14085 self.create_time = v.map(|x| x.into());
14086 self
14087 }
14088
14089 /// Sets the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14090 ///
14091 /// # Example
14092 /// ```ignore,no_run
14093 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14094 /// use wkt::Timestamp;
14095 /// let x = DeleteWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14096 /// ```
14097 pub fn set_complete_time<T>(mut self, v: T) -> Self
14098 where
14099 T: std::convert::Into<wkt::Timestamp>,
14100 {
14101 self.complete_time = std::option::Option::Some(v.into());
14102 self
14103 }
14104
14105 /// Sets or clears the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14106 ///
14107 /// # Example
14108 /// ```ignore,no_run
14109 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14110 /// use wkt::Timestamp;
14111 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14112 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14113 /// ```
14114 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14115 where
14116 T: std::convert::Into<wkt::Timestamp>,
14117 {
14118 self.complete_time = v.map(|x| x.into());
14119 self
14120 }
14121}
14122
14123impl wkt::message::Message for DeleteWorkerPoolOperationMetadata {
14124 fn typename() -> &'static str {
14125 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata"
14126 }
14127}