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 async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Returns the default service account that will be used for `Builds`.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct GetDefaultServiceAccountRequest {
42 /// Required. The name of the `DefaultServiceAccount` to retrieve.
43 /// Format:
44 /// `projects/{project}/locations/{location}/defaultServiceAccount`
45 pub name: std::string::String,
46
47 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
48}
49
50impl GetDefaultServiceAccountRequest {
51 pub fn new() -> Self {
52 std::default::Default::default()
53 }
54
55 /// Sets the value of [name][crate::model::GetDefaultServiceAccountRequest::name].
56 ///
57 /// # Example
58 /// ```ignore,no_run
59 /// # use google_cloud_build_v1::model::GetDefaultServiceAccountRequest;
60 /// let x = GetDefaultServiceAccountRequest::new().set_name("example");
61 /// ```
62 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
63 self.name = v.into();
64 self
65 }
66}
67
68impl wkt::message::Message for GetDefaultServiceAccountRequest {
69 fn typename() -> &'static str {
70 "type.googleapis.com/google.devtools.cloudbuild.v1.GetDefaultServiceAccountRequest"
71 }
72}
73
74/// The default service account used for `Builds`.
75#[derive(Clone, Default, PartialEq)]
76#[non_exhaustive]
77pub struct DefaultServiceAccount {
78 /// Identifier. Format:
79 /// `projects/{project}/locations/{location}/defaultServiceAccount`
80 pub name: std::string::String,
81
82 /// Output only. The email address of the service account identity that will be
83 /// used for a build by default.
84 ///
85 /// This is returned in the format
86 /// `projects/{project}/serviceAccounts/{service_account}` where
87 /// `{service_account}` could be the legacy Cloud Build SA, in the format
88 /// [PROJECT_NUMBER]@cloudbuild.gserviceaccount.com or the Compute SA, in the
89 /// format [PROJECT_NUMBER]-compute@developer.gserviceaccount.com.
90 ///
91 /// If no service account will be used by default, this will be empty.
92 pub service_account_email: std::string::String,
93
94 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
95}
96
97impl DefaultServiceAccount {
98 pub fn new() -> Self {
99 std::default::Default::default()
100 }
101
102 /// Sets the value of [name][crate::model::DefaultServiceAccount::name].
103 ///
104 /// # Example
105 /// ```ignore,no_run
106 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
107 /// let x = DefaultServiceAccount::new().set_name("example");
108 /// ```
109 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
110 self.name = v.into();
111 self
112 }
113
114 /// Sets the value of [service_account_email][crate::model::DefaultServiceAccount::service_account_email].
115 ///
116 /// # Example
117 /// ```ignore,no_run
118 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
119 /// let x = DefaultServiceAccount::new().set_service_account_email("example");
120 /// ```
121 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
122 mut self,
123 v: T,
124 ) -> Self {
125 self.service_account_email = v.into();
126 self
127 }
128}
129
130impl wkt::message::Message for DefaultServiceAccount {
131 fn typename() -> &'static str {
132 "type.googleapis.com/google.devtools.cloudbuild.v1.DefaultServiceAccount"
133 }
134}
135
136/// Specifies a build to retry.
137#[derive(Clone, Default, PartialEq)]
138#[non_exhaustive]
139pub struct RetryBuildRequest {
140 /// The name of the `Build` to retry.
141 /// Format: `projects/{project}/locations/{location}/builds/{build}`
142 pub name: std::string::String,
143
144 /// Required. ID of the project.
145 pub project_id: std::string::String,
146
147 /// Required. Build ID of the original build.
148 pub id: std::string::String,
149
150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
151}
152
153impl RetryBuildRequest {
154 pub fn new() -> Self {
155 std::default::Default::default()
156 }
157
158 /// Sets the value of [name][crate::model::RetryBuildRequest::name].
159 ///
160 /// # Example
161 /// ```ignore,no_run
162 /// # use google_cloud_build_v1::model::RetryBuildRequest;
163 /// let x = RetryBuildRequest::new().set_name("example");
164 /// ```
165 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
166 self.name = v.into();
167 self
168 }
169
170 /// Sets the value of [project_id][crate::model::RetryBuildRequest::project_id].
171 ///
172 /// # Example
173 /// ```ignore,no_run
174 /// # use google_cloud_build_v1::model::RetryBuildRequest;
175 /// let x = RetryBuildRequest::new().set_project_id("example");
176 /// ```
177 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
178 self.project_id = v.into();
179 self
180 }
181
182 /// Sets the value of [id][crate::model::RetryBuildRequest::id].
183 ///
184 /// # Example
185 /// ```ignore,no_run
186 /// # use google_cloud_build_v1::model::RetryBuildRequest;
187 /// let x = RetryBuildRequest::new().set_id("example");
188 /// ```
189 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
190 self.id = v.into();
191 self
192 }
193}
194
195impl wkt::message::Message for RetryBuildRequest {
196 fn typename() -> &'static str {
197 "type.googleapis.com/google.devtools.cloudbuild.v1.RetryBuildRequest"
198 }
199}
200
201/// Specifies a build trigger to run and the source to use.
202#[derive(Clone, Default, PartialEq)]
203#[non_exhaustive]
204pub struct RunBuildTriggerRequest {
205 /// The name of the `Trigger` to run.
206 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
207 pub name: std::string::String,
208
209 /// Required. ID of the project.
210 pub project_id: std::string::String,
211
212 /// Required. ID of the trigger.
213 pub trigger_id: std::string::String,
214
215 /// Source to build against this trigger.
216 /// Branch and tag names cannot consist of regular expressions.
217 pub source: std::option::Option<crate::model::RepoSource>,
218
219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
220}
221
222impl RunBuildTriggerRequest {
223 pub fn new() -> Self {
224 std::default::Default::default()
225 }
226
227 /// Sets the value of [name][crate::model::RunBuildTriggerRequest::name].
228 ///
229 /// # Example
230 /// ```ignore,no_run
231 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
232 /// let x = RunBuildTriggerRequest::new().set_name("example");
233 /// ```
234 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
235 self.name = v.into();
236 self
237 }
238
239 /// Sets the value of [project_id][crate::model::RunBuildTriggerRequest::project_id].
240 ///
241 /// # Example
242 /// ```ignore,no_run
243 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
244 /// let x = RunBuildTriggerRequest::new().set_project_id("example");
245 /// ```
246 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
247 self.project_id = v.into();
248 self
249 }
250
251 /// Sets the value of [trigger_id][crate::model::RunBuildTriggerRequest::trigger_id].
252 ///
253 /// # Example
254 /// ```ignore,no_run
255 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
256 /// let x = RunBuildTriggerRequest::new().set_trigger_id("example");
257 /// ```
258 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
259 self.trigger_id = v.into();
260 self
261 }
262
263 /// Sets the value of [source][crate::model::RunBuildTriggerRequest::source].
264 ///
265 /// # Example
266 /// ```ignore,no_run
267 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
268 /// use google_cloud_build_v1::model::RepoSource;
269 /// let x = RunBuildTriggerRequest::new().set_source(RepoSource::default()/* use setters */);
270 /// ```
271 pub fn set_source<T>(mut self, v: T) -> Self
272 where
273 T: std::convert::Into<crate::model::RepoSource>,
274 {
275 self.source = std::option::Option::Some(v.into());
276 self
277 }
278
279 /// Sets or clears the value of [source][crate::model::RunBuildTriggerRequest::source].
280 ///
281 /// # Example
282 /// ```ignore,no_run
283 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
284 /// use google_cloud_build_v1::model::RepoSource;
285 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(Some(RepoSource::default()/* use setters */));
286 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(None::<RepoSource>);
287 /// ```
288 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
289 where
290 T: std::convert::Into<crate::model::RepoSource>,
291 {
292 self.source = v.map(|x| x.into());
293 self
294 }
295}
296
297impl wkt::message::Message for RunBuildTriggerRequest {
298 fn typename() -> &'static str {
299 "type.googleapis.com/google.devtools.cloudbuild.v1.RunBuildTriggerRequest"
300 }
301}
302
303/// Location of the source in an archive file in Cloud Storage.
304#[derive(Clone, Default, PartialEq)]
305#[non_exhaustive]
306pub struct StorageSource {
307 /// Cloud Storage bucket containing the source (see
308 /// [Bucket Name
309 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
310 pub bucket: std::string::String,
311
312 /// Required. Cloud Storage object containing the source.
313 ///
314 /// This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`)
315 /// containing source to build.
316 pub object: std::string::String,
317
318 /// Optional. Cloud Storage generation for the object. If the generation is
319 /// omitted, the latest generation will be used.
320 pub generation: i64,
321
322 /// Optional. Option to specify the tool to fetch the source file for the
323 /// build.
324 pub source_fetcher: crate::model::storage_source::SourceFetcher,
325
326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
327}
328
329impl StorageSource {
330 pub fn new() -> Self {
331 std::default::Default::default()
332 }
333
334 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
335 ///
336 /// # Example
337 /// ```ignore,no_run
338 /// # use google_cloud_build_v1::model::StorageSource;
339 /// let x = StorageSource::new().set_bucket("example");
340 /// ```
341 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
342 self.bucket = v.into();
343 self
344 }
345
346 /// Sets the value of [object][crate::model::StorageSource::object].
347 ///
348 /// # Example
349 /// ```ignore,no_run
350 /// # use google_cloud_build_v1::model::StorageSource;
351 /// let x = StorageSource::new().set_object("example");
352 /// ```
353 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
354 self.object = v.into();
355 self
356 }
357
358 /// Sets the value of [generation][crate::model::StorageSource::generation].
359 ///
360 /// # Example
361 /// ```ignore,no_run
362 /// # use google_cloud_build_v1::model::StorageSource;
363 /// let x = StorageSource::new().set_generation(42);
364 /// ```
365 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
366 self.generation = v.into();
367 self
368 }
369
370 /// Sets the value of [source_fetcher][crate::model::StorageSource::source_fetcher].
371 ///
372 /// # Example
373 /// ```ignore,no_run
374 /// # use google_cloud_build_v1::model::StorageSource;
375 /// use google_cloud_build_v1::model::storage_source::SourceFetcher;
376 /// let x0 = StorageSource::new().set_source_fetcher(SourceFetcher::Gsutil);
377 /// let x1 = StorageSource::new().set_source_fetcher(SourceFetcher::GcsFetcher);
378 /// ```
379 pub fn set_source_fetcher<
380 T: std::convert::Into<crate::model::storage_source::SourceFetcher>,
381 >(
382 mut self,
383 v: T,
384 ) -> Self {
385 self.source_fetcher = v.into();
386 self
387 }
388}
389
390impl wkt::message::Message for StorageSource {
391 fn typename() -> &'static str {
392 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSource"
393 }
394}
395
396/// Defines additional types related to [StorageSource].
397pub mod storage_source {
398 #[allow(unused_imports)]
399 use super::*;
400
401 /// Specifies the tool to fetch the source file for the build.
402 ///
403 /// # Working with unknown values
404 ///
405 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
406 /// additional enum variants at any time. Adding new variants is not considered
407 /// a breaking change. Applications should write their code in anticipation of:
408 ///
409 /// - New values appearing in future releases of the client library, **and**
410 /// - New values received dynamically, without application changes.
411 ///
412 /// Please consult the [Working with enums] section in the user guide for some
413 /// guidelines.
414 ///
415 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
416 #[derive(Clone, Debug, PartialEq)]
417 #[non_exhaustive]
418 pub enum SourceFetcher {
419 /// Unspecified defaults to GSUTIL.
420 Unspecified,
421 /// Use the "gsutil" tool to download the source file.
422 Gsutil,
423 /// Use the Cloud Storage Fetcher tool to download the source file.
424 GcsFetcher,
425 /// If set, the enum was initialized with an unknown value.
426 ///
427 /// Applications can examine the value using [SourceFetcher::value] or
428 /// [SourceFetcher::name].
429 UnknownValue(source_fetcher::UnknownValue),
430 }
431
432 #[doc(hidden)]
433 pub mod source_fetcher {
434 #[allow(unused_imports)]
435 use super::*;
436 #[derive(Clone, Debug, PartialEq)]
437 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
438 }
439
440 impl SourceFetcher {
441 /// Gets the enum value.
442 ///
443 /// Returns `None` if the enum contains an unknown value deserialized from
444 /// the string representation of enums.
445 pub fn value(&self) -> std::option::Option<i32> {
446 match self {
447 Self::Unspecified => std::option::Option::Some(0),
448 Self::Gsutil => std::option::Option::Some(1),
449 Self::GcsFetcher => std::option::Option::Some(2),
450 Self::UnknownValue(u) => u.0.value(),
451 }
452 }
453
454 /// Gets the enum value as a string.
455 ///
456 /// Returns `None` if the enum contains an unknown value deserialized from
457 /// the integer representation of enums.
458 pub fn name(&self) -> std::option::Option<&str> {
459 match self {
460 Self::Unspecified => std::option::Option::Some("SOURCE_FETCHER_UNSPECIFIED"),
461 Self::Gsutil => std::option::Option::Some("GSUTIL"),
462 Self::GcsFetcher => std::option::Option::Some("GCS_FETCHER"),
463 Self::UnknownValue(u) => u.0.name(),
464 }
465 }
466 }
467
468 impl std::default::Default for SourceFetcher {
469 fn default() -> Self {
470 use std::convert::From;
471 Self::from(0)
472 }
473 }
474
475 impl std::fmt::Display for SourceFetcher {
476 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
477 wkt::internal::display_enum(f, self.name(), self.value())
478 }
479 }
480
481 impl std::convert::From<i32> for SourceFetcher {
482 fn from(value: i32) -> Self {
483 match value {
484 0 => Self::Unspecified,
485 1 => Self::Gsutil,
486 2 => Self::GcsFetcher,
487 _ => Self::UnknownValue(source_fetcher::UnknownValue(
488 wkt::internal::UnknownEnumValue::Integer(value),
489 )),
490 }
491 }
492 }
493
494 impl std::convert::From<&str> for SourceFetcher {
495 fn from(value: &str) -> Self {
496 use std::string::ToString;
497 match value {
498 "SOURCE_FETCHER_UNSPECIFIED" => Self::Unspecified,
499 "GSUTIL" => Self::Gsutil,
500 "GCS_FETCHER" => Self::GcsFetcher,
501 _ => Self::UnknownValue(source_fetcher::UnknownValue(
502 wkt::internal::UnknownEnumValue::String(value.to_string()),
503 )),
504 }
505 }
506 }
507
508 impl serde::ser::Serialize for SourceFetcher {
509 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
510 where
511 S: serde::Serializer,
512 {
513 match self {
514 Self::Unspecified => serializer.serialize_i32(0),
515 Self::Gsutil => serializer.serialize_i32(1),
516 Self::GcsFetcher => serializer.serialize_i32(2),
517 Self::UnknownValue(u) => u.0.serialize(serializer),
518 }
519 }
520 }
521
522 impl<'de> serde::de::Deserialize<'de> for SourceFetcher {
523 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
524 where
525 D: serde::Deserializer<'de>,
526 {
527 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SourceFetcher>::new(
528 ".google.devtools.cloudbuild.v1.StorageSource.SourceFetcher",
529 ))
530 }
531 }
532}
533
534/// Location of the source in any accessible Git repository.
535#[derive(Clone, Default, PartialEq)]
536#[non_exhaustive]
537pub struct GitSource {
538 /// Required. Location of the Git repo to build.
539 ///
540 /// This will be used as a `git remote`, see
541 /// <https://git-scm.com/docs/git-remote>.
542 pub url: std::string::String,
543
544 /// Optional. Directory, relative to the source root, in which to run the
545 /// build.
546 ///
547 /// This must be a relative path. If a step's `dir` is specified and is an
548 /// absolute path, this value is ignored for that step's execution.
549 pub dir: std::string::String,
550
551 /// Optional. The revision to fetch from the Git repository such as a branch, a
552 /// tag, a commit SHA, or any Git ref.
553 ///
554 /// Cloud Build uses `git fetch` to fetch the revision from the Git
555 /// repository; therefore make sure that the string you provide for `revision`
556 /// is parsable by the command. For information on string values accepted by
557 /// `git fetch`, see
558 /// <https://git-scm.com/docs/gitrevisions#_specifying_revisions>. For
559 /// information on `git fetch`, see <https://git-scm.com/docs/git-fetch>.
560 pub revision: std::string::String,
561
562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
563}
564
565impl GitSource {
566 pub fn new() -> Self {
567 std::default::Default::default()
568 }
569
570 /// Sets the value of [url][crate::model::GitSource::url].
571 ///
572 /// # Example
573 /// ```ignore,no_run
574 /// # use google_cloud_build_v1::model::GitSource;
575 /// let x = GitSource::new().set_url("example");
576 /// ```
577 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
578 self.url = v.into();
579 self
580 }
581
582 /// Sets the value of [dir][crate::model::GitSource::dir].
583 ///
584 /// # Example
585 /// ```ignore,no_run
586 /// # use google_cloud_build_v1::model::GitSource;
587 /// let x = GitSource::new().set_dir("example");
588 /// ```
589 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
590 self.dir = v.into();
591 self
592 }
593
594 /// Sets the value of [revision][crate::model::GitSource::revision].
595 ///
596 /// # Example
597 /// ```ignore,no_run
598 /// # use google_cloud_build_v1::model::GitSource;
599 /// let x = GitSource::new().set_revision("example");
600 /// ```
601 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
602 self.revision = v.into();
603 self
604 }
605}
606
607impl wkt::message::Message for GitSource {
608 fn typename() -> &'static str {
609 "type.googleapis.com/google.devtools.cloudbuild.v1.GitSource"
610 }
611}
612
613/// Location of the source in a Google Cloud Source Repository.
614#[derive(Clone, Default, PartialEq)]
615#[non_exhaustive]
616pub struct RepoSource {
617 /// Optional. ID of the project that owns the Cloud Source Repository. If
618 /// omitted, the project ID requesting the build is assumed.
619 pub project_id: std::string::String,
620
621 /// Required. Name of the Cloud Source Repository.
622 pub repo_name: std::string::String,
623
624 /// Optional. Directory, relative to the source root, in which to run the
625 /// build.
626 ///
627 /// This must be a relative path. If a step's `dir` is specified and is an
628 /// absolute path, this value is ignored for that step's execution.
629 pub dir: std::string::String,
630
631 /// Optional. Only trigger a build if the revision regex does NOT match the
632 /// revision regex.
633 pub invert_regex: bool,
634
635 /// Optional. Substitutions to use in a triggered build.
636 /// Should only be used with RunBuildTrigger
637 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
638
639 /// A revision within the Cloud Source Repository must be specified in
640 /// one of these ways.
641 pub revision: std::option::Option<crate::model::repo_source::Revision>,
642
643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
644}
645
646impl RepoSource {
647 pub fn new() -> Self {
648 std::default::Default::default()
649 }
650
651 /// Sets the value of [project_id][crate::model::RepoSource::project_id].
652 ///
653 /// # Example
654 /// ```ignore,no_run
655 /// # use google_cloud_build_v1::model::RepoSource;
656 /// let x = RepoSource::new().set_project_id("example");
657 /// ```
658 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
659 self.project_id = v.into();
660 self
661 }
662
663 /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
664 ///
665 /// # Example
666 /// ```ignore,no_run
667 /// # use google_cloud_build_v1::model::RepoSource;
668 /// let x = RepoSource::new().set_repo_name("example");
669 /// ```
670 pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
671 self.repo_name = v.into();
672 self
673 }
674
675 /// Sets the value of [dir][crate::model::RepoSource::dir].
676 ///
677 /// # Example
678 /// ```ignore,no_run
679 /// # use google_cloud_build_v1::model::RepoSource;
680 /// let x = RepoSource::new().set_dir("example");
681 /// ```
682 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
683 self.dir = v.into();
684 self
685 }
686
687 /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
688 ///
689 /// # Example
690 /// ```ignore,no_run
691 /// # use google_cloud_build_v1::model::RepoSource;
692 /// let x = RepoSource::new().set_invert_regex(true);
693 /// ```
694 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
695 self.invert_regex = v.into();
696 self
697 }
698
699 /// Sets the value of [substitutions][crate::model::RepoSource::substitutions].
700 ///
701 /// # Example
702 /// ```ignore,no_run
703 /// # use google_cloud_build_v1::model::RepoSource;
704 /// let x = RepoSource::new().set_substitutions([
705 /// ("key0", "abc"),
706 /// ("key1", "xyz"),
707 /// ]);
708 /// ```
709 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
710 where
711 T: std::iter::IntoIterator<Item = (K, V)>,
712 K: std::convert::Into<std::string::String>,
713 V: std::convert::Into<std::string::String>,
714 {
715 use std::iter::Iterator;
716 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
717 self
718 }
719
720 /// Sets the value of [revision][crate::model::RepoSource::revision].
721 ///
722 /// Note that all the setters affecting `revision` are mutually
723 /// exclusive.
724 ///
725 /// # Example
726 /// ```ignore,no_run
727 /// # use google_cloud_build_v1::model::RepoSource;
728 /// use google_cloud_build_v1::model::repo_source::Revision;
729 /// let x = RepoSource::new().set_revision(Some(Revision::BranchName("example".to_string())));
730 /// ```
731 pub fn set_revision<
732 T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
733 >(
734 mut self,
735 v: T,
736 ) -> Self {
737 self.revision = v.into();
738 self
739 }
740
741 /// The value of [revision][crate::model::RepoSource::revision]
742 /// if it holds a `BranchName`, `None` if the field is not set or
743 /// holds a different branch.
744 pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
745 #[allow(unreachable_patterns)]
746 self.revision.as_ref().and_then(|v| match v {
747 crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
748 _ => std::option::Option::None,
749 })
750 }
751
752 /// Sets the value of [revision][crate::model::RepoSource::revision]
753 /// to hold a `BranchName`.
754 ///
755 /// Note that all the setters affecting `revision` are
756 /// mutually exclusive.
757 ///
758 /// # Example
759 /// ```ignore,no_run
760 /// # use google_cloud_build_v1::model::RepoSource;
761 /// let x = RepoSource::new().set_branch_name("example");
762 /// assert!(x.branch_name().is_some());
763 /// assert!(x.tag_name().is_none());
764 /// assert!(x.commit_sha().is_none());
765 /// ```
766 pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
767 self.revision =
768 std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
769 self
770 }
771
772 /// The value of [revision][crate::model::RepoSource::revision]
773 /// if it holds a `TagName`, `None` if the field is not set or
774 /// holds a different branch.
775 pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
776 #[allow(unreachable_patterns)]
777 self.revision.as_ref().and_then(|v| match v {
778 crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
779 _ => std::option::Option::None,
780 })
781 }
782
783 /// Sets the value of [revision][crate::model::RepoSource::revision]
784 /// to hold a `TagName`.
785 ///
786 /// Note that all the setters affecting `revision` are
787 /// mutually exclusive.
788 ///
789 /// # Example
790 /// ```ignore,no_run
791 /// # use google_cloud_build_v1::model::RepoSource;
792 /// let x = RepoSource::new().set_tag_name("example");
793 /// assert!(x.tag_name().is_some());
794 /// assert!(x.branch_name().is_none());
795 /// assert!(x.commit_sha().is_none());
796 /// ```
797 pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
798 self.revision =
799 std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
800 self
801 }
802
803 /// The value of [revision][crate::model::RepoSource::revision]
804 /// if it holds a `CommitSha`, `None` if the field is not set or
805 /// holds a different branch.
806 pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
807 #[allow(unreachable_patterns)]
808 self.revision.as_ref().and_then(|v| match v {
809 crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
810 _ => std::option::Option::None,
811 })
812 }
813
814 /// Sets the value of [revision][crate::model::RepoSource::revision]
815 /// to hold a `CommitSha`.
816 ///
817 /// Note that all the setters affecting `revision` are
818 /// mutually exclusive.
819 ///
820 /// # Example
821 /// ```ignore,no_run
822 /// # use google_cloud_build_v1::model::RepoSource;
823 /// let x = RepoSource::new().set_commit_sha("example");
824 /// assert!(x.commit_sha().is_some());
825 /// assert!(x.branch_name().is_none());
826 /// assert!(x.tag_name().is_none());
827 /// ```
828 pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
829 self.revision =
830 std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
831 self
832 }
833}
834
835impl wkt::message::Message for RepoSource {
836 fn typename() -> &'static str {
837 "type.googleapis.com/google.devtools.cloudbuild.v1.RepoSource"
838 }
839}
840
841/// Defines additional types related to [RepoSource].
842pub mod repo_source {
843 #[allow(unused_imports)]
844 use super::*;
845
846 /// A revision within the Cloud Source Repository must be specified in
847 /// one of these ways.
848 #[derive(Clone, Debug, PartialEq)]
849 #[non_exhaustive]
850 pub enum Revision {
851 /// Regex matching branches to build.
852 ///
853 /// The syntax of the regular expressions accepted is the syntax accepted by
854 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
855 BranchName(std::string::String),
856 /// Regex matching tags to build.
857 ///
858 /// The syntax of the regular expressions accepted is the syntax accepted by
859 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
860 TagName(std::string::String),
861 /// Explicit commit SHA to build.
862 CommitSha(std::string::String),
863 }
864}
865
866/// Location of the source manifest in Cloud Storage.
867/// This feature is in Preview; see description
868/// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
869#[derive(Clone, Default, PartialEq)]
870#[non_exhaustive]
871pub struct StorageSourceManifest {
872 /// Required. Cloud Storage bucket containing the source manifest (see [Bucket
873 /// Name
874 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
875 pub bucket: std::string::String,
876
877 /// Required. Cloud Storage object containing the source manifest.
878 ///
879 /// This object must be a JSON file.
880 pub object: std::string::String,
881
882 /// Cloud Storage generation for the object. If the generation is
883 /// omitted, the latest generation will be used.
884 pub generation: i64,
885
886 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
887}
888
889impl StorageSourceManifest {
890 pub fn new() -> Self {
891 std::default::Default::default()
892 }
893
894 /// Sets the value of [bucket][crate::model::StorageSourceManifest::bucket].
895 ///
896 /// # Example
897 /// ```ignore,no_run
898 /// # use google_cloud_build_v1::model::StorageSourceManifest;
899 /// let x = StorageSourceManifest::new().set_bucket("example");
900 /// ```
901 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
902 self.bucket = v.into();
903 self
904 }
905
906 /// Sets the value of [object][crate::model::StorageSourceManifest::object].
907 ///
908 /// # Example
909 /// ```ignore,no_run
910 /// # use google_cloud_build_v1::model::StorageSourceManifest;
911 /// let x = StorageSourceManifest::new().set_object("example");
912 /// ```
913 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
914 self.object = v.into();
915 self
916 }
917
918 /// Sets the value of [generation][crate::model::StorageSourceManifest::generation].
919 ///
920 /// # Example
921 /// ```ignore,no_run
922 /// # use google_cloud_build_v1::model::StorageSourceManifest;
923 /// let x = StorageSourceManifest::new().set_generation(42);
924 /// ```
925 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
926 self.generation = v.into();
927 self
928 }
929}
930
931impl wkt::message::Message for StorageSourceManifest {
932 fn typename() -> &'static str {
933 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSourceManifest"
934 }
935}
936
937/// Location of the source in a 2nd-gen Google Cloud Build repository resource.
938#[derive(Clone, Default, PartialEq)]
939#[non_exhaustive]
940pub struct ConnectedRepository {
941 /// Required. Name of the Google Cloud Build repository, formatted as
942 /// `projects/*/locations/*/connections/*/repositories/*`.
943 pub repository: std::string::String,
944
945 /// Optional. Directory, relative to the source root, in which to run the
946 /// build.
947 pub dir: std::string::String,
948
949 /// Required. The revision to fetch from the Git repository such as a branch, a
950 /// tag, a commit SHA, or any Git ref.
951 pub revision: std::string::String,
952
953 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
954}
955
956impl ConnectedRepository {
957 pub fn new() -> Self {
958 std::default::Default::default()
959 }
960
961 /// Sets the value of [repository][crate::model::ConnectedRepository::repository].
962 ///
963 /// # Example
964 /// ```ignore,no_run
965 /// # use google_cloud_build_v1::model::ConnectedRepository;
966 /// let x = ConnectedRepository::new().set_repository("example");
967 /// ```
968 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
969 self.repository = v.into();
970 self
971 }
972
973 /// Sets the value of [dir][crate::model::ConnectedRepository::dir].
974 ///
975 /// # Example
976 /// ```ignore,no_run
977 /// # use google_cloud_build_v1::model::ConnectedRepository;
978 /// let x = ConnectedRepository::new().set_dir("example");
979 /// ```
980 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
981 self.dir = v.into();
982 self
983 }
984
985 /// Sets the value of [revision][crate::model::ConnectedRepository::revision].
986 ///
987 /// # Example
988 /// ```ignore,no_run
989 /// # use google_cloud_build_v1::model::ConnectedRepository;
990 /// let x = ConnectedRepository::new().set_revision("example");
991 /// ```
992 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
993 self.revision = v.into();
994 self
995 }
996}
997
998impl wkt::message::Message for ConnectedRepository {
999 fn typename() -> &'static str {
1000 "type.googleapis.com/google.devtools.cloudbuild.v1.ConnectedRepository"
1001 }
1002}
1003
1004/// Location of the source in a supported storage service.
1005#[derive(Clone, Default, PartialEq)]
1006#[non_exhaustive]
1007pub struct Source {
1008 /// Location of source.
1009 pub source: std::option::Option<crate::model::source::Source>,
1010
1011 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1012}
1013
1014impl Source {
1015 pub fn new() -> Self {
1016 std::default::Default::default()
1017 }
1018
1019 /// Sets the value of [source][crate::model::Source::source].
1020 ///
1021 /// Note that all the setters affecting `source` are mutually
1022 /// exclusive.
1023 ///
1024 /// # Example
1025 /// ```ignore,no_run
1026 /// # use google_cloud_build_v1::model::Source;
1027 /// use google_cloud_build_v1::model::StorageSource;
1028 /// let x = Source::new().set_source(Some(
1029 /// google_cloud_build_v1::model::source::Source::StorageSource(StorageSource::default().into())));
1030 /// ```
1031 pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
1032 mut self,
1033 v: T,
1034 ) -> Self {
1035 self.source = v.into();
1036 self
1037 }
1038
1039 /// The value of [source][crate::model::Source::source]
1040 /// if it holds a `StorageSource`, `None` if the field is not set or
1041 /// holds a different branch.
1042 pub fn storage_source(
1043 &self,
1044 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
1045 #[allow(unreachable_patterns)]
1046 self.source.as_ref().and_then(|v| match v {
1047 crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
1048 _ => std::option::Option::None,
1049 })
1050 }
1051
1052 /// Sets the value of [source][crate::model::Source::source]
1053 /// to hold a `StorageSource`.
1054 ///
1055 /// Note that all the setters affecting `source` are
1056 /// mutually exclusive.
1057 ///
1058 /// # Example
1059 /// ```ignore,no_run
1060 /// # use google_cloud_build_v1::model::Source;
1061 /// use google_cloud_build_v1::model::StorageSource;
1062 /// let x = Source::new().set_storage_source(StorageSource::default()/* use setters */);
1063 /// assert!(x.storage_source().is_some());
1064 /// assert!(x.repo_source().is_none());
1065 /// assert!(x.git_source().is_none());
1066 /// assert!(x.storage_source_manifest().is_none());
1067 /// assert!(x.connected_repository().is_none());
1068 /// ```
1069 pub fn set_storage_source<
1070 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
1071 >(
1072 mut self,
1073 v: T,
1074 ) -> Self {
1075 self.source =
1076 std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
1077 self
1078 }
1079
1080 /// The value of [source][crate::model::Source::source]
1081 /// if it holds a `RepoSource`, `None` if the field is not set or
1082 /// holds a different branch.
1083 pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
1084 #[allow(unreachable_patterns)]
1085 self.source.as_ref().and_then(|v| match v {
1086 crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
1087 _ => std::option::Option::None,
1088 })
1089 }
1090
1091 /// Sets the value of [source][crate::model::Source::source]
1092 /// to hold a `RepoSource`.
1093 ///
1094 /// Note that all the setters affecting `source` are
1095 /// mutually exclusive.
1096 ///
1097 /// # Example
1098 /// ```ignore,no_run
1099 /// # use google_cloud_build_v1::model::Source;
1100 /// use google_cloud_build_v1::model::RepoSource;
1101 /// let x = Source::new().set_repo_source(RepoSource::default()/* use setters */);
1102 /// assert!(x.repo_source().is_some());
1103 /// assert!(x.storage_source().is_none());
1104 /// assert!(x.git_source().is_none());
1105 /// assert!(x.storage_source_manifest().is_none());
1106 /// assert!(x.connected_repository().is_none());
1107 /// ```
1108 pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
1109 mut self,
1110 v: T,
1111 ) -> Self {
1112 self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
1113 self
1114 }
1115
1116 /// The value of [source][crate::model::Source::source]
1117 /// if it holds a `GitSource`, `None` if the field is not set or
1118 /// holds a different branch.
1119 pub fn git_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSource>> {
1120 #[allow(unreachable_patterns)]
1121 self.source.as_ref().and_then(|v| match v {
1122 crate::model::source::Source::GitSource(v) => std::option::Option::Some(v),
1123 _ => std::option::Option::None,
1124 })
1125 }
1126
1127 /// Sets the value of [source][crate::model::Source::source]
1128 /// to hold a `GitSource`.
1129 ///
1130 /// Note that all the setters affecting `source` are
1131 /// mutually exclusive.
1132 ///
1133 /// # Example
1134 /// ```ignore,no_run
1135 /// # use google_cloud_build_v1::model::Source;
1136 /// use google_cloud_build_v1::model::GitSource;
1137 /// let x = Source::new().set_git_source(GitSource::default()/* use setters */);
1138 /// assert!(x.git_source().is_some());
1139 /// assert!(x.storage_source().is_none());
1140 /// assert!(x.repo_source().is_none());
1141 /// assert!(x.storage_source_manifest().is_none());
1142 /// assert!(x.connected_repository().is_none());
1143 /// ```
1144 pub fn set_git_source<T: std::convert::Into<std::boxed::Box<crate::model::GitSource>>>(
1145 mut self,
1146 v: T,
1147 ) -> Self {
1148 self.source = std::option::Option::Some(crate::model::source::Source::GitSource(v.into()));
1149 self
1150 }
1151
1152 /// The value of [source][crate::model::Source::source]
1153 /// if it holds a `StorageSourceManifest`, `None` if the field is not set or
1154 /// holds a different branch.
1155 pub fn storage_source_manifest(
1156 &self,
1157 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSourceManifest>> {
1158 #[allow(unreachable_patterns)]
1159 self.source.as_ref().and_then(|v| match v {
1160 crate::model::source::Source::StorageSourceManifest(v) => std::option::Option::Some(v),
1161 _ => std::option::Option::None,
1162 })
1163 }
1164
1165 /// Sets the value of [source][crate::model::Source::source]
1166 /// to hold a `StorageSourceManifest`.
1167 ///
1168 /// Note that all the setters affecting `source` are
1169 /// mutually exclusive.
1170 ///
1171 /// # Example
1172 /// ```ignore,no_run
1173 /// # use google_cloud_build_v1::model::Source;
1174 /// use google_cloud_build_v1::model::StorageSourceManifest;
1175 /// let x = Source::new().set_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
1176 /// assert!(x.storage_source_manifest().is_some());
1177 /// assert!(x.storage_source().is_none());
1178 /// assert!(x.repo_source().is_none());
1179 /// assert!(x.git_source().is_none());
1180 /// assert!(x.connected_repository().is_none());
1181 /// ```
1182 pub fn set_storage_source_manifest<
1183 T: std::convert::Into<std::boxed::Box<crate::model::StorageSourceManifest>>,
1184 >(
1185 mut self,
1186 v: T,
1187 ) -> Self {
1188 self.source = std::option::Option::Some(
1189 crate::model::source::Source::StorageSourceManifest(v.into()),
1190 );
1191 self
1192 }
1193
1194 /// The value of [source][crate::model::Source::source]
1195 /// if it holds a `ConnectedRepository`, `None` if the field is not set or
1196 /// holds a different branch.
1197 pub fn connected_repository(
1198 &self,
1199 ) -> std::option::Option<&std::boxed::Box<crate::model::ConnectedRepository>> {
1200 #[allow(unreachable_patterns)]
1201 self.source.as_ref().and_then(|v| match v {
1202 crate::model::source::Source::ConnectedRepository(v) => std::option::Option::Some(v),
1203 _ => std::option::Option::None,
1204 })
1205 }
1206
1207 /// Sets the value of [source][crate::model::Source::source]
1208 /// to hold a `ConnectedRepository`.
1209 ///
1210 /// Note that all the setters affecting `source` are
1211 /// mutually exclusive.
1212 ///
1213 /// # Example
1214 /// ```ignore,no_run
1215 /// # use google_cloud_build_v1::model::Source;
1216 /// use google_cloud_build_v1::model::ConnectedRepository;
1217 /// let x = Source::new().set_connected_repository(ConnectedRepository::default()/* use setters */);
1218 /// assert!(x.connected_repository().is_some());
1219 /// assert!(x.storage_source().is_none());
1220 /// assert!(x.repo_source().is_none());
1221 /// assert!(x.git_source().is_none());
1222 /// assert!(x.storage_source_manifest().is_none());
1223 /// ```
1224 pub fn set_connected_repository<
1225 T: std::convert::Into<std::boxed::Box<crate::model::ConnectedRepository>>,
1226 >(
1227 mut self,
1228 v: T,
1229 ) -> Self {
1230 self.source =
1231 std::option::Option::Some(crate::model::source::Source::ConnectedRepository(v.into()));
1232 self
1233 }
1234}
1235
1236impl wkt::message::Message for Source {
1237 fn typename() -> &'static str {
1238 "type.googleapis.com/google.devtools.cloudbuild.v1.Source"
1239 }
1240}
1241
1242/// Defines additional types related to [Source].
1243pub mod source {
1244 #[allow(unused_imports)]
1245 use super::*;
1246
1247 /// Location of source.
1248 #[derive(Clone, Debug, PartialEq)]
1249 #[non_exhaustive]
1250 pub enum Source {
1251 /// If provided, get the source from this location in Cloud Storage.
1252 StorageSource(std::boxed::Box<crate::model::StorageSource>),
1253 /// If provided, get the source from this location in a Cloud Source
1254 /// Repository.
1255 RepoSource(std::boxed::Box<crate::model::RepoSource>),
1256 /// If provided, get the source from this Git repository.
1257 GitSource(std::boxed::Box<crate::model::GitSource>),
1258 /// If provided, get the source from this manifest in Cloud Storage.
1259 /// This feature is in Preview; see description
1260 /// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
1261 StorageSourceManifest(std::boxed::Box<crate::model::StorageSourceManifest>),
1262 /// Optional. If provided, get the source from this 2nd-gen Google Cloud
1263 /// Build repository resource.
1264 ConnectedRepository(std::boxed::Box<crate::model::ConnectedRepository>),
1265 }
1266}
1267
1268/// An image built by the pipeline.
1269#[derive(Clone, Default, PartialEq)]
1270#[non_exhaustive]
1271pub struct BuiltImage {
1272 /// Name used to push the container image to Google Container Registry, as
1273 /// presented to `docker push`.
1274 pub name: std::string::String,
1275
1276 /// Docker Registry 2.0 digest.
1277 pub digest: std::string::String,
1278
1279 /// Output only. Stores timing information for pushing the specified image.
1280 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1281
1282 /// Output only. Path to the artifact in Artifact Registry.
1283 pub artifact_registry_package: std::string::String,
1284
1285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1286}
1287
1288impl BuiltImage {
1289 pub fn new() -> Self {
1290 std::default::Default::default()
1291 }
1292
1293 /// Sets the value of [name][crate::model::BuiltImage::name].
1294 ///
1295 /// # Example
1296 /// ```ignore,no_run
1297 /// # use google_cloud_build_v1::model::BuiltImage;
1298 /// let x = BuiltImage::new().set_name("example");
1299 /// ```
1300 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1301 self.name = v.into();
1302 self
1303 }
1304
1305 /// Sets the value of [digest][crate::model::BuiltImage::digest].
1306 ///
1307 /// # Example
1308 /// ```ignore,no_run
1309 /// # use google_cloud_build_v1::model::BuiltImage;
1310 /// let x = BuiltImage::new().set_digest("example");
1311 /// ```
1312 pub fn set_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1313 self.digest = v.into();
1314 self
1315 }
1316
1317 /// Sets the value of [push_timing][crate::model::BuiltImage::push_timing].
1318 ///
1319 /// # Example
1320 /// ```ignore,no_run
1321 /// # use google_cloud_build_v1::model::BuiltImage;
1322 /// use google_cloud_build_v1::model::TimeSpan;
1323 /// let x = BuiltImage::new().set_push_timing(TimeSpan::default()/* use setters */);
1324 /// ```
1325 pub fn set_push_timing<T>(mut self, v: T) -> Self
1326 where
1327 T: std::convert::Into<crate::model::TimeSpan>,
1328 {
1329 self.push_timing = std::option::Option::Some(v.into());
1330 self
1331 }
1332
1333 /// Sets or clears the value of [push_timing][crate::model::BuiltImage::push_timing].
1334 ///
1335 /// # Example
1336 /// ```ignore,no_run
1337 /// # use google_cloud_build_v1::model::BuiltImage;
1338 /// use google_cloud_build_v1::model::TimeSpan;
1339 /// let x = BuiltImage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1340 /// let x = BuiltImage::new().set_or_clear_push_timing(None::<TimeSpan>);
1341 /// ```
1342 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1343 where
1344 T: std::convert::Into<crate::model::TimeSpan>,
1345 {
1346 self.push_timing = v.map(|x| x.into());
1347 self
1348 }
1349
1350 /// Sets the value of [artifact_registry_package][crate::model::BuiltImage::artifact_registry_package].
1351 ///
1352 /// # Example
1353 /// ```ignore,no_run
1354 /// # use google_cloud_build_v1::model::BuiltImage;
1355 /// let x = BuiltImage::new().set_artifact_registry_package("example");
1356 /// ```
1357 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1358 mut self,
1359 v: T,
1360 ) -> Self {
1361 self.artifact_registry_package = v.into();
1362 self
1363 }
1364}
1365
1366impl wkt::message::Message for BuiltImage {
1367 fn typename() -> &'static str {
1368 "type.googleapis.com/google.devtools.cloudbuild.v1.BuiltImage"
1369 }
1370}
1371
1372/// Artifact uploaded using the PythonPackage directive.
1373#[derive(Clone, Default, PartialEq)]
1374#[non_exhaustive]
1375pub struct UploadedPythonPackage {
1376 /// URI of the uploaded artifact.
1377 pub uri: std::string::String,
1378
1379 /// Hash types and values of the Python Artifact.
1380 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1381
1382 /// Output only. Stores timing information for pushing the specified artifact.
1383 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1384
1385 /// Output only. Path to the artifact in Artifact Registry.
1386 pub artifact_registry_package: std::string::String,
1387
1388 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1389}
1390
1391impl UploadedPythonPackage {
1392 pub fn new() -> Self {
1393 std::default::Default::default()
1394 }
1395
1396 /// Sets the value of [uri][crate::model::UploadedPythonPackage::uri].
1397 ///
1398 /// # Example
1399 /// ```ignore,no_run
1400 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1401 /// let x = UploadedPythonPackage::new().set_uri("example");
1402 /// ```
1403 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1404 self.uri = v.into();
1405 self
1406 }
1407
1408 /// Sets the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1409 ///
1410 /// # Example
1411 /// ```ignore,no_run
1412 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1413 /// use google_cloud_build_v1::model::FileHashes;
1414 /// let x = UploadedPythonPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1415 /// ```
1416 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1417 where
1418 T: std::convert::Into<crate::model::FileHashes>,
1419 {
1420 self.file_hashes = std::option::Option::Some(v.into());
1421 self
1422 }
1423
1424 /// Sets or clears the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1425 ///
1426 /// # Example
1427 /// ```ignore,no_run
1428 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1429 /// use google_cloud_build_v1::model::FileHashes;
1430 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1431 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1432 /// ```
1433 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1434 where
1435 T: std::convert::Into<crate::model::FileHashes>,
1436 {
1437 self.file_hashes = v.map(|x| x.into());
1438 self
1439 }
1440
1441 /// Sets the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1442 ///
1443 /// # Example
1444 /// ```ignore,no_run
1445 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1446 /// use google_cloud_build_v1::model::TimeSpan;
1447 /// let x = UploadedPythonPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1448 /// ```
1449 pub fn set_push_timing<T>(mut self, v: T) -> Self
1450 where
1451 T: std::convert::Into<crate::model::TimeSpan>,
1452 {
1453 self.push_timing = std::option::Option::Some(v.into());
1454 self
1455 }
1456
1457 /// Sets or clears the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1458 ///
1459 /// # Example
1460 /// ```ignore,no_run
1461 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1462 /// use google_cloud_build_v1::model::TimeSpan;
1463 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1464 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1465 /// ```
1466 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1467 where
1468 T: std::convert::Into<crate::model::TimeSpan>,
1469 {
1470 self.push_timing = v.map(|x| x.into());
1471 self
1472 }
1473
1474 /// Sets the value of [artifact_registry_package][crate::model::UploadedPythonPackage::artifact_registry_package].
1475 ///
1476 /// # Example
1477 /// ```ignore,no_run
1478 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1479 /// let x = UploadedPythonPackage::new().set_artifact_registry_package("example");
1480 /// ```
1481 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1482 mut self,
1483 v: T,
1484 ) -> Self {
1485 self.artifact_registry_package = v.into();
1486 self
1487 }
1488}
1489
1490impl wkt::message::Message for UploadedPythonPackage {
1491 fn typename() -> &'static str {
1492 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedPythonPackage"
1493 }
1494}
1495
1496/// A Maven artifact uploaded using the MavenArtifact directive.
1497#[derive(Clone, Default, PartialEq)]
1498#[non_exhaustive]
1499pub struct UploadedMavenArtifact {
1500 /// URI of the uploaded artifact.
1501 pub uri: std::string::String,
1502
1503 /// Hash types and values of the Maven Artifact.
1504 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1505
1506 /// Output only. Stores timing information for pushing the specified artifact.
1507 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1508
1509 /// Output only. Path to the artifact in Artifact Registry.
1510 pub artifact_registry_package: std::string::String,
1511
1512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1513}
1514
1515impl UploadedMavenArtifact {
1516 pub fn new() -> Self {
1517 std::default::Default::default()
1518 }
1519
1520 /// Sets the value of [uri][crate::model::UploadedMavenArtifact::uri].
1521 ///
1522 /// # Example
1523 /// ```ignore,no_run
1524 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1525 /// let x = UploadedMavenArtifact::new().set_uri("example");
1526 /// ```
1527 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1528 self.uri = v.into();
1529 self
1530 }
1531
1532 /// Sets the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1533 ///
1534 /// # Example
1535 /// ```ignore,no_run
1536 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1537 /// use google_cloud_build_v1::model::FileHashes;
1538 /// let x = UploadedMavenArtifact::new().set_file_hashes(FileHashes::default()/* use setters */);
1539 /// ```
1540 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1541 where
1542 T: std::convert::Into<crate::model::FileHashes>,
1543 {
1544 self.file_hashes = std::option::Option::Some(v.into());
1545 self
1546 }
1547
1548 /// Sets or clears the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1549 ///
1550 /// # Example
1551 /// ```ignore,no_run
1552 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1553 /// use google_cloud_build_v1::model::FileHashes;
1554 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1555 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(None::<FileHashes>);
1556 /// ```
1557 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1558 where
1559 T: std::convert::Into<crate::model::FileHashes>,
1560 {
1561 self.file_hashes = v.map(|x| x.into());
1562 self
1563 }
1564
1565 /// Sets the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1566 ///
1567 /// # Example
1568 /// ```ignore,no_run
1569 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1570 /// use google_cloud_build_v1::model::TimeSpan;
1571 /// let x = UploadedMavenArtifact::new().set_push_timing(TimeSpan::default()/* use setters */);
1572 /// ```
1573 pub fn set_push_timing<T>(mut self, v: T) -> Self
1574 where
1575 T: std::convert::Into<crate::model::TimeSpan>,
1576 {
1577 self.push_timing = std::option::Option::Some(v.into());
1578 self
1579 }
1580
1581 /// Sets or clears the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1582 ///
1583 /// # Example
1584 /// ```ignore,no_run
1585 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1586 /// use google_cloud_build_v1::model::TimeSpan;
1587 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1588 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(None::<TimeSpan>);
1589 /// ```
1590 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1591 where
1592 T: std::convert::Into<crate::model::TimeSpan>,
1593 {
1594 self.push_timing = v.map(|x| x.into());
1595 self
1596 }
1597
1598 /// Sets the value of [artifact_registry_package][crate::model::UploadedMavenArtifact::artifact_registry_package].
1599 ///
1600 /// # Example
1601 /// ```ignore,no_run
1602 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1603 /// let x = UploadedMavenArtifact::new().set_artifact_registry_package("example");
1604 /// ```
1605 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1606 mut self,
1607 v: T,
1608 ) -> Self {
1609 self.artifact_registry_package = v.into();
1610 self
1611 }
1612}
1613
1614impl wkt::message::Message for UploadedMavenArtifact {
1615 fn typename() -> &'static str {
1616 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedMavenArtifact"
1617 }
1618}
1619
1620/// A Go module artifact uploaded to Artifact Registry using the GoModule
1621/// directive.
1622#[derive(Clone, Default, PartialEq)]
1623#[non_exhaustive]
1624pub struct UploadedGoModule {
1625 /// URI of the uploaded artifact.
1626 pub uri: std::string::String,
1627
1628 /// Hash types and values of the Go Module Artifact.
1629 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1630
1631 /// Output only. Stores timing information for pushing the specified artifact.
1632 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1633
1634 /// Output only. Path to the artifact in Artifact Registry.
1635 pub artifact_registry_package: std::string::String,
1636
1637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1638}
1639
1640impl UploadedGoModule {
1641 pub fn new() -> Self {
1642 std::default::Default::default()
1643 }
1644
1645 /// Sets the value of [uri][crate::model::UploadedGoModule::uri].
1646 ///
1647 /// # Example
1648 /// ```ignore,no_run
1649 /// # use google_cloud_build_v1::model::UploadedGoModule;
1650 /// let x = UploadedGoModule::new().set_uri("example");
1651 /// ```
1652 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1653 self.uri = v.into();
1654 self
1655 }
1656
1657 /// Sets the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1658 ///
1659 /// # Example
1660 /// ```ignore,no_run
1661 /// # use google_cloud_build_v1::model::UploadedGoModule;
1662 /// use google_cloud_build_v1::model::FileHashes;
1663 /// let x = UploadedGoModule::new().set_file_hashes(FileHashes::default()/* use setters */);
1664 /// ```
1665 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1666 where
1667 T: std::convert::Into<crate::model::FileHashes>,
1668 {
1669 self.file_hashes = std::option::Option::Some(v.into());
1670 self
1671 }
1672
1673 /// Sets or clears the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1674 ///
1675 /// # Example
1676 /// ```ignore,no_run
1677 /// # use google_cloud_build_v1::model::UploadedGoModule;
1678 /// use google_cloud_build_v1::model::FileHashes;
1679 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1680 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(None::<FileHashes>);
1681 /// ```
1682 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1683 where
1684 T: std::convert::Into<crate::model::FileHashes>,
1685 {
1686 self.file_hashes = v.map(|x| x.into());
1687 self
1688 }
1689
1690 /// Sets the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1691 ///
1692 /// # Example
1693 /// ```ignore,no_run
1694 /// # use google_cloud_build_v1::model::UploadedGoModule;
1695 /// use google_cloud_build_v1::model::TimeSpan;
1696 /// let x = UploadedGoModule::new().set_push_timing(TimeSpan::default()/* use setters */);
1697 /// ```
1698 pub fn set_push_timing<T>(mut self, v: T) -> Self
1699 where
1700 T: std::convert::Into<crate::model::TimeSpan>,
1701 {
1702 self.push_timing = std::option::Option::Some(v.into());
1703 self
1704 }
1705
1706 /// Sets or clears the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1707 ///
1708 /// # Example
1709 /// ```ignore,no_run
1710 /// # use google_cloud_build_v1::model::UploadedGoModule;
1711 /// use google_cloud_build_v1::model::TimeSpan;
1712 /// let x = UploadedGoModule::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1713 /// let x = UploadedGoModule::new().set_or_clear_push_timing(None::<TimeSpan>);
1714 /// ```
1715 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1716 where
1717 T: std::convert::Into<crate::model::TimeSpan>,
1718 {
1719 self.push_timing = v.map(|x| x.into());
1720 self
1721 }
1722
1723 /// Sets the value of [artifact_registry_package][crate::model::UploadedGoModule::artifact_registry_package].
1724 ///
1725 /// # Example
1726 /// ```ignore,no_run
1727 /// # use google_cloud_build_v1::model::UploadedGoModule;
1728 /// let x = UploadedGoModule::new().set_artifact_registry_package("example");
1729 /// ```
1730 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1731 mut self,
1732 v: T,
1733 ) -> Self {
1734 self.artifact_registry_package = v.into();
1735 self
1736 }
1737}
1738
1739impl wkt::message::Message for UploadedGoModule {
1740 fn typename() -> &'static str {
1741 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedGoModule"
1742 }
1743}
1744
1745/// An npm package uploaded to Artifact Registry using the NpmPackage
1746/// directive.
1747#[derive(Clone, Default, PartialEq)]
1748#[non_exhaustive]
1749pub struct UploadedNpmPackage {
1750 /// URI of the uploaded npm package.
1751 pub uri: std::string::String,
1752
1753 /// Hash types and values of the npm package.
1754 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1755
1756 /// Output only. Stores timing information for pushing the specified artifact.
1757 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1758
1759 /// Output only. Path to the artifact in Artifact Registry.
1760 pub artifact_registry_package: std::string::String,
1761
1762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1763}
1764
1765impl UploadedNpmPackage {
1766 pub fn new() -> Self {
1767 std::default::Default::default()
1768 }
1769
1770 /// Sets the value of [uri][crate::model::UploadedNpmPackage::uri].
1771 ///
1772 /// # Example
1773 /// ```ignore,no_run
1774 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1775 /// let x = UploadedNpmPackage::new().set_uri("example");
1776 /// ```
1777 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1778 self.uri = v.into();
1779 self
1780 }
1781
1782 /// Sets the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1783 ///
1784 /// # Example
1785 /// ```ignore,no_run
1786 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1787 /// use google_cloud_build_v1::model::FileHashes;
1788 /// let x = UploadedNpmPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1789 /// ```
1790 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1791 where
1792 T: std::convert::Into<crate::model::FileHashes>,
1793 {
1794 self.file_hashes = std::option::Option::Some(v.into());
1795 self
1796 }
1797
1798 /// Sets or clears the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1799 ///
1800 /// # Example
1801 /// ```ignore,no_run
1802 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1803 /// use google_cloud_build_v1::model::FileHashes;
1804 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1805 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1806 /// ```
1807 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1808 where
1809 T: std::convert::Into<crate::model::FileHashes>,
1810 {
1811 self.file_hashes = v.map(|x| x.into());
1812 self
1813 }
1814
1815 /// Sets the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1816 ///
1817 /// # Example
1818 /// ```ignore,no_run
1819 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1820 /// use google_cloud_build_v1::model::TimeSpan;
1821 /// let x = UploadedNpmPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1822 /// ```
1823 pub fn set_push_timing<T>(mut self, v: T) -> Self
1824 where
1825 T: std::convert::Into<crate::model::TimeSpan>,
1826 {
1827 self.push_timing = std::option::Option::Some(v.into());
1828 self
1829 }
1830
1831 /// Sets or clears the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1832 ///
1833 /// # Example
1834 /// ```ignore,no_run
1835 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1836 /// use google_cloud_build_v1::model::TimeSpan;
1837 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1838 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1839 /// ```
1840 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1841 where
1842 T: std::convert::Into<crate::model::TimeSpan>,
1843 {
1844 self.push_timing = v.map(|x| x.into());
1845 self
1846 }
1847
1848 /// Sets the value of [artifact_registry_package][crate::model::UploadedNpmPackage::artifact_registry_package].
1849 ///
1850 /// # Example
1851 /// ```ignore,no_run
1852 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1853 /// let x = UploadedNpmPackage::new().set_artifact_registry_package("example");
1854 /// ```
1855 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1856 mut self,
1857 v: T,
1858 ) -> Self {
1859 self.artifact_registry_package = v.into();
1860 self
1861 }
1862}
1863
1864impl wkt::message::Message for UploadedNpmPackage {
1865 fn typename() -> &'static str {
1866 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedNpmPackage"
1867 }
1868}
1869
1870/// A step in the build pipeline.
1871#[derive(Clone, Default, PartialEq)]
1872#[non_exhaustive]
1873pub struct BuildStep {
1874 /// Required. The name of the container image that will run this particular
1875 /// build step.
1876 ///
1877 /// If the image is available in the host's Docker daemon's cache, it
1878 /// will be run directly. If not, the host will attempt to pull the image
1879 /// first, using the builder service account's credentials if necessary.
1880 ///
1881 /// The Docker daemon's cache will already have the latest versions of all of
1882 /// the officially supported build steps
1883 /// ([<https://github.com/GoogleCloudPlatform/cloud-builders>](https://github.com/GoogleCloudPlatform/cloud-builders)).
1884 /// The Docker daemon will also have cached many of the layers for some popular
1885 /// images, like "ubuntu", "debian", but they will be refreshed at the time you
1886 /// attempt to use them.
1887 ///
1888 /// If you built an image in a previous build step, it will be stored in the
1889 /// host's Docker daemon's cache and is available to use as the name for a
1890 /// later build step.
1891 pub name: std::string::String,
1892
1893 /// A list of environment variable definitions to be used when running a step.
1894 ///
1895 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
1896 /// being given the value "VALUE".
1897 pub env: std::vec::Vec<std::string::String>,
1898
1899 /// A list of arguments that will be presented to the step when it is started.
1900 ///
1901 /// If the image used to run the step's container has an entrypoint, the `args`
1902 /// are used as arguments to that entrypoint. If the image does not define
1903 /// an entrypoint, the first element in args is used as the entrypoint,
1904 /// and the remainder will be used as arguments.
1905 pub args: std::vec::Vec<std::string::String>,
1906
1907 /// Working directory to use when running this step's container.
1908 ///
1909 /// If this value is a relative path, it is relative to the build's working
1910 /// directory. If this value is absolute, it may be outside the build's working
1911 /// directory, in which case the contents of the path may not be persisted
1912 /// across build step executions, unless a `volume` for that path is specified.
1913 ///
1914 /// If the build specifies a `RepoSource` with `dir` and a step with a `dir`,
1915 /// which specifies an absolute path, the `RepoSource` `dir` is ignored for
1916 /// the step's execution.
1917 pub dir: std::string::String,
1918
1919 /// Unique identifier for this build step, used in `wait_for` to
1920 /// reference this build step as a dependency.
1921 pub id: std::string::String,
1922
1923 /// The ID(s) of the step(s) that this build step depends on.
1924 /// This build step will not start until all the build steps in `wait_for`
1925 /// have completed successfully. If `wait_for` is empty, this build step will
1926 /// start when all previous build steps in the `Build.Steps` list have
1927 /// completed successfully.
1928 pub wait_for: std::vec::Vec<std::string::String>,
1929
1930 /// Entrypoint to be used instead of the build step image's default entrypoint.
1931 /// If unset, the image's default entrypoint is used.
1932 pub entrypoint: std::string::String,
1933
1934 /// A list of environment variables which are encrypted using a Cloud Key
1935 /// Management Service crypto key. These values must be specified in the
1936 /// build's `Secret`.
1937 pub secret_env: std::vec::Vec<std::string::String>,
1938
1939 /// List of volumes to mount into the build step.
1940 ///
1941 /// Each volume is created as an empty volume prior to execution of the
1942 /// build step. Upon completion of the build, volumes and their contents are
1943 /// discarded.
1944 ///
1945 /// Using a named volume in only one step is not valid as it is indicative
1946 /// of a build request with an incorrect configuration.
1947 pub volumes: std::vec::Vec<crate::model::Volume>,
1948
1949 /// Output only. Stores timing information for executing this build step.
1950 pub timing: std::option::Option<crate::model::TimeSpan>,
1951
1952 /// Output only. Stores timing information for pulling this build step's
1953 /// builder image only.
1954 pub pull_timing: std::option::Option<crate::model::TimeSpan>,
1955
1956 /// Time limit for executing this build step. If not defined, the step has no
1957 /// time limit and will be allowed to continue to run until either it completes
1958 /// or the build itself times out.
1959 pub timeout: std::option::Option<wkt::Duration>,
1960
1961 /// Output only. Status of the build step. At this time, build step status is
1962 /// only updated on build completion; step status is not updated in real-time
1963 /// as the build progresses.
1964 pub status: crate::model::build::Status,
1965
1966 /// Allow this build step to fail without failing the entire build.
1967 ///
1968 /// If false, the entire build will fail if this step fails. Otherwise, the
1969 /// build will succeed, but this step will still have a failure status.
1970 /// Error information will be reported in the failure_detail field.
1971 pub allow_failure: bool,
1972
1973 /// Output only. Return code from running the step.
1974 pub exit_code: i32,
1975
1976 /// Allow this build step to fail without failing the entire build if and
1977 /// only if the exit code is one of the specified codes. If allow_failure
1978 /// is also specified, this field will take precedence.
1979 pub allow_exit_codes: std::vec::Vec<i32>,
1980
1981 /// A shell script to be executed in the step.
1982 ///
1983 /// When script is provided, the user cannot specify the entrypoint or args.
1984 pub script: std::string::String,
1985
1986 /// Option to include built-in and custom substitutions as env variables
1987 /// for this build step. This option will override the global option
1988 /// in BuildOption.
1989 pub automap_substitutions: std::option::Option<bool>,
1990
1991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1992}
1993
1994impl BuildStep {
1995 pub fn new() -> Self {
1996 std::default::Default::default()
1997 }
1998
1999 /// Sets the value of [name][crate::model::BuildStep::name].
2000 ///
2001 /// # Example
2002 /// ```ignore,no_run
2003 /// # use google_cloud_build_v1::model::BuildStep;
2004 /// let x = BuildStep::new().set_name("example");
2005 /// ```
2006 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2007 self.name = v.into();
2008 self
2009 }
2010
2011 /// Sets the value of [env][crate::model::BuildStep::env].
2012 ///
2013 /// # Example
2014 /// ```ignore,no_run
2015 /// # use google_cloud_build_v1::model::BuildStep;
2016 /// let x = BuildStep::new().set_env(["a", "b", "c"]);
2017 /// ```
2018 pub fn set_env<T, V>(mut self, v: T) -> Self
2019 where
2020 T: std::iter::IntoIterator<Item = V>,
2021 V: std::convert::Into<std::string::String>,
2022 {
2023 use std::iter::Iterator;
2024 self.env = v.into_iter().map(|i| i.into()).collect();
2025 self
2026 }
2027
2028 /// Sets the value of [args][crate::model::BuildStep::args].
2029 ///
2030 /// # Example
2031 /// ```ignore,no_run
2032 /// # use google_cloud_build_v1::model::BuildStep;
2033 /// let x = BuildStep::new().set_args(["a", "b", "c"]);
2034 /// ```
2035 pub fn set_args<T, V>(mut self, v: T) -> Self
2036 where
2037 T: std::iter::IntoIterator<Item = V>,
2038 V: std::convert::Into<std::string::String>,
2039 {
2040 use std::iter::Iterator;
2041 self.args = v.into_iter().map(|i| i.into()).collect();
2042 self
2043 }
2044
2045 /// Sets the value of [dir][crate::model::BuildStep::dir].
2046 ///
2047 /// # Example
2048 /// ```ignore,no_run
2049 /// # use google_cloud_build_v1::model::BuildStep;
2050 /// let x = BuildStep::new().set_dir("example");
2051 /// ```
2052 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2053 self.dir = v.into();
2054 self
2055 }
2056
2057 /// Sets the value of [id][crate::model::BuildStep::id].
2058 ///
2059 /// # Example
2060 /// ```ignore,no_run
2061 /// # use google_cloud_build_v1::model::BuildStep;
2062 /// let x = BuildStep::new().set_id("example");
2063 /// ```
2064 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2065 self.id = v.into();
2066 self
2067 }
2068
2069 /// Sets the value of [wait_for][crate::model::BuildStep::wait_for].
2070 ///
2071 /// # Example
2072 /// ```ignore,no_run
2073 /// # use google_cloud_build_v1::model::BuildStep;
2074 /// let x = BuildStep::new().set_wait_for(["a", "b", "c"]);
2075 /// ```
2076 pub fn set_wait_for<T, V>(mut self, v: T) -> Self
2077 where
2078 T: std::iter::IntoIterator<Item = V>,
2079 V: std::convert::Into<std::string::String>,
2080 {
2081 use std::iter::Iterator;
2082 self.wait_for = v.into_iter().map(|i| i.into()).collect();
2083 self
2084 }
2085
2086 /// Sets the value of [entrypoint][crate::model::BuildStep::entrypoint].
2087 ///
2088 /// # Example
2089 /// ```ignore,no_run
2090 /// # use google_cloud_build_v1::model::BuildStep;
2091 /// let x = BuildStep::new().set_entrypoint("example");
2092 /// ```
2093 pub fn set_entrypoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2094 self.entrypoint = v.into();
2095 self
2096 }
2097
2098 /// Sets the value of [secret_env][crate::model::BuildStep::secret_env].
2099 ///
2100 /// # Example
2101 /// ```ignore,no_run
2102 /// # use google_cloud_build_v1::model::BuildStep;
2103 /// let x = BuildStep::new().set_secret_env(["a", "b", "c"]);
2104 /// ```
2105 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
2106 where
2107 T: std::iter::IntoIterator<Item = V>,
2108 V: std::convert::Into<std::string::String>,
2109 {
2110 use std::iter::Iterator;
2111 self.secret_env = v.into_iter().map(|i| i.into()).collect();
2112 self
2113 }
2114
2115 /// Sets the value of [volumes][crate::model::BuildStep::volumes].
2116 ///
2117 /// # Example
2118 /// ```ignore,no_run
2119 /// # use google_cloud_build_v1::model::BuildStep;
2120 /// use google_cloud_build_v1::model::Volume;
2121 /// let x = BuildStep::new()
2122 /// .set_volumes([
2123 /// Volume::default()/* use setters */,
2124 /// Volume::default()/* use (different) setters */,
2125 /// ]);
2126 /// ```
2127 pub fn set_volumes<T, V>(mut self, v: T) -> Self
2128 where
2129 T: std::iter::IntoIterator<Item = V>,
2130 V: std::convert::Into<crate::model::Volume>,
2131 {
2132 use std::iter::Iterator;
2133 self.volumes = v.into_iter().map(|i| i.into()).collect();
2134 self
2135 }
2136
2137 /// Sets the value of [timing][crate::model::BuildStep::timing].
2138 ///
2139 /// # Example
2140 /// ```ignore,no_run
2141 /// # use google_cloud_build_v1::model::BuildStep;
2142 /// use google_cloud_build_v1::model::TimeSpan;
2143 /// let x = BuildStep::new().set_timing(TimeSpan::default()/* use setters */);
2144 /// ```
2145 pub fn set_timing<T>(mut self, v: T) -> Self
2146 where
2147 T: std::convert::Into<crate::model::TimeSpan>,
2148 {
2149 self.timing = std::option::Option::Some(v.into());
2150 self
2151 }
2152
2153 /// Sets or clears the value of [timing][crate::model::BuildStep::timing].
2154 ///
2155 /// # Example
2156 /// ```ignore,no_run
2157 /// # use google_cloud_build_v1::model::BuildStep;
2158 /// use google_cloud_build_v1::model::TimeSpan;
2159 /// let x = BuildStep::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
2160 /// let x = BuildStep::new().set_or_clear_timing(None::<TimeSpan>);
2161 /// ```
2162 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
2163 where
2164 T: std::convert::Into<crate::model::TimeSpan>,
2165 {
2166 self.timing = v.map(|x| x.into());
2167 self
2168 }
2169
2170 /// Sets the value of [pull_timing][crate::model::BuildStep::pull_timing].
2171 ///
2172 /// # Example
2173 /// ```ignore,no_run
2174 /// # use google_cloud_build_v1::model::BuildStep;
2175 /// use google_cloud_build_v1::model::TimeSpan;
2176 /// let x = BuildStep::new().set_pull_timing(TimeSpan::default()/* use setters */);
2177 /// ```
2178 pub fn set_pull_timing<T>(mut self, v: T) -> Self
2179 where
2180 T: std::convert::Into<crate::model::TimeSpan>,
2181 {
2182 self.pull_timing = std::option::Option::Some(v.into());
2183 self
2184 }
2185
2186 /// Sets or clears the value of [pull_timing][crate::model::BuildStep::pull_timing].
2187 ///
2188 /// # Example
2189 /// ```ignore,no_run
2190 /// # use google_cloud_build_v1::model::BuildStep;
2191 /// use google_cloud_build_v1::model::TimeSpan;
2192 /// let x = BuildStep::new().set_or_clear_pull_timing(Some(TimeSpan::default()/* use setters */));
2193 /// let x = BuildStep::new().set_or_clear_pull_timing(None::<TimeSpan>);
2194 /// ```
2195 pub fn set_or_clear_pull_timing<T>(mut self, v: std::option::Option<T>) -> Self
2196 where
2197 T: std::convert::Into<crate::model::TimeSpan>,
2198 {
2199 self.pull_timing = v.map(|x| x.into());
2200 self
2201 }
2202
2203 /// Sets the value of [timeout][crate::model::BuildStep::timeout].
2204 ///
2205 /// # Example
2206 /// ```ignore,no_run
2207 /// # use google_cloud_build_v1::model::BuildStep;
2208 /// use wkt::Duration;
2209 /// let x = BuildStep::new().set_timeout(Duration::default()/* use setters */);
2210 /// ```
2211 pub fn set_timeout<T>(mut self, v: T) -> Self
2212 where
2213 T: std::convert::Into<wkt::Duration>,
2214 {
2215 self.timeout = std::option::Option::Some(v.into());
2216 self
2217 }
2218
2219 /// Sets or clears the value of [timeout][crate::model::BuildStep::timeout].
2220 ///
2221 /// # Example
2222 /// ```ignore,no_run
2223 /// # use google_cloud_build_v1::model::BuildStep;
2224 /// use wkt::Duration;
2225 /// let x = BuildStep::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
2226 /// let x = BuildStep::new().set_or_clear_timeout(None::<Duration>);
2227 /// ```
2228 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2229 where
2230 T: std::convert::Into<wkt::Duration>,
2231 {
2232 self.timeout = v.map(|x| x.into());
2233 self
2234 }
2235
2236 /// Sets the value of [status][crate::model::BuildStep::status].
2237 ///
2238 /// # Example
2239 /// ```ignore,no_run
2240 /// # use google_cloud_build_v1::model::BuildStep;
2241 /// use google_cloud_build_v1::model::build::Status;
2242 /// let x0 = BuildStep::new().set_status(Status::Pending);
2243 /// let x1 = BuildStep::new().set_status(Status::Queued);
2244 /// let x2 = BuildStep::new().set_status(Status::Working);
2245 /// ```
2246 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2247 self.status = v.into();
2248 self
2249 }
2250
2251 /// Sets the value of [allow_failure][crate::model::BuildStep::allow_failure].
2252 ///
2253 /// # Example
2254 /// ```ignore,no_run
2255 /// # use google_cloud_build_v1::model::BuildStep;
2256 /// let x = BuildStep::new().set_allow_failure(true);
2257 /// ```
2258 pub fn set_allow_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2259 self.allow_failure = v.into();
2260 self
2261 }
2262
2263 /// Sets the value of [exit_code][crate::model::BuildStep::exit_code].
2264 ///
2265 /// # Example
2266 /// ```ignore,no_run
2267 /// # use google_cloud_build_v1::model::BuildStep;
2268 /// let x = BuildStep::new().set_exit_code(42);
2269 /// ```
2270 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2271 self.exit_code = v.into();
2272 self
2273 }
2274
2275 /// Sets the value of [allow_exit_codes][crate::model::BuildStep::allow_exit_codes].
2276 ///
2277 /// # Example
2278 /// ```ignore,no_run
2279 /// # use google_cloud_build_v1::model::BuildStep;
2280 /// let x = BuildStep::new().set_allow_exit_codes([1, 2, 3]);
2281 /// ```
2282 pub fn set_allow_exit_codes<T, V>(mut self, v: T) -> Self
2283 where
2284 T: std::iter::IntoIterator<Item = V>,
2285 V: std::convert::Into<i32>,
2286 {
2287 use std::iter::Iterator;
2288 self.allow_exit_codes = v.into_iter().map(|i| i.into()).collect();
2289 self
2290 }
2291
2292 /// Sets the value of [script][crate::model::BuildStep::script].
2293 ///
2294 /// # Example
2295 /// ```ignore,no_run
2296 /// # use google_cloud_build_v1::model::BuildStep;
2297 /// let x = BuildStep::new().set_script("example");
2298 /// ```
2299 pub fn set_script<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2300 self.script = v.into();
2301 self
2302 }
2303
2304 /// Sets the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2305 ///
2306 /// # Example
2307 /// ```ignore,no_run
2308 /// # use google_cloud_build_v1::model::BuildStep;
2309 /// let x = BuildStep::new().set_automap_substitutions(true);
2310 /// ```
2311 pub fn set_automap_substitutions<T>(mut self, v: T) -> Self
2312 where
2313 T: std::convert::Into<bool>,
2314 {
2315 self.automap_substitutions = std::option::Option::Some(v.into());
2316 self
2317 }
2318
2319 /// Sets or clears the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2320 ///
2321 /// # Example
2322 /// ```ignore,no_run
2323 /// # use google_cloud_build_v1::model::BuildStep;
2324 /// let x = BuildStep::new().set_or_clear_automap_substitutions(Some(false));
2325 /// let x = BuildStep::new().set_or_clear_automap_substitutions(None::<bool>);
2326 /// ```
2327 pub fn set_or_clear_automap_substitutions<T>(mut self, v: std::option::Option<T>) -> Self
2328 where
2329 T: std::convert::Into<bool>,
2330 {
2331 self.automap_substitutions = v.map(|x| x.into());
2332 self
2333 }
2334}
2335
2336impl wkt::message::Message for BuildStep {
2337 fn typename() -> &'static str {
2338 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildStep"
2339 }
2340}
2341
2342/// Volume describes a Docker container volume which is mounted into build steps
2343/// in order to persist files across build step execution.
2344#[derive(Clone, Default, PartialEq)]
2345#[non_exhaustive]
2346pub struct Volume {
2347 /// Name of the volume to mount.
2348 ///
2349 /// Volume names must be unique per build step and must be valid names for
2350 /// Docker volumes. Each named volume must be used by at least two build steps.
2351 pub name: std::string::String,
2352
2353 /// Path at which to mount the volume.
2354 ///
2355 /// Paths must be absolute and cannot conflict with other volume paths on the
2356 /// same build step or with certain reserved volume paths.
2357 pub path: std::string::String,
2358
2359 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2360}
2361
2362impl Volume {
2363 pub fn new() -> Self {
2364 std::default::Default::default()
2365 }
2366
2367 /// Sets the value of [name][crate::model::Volume::name].
2368 ///
2369 /// # Example
2370 /// ```ignore,no_run
2371 /// # use google_cloud_build_v1::model::Volume;
2372 /// let x = Volume::new().set_name("example");
2373 /// ```
2374 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2375 self.name = v.into();
2376 self
2377 }
2378
2379 /// Sets the value of [path][crate::model::Volume::path].
2380 ///
2381 /// # Example
2382 /// ```ignore,no_run
2383 /// # use google_cloud_build_v1::model::Volume;
2384 /// let x = Volume::new().set_path("example");
2385 /// ```
2386 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2387 self.path = v.into();
2388 self
2389 }
2390}
2391
2392impl wkt::message::Message for Volume {
2393 fn typename() -> &'static str {
2394 "type.googleapis.com/google.devtools.cloudbuild.v1.Volume"
2395 }
2396}
2397
2398/// Artifacts created by the build pipeline.
2399#[derive(Clone, Default, PartialEq)]
2400#[non_exhaustive]
2401pub struct Results {
2402 /// Container images that were built as a part of the build.
2403 pub images: std::vec::Vec<crate::model::BuiltImage>,
2404
2405 /// List of build step digests, in the order corresponding to build step
2406 /// indices.
2407 pub build_step_images: std::vec::Vec<std::string::String>,
2408
2409 /// Path to the artifact manifest for non-container artifacts uploaded to Cloud
2410 /// Storage. Only populated when artifacts are uploaded to Cloud Storage.
2411 pub artifact_manifest: std::string::String,
2412
2413 /// Number of non-container artifacts uploaded to Cloud Storage. Only populated
2414 /// when artifacts are uploaded to Cloud Storage.
2415 pub num_artifacts: i64,
2416
2417 /// List of build step outputs, produced by builder images, in the order
2418 /// corresponding to build step indices.
2419 ///
2420 /// [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders)
2421 /// can produce this output by writing to `$BUILDER_OUTPUT/output`. Only the
2422 /// first 50KB of data is stored. Note that the `$BUILDER_OUTPUT` variable is
2423 /// read-only and can't be substituted.
2424 pub build_step_outputs: std::vec::Vec<::bytes::Bytes>,
2425
2426 /// Time to push all non-container artifacts to Cloud Storage.
2427 pub artifact_timing: std::option::Option<crate::model::TimeSpan>,
2428
2429 /// Python artifacts uploaded to Artifact Registry at the end of the build.
2430 pub python_packages: std::vec::Vec<crate::model::UploadedPythonPackage>,
2431
2432 /// Maven artifacts uploaded to Artifact Registry at the end of the build.
2433 pub maven_artifacts: std::vec::Vec<crate::model::UploadedMavenArtifact>,
2434
2435 /// Optional. Go module artifacts uploaded to Artifact Registry at the end of
2436 /// the build.
2437 pub go_modules: std::vec::Vec<crate::model::UploadedGoModule>,
2438
2439 /// Npm packages uploaded to Artifact Registry at the end of the build.
2440 pub npm_packages: std::vec::Vec<crate::model::UploadedNpmPackage>,
2441
2442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2443}
2444
2445impl Results {
2446 pub fn new() -> Self {
2447 std::default::Default::default()
2448 }
2449
2450 /// Sets the value of [images][crate::model::Results::images].
2451 ///
2452 /// # Example
2453 /// ```ignore,no_run
2454 /// # use google_cloud_build_v1::model::Results;
2455 /// use google_cloud_build_v1::model::BuiltImage;
2456 /// let x = Results::new()
2457 /// .set_images([
2458 /// BuiltImage::default()/* use setters */,
2459 /// BuiltImage::default()/* use (different) setters */,
2460 /// ]);
2461 /// ```
2462 pub fn set_images<T, V>(mut self, v: T) -> Self
2463 where
2464 T: std::iter::IntoIterator<Item = V>,
2465 V: std::convert::Into<crate::model::BuiltImage>,
2466 {
2467 use std::iter::Iterator;
2468 self.images = v.into_iter().map(|i| i.into()).collect();
2469 self
2470 }
2471
2472 /// Sets the value of [build_step_images][crate::model::Results::build_step_images].
2473 ///
2474 /// # Example
2475 /// ```ignore,no_run
2476 /// # use google_cloud_build_v1::model::Results;
2477 /// let x = Results::new().set_build_step_images(["a", "b", "c"]);
2478 /// ```
2479 pub fn set_build_step_images<T, V>(mut self, v: T) -> Self
2480 where
2481 T: std::iter::IntoIterator<Item = V>,
2482 V: std::convert::Into<std::string::String>,
2483 {
2484 use std::iter::Iterator;
2485 self.build_step_images = v.into_iter().map(|i| i.into()).collect();
2486 self
2487 }
2488
2489 /// Sets the value of [artifact_manifest][crate::model::Results::artifact_manifest].
2490 ///
2491 /// # Example
2492 /// ```ignore,no_run
2493 /// # use google_cloud_build_v1::model::Results;
2494 /// let x = Results::new().set_artifact_manifest("example");
2495 /// ```
2496 pub fn set_artifact_manifest<T: std::convert::Into<std::string::String>>(
2497 mut self,
2498 v: T,
2499 ) -> Self {
2500 self.artifact_manifest = v.into();
2501 self
2502 }
2503
2504 /// Sets the value of [num_artifacts][crate::model::Results::num_artifacts].
2505 ///
2506 /// # Example
2507 /// ```ignore,no_run
2508 /// # use google_cloud_build_v1::model::Results;
2509 /// let x = Results::new().set_num_artifacts(42);
2510 /// ```
2511 pub fn set_num_artifacts<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2512 self.num_artifacts = v.into();
2513 self
2514 }
2515
2516 /// Sets the value of [build_step_outputs][crate::model::Results::build_step_outputs].
2517 ///
2518 /// # Example
2519 /// ```ignore,no_run
2520 /// # use google_cloud_build_v1::model::Results;
2521 /// let b1 = bytes::Bytes::from_static(b"abc");
2522 /// let b2 = bytes::Bytes::from_static(b"xyz");
2523 /// let x = Results::new().set_build_step_outputs([b1, b2]);
2524 /// ```
2525 pub fn set_build_step_outputs<T, V>(mut self, v: T) -> Self
2526 where
2527 T: std::iter::IntoIterator<Item = V>,
2528 V: std::convert::Into<::bytes::Bytes>,
2529 {
2530 use std::iter::Iterator;
2531 self.build_step_outputs = v.into_iter().map(|i| i.into()).collect();
2532 self
2533 }
2534
2535 /// Sets the value of [artifact_timing][crate::model::Results::artifact_timing].
2536 ///
2537 /// # Example
2538 /// ```ignore,no_run
2539 /// # use google_cloud_build_v1::model::Results;
2540 /// use google_cloud_build_v1::model::TimeSpan;
2541 /// let x = Results::new().set_artifact_timing(TimeSpan::default()/* use setters */);
2542 /// ```
2543 pub fn set_artifact_timing<T>(mut self, v: T) -> Self
2544 where
2545 T: std::convert::Into<crate::model::TimeSpan>,
2546 {
2547 self.artifact_timing = std::option::Option::Some(v.into());
2548 self
2549 }
2550
2551 /// Sets or clears the value of [artifact_timing][crate::model::Results::artifact_timing].
2552 ///
2553 /// # Example
2554 /// ```ignore,no_run
2555 /// # use google_cloud_build_v1::model::Results;
2556 /// use google_cloud_build_v1::model::TimeSpan;
2557 /// let x = Results::new().set_or_clear_artifact_timing(Some(TimeSpan::default()/* use setters */));
2558 /// let x = Results::new().set_or_clear_artifact_timing(None::<TimeSpan>);
2559 /// ```
2560 pub fn set_or_clear_artifact_timing<T>(mut self, v: std::option::Option<T>) -> Self
2561 where
2562 T: std::convert::Into<crate::model::TimeSpan>,
2563 {
2564 self.artifact_timing = v.map(|x| x.into());
2565 self
2566 }
2567
2568 /// Sets the value of [python_packages][crate::model::Results::python_packages].
2569 ///
2570 /// # Example
2571 /// ```ignore,no_run
2572 /// # use google_cloud_build_v1::model::Results;
2573 /// use google_cloud_build_v1::model::UploadedPythonPackage;
2574 /// let x = Results::new()
2575 /// .set_python_packages([
2576 /// UploadedPythonPackage::default()/* use setters */,
2577 /// UploadedPythonPackage::default()/* use (different) setters */,
2578 /// ]);
2579 /// ```
2580 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
2581 where
2582 T: std::iter::IntoIterator<Item = V>,
2583 V: std::convert::Into<crate::model::UploadedPythonPackage>,
2584 {
2585 use std::iter::Iterator;
2586 self.python_packages = v.into_iter().map(|i| i.into()).collect();
2587 self
2588 }
2589
2590 /// Sets the value of [maven_artifacts][crate::model::Results::maven_artifacts].
2591 ///
2592 /// # Example
2593 /// ```ignore,no_run
2594 /// # use google_cloud_build_v1::model::Results;
2595 /// use google_cloud_build_v1::model::UploadedMavenArtifact;
2596 /// let x = Results::new()
2597 /// .set_maven_artifacts([
2598 /// UploadedMavenArtifact::default()/* use setters */,
2599 /// UploadedMavenArtifact::default()/* use (different) setters */,
2600 /// ]);
2601 /// ```
2602 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
2603 where
2604 T: std::iter::IntoIterator<Item = V>,
2605 V: std::convert::Into<crate::model::UploadedMavenArtifact>,
2606 {
2607 use std::iter::Iterator;
2608 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
2609 self
2610 }
2611
2612 /// Sets the value of [go_modules][crate::model::Results::go_modules].
2613 ///
2614 /// # Example
2615 /// ```ignore,no_run
2616 /// # use google_cloud_build_v1::model::Results;
2617 /// use google_cloud_build_v1::model::UploadedGoModule;
2618 /// let x = Results::new()
2619 /// .set_go_modules([
2620 /// UploadedGoModule::default()/* use setters */,
2621 /// UploadedGoModule::default()/* use (different) setters */,
2622 /// ]);
2623 /// ```
2624 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
2625 where
2626 T: std::iter::IntoIterator<Item = V>,
2627 V: std::convert::Into<crate::model::UploadedGoModule>,
2628 {
2629 use std::iter::Iterator;
2630 self.go_modules = v.into_iter().map(|i| i.into()).collect();
2631 self
2632 }
2633
2634 /// Sets the value of [npm_packages][crate::model::Results::npm_packages].
2635 ///
2636 /// # Example
2637 /// ```ignore,no_run
2638 /// # use google_cloud_build_v1::model::Results;
2639 /// use google_cloud_build_v1::model::UploadedNpmPackage;
2640 /// let x = Results::new()
2641 /// .set_npm_packages([
2642 /// UploadedNpmPackage::default()/* use setters */,
2643 /// UploadedNpmPackage::default()/* use (different) setters */,
2644 /// ]);
2645 /// ```
2646 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
2647 where
2648 T: std::iter::IntoIterator<Item = V>,
2649 V: std::convert::Into<crate::model::UploadedNpmPackage>,
2650 {
2651 use std::iter::Iterator;
2652 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
2653 self
2654 }
2655}
2656
2657impl wkt::message::Message for Results {
2658 fn typename() -> &'static str {
2659 "type.googleapis.com/google.devtools.cloudbuild.v1.Results"
2660 }
2661}
2662
2663/// An artifact that was uploaded during a build. This
2664/// is a single record in the artifact manifest JSON file.
2665#[derive(Clone, Default, PartialEq)]
2666#[non_exhaustive]
2667pub struct ArtifactResult {
2668 /// The path of an artifact in a Cloud Storage bucket, with the
2669 /// generation number. For example,
2670 /// `gs://mybucket/path/to/output.jar#generation`.
2671 pub location: std::string::String,
2672
2673 /// The file hash of the artifact.
2674 pub file_hash: std::vec::Vec<crate::model::FileHashes>,
2675
2676 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2677}
2678
2679impl ArtifactResult {
2680 pub fn new() -> Self {
2681 std::default::Default::default()
2682 }
2683
2684 /// Sets the value of [location][crate::model::ArtifactResult::location].
2685 ///
2686 /// # Example
2687 /// ```ignore,no_run
2688 /// # use google_cloud_build_v1::model::ArtifactResult;
2689 /// let x = ArtifactResult::new().set_location("example");
2690 /// ```
2691 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2692 self.location = v.into();
2693 self
2694 }
2695
2696 /// Sets the value of [file_hash][crate::model::ArtifactResult::file_hash].
2697 ///
2698 /// # Example
2699 /// ```ignore,no_run
2700 /// # use google_cloud_build_v1::model::ArtifactResult;
2701 /// use google_cloud_build_v1::model::FileHashes;
2702 /// let x = ArtifactResult::new()
2703 /// .set_file_hash([
2704 /// FileHashes::default()/* use setters */,
2705 /// FileHashes::default()/* use (different) setters */,
2706 /// ]);
2707 /// ```
2708 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
2709 where
2710 T: std::iter::IntoIterator<Item = V>,
2711 V: std::convert::Into<crate::model::FileHashes>,
2712 {
2713 use std::iter::Iterator;
2714 self.file_hash = v.into_iter().map(|i| i.into()).collect();
2715 self
2716 }
2717}
2718
2719impl wkt::message::Message for ArtifactResult {
2720 fn typename() -> &'static str {
2721 "type.googleapis.com/google.devtools.cloudbuild.v1.ArtifactResult"
2722 }
2723}
2724
2725/// A build resource in the Cloud Build API.
2726///
2727/// At a high level, a `Build` describes where to find source code, how to build
2728/// it (for example, the builder image to run on the source), and where to store
2729/// the built artifacts.
2730///
2731/// Fields can include the following variables, which will be expanded when the
2732/// build is created:
2733///
2734/// - $PROJECT_ID: the project ID of the build.
2735/// - $PROJECT_NUMBER: the project number of the build.
2736/// - $LOCATION: the location/region of the build.
2737/// - $BUILD_ID: the autogenerated ID of the build.
2738/// - $REPO_NAME: the source repository name specified by RepoSource.
2739/// - $BRANCH_NAME: the branch name specified by RepoSource.
2740/// - $TAG_NAME: the tag name specified by RepoSource.
2741/// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or
2742/// resolved from the specified branch or tag.
2743/// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA.
2744#[derive(Clone, Default, PartialEq)]
2745#[non_exhaustive]
2746pub struct Build {
2747 /// Output only. The 'Build' name with format:
2748 /// `projects/{project}/locations/{location}/builds/{build}`, where {build}
2749 /// is a unique identifier generated by the service.
2750 pub name: std::string::String,
2751
2752 /// Output only. Unique identifier of the build.
2753 pub id: std::string::String,
2754
2755 /// Output only. ID of the project.
2756 pub project_id: std::string::String,
2757
2758 /// Output only. Status of the build.
2759 pub status: crate::model::build::Status,
2760
2761 /// Output only. Customer-readable message about the current status.
2762 pub status_detail: std::string::String,
2763
2764 /// Optional. The location of the source files to build.
2765 pub source: std::option::Option<crate::model::Source>,
2766
2767 /// Required. The operations to be performed on the workspace.
2768 pub steps: std::vec::Vec<crate::model::BuildStep>,
2769
2770 /// Output only. Results of the build.
2771 pub results: std::option::Option<crate::model::Results>,
2772
2773 /// Output only. Time at which the request to create the build was received.
2774 pub create_time: std::option::Option<wkt::Timestamp>,
2775
2776 /// Output only. Time at which execution of the build was started.
2777 pub start_time: std::option::Option<wkt::Timestamp>,
2778
2779 /// Output only. Time at which execution of the build was finished.
2780 ///
2781 /// The difference between finish_time and start_time is the duration of the
2782 /// build's execution.
2783 pub finish_time: std::option::Option<wkt::Timestamp>,
2784
2785 /// Amount of time that this build should be allowed to run, to second
2786 /// granularity. If this amount of time elapses, work on the build will cease
2787 /// and the build status will be `TIMEOUT`.
2788 ///
2789 /// `timeout` starts ticking from `startTime`.
2790 ///
2791 /// Default time is 60 minutes.
2792 pub timeout: std::option::Option<wkt::Duration>,
2793
2794 /// A list of images to be pushed upon the successful completion of all build
2795 /// steps.
2796 ///
2797 /// The images are pushed using the builder service account's credentials.
2798 ///
2799 /// The digests of the pushed images will be stored in the `Build` resource's
2800 /// results field.
2801 ///
2802 /// If any of the images fail to be pushed, the build status is marked
2803 /// `FAILURE`.
2804 pub images: std::vec::Vec<std::string::String>,
2805
2806 /// TTL in queue for this build. If provided and the build is enqueued longer
2807 /// than this value, the build will expire and the build status will be
2808 /// `EXPIRED`.
2809 ///
2810 /// The TTL starts ticking from create_time.
2811 pub queue_ttl: std::option::Option<wkt::Duration>,
2812
2813 /// Artifacts produced by the build that should be uploaded upon
2814 /// successful completion of all build steps.
2815 pub artifacts: std::option::Option<crate::model::Artifacts>,
2816
2817 /// Cloud Storage bucket where logs should be written (see
2818 /// [Bucket Name
2819 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
2820 /// Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`.
2821 pub logs_bucket: std::string::String,
2822
2823 /// Output only. A permanent fixed identifier for source.
2824 pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
2825
2826 /// Output only. The ID of the `BuildTrigger` that triggered this build, if it
2827 /// was triggered automatically.
2828 pub build_trigger_id: std::string::String,
2829
2830 /// Special options for this build.
2831 pub options: std::option::Option<crate::model::BuildOptions>,
2832
2833 /// Output only. URL to logs for this build in Google Cloud Console.
2834 pub log_url: std::string::String,
2835
2836 /// Substitutions data for `Build` resource.
2837 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
2838
2839 /// Tags for annotation of a `Build`. These are not docker tags.
2840 pub tags: std::vec::Vec<std::string::String>,
2841
2842 /// Secrets to decrypt using Cloud Key Management Service.
2843 /// Note: Secret Manager is the recommended technique
2844 /// for managing sensitive data with Cloud Build. Use `available_secrets` to
2845 /// configure builds to access secrets from Secret Manager. For instructions,
2846 /// see: <https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets>
2847 pub secrets: std::vec::Vec<crate::model::Secret>,
2848
2849 /// Output only. Stores timing information for phases of the build. Valid keys
2850 /// are:
2851 ///
2852 /// * BUILD: time to execute all build steps.
2853 /// * PUSH: time to push all artifacts including docker images and non docker
2854 /// artifacts.
2855 /// * FETCHSOURCE: time to fetch source.
2856 /// * SETUPBUILD: time to set up build.
2857 ///
2858 /// If the build does not specify source or images,
2859 /// these keys will not be included.
2860 pub timing: std::collections::HashMap<std::string::String, crate::model::TimeSpan>,
2861
2862 /// Output only. Describes this build's approval configuration, status,
2863 /// and result.
2864 pub approval: std::option::Option<crate::model::BuildApproval>,
2865
2866 /// IAM service account whose credentials will be used at build runtime.
2867 /// Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
2868 /// ACCOUNT can be email address or uniqueId of the service account.
2869 pub service_account: std::string::String,
2870
2871 /// Secrets and secret environment variables.
2872 pub available_secrets: std::option::Option<crate::model::Secrets>,
2873
2874 /// Output only. Non-fatal problems encountered during the execution of the
2875 /// build.
2876 pub warnings: std::vec::Vec<crate::model::build::Warning>,
2877
2878 /// Optional. Configuration for git operations.
2879 pub git_config: std::option::Option<crate::model::GitConfig>,
2880
2881 /// Output only. Contains information about the build when status=FAILURE.
2882 pub failure_info: std::option::Option<crate::model::build::FailureInfo>,
2883
2884 /// Optional. Dependencies that the Cloud Build worker will fetch before
2885 /// executing user steps.
2886 pub dependencies: std::vec::Vec<crate::model::Dependency>,
2887
2888 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2889}
2890
2891impl Build {
2892 pub fn new() -> Self {
2893 std::default::Default::default()
2894 }
2895
2896 /// Sets the value of [name][crate::model::Build::name].
2897 ///
2898 /// # Example
2899 /// ```ignore,no_run
2900 /// # use google_cloud_build_v1::model::Build;
2901 /// let x = Build::new().set_name("example");
2902 /// ```
2903 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2904 self.name = v.into();
2905 self
2906 }
2907
2908 /// Sets the value of [id][crate::model::Build::id].
2909 ///
2910 /// # Example
2911 /// ```ignore,no_run
2912 /// # use google_cloud_build_v1::model::Build;
2913 /// let x = Build::new().set_id("example");
2914 /// ```
2915 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2916 self.id = v.into();
2917 self
2918 }
2919
2920 /// Sets the value of [project_id][crate::model::Build::project_id].
2921 ///
2922 /// # Example
2923 /// ```ignore,no_run
2924 /// # use google_cloud_build_v1::model::Build;
2925 /// let x = Build::new().set_project_id("example");
2926 /// ```
2927 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2928 self.project_id = v.into();
2929 self
2930 }
2931
2932 /// Sets the value of [status][crate::model::Build::status].
2933 ///
2934 /// # Example
2935 /// ```ignore,no_run
2936 /// # use google_cloud_build_v1::model::Build;
2937 /// use google_cloud_build_v1::model::build::Status;
2938 /// let x0 = Build::new().set_status(Status::Pending);
2939 /// let x1 = Build::new().set_status(Status::Queued);
2940 /// let x2 = Build::new().set_status(Status::Working);
2941 /// ```
2942 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2943 self.status = v.into();
2944 self
2945 }
2946
2947 /// Sets the value of [status_detail][crate::model::Build::status_detail].
2948 ///
2949 /// # Example
2950 /// ```ignore,no_run
2951 /// # use google_cloud_build_v1::model::Build;
2952 /// let x = Build::new().set_status_detail("example");
2953 /// ```
2954 pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2955 self.status_detail = v.into();
2956 self
2957 }
2958
2959 /// Sets the value of [source][crate::model::Build::source].
2960 ///
2961 /// # Example
2962 /// ```ignore,no_run
2963 /// # use google_cloud_build_v1::model::Build;
2964 /// use google_cloud_build_v1::model::Source;
2965 /// let x = Build::new().set_source(Source::default()/* use setters */);
2966 /// ```
2967 pub fn set_source<T>(mut self, v: T) -> Self
2968 where
2969 T: std::convert::Into<crate::model::Source>,
2970 {
2971 self.source = std::option::Option::Some(v.into());
2972 self
2973 }
2974
2975 /// Sets or clears the value of [source][crate::model::Build::source].
2976 ///
2977 /// # Example
2978 /// ```ignore,no_run
2979 /// # use google_cloud_build_v1::model::Build;
2980 /// use google_cloud_build_v1::model::Source;
2981 /// let x = Build::new().set_or_clear_source(Some(Source::default()/* use setters */));
2982 /// let x = Build::new().set_or_clear_source(None::<Source>);
2983 /// ```
2984 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
2985 where
2986 T: std::convert::Into<crate::model::Source>,
2987 {
2988 self.source = v.map(|x| x.into());
2989 self
2990 }
2991
2992 /// Sets the value of [steps][crate::model::Build::steps].
2993 ///
2994 /// # Example
2995 /// ```ignore,no_run
2996 /// # use google_cloud_build_v1::model::Build;
2997 /// use google_cloud_build_v1::model::BuildStep;
2998 /// let x = Build::new()
2999 /// .set_steps([
3000 /// BuildStep::default()/* use setters */,
3001 /// BuildStep::default()/* use (different) setters */,
3002 /// ]);
3003 /// ```
3004 pub fn set_steps<T, V>(mut self, v: T) -> Self
3005 where
3006 T: std::iter::IntoIterator<Item = V>,
3007 V: std::convert::Into<crate::model::BuildStep>,
3008 {
3009 use std::iter::Iterator;
3010 self.steps = v.into_iter().map(|i| i.into()).collect();
3011 self
3012 }
3013
3014 /// Sets the value of [results][crate::model::Build::results].
3015 ///
3016 /// # Example
3017 /// ```ignore,no_run
3018 /// # use google_cloud_build_v1::model::Build;
3019 /// use google_cloud_build_v1::model::Results;
3020 /// let x = Build::new().set_results(Results::default()/* use setters */);
3021 /// ```
3022 pub fn set_results<T>(mut self, v: T) -> Self
3023 where
3024 T: std::convert::Into<crate::model::Results>,
3025 {
3026 self.results = std::option::Option::Some(v.into());
3027 self
3028 }
3029
3030 /// Sets or clears the value of [results][crate::model::Build::results].
3031 ///
3032 /// # Example
3033 /// ```ignore,no_run
3034 /// # use google_cloud_build_v1::model::Build;
3035 /// use google_cloud_build_v1::model::Results;
3036 /// let x = Build::new().set_or_clear_results(Some(Results::default()/* use setters */));
3037 /// let x = Build::new().set_or_clear_results(None::<Results>);
3038 /// ```
3039 pub fn set_or_clear_results<T>(mut self, v: std::option::Option<T>) -> Self
3040 where
3041 T: std::convert::Into<crate::model::Results>,
3042 {
3043 self.results = v.map(|x| x.into());
3044 self
3045 }
3046
3047 /// Sets the value of [create_time][crate::model::Build::create_time].
3048 ///
3049 /// # Example
3050 /// ```ignore,no_run
3051 /// # use google_cloud_build_v1::model::Build;
3052 /// use wkt::Timestamp;
3053 /// let x = Build::new().set_create_time(Timestamp::default()/* use setters */);
3054 /// ```
3055 pub fn set_create_time<T>(mut self, v: T) -> Self
3056 where
3057 T: std::convert::Into<wkt::Timestamp>,
3058 {
3059 self.create_time = std::option::Option::Some(v.into());
3060 self
3061 }
3062
3063 /// Sets or clears the value of [create_time][crate::model::Build::create_time].
3064 ///
3065 /// # Example
3066 /// ```ignore,no_run
3067 /// # use google_cloud_build_v1::model::Build;
3068 /// use wkt::Timestamp;
3069 /// let x = Build::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3070 /// let x = Build::new().set_or_clear_create_time(None::<Timestamp>);
3071 /// ```
3072 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3073 where
3074 T: std::convert::Into<wkt::Timestamp>,
3075 {
3076 self.create_time = v.map(|x| x.into());
3077 self
3078 }
3079
3080 /// Sets the value of [start_time][crate::model::Build::start_time].
3081 ///
3082 /// # Example
3083 /// ```ignore,no_run
3084 /// # use google_cloud_build_v1::model::Build;
3085 /// use wkt::Timestamp;
3086 /// let x = Build::new().set_start_time(Timestamp::default()/* use setters */);
3087 /// ```
3088 pub fn set_start_time<T>(mut self, v: T) -> Self
3089 where
3090 T: std::convert::Into<wkt::Timestamp>,
3091 {
3092 self.start_time = std::option::Option::Some(v.into());
3093 self
3094 }
3095
3096 /// Sets or clears the value of [start_time][crate::model::Build::start_time].
3097 ///
3098 /// # Example
3099 /// ```ignore,no_run
3100 /// # use google_cloud_build_v1::model::Build;
3101 /// use wkt::Timestamp;
3102 /// let x = Build::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3103 /// let x = Build::new().set_or_clear_start_time(None::<Timestamp>);
3104 /// ```
3105 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3106 where
3107 T: std::convert::Into<wkt::Timestamp>,
3108 {
3109 self.start_time = v.map(|x| x.into());
3110 self
3111 }
3112
3113 /// Sets the value of [finish_time][crate::model::Build::finish_time].
3114 ///
3115 /// # Example
3116 /// ```ignore,no_run
3117 /// # use google_cloud_build_v1::model::Build;
3118 /// use wkt::Timestamp;
3119 /// let x = Build::new().set_finish_time(Timestamp::default()/* use setters */);
3120 /// ```
3121 pub fn set_finish_time<T>(mut self, v: T) -> Self
3122 where
3123 T: std::convert::Into<wkt::Timestamp>,
3124 {
3125 self.finish_time = std::option::Option::Some(v.into());
3126 self
3127 }
3128
3129 /// Sets or clears the value of [finish_time][crate::model::Build::finish_time].
3130 ///
3131 /// # Example
3132 /// ```ignore,no_run
3133 /// # use google_cloud_build_v1::model::Build;
3134 /// use wkt::Timestamp;
3135 /// let x = Build::new().set_or_clear_finish_time(Some(Timestamp::default()/* use setters */));
3136 /// let x = Build::new().set_or_clear_finish_time(None::<Timestamp>);
3137 /// ```
3138 pub fn set_or_clear_finish_time<T>(mut self, v: std::option::Option<T>) -> Self
3139 where
3140 T: std::convert::Into<wkt::Timestamp>,
3141 {
3142 self.finish_time = v.map(|x| x.into());
3143 self
3144 }
3145
3146 /// Sets the value of [timeout][crate::model::Build::timeout].
3147 ///
3148 /// # Example
3149 /// ```ignore,no_run
3150 /// # use google_cloud_build_v1::model::Build;
3151 /// use wkt::Duration;
3152 /// let x = Build::new().set_timeout(Duration::default()/* use setters */);
3153 /// ```
3154 pub fn set_timeout<T>(mut self, v: T) -> Self
3155 where
3156 T: std::convert::Into<wkt::Duration>,
3157 {
3158 self.timeout = std::option::Option::Some(v.into());
3159 self
3160 }
3161
3162 /// Sets or clears the value of [timeout][crate::model::Build::timeout].
3163 ///
3164 /// # Example
3165 /// ```ignore,no_run
3166 /// # use google_cloud_build_v1::model::Build;
3167 /// use wkt::Duration;
3168 /// let x = Build::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
3169 /// let x = Build::new().set_or_clear_timeout(None::<Duration>);
3170 /// ```
3171 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3172 where
3173 T: std::convert::Into<wkt::Duration>,
3174 {
3175 self.timeout = v.map(|x| x.into());
3176 self
3177 }
3178
3179 /// Sets the value of [images][crate::model::Build::images].
3180 ///
3181 /// # Example
3182 /// ```ignore,no_run
3183 /// # use google_cloud_build_v1::model::Build;
3184 /// let x = Build::new().set_images(["a", "b", "c"]);
3185 /// ```
3186 pub fn set_images<T, V>(mut self, v: T) -> Self
3187 where
3188 T: std::iter::IntoIterator<Item = V>,
3189 V: std::convert::Into<std::string::String>,
3190 {
3191 use std::iter::Iterator;
3192 self.images = v.into_iter().map(|i| i.into()).collect();
3193 self
3194 }
3195
3196 /// Sets the value of [queue_ttl][crate::model::Build::queue_ttl].
3197 ///
3198 /// # Example
3199 /// ```ignore,no_run
3200 /// # use google_cloud_build_v1::model::Build;
3201 /// use wkt::Duration;
3202 /// let x = Build::new().set_queue_ttl(Duration::default()/* use setters */);
3203 /// ```
3204 pub fn set_queue_ttl<T>(mut self, v: T) -> Self
3205 where
3206 T: std::convert::Into<wkt::Duration>,
3207 {
3208 self.queue_ttl = std::option::Option::Some(v.into());
3209 self
3210 }
3211
3212 /// Sets or clears the value of [queue_ttl][crate::model::Build::queue_ttl].
3213 ///
3214 /// # Example
3215 /// ```ignore,no_run
3216 /// # use google_cloud_build_v1::model::Build;
3217 /// use wkt::Duration;
3218 /// let x = Build::new().set_or_clear_queue_ttl(Some(Duration::default()/* use setters */));
3219 /// let x = Build::new().set_or_clear_queue_ttl(None::<Duration>);
3220 /// ```
3221 pub fn set_or_clear_queue_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3222 where
3223 T: std::convert::Into<wkt::Duration>,
3224 {
3225 self.queue_ttl = v.map(|x| x.into());
3226 self
3227 }
3228
3229 /// Sets the value of [artifacts][crate::model::Build::artifacts].
3230 ///
3231 /// # Example
3232 /// ```ignore,no_run
3233 /// # use google_cloud_build_v1::model::Build;
3234 /// use google_cloud_build_v1::model::Artifacts;
3235 /// let x = Build::new().set_artifacts(Artifacts::default()/* use setters */);
3236 /// ```
3237 pub fn set_artifacts<T>(mut self, v: T) -> Self
3238 where
3239 T: std::convert::Into<crate::model::Artifacts>,
3240 {
3241 self.artifacts = std::option::Option::Some(v.into());
3242 self
3243 }
3244
3245 /// Sets or clears the value of [artifacts][crate::model::Build::artifacts].
3246 ///
3247 /// # Example
3248 /// ```ignore,no_run
3249 /// # use google_cloud_build_v1::model::Build;
3250 /// use google_cloud_build_v1::model::Artifacts;
3251 /// let x = Build::new().set_or_clear_artifacts(Some(Artifacts::default()/* use setters */));
3252 /// let x = Build::new().set_or_clear_artifacts(None::<Artifacts>);
3253 /// ```
3254 pub fn set_or_clear_artifacts<T>(mut self, v: std::option::Option<T>) -> Self
3255 where
3256 T: std::convert::Into<crate::model::Artifacts>,
3257 {
3258 self.artifacts = v.map(|x| x.into());
3259 self
3260 }
3261
3262 /// Sets the value of [logs_bucket][crate::model::Build::logs_bucket].
3263 ///
3264 /// # Example
3265 /// ```ignore,no_run
3266 /// # use google_cloud_build_v1::model::Build;
3267 /// let x = Build::new().set_logs_bucket("example");
3268 /// ```
3269 pub fn set_logs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3270 self.logs_bucket = v.into();
3271 self
3272 }
3273
3274 /// Sets the value of [source_provenance][crate::model::Build::source_provenance].
3275 ///
3276 /// # Example
3277 /// ```ignore,no_run
3278 /// # use google_cloud_build_v1::model::Build;
3279 /// use google_cloud_build_v1::model::SourceProvenance;
3280 /// let x = Build::new().set_source_provenance(SourceProvenance::default()/* use setters */);
3281 /// ```
3282 pub fn set_source_provenance<T>(mut self, v: T) -> Self
3283 where
3284 T: std::convert::Into<crate::model::SourceProvenance>,
3285 {
3286 self.source_provenance = std::option::Option::Some(v.into());
3287 self
3288 }
3289
3290 /// Sets or clears the value of [source_provenance][crate::model::Build::source_provenance].
3291 ///
3292 /// # Example
3293 /// ```ignore,no_run
3294 /// # use google_cloud_build_v1::model::Build;
3295 /// use google_cloud_build_v1::model::SourceProvenance;
3296 /// let x = Build::new().set_or_clear_source_provenance(Some(SourceProvenance::default()/* use setters */));
3297 /// let x = Build::new().set_or_clear_source_provenance(None::<SourceProvenance>);
3298 /// ```
3299 pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3300 where
3301 T: std::convert::Into<crate::model::SourceProvenance>,
3302 {
3303 self.source_provenance = v.map(|x| x.into());
3304 self
3305 }
3306
3307 /// Sets the value of [build_trigger_id][crate::model::Build::build_trigger_id].
3308 ///
3309 /// # Example
3310 /// ```ignore,no_run
3311 /// # use google_cloud_build_v1::model::Build;
3312 /// let x = Build::new().set_build_trigger_id("example");
3313 /// ```
3314 pub fn set_build_trigger_id<T: std::convert::Into<std::string::String>>(
3315 mut self,
3316 v: T,
3317 ) -> Self {
3318 self.build_trigger_id = v.into();
3319 self
3320 }
3321
3322 /// Sets the value of [options][crate::model::Build::options].
3323 ///
3324 /// # Example
3325 /// ```ignore,no_run
3326 /// # use google_cloud_build_v1::model::Build;
3327 /// use google_cloud_build_v1::model::BuildOptions;
3328 /// let x = Build::new().set_options(BuildOptions::default()/* use setters */);
3329 /// ```
3330 pub fn set_options<T>(mut self, v: T) -> Self
3331 where
3332 T: std::convert::Into<crate::model::BuildOptions>,
3333 {
3334 self.options = std::option::Option::Some(v.into());
3335 self
3336 }
3337
3338 /// Sets or clears the value of [options][crate::model::Build::options].
3339 ///
3340 /// # Example
3341 /// ```ignore,no_run
3342 /// # use google_cloud_build_v1::model::Build;
3343 /// use google_cloud_build_v1::model::BuildOptions;
3344 /// let x = Build::new().set_or_clear_options(Some(BuildOptions::default()/* use setters */));
3345 /// let x = Build::new().set_or_clear_options(None::<BuildOptions>);
3346 /// ```
3347 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3348 where
3349 T: std::convert::Into<crate::model::BuildOptions>,
3350 {
3351 self.options = v.map(|x| x.into());
3352 self
3353 }
3354
3355 /// Sets the value of [log_url][crate::model::Build::log_url].
3356 ///
3357 /// # Example
3358 /// ```ignore,no_run
3359 /// # use google_cloud_build_v1::model::Build;
3360 /// let x = Build::new().set_log_url("example");
3361 /// ```
3362 pub fn set_log_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3363 self.log_url = v.into();
3364 self
3365 }
3366
3367 /// Sets the value of [substitutions][crate::model::Build::substitutions].
3368 ///
3369 /// # Example
3370 /// ```ignore,no_run
3371 /// # use google_cloud_build_v1::model::Build;
3372 /// let x = Build::new().set_substitutions([
3373 /// ("key0", "abc"),
3374 /// ("key1", "xyz"),
3375 /// ]);
3376 /// ```
3377 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
3378 where
3379 T: std::iter::IntoIterator<Item = (K, V)>,
3380 K: std::convert::Into<std::string::String>,
3381 V: std::convert::Into<std::string::String>,
3382 {
3383 use std::iter::Iterator;
3384 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3385 self
3386 }
3387
3388 /// Sets the value of [tags][crate::model::Build::tags].
3389 ///
3390 /// # Example
3391 /// ```ignore,no_run
3392 /// # use google_cloud_build_v1::model::Build;
3393 /// let x = Build::new().set_tags(["a", "b", "c"]);
3394 /// ```
3395 pub fn set_tags<T, V>(mut self, v: T) -> Self
3396 where
3397 T: std::iter::IntoIterator<Item = V>,
3398 V: std::convert::Into<std::string::String>,
3399 {
3400 use std::iter::Iterator;
3401 self.tags = v.into_iter().map(|i| i.into()).collect();
3402 self
3403 }
3404
3405 /// Sets the value of [secrets][crate::model::Build::secrets].
3406 ///
3407 /// # Example
3408 /// ```ignore,no_run
3409 /// # use google_cloud_build_v1::model::Build;
3410 /// use google_cloud_build_v1::model::Secret;
3411 /// let x = Build::new()
3412 /// .set_secrets([
3413 /// Secret::default()/* use setters */,
3414 /// Secret::default()/* use (different) setters */,
3415 /// ]);
3416 /// ```
3417 pub fn set_secrets<T, V>(mut self, v: T) -> Self
3418 where
3419 T: std::iter::IntoIterator<Item = V>,
3420 V: std::convert::Into<crate::model::Secret>,
3421 {
3422 use std::iter::Iterator;
3423 self.secrets = v.into_iter().map(|i| i.into()).collect();
3424 self
3425 }
3426
3427 /// Sets the value of [timing][crate::model::Build::timing].
3428 ///
3429 /// # Example
3430 /// ```ignore,no_run
3431 /// # use google_cloud_build_v1::model::Build;
3432 /// use google_cloud_build_v1::model::TimeSpan;
3433 /// let x = Build::new().set_timing([
3434 /// ("key0", TimeSpan::default()/* use setters */),
3435 /// ("key1", TimeSpan::default()/* use (different) setters */),
3436 /// ]);
3437 /// ```
3438 pub fn set_timing<T, K, V>(mut self, v: T) -> Self
3439 where
3440 T: std::iter::IntoIterator<Item = (K, V)>,
3441 K: std::convert::Into<std::string::String>,
3442 V: std::convert::Into<crate::model::TimeSpan>,
3443 {
3444 use std::iter::Iterator;
3445 self.timing = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3446 self
3447 }
3448
3449 /// Sets the value of [approval][crate::model::Build::approval].
3450 ///
3451 /// # Example
3452 /// ```ignore,no_run
3453 /// # use google_cloud_build_v1::model::Build;
3454 /// use google_cloud_build_v1::model::BuildApproval;
3455 /// let x = Build::new().set_approval(BuildApproval::default()/* use setters */);
3456 /// ```
3457 pub fn set_approval<T>(mut self, v: T) -> Self
3458 where
3459 T: std::convert::Into<crate::model::BuildApproval>,
3460 {
3461 self.approval = std::option::Option::Some(v.into());
3462 self
3463 }
3464
3465 /// Sets or clears the value of [approval][crate::model::Build::approval].
3466 ///
3467 /// # Example
3468 /// ```ignore,no_run
3469 /// # use google_cloud_build_v1::model::Build;
3470 /// use google_cloud_build_v1::model::BuildApproval;
3471 /// let x = Build::new().set_or_clear_approval(Some(BuildApproval::default()/* use setters */));
3472 /// let x = Build::new().set_or_clear_approval(None::<BuildApproval>);
3473 /// ```
3474 pub fn set_or_clear_approval<T>(mut self, v: std::option::Option<T>) -> Self
3475 where
3476 T: std::convert::Into<crate::model::BuildApproval>,
3477 {
3478 self.approval = v.map(|x| x.into());
3479 self
3480 }
3481
3482 /// Sets the value of [service_account][crate::model::Build::service_account].
3483 ///
3484 /// # Example
3485 /// ```ignore,no_run
3486 /// # use google_cloud_build_v1::model::Build;
3487 /// let x = Build::new().set_service_account("example");
3488 /// ```
3489 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3490 self.service_account = v.into();
3491 self
3492 }
3493
3494 /// Sets the value of [available_secrets][crate::model::Build::available_secrets].
3495 ///
3496 /// # Example
3497 /// ```ignore,no_run
3498 /// # use google_cloud_build_v1::model::Build;
3499 /// use google_cloud_build_v1::model::Secrets;
3500 /// let x = Build::new().set_available_secrets(Secrets::default()/* use setters */);
3501 /// ```
3502 pub fn set_available_secrets<T>(mut self, v: T) -> Self
3503 where
3504 T: std::convert::Into<crate::model::Secrets>,
3505 {
3506 self.available_secrets = std::option::Option::Some(v.into());
3507 self
3508 }
3509
3510 /// Sets or clears the value of [available_secrets][crate::model::Build::available_secrets].
3511 ///
3512 /// # Example
3513 /// ```ignore,no_run
3514 /// # use google_cloud_build_v1::model::Build;
3515 /// use google_cloud_build_v1::model::Secrets;
3516 /// let x = Build::new().set_or_clear_available_secrets(Some(Secrets::default()/* use setters */));
3517 /// let x = Build::new().set_or_clear_available_secrets(None::<Secrets>);
3518 /// ```
3519 pub fn set_or_clear_available_secrets<T>(mut self, v: std::option::Option<T>) -> Self
3520 where
3521 T: std::convert::Into<crate::model::Secrets>,
3522 {
3523 self.available_secrets = v.map(|x| x.into());
3524 self
3525 }
3526
3527 /// Sets the value of [warnings][crate::model::Build::warnings].
3528 ///
3529 /// # Example
3530 /// ```ignore,no_run
3531 /// # use google_cloud_build_v1::model::Build;
3532 /// use google_cloud_build_v1::model::build::Warning;
3533 /// let x = Build::new()
3534 /// .set_warnings([
3535 /// Warning::default()/* use setters */,
3536 /// Warning::default()/* use (different) setters */,
3537 /// ]);
3538 /// ```
3539 pub fn set_warnings<T, V>(mut self, v: T) -> Self
3540 where
3541 T: std::iter::IntoIterator<Item = V>,
3542 V: std::convert::Into<crate::model::build::Warning>,
3543 {
3544 use std::iter::Iterator;
3545 self.warnings = v.into_iter().map(|i| i.into()).collect();
3546 self
3547 }
3548
3549 /// Sets the value of [git_config][crate::model::Build::git_config].
3550 ///
3551 /// # Example
3552 /// ```ignore,no_run
3553 /// # use google_cloud_build_v1::model::Build;
3554 /// use google_cloud_build_v1::model::GitConfig;
3555 /// let x = Build::new().set_git_config(GitConfig::default()/* use setters */);
3556 /// ```
3557 pub fn set_git_config<T>(mut self, v: T) -> Self
3558 where
3559 T: std::convert::Into<crate::model::GitConfig>,
3560 {
3561 self.git_config = std::option::Option::Some(v.into());
3562 self
3563 }
3564
3565 /// Sets or clears the value of [git_config][crate::model::Build::git_config].
3566 ///
3567 /// # Example
3568 /// ```ignore,no_run
3569 /// # use google_cloud_build_v1::model::Build;
3570 /// use google_cloud_build_v1::model::GitConfig;
3571 /// let x = Build::new().set_or_clear_git_config(Some(GitConfig::default()/* use setters */));
3572 /// let x = Build::new().set_or_clear_git_config(None::<GitConfig>);
3573 /// ```
3574 pub fn set_or_clear_git_config<T>(mut self, v: std::option::Option<T>) -> Self
3575 where
3576 T: std::convert::Into<crate::model::GitConfig>,
3577 {
3578 self.git_config = v.map(|x| x.into());
3579 self
3580 }
3581
3582 /// Sets the value of [failure_info][crate::model::Build::failure_info].
3583 ///
3584 /// # Example
3585 /// ```ignore,no_run
3586 /// # use google_cloud_build_v1::model::Build;
3587 /// use google_cloud_build_v1::model::build::FailureInfo;
3588 /// let x = Build::new().set_failure_info(FailureInfo::default()/* use setters */);
3589 /// ```
3590 pub fn set_failure_info<T>(mut self, v: T) -> Self
3591 where
3592 T: std::convert::Into<crate::model::build::FailureInfo>,
3593 {
3594 self.failure_info = std::option::Option::Some(v.into());
3595 self
3596 }
3597
3598 /// Sets or clears the value of [failure_info][crate::model::Build::failure_info].
3599 ///
3600 /// # Example
3601 /// ```ignore,no_run
3602 /// # use google_cloud_build_v1::model::Build;
3603 /// use google_cloud_build_v1::model::build::FailureInfo;
3604 /// let x = Build::new().set_or_clear_failure_info(Some(FailureInfo::default()/* use setters */));
3605 /// let x = Build::new().set_or_clear_failure_info(None::<FailureInfo>);
3606 /// ```
3607 pub fn set_or_clear_failure_info<T>(mut self, v: std::option::Option<T>) -> Self
3608 where
3609 T: std::convert::Into<crate::model::build::FailureInfo>,
3610 {
3611 self.failure_info = v.map(|x| x.into());
3612 self
3613 }
3614
3615 /// Sets the value of [dependencies][crate::model::Build::dependencies].
3616 ///
3617 /// # Example
3618 /// ```ignore,no_run
3619 /// # use google_cloud_build_v1::model::Build;
3620 /// use google_cloud_build_v1::model::Dependency;
3621 /// let x = Build::new()
3622 /// .set_dependencies([
3623 /// Dependency::default()/* use setters */,
3624 /// Dependency::default()/* use (different) setters */,
3625 /// ]);
3626 /// ```
3627 pub fn set_dependencies<T, V>(mut self, v: T) -> Self
3628 where
3629 T: std::iter::IntoIterator<Item = V>,
3630 V: std::convert::Into<crate::model::Dependency>,
3631 {
3632 use std::iter::Iterator;
3633 self.dependencies = v.into_iter().map(|i| i.into()).collect();
3634 self
3635 }
3636}
3637
3638impl wkt::message::Message for Build {
3639 fn typename() -> &'static str {
3640 "type.googleapis.com/google.devtools.cloudbuild.v1.Build"
3641 }
3642}
3643
3644/// Defines additional types related to [Build].
3645pub mod build {
3646 #[allow(unused_imports)]
3647 use super::*;
3648
3649 /// A non-fatal problem encountered during the execution of the build.
3650 #[derive(Clone, Default, PartialEq)]
3651 #[non_exhaustive]
3652 pub struct Warning {
3653 /// Explanation of the warning generated.
3654 pub text: std::string::String,
3655
3656 /// The priority for this warning.
3657 pub priority: crate::model::build::warning::Priority,
3658
3659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3660 }
3661
3662 impl Warning {
3663 pub fn new() -> Self {
3664 std::default::Default::default()
3665 }
3666
3667 /// Sets the value of [text][crate::model::build::Warning::text].
3668 ///
3669 /// # Example
3670 /// ```ignore,no_run
3671 /// # use google_cloud_build_v1::model::build::Warning;
3672 /// let x = Warning::new().set_text("example");
3673 /// ```
3674 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3675 self.text = v.into();
3676 self
3677 }
3678
3679 /// Sets the value of [priority][crate::model::build::Warning::priority].
3680 ///
3681 /// # Example
3682 /// ```ignore,no_run
3683 /// # use google_cloud_build_v1::model::build::Warning;
3684 /// use google_cloud_build_v1::model::build::warning::Priority;
3685 /// let x0 = Warning::new().set_priority(Priority::Info);
3686 /// let x1 = Warning::new().set_priority(Priority::Warning);
3687 /// let x2 = Warning::new().set_priority(Priority::Alert);
3688 /// ```
3689 pub fn set_priority<T: std::convert::Into<crate::model::build::warning::Priority>>(
3690 mut self,
3691 v: T,
3692 ) -> Self {
3693 self.priority = v.into();
3694 self
3695 }
3696 }
3697
3698 impl wkt::message::Message for Warning {
3699 fn typename() -> &'static str {
3700 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.Warning"
3701 }
3702 }
3703
3704 /// Defines additional types related to [Warning].
3705 pub mod warning {
3706 #[allow(unused_imports)]
3707 use super::*;
3708
3709 /// The relative importance of this warning.
3710 ///
3711 /// # Working with unknown values
3712 ///
3713 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3714 /// additional enum variants at any time. Adding new variants is not considered
3715 /// a breaking change. Applications should write their code in anticipation of:
3716 ///
3717 /// - New values appearing in future releases of the client library, **and**
3718 /// - New values received dynamically, without application changes.
3719 ///
3720 /// Please consult the [Working with enums] section in the user guide for some
3721 /// guidelines.
3722 ///
3723 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3724 #[derive(Clone, Debug, PartialEq)]
3725 #[non_exhaustive]
3726 pub enum Priority {
3727 /// Should not be used.
3728 Unspecified,
3729 /// e.g. deprecation warnings and alternative feature highlights.
3730 Info,
3731 /// e.g. automated detection of possible issues with the build.
3732 Warning,
3733 /// e.g. alerts that a feature used in the build is pending removal
3734 Alert,
3735 /// If set, the enum was initialized with an unknown value.
3736 ///
3737 /// Applications can examine the value using [Priority::value] or
3738 /// [Priority::name].
3739 UnknownValue(priority::UnknownValue),
3740 }
3741
3742 #[doc(hidden)]
3743 pub mod priority {
3744 #[allow(unused_imports)]
3745 use super::*;
3746 #[derive(Clone, Debug, PartialEq)]
3747 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3748 }
3749
3750 impl Priority {
3751 /// Gets the enum value.
3752 ///
3753 /// Returns `None` if the enum contains an unknown value deserialized from
3754 /// the string representation of enums.
3755 pub fn value(&self) -> std::option::Option<i32> {
3756 match self {
3757 Self::Unspecified => std::option::Option::Some(0),
3758 Self::Info => std::option::Option::Some(1),
3759 Self::Warning => std::option::Option::Some(2),
3760 Self::Alert => std::option::Option::Some(3),
3761 Self::UnknownValue(u) => u.0.value(),
3762 }
3763 }
3764
3765 /// Gets the enum value as a string.
3766 ///
3767 /// Returns `None` if the enum contains an unknown value deserialized from
3768 /// the integer representation of enums.
3769 pub fn name(&self) -> std::option::Option<&str> {
3770 match self {
3771 Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
3772 Self::Info => std::option::Option::Some("INFO"),
3773 Self::Warning => std::option::Option::Some("WARNING"),
3774 Self::Alert => std::option::Option::Some("ALERT"),
3775 Self::UnknownValue(u) => u.0.name(),
3776 }
3777 }
3778 }
3779
3780 impl std::default::Default for Priority {
3781 fn default() -> Self {
3782 use std::convert::From;
3783 Self::from(0)
3784 }
3785 }
3786
3787 impl std::fmt::Display for Priority {
3788 fn fmt(
3789 &self,
3790 f: &mut std::fmt::Formatter<'_>,
3791 ) -> std::result::Result<(), std::fmt::Error> {
3792 wkt::internal::display_enum(f, self.name(), self.value())
3793 }
3794 }
3795
3796 impl std::convert::From<i32> for Priority {
3797 fn from(value: i32) -> Self {
3798 match value {
3799 0 => Self::Unspecified,
3800 1 => Self::Info,
3801 2 => Self::Warning,
3802 3 => Self::Alert,
3803 _ => Self::UnknownValue(priority::UnknownValue(
3804 wkt::internal::UnknownEnumValue::Integer(value),
3805 )),
3806 }
3807 }
3808 }
3809
3810 impl std::convert::From<&str> for Priority {
3811 fn from(value: &str) -> Self {
3812 use std::string::ToString;
3813 match value {
3814 "PRIORITY_UNSPECIFIED" => Self::Unspecified,
3815 "INFO" => Self::Info,
3816 "WARNING" => Self::Warning,
3817 "ALERT" => Self::Alert,
3818 _ => Self::UnknownValue(priority::UnknownValue(
3819 wkt::internal::UnknownEnumValue::String(value.to_string()),
3820 )),
3821 }
3822 }
3823 }
3824
3825 impl serde::ser::Serialize for Priority {
3826 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3827 where
3828 S: serde::Serializer,
3829 {
3830 match self {
3831 Self::Unspecified => serializer.serialize_i32(0),
3832 Self::Info => serializer.serialize_i32(1),
3833 Self::Warning => serializer.serialize_i32(2),
3834 Self::Alert => serializer.serialize_i32(3),
3835 Self::UnknownValue(u) => u.0.serialize(serializer),
3836 }
3837 }
3838 }
3839
3840 impl<'de> serde::de::Deserialize<'de> for Priority {
3841 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3842 where
3843 D: serde::Deserializer<'de>,
3844 {
3845 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
3846 ".google.devtools.cloudbuild.v1.Build.Warning.Priority",
3847 ))
3848 }
3849 }
3850 }
3851
3852 /// A fatal problem encountered during the execution of the build.
3853 #[derive(Clone, Default, PartialEq)]
3854 #[non_exhaustive]
3855 pub struct FailureInfo {
3856 /// The name of the failure.
3857 pub r#type: crate::model::build::failure_info::FailureType,
3858
3859 /// Explains the failure issue in more detail using hard-coded text.
3860 pub detail: std::string::String,
3861
3862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3863 }
3864
3865 impl FailureInfo {
3866 pub fn new() -> Self {
3867 std::default::Default::default()
3868 }
3869
3870 /// Sets the value of [r#type][crate::model::build::FailureInfo::type].
3871 ///
3872 /// # Example
3873 /// ```ignore,no_run
3874 /// # use google_cloud_build_v1::model::build::FailureInfo;
3875 /// use google_cloud_build_v1::model::build::failure_info::FailureType;
3876 /// let x0 = FailureInfo::new().set_type(FailureType::PushFailed);
3877 /// let x1 = FailureInfo::new().set_type(FailureType::PushImageNotFound);
3878 /// let x2 = FailureInfo::new().set_type(FailureType::PushNotAuthorized);
3879 /// ```
3880 pub fn set_type<T: std::convert::Into<crate::model::build::failure_info::FailureType>>(
3881 mut self,
3882 v: T,
3883 ) -> Self {
3884 self.r#type = v.into();
3885 self
3886 }
3887
3888 /// Sets the value of [detail][crate::model::build::FailureInfo::detail].
3889 ///
3890 /// # Example
3891 /// ```ignore,no_run
3892 /// # use google_cloud_build_v1::model::build::FailureInfo;
3893 /// let x = FailureInfo::new().set_detail("example");
3894 /// ```
3895 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3896 self.detail = v.into();
3897 self
3898 }
3899 }
3900
3901 impl wkt::message::Message for FailureInfo {
3902 fn typename() -> &'static str {
3903 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.FailureInfo"
3904 }
3905 }
3906
3907 /// Defines additional types related to [FailureInfo].
3908 pub mod failure_info {
3909 #[allow(unused_imports)]
3910 use super::*;
3911
3912 /// The name of a fatal problem encountered during the execution of the
3913 /// build.
3914 ///
3915 /// # Working with unknown values
3916 ///
3917 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3918 /// additional enum variants at any time. Adding new variants is not considered
3919 /// a breaking change. Applications should write their code in anticipation of:
3920 ///
3921 /// - New values appearing in future releases of the client library, **and**
3922 /// - New values received dynamically, without application changes.
3923 ///
3924 /// Please consult the [Working with enums] section in the user guide for some
3925 /// guidelines.
3926 ///
3927 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3928 #[derive(Clone, Debug, PartialEq)]
3929 #[non_exhaustive]
3930 pub enum FailureType {
3931 /// Type unspecified
3932 Unspecified,
3933 /// Unable to push the image to the repository.
3934 PushFailed,
3935 /// Final image not found.
3936 PushImageNotFound,
3937 /// Unauthorized push of the final image.
3938 PushNotAuthorized,
3939 /// Backend logging failures. Should retry.
3940 LoggingFailure,
3941 /// A build step has failed.
3942 UserBuildStep,
3943 /// The source fetching has failed.
3944 FetchSourceFailed,
3945 /// If set, the enum was initialized with an unknown value.
3946 ///
3947 /// Applications can examine the value using [FailureType::value] or
3948 /// [FailureType::name].
3949 UnknownValue(failure_type::UnknownValue),
3950 }
3951
3952 #[doc(hidden)]
3953 pub mod failure_type {
3954 #[allow(unused_imports)]
3955 use super::*;
3956 #[derive(Clone, Debug, PartialEq)]
3957 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3958 }
3959
3960 impl FailureType {
3961 /// Gets the enum value.
3962 ///
3963 /// Returns `None` if the enum contains an unknown value deserialized from
3964 /// the string representation of enums.
3965 pub fn value(&self) -> std::option::Option<i32> {
3966 match self {
3967 Self::Unspecified => std::option::Option::Some(0),
3968 Self::PushFailed => std::option::Option::Some(1),
3969 Self::PushImageNotFound => std::option::Option::Some(2),
3970 Self::PushNotAuthorized => std::option::Option::Some(3),
3971 Self::LoggingFailure => std::option::Option::Some(4),
3972 Self::UserBuildStep => std::option::Option::Some(5),
3973 Self::FetchSourceFailed => std::option::Option::Some(6),
3974 Self::UnknownValue(u) => u.0.value(),
3975 }
3976 }
3977
3978 /// Gets the enum value as a string.
3979 ///
3980 /// Returns `None` if the enum contains an unknown value deserialized from
3981 /// the integer representation of enums.
3982 pub fn name(&self) -> std::option::Option<&str> {
3983 match self {
3984 Self::Unspecified => std::option::Option::Some("FAILURE_TYPE_UNSPECIFIED"),
3985 Self::PushFailed => std::option::Option::Some("PUSH_FAILED"),
3986 Self::PushImageNotFound => std::option::Option::Some("PUSH_IMAGE_NOT_FOUND"),
3987 Self::PushNotAuthorized => std::option::Option::Some("PUSH_NOT_AUTHORIZED"),
3988 Self::LoggingFailure => std::option::Option::Some("LOGGING_FAILURE"),
3989 Self::UserBuildStep => std::option::Option::Some("USER_BUILD_STEP"),
3990 Self::FetchSourceFailed => std::option::Option::Some("FETCH_SOURCE_FAILED"),
3991 Self::UnknownValue(u) => u.0.name(),
3992 }
3993 }
3994 }
3995
3996 impl std::default::Default for FailureType {
3997 fn default() -> Self {
3998 use std::convert::From;
3999 Self::from(0)
4000 }
4001 }
4002
4003 impl std::fmt::Display for FailureType {
4004 fn fmt(
4005 &self,
4006 f: &mut std::fmt::Formatter<'_>,
4007 ) -> std::result::Result<(), std::fmt::Error> {
4008 wkt::internal::display_enum(f, self.name(), self.value())
4009 }
4010 }
4011
4012 impl std::convert::From<i32> for FailureType {
4013 fn from(value: i32) -> Self {
4014 match value {
4015 0 => Self::Unspecified,
4016 1 => Self::PushFailed,
4017 2 => Self::PushImageNotFound,
4018 3 => Self::PushNotAuthorized,
4019 4 => Self::LoggingFailure,
4020 5 => Self::UserBuildStep,
4021 6 => Self::FetchSourceFailed,
4022 _ => Self::UnknownValue(failure_type::UnknownValue(
4023 wkt::internal::UnknownEnumValue::Integer(value),
4024 )),
4025 }
4026 }
4027 }
4028
4029 impl std::convert::From<&str> for FailureType {
4030 fn from(value: &str) -> Self {
4031 use std::string::ToString;
4032 match value {
4033 "FAILURE_TYPE_UNSPECIFIED" => Self::Unspecified,
4034 "PUSH_FAILED" => Self::PushFailed,
4035 "PUSH_IMAGE_NOT_FOUND" => Self::PushImageNotFound,
4036 "PUSH_NOT_AUTHORIZED" => Self::PushNotAuthorized,
4037 "LOGGING_FAILURE" => Self::LoggingFailure,
4038 "USER_BUILD_STEP" => Self::UserBuildStep,
4039 "FETCH_SOURCE_FAILED" => Self::FetchSourceFailed,
4040 _ => Self::UnknownValue(failure_type::UnknownValue(
4041 wkt::internal::UnknownEnumValue::String(value.to_string()),
4042 )),
4043 }
4044 }
4045 }
4046
4047 impl serde::ser::Serialize for FailureType {
4048 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4049 where
4050 S: serde::Serializer,
4051 {
4052 match self {
4053 Self::Unspecified => serializer.serialize_i32(0),
4054 Self::PushFailed => serializer.serialize_i32(1),
4055 Self::PushImageNotFound => serializer.serialize_i32(2),
4056 Self::PushNotAuthorized => serializer.serialize_i32(3),
4057 Self::LoggingFailure => serializer.serialize_i32(4),
4058 Self::UserBuildStep => serializer.serialize_i32(5),
4059 Self::FetchSourceFailed => serializer.serialize_i32(6),
4060 Self::UnknownValue(u) => u.0.serialize(serializer),
4061 }
4062 }
4063 }
4064
4065 impl<'de> serde::de::Deserialize<'de> for FailureType {
4066 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4067 where
4068 D: serde::Deserializer<'de>,
4069 {
4070 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureType>::new(
4071 ".google.devtools.cloudbuild.v1.Build.FailureInfo.FailureType",
4072 ))
4073 }
4074 }
4075 }
4076
4077 /// Possible status of a build or build step.
4078 ///
4079 /// # Working with unknown values
4080 ///
4081 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4082 /// additional enum variants at any time. Adding new variants is not considered
4083 /// a breaking change. Applications should write their code in anticipation of:
4084 ///
4085 /// - New values appearing in future releases of the client library, **and**
4086 /// - New values received dynamically, without application changes.
4087 ///
4088 /// Please consult the [Working with enums] section in the user guide for some
4089 /// guidelines.
4090 ///
4091 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4092 #[derive(Clone, Debug, PartialEq)]
4093 #[non_exhaustive]
4094 pub enum Status {
4095 /// Status of the build is unknown.
4096 Unknown,
4097 /// Build has been created and is pending execution and queuing. It has not
4098 /// been queued.
4099 Pending,
4100 /// Build or step is queued; work has not yet begun.
4101 Queued,
4102 /// Build or step is being executed.
4103 Working,
4104 /// Build or step finished successfully.
4105 Success,
4106 /// Build or step failed to complete successfully.
4107 Failure,
4108 /// Build or step failed due to an internal cause.
4109 InternalError,
4110 /// Build or step took longer than was allowed.
4111 Timeout,
4112 /// Build or step was canceled by a user.
4113 Cancelled,
4114 /// Build was enqueued for longer than the value of `queue_ttl`.
4115 Expired,
4116 /// If set, the enum was initialized with an unknown value.
4117 ///
4118 /// Applications can examine the value using [Status::value] or
4119 /// [Status::name].
4120 UnknownValue(status::UnknownValue),
4121 }
4122
4123 #[doc(hidden)]
4124 pub mod status {
4125 #[allow(unused_imports)]
4126 use super::*;
4127 #[derive(Clone, Debug, PartialEq)]
4128 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4129 }
4130
4131 impl Status {
4132 /// Gets the enum value.
4133 ///
4134 /// Returns `None` if the enum contains an unknown value deserialized from
4135 /// the string representation of enums.
4136 pub fn value(&self) -> std::option::Option<i32> {
4137 match self {
4138 Self::Unknown => std::option::Option::Some(0),
4139 Self::Pending => std::option::Option::Some(10),
4140 Self::Queued => std::option::Option::Some(1),
4141 Self::Working => std::option::Option::Some(2),
4142 Self::Success => std::option::Option::Some(3),
4143 Self::Failure => std::option::Option::Some(4),
4144 Self::InternalError => std::option::Option::Some(5),
4145 Self::Timeout => std::option::Option::Some(6),
4146 Self::Cancelled => std::option::Option::Some(7),
4147 Self::Expired => std::option::Option::Some(9),
4148 Self::UnknownValue(u) => u.0.value(),
4149 }
4150 }
4151
4152 /// Gets the enum value as a string.
4153 ///
4154 /// Returns `None` if the enum contains an unknown value deserialized from
4155 /// the integer representation of enums.
4156 pub fn name(&self) -> std::option::Option<&str> {
4157 match self {
4158 Self::Unknown => std::option::Option::Some("STATUS_UNKNOWN"),
4159 Self::Pending => std::option::Option::Some("PENDING"),
4160 Self::Queued => std::option::Option::Some("QUEUED"),
4161 Self::Working => std::option::Option::Some("WORKING"),
4162 Self::Success => std::option::Option::Some("SUCCESS"),
4163 Self::Failure => std::option::Option::Some("FAILURE"),
4164 Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
4165 Self::Timeout => std::option::Option::Some("TIMEOUT"),
4166 Self::Cancelled => std::option::Option::Some("CANCELLED"),
4167 Self::Expired => std::option::Option::Some("EXPIRED"),
4168 Self::UnknownValue(u) => u.0.name(),
4169 }
4170 }
4171 }
4172
4173 impl std::default::Default for Status {
4174 fn default() -> Self {
4175 use std::convert::From;
4176 Self::from(0)
4177 }
4178 }
4179
4180 impl std::fmt::Display for Status {
4181 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4182 wkt::internal::display_enum(f, self.name(), self.value())
4183 }
4184 }
4185
4186 impl std::convert::From<i32> for Status {
4187 fn from(value: i32) -> Self {
4188 match value {
4189 0 => Self::Unknown,
4190 1 => Self::Queued,
4191 2 => Self::Working,
4192 3 => Self::Success,
4193 4 => Self::Failure,
4194 5 => Self::InternalError,
4195 6 => Self::Timeout,
4196 7 => Self::Cancelled,
4197 9 => Self::Expired,
4198 10 => Self::Pending,
4199 _ => Self::UnknownValue(status::UnknownValue(
4200 wkt::internal::UnknownEnumValue::Integer(value),
4201 )),
4202 }
4203 }
4204 }
4205
4206 impl std::convert::From<&str> for Status {
4207 fn from(value: &str) -> Self {
4208 use std::string::ToString;
4209 match value {
4210 "STATUS_UNKNOWN" => Self::Unknown,
4211 "PENDING" => Self::Pending,
4212 "QUEUED" => Self::Queued,
4213 "WORKING" => Self::Working,
4214 "SUCCESS" => Self::Success,
4215 "FAILURE" => Self::Failure,
4216 "INTERNAL_ERROR" => Self::InternalError,
4217 "TIMEOUT" => Self::Timeout,
4218 "CANCELLED" => Self::Cancelled,
4219 "EXPIRED" => Self::Expired,
4220 _ => Self::UnknownValue(status::UnknownValue(
4221 wkt::internal::UnknownEnumValue::String(value.to_string()),
4222 )),
4223 }
4224 }
4225 }
4226
4227 impl serde::ser::Serialize for Status {
4228 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4229 where
4230 S: serde::Serializer,
4231 {
4232 match self {
4233 Self::Unknown => serializer.serialize_i32(0),
4234 Self::Pending => serializer.serialize_i32(10),
4235 Self::Queued => serializer.serialize_i32(1),
4236 Self::Working => serializer.serialize_i32(2),
4237 Self::Success => serializer.serialize_i32(3),
4238 Self::Failure => serializer.serialize_i32(4),
4239 Self::InternalError => serializer.serialize_i32(5),
4240 Self::Timeout => serializer.serialize_i32(6),
4241 Self::Cancelled => serializer.serialize_i32(7),
4242 Self::Expired => serializer.serialize_i32(9),
4243 Self::UnknownValue(u) => u.0.serialize(serializer),
4244 }
4245 }
4246 }
4247
4248 impl<'de> serde::de::Deserialize<'de> for Status {
4249 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4250 where
4251 D: serde::Deserializer<'de>,
4252 {
4253 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
4254 ".google.devtools.cloudbuild.v1.Build.Status",
4255 ))
4256 }
4257 }
4258}
4259
4260/// A dependency that the Cloud Build worker will fetch before executing user
4261/// steps.
4262#[derive(Clone, Default, PartialEq)]
4263#[non_exhaustive]
4264pub struct Dependency {
4265 /// The type of dependency to fetch.
4266 pub dep: std::option::Option<crate::model::dependency::Dep>,
4267
4268 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4269}
4270
4271impl Dependency {
4272 pub fn new() -> Self {
4273 std::default::Default::default()
4274 }
4275
4276 /// Sets the value of [dep][crate::model::Dependency::dep].
4277 ///
4278 /// Note that all the setters affecting `dep` are mutually
4279 /// exclusive.
4280 ///
4281 /// # Example
4282 /// ```ignore,no_run
4283 /// # use google_cloud_build_v1::model::Dependency;
4284 /// use google_cloud_build_v1::model::dependency::Dep;
4285 /// let x = Dependency::new().set_dep(Some(Dep::Empty(true)));
4286 /// ```
4287 pub fn set_dep<T: std::convert::Into<std::option::Option<crate::model::dependency::Dep>>>(
4288 mut self,
4289 v: T,
4290 ) -> Self {
4291 self.dep = v.into();
4292 self
4293 }
4294
4295 /// The value of [dep][crate::model::Dependency::dep]
4296 /// if it holds a `Empty`, `None` if the field is not set or
4297 /// holds a different branch.
4298 pub fn empty(&self) -> std::option::Option<&bool> {
4299 #[allow(unreachable_patterns)]
4300 self.dep.as_ref().and_then(|v| match v {
4301 crate::model::dependency::Dep::Empty(v) => std::option::Option::Some(v),
4302 _ => std::option::Option::None,
4303 })
4304 }
4305
4306 /// Sets the value of [dep][crate::model::Dependency::dep]
4307 /// to hold a `Empty`.
4308 ///
4309 /// Note that all the setters affecting `dep` are
4310 /// mutually exclusive.
4311 ///
4312 /// # Example
4313 /// ```ignore,no_run
4314 /// # use google_cloud_build_v1::model::Dependency;
4315 /// let x = Dependency::new().set_empty(true);
4316 /// assert!(x.empty().is_some());
4317 /// assert!(x.git_source().is_none());
4318 /// ```
4319 pub fn set_empty<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4320 self.dep = std::option::Option::Some(crate::model::dependency::Dep::Empty(v.into()));
4321 self
4322 }
4323
4324 /// The value of [dep][crate::model::Dependency::dep]
4325 /// if it holds a `GitSource`, `None` if the field is not set or
4326 /// holds a different branch.
4327 pub fn git_source(
4328 &self,
4329 ) -> std::option::Option<&std::boxed::Box<crate::model::dependency::GitSourceDependency>> {
4330 #[allow(unreachable_patterns)]
4331 self.dep.as_ref().and_then(|v| match v {
4332 crate::model::dependency::Dep::GitSource(v) => std::option::Option::Some(v),
4333 _ => std::option::Option::None,
4334 })
4335 }
4336
4337 /// Sets the value of [dep][crate::model::Dependency::dep]
4338 /// to hold a `GitSource`.
4339 ///
4340 /// Note that all the setters affecting `dep` are
4341 /// mutually exclusive.
4342 ///
4343 /// # Example
4344 /// ```ignore,no_run
4345 /// # use google_cloud_build_v1::model::Dependency;
4346 /// use google_cloud_build_v1::model::dependency::GitSourceDependency;
4347 /// let x = Dependency::new().set_git_source(GitSourceDependency::default()/* use setters */);
4348 /// assert!(x.git_source().is_some());
4349 /// assert!(x.empty().is_none());
4350 /// ```
4351 pub fn set_git_source<
4352 T: std::convert::Into<std::boxed::Box<crate::model::dependency::GitSourceDependency>>,
4353 >(
4354 mut self,
4355 v: T,
4356 ) -> Self {
4357 self.dep = std::option::Option::Some(crate::model::dependency::Dep::GitSource(v.into()));
4358 self
4359 }
4360}
4361
4362impl wkt::message::Message for Dependency {
4363 fn typename() -> &'static str {
4364 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency"
4365 }
4366}
4367
4368/// Defines additional types related to [Dependency].
4369pub mod dependency {
4370 #[allow(unused_imports)]
4371 use super::*;
4372
4373 /// Represents a git repository as a build dependency.
4374 #[derive(Clone, Default, PartialEq)]
4375 #[non_exhaustive]
4376 pub struct GitSourceDependency {
4377 /// Required. The kind of repo (url or dev connect).
4378 pub repository: std::option::Option<crate::model::dependency::GitSourceRepository>,
4379
4380 /// Required. The revision that we will fetch the repo at.
4381 pub revision: std::string::String,
4382
4383 /// Optional. True if submodules should be fetched too (default false).
4384 pub recurse_submodules: bool,
4385
4386 /// Optional. How much history should be fetched for the build (default 1, -1
4387 /// for all history).
4388 pub depth: i64,
4389
4390 /// Required. Where should the files be placed on the worker.
4391 pub dest_path: std::string::String,
4392
4393 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4394 }
4395
4396 impl GitSourceDependency {
4397 pub fn new() -> Self {
4398 std::default::Default::default()
4399 }
4400
4401 /// Sets the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4402 ///
4403 /// # Example
4404 /// ```ignore,no_run
4405 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4406 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4407 /// let x = GitSourceDependency::new().set_repository(GitSourceRepository::default()/* use setters */);
4408 /// ```
4409 pub fn set_repository<T>(mut self, v: T) -> Self
4410 where
4411 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4412 {
4413 self.repository = std::option::Option::Some(v.into());
4414 self
4415 }
4416
4417 /// Sets or clears the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4418 ///
4419 /// # Example
4420 /// ```ignore,no_run
4421 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4422 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4423 /// let x = GitSourceDependency::new().set_or_clear_repository(Some(GitSourceRepository::default()/* use setters */));
4424 /// let x = GitSourceDependency::new().set_or_clear_repository(None::<GitSourceRepository>);
4425 /// ```
4426 pub fn set_or_clear_repository<T>(mut self, v: std::option::Option<T>) -> Self
4427 where
4428 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4429 {
4430 self.repository = v.map(|x| x.into());
4431 self
4432 }
4433
4434 /// Sets the value of [revision][crate::model::dependency::GitSourceDependency::revision].
4435 ///
4436 /// # Example
4437 /// ```ignore,no_run
4438 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4439 /// let x = GitSourceDependency::new().set_revision("example");
4440 /// ```
4441 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4442 self.revision = v.into();
4443 self
4444 }
4445
4446 /// Sets the value of [recurse_submodules][crate::model::dependency::GitSourceDependency::recurse_submodules].
4447 ///
4448 /// # Example
4449 /// ```ignore,no_run
4450 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4451 /// let x = GitSourceDependency::new().set_recurse_submodules(true);
4452 /// ```
4453 pub fn set_recurse_submodules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4454 self.recurse_submodules = v.into();
4455 self
4456 }
4457
4458 /// Sets the value of [depth][crate::model::dependency::GitSourceDependency::depth].
4459 ///
4460 /// # Example
4461 /// ```ignore,no_run
4462 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4463 /// let x = GitSourceDependency::new().set_depth(42);
4464 /// ```
4465 pub fn set_depth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4466 self.depth = v.into();
4467 self
4468 }
4469
4470 /// Sets the value of [dest_path][crate::model::dependency::GitSourceDependency::dest_path].
4471 ///
4472 /// # Example
4473 /// ```ignore,no_run
4474 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4475 /// let x = GitSourceDependency::new().set_dest_path("example");
4476 /// ```
4477 pub fn set_dest_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4478 self.dest_path = v.into();
4479 self
4480 }
4481 }
4482
4483 impl wkt::message::Message for GitSourceDependency {
4484 fn typename() -> &'static str {
4485 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceDependency"
4486 }
4487 }
4488
4489 /// A repository for a git source.
4490 #[derive(Clone, Default, PartialEq)]
4491 #[non_exhaustive]
4492 pub struct GitSourceRepository {
4493 /// The type of git source repo (url or dev connect).
4494 pub repotype:
4495 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4496
4497 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4498 }
4499
4500 impl GitSourceRepository {
4501 pub fn new() -> Self {
4502 std::default::Default::default()
4503 }
4504
4505 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype].
4506 ///
4507 /// Note that all the setters affecting `repotype` are mutually
4508 /// exclusive.
4509 ///
4510 /// # Example
4511 /// ```ignore,no_run
4512 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4513 /// use google_cloud_build_v1::model::dependency::git_source_repository::Repotype;
4514 /// let x = GitSourceRepository::new().set_repotype(Some(Repotype::Url("example".to_string())));
4515 /// ```
4516 pub fn set_repotype<
4517 T: std::convert::Into<
4518 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4519 >,
4520 >(
4521 mut self,
4522 v: T,
4523 ) -> Self {
4524 self.repotype = v.into();
4525 self
4526 }
4527
4528 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4529 /// if it holds a `Url`, `None` if the field is not set or
4530 /// holds a different branch.
4531 pub fn url(&self) -> std::option::Option<&std::string::String> {
4532 #[allow(unreachable_patterns)]
4533 self.repotype.as_ref().and_then(|v| match v {
4534 crate::model::dependency::git_source_repository::Repotype::Url(v) => {
4535 std::option::Option::Some(v)
4536 }
4537 _ => std::option::Option::None,
4538 })
4539 }
4540
4541 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4542 /// to hold a `Url`.
4543 ///
4544 /// Note that all the setters affecting `repotype` are
4545 /// mutually exclusive.
4546 ///
4547 /// # Example
4548 /// ```ignore,no_run
4549 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4550 /// let x = GitSourceRepository::new().set_url("example");
4551 /// assert!(x.url().is_some());
4552 /// assert!(x.developer_connect().is_none());
4553 /// ```
4554 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4555 self.repotype = std::option::Option::Some(
4556 crate::model::dependency::git_source_repository::Repotype::Url(v.into()),
4557 );
4558 self
4559 }
4560
4561 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4562 /// if it holds a `DeveloperConnect`, `None` if the field is not set or
4563 /// holds a different branch.
4564 pub fn developer_connect(&self) -> std::option::Option<&std::string::String> {
4565 #[allow(unreachable_patterns)]
4566 self.repotype.as_ref().and_then(|v| match v {
4567 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(v) => {
4568 std::option::Option::Some(v)
4569 }
4570 _ => std::option::Option::None,
4571 })
4572 }
4573
4574 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4575 /// to hold a `DeveloperConnect`.
4576 ///
4577 /// Note that all the setters affecting `repotype` are
4578 /// mutually exclusive.
4579 ///
4580 /// # Example
4581 /// ```ignore,no_run
4582 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4583 /// let x = GitSourceRepository::new().set_developer_connect("example");
4584 /// assert!(x.developer_connect().is_some());
4585 /// assert!(x.url().is_none());
4586 /// ```
4587 pub fn set_developer_connect<T: std::convert::Into<std::string::String>>(
4588 mut self,
4589 v: T,
4590 ) -> Self {
4591 self.repotype = std::option::Option::Some(
4592 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(
4593 v.into(),
4594 ),
4595 );
4596 self
4597 }
4598 }
4599
4600 impl wkt::message::Message for GitSourceRepository {
4601 fn typename() -> &'static str {
4602 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceRepository"
4603 }
4604 }
4605
4606 /// Defines additional types related to [GitSourceRepository].
4607 pub mod git_source_repository {
4608 #[allow(unused_imports)]
4609 use super::*;
4610
4611 /// The type of git source repo (url or dev connect).
4612 #[derive(Clone, Debug, PartialEq)]
4613 #[non_exhaustive]
4614 pub enum Repotype {
4615 /// Location of the Git repository.
4616 Url(std::string::String),
4617 /// The Developer Connect Git repository link formatted as
4618 /// `projects/*/locations/*/connections/*/gitRepositoryLink/*`
4619 DeveloperConnect(std::string::String),
4620 }
4621 }
4622
4623 /// The type of dependency to fetch.
4624 #[derive(Clone, Debug, PartialEq)]
4625 #[non_exhaustive]
4626 pub enum Dep {
4627 /// If set to true disable all dependency fetching (ignoring the default
4628 /// source as well).
4629 Empty(bool),
4630 /// Represents a git repository as a build dependency.
4631 GitSource(std::boxed::Box<crate::model::dependency::GitSourceDependency>),
4632 }
4633}
4634
4635/// GitConfig is a configuration for git operations.
4636#[derive(Clone, Default, PartialEq)]
4637#[non_exhaustive]
4638pub struct GitConfig {
4639 /// Configuration for HTTP related git operations.
4640 pub http: std::option::Option<crate::model::git_config::HttpConfig>,
4641
4642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4643}
4644
4645impl GitConfig {
4646 pub fn new() -> Self {
4647 std::default::Default::default()
4648 }
4649
4650 /// Sets the value of [http][crate::model::GitConfig::http].
4651 ///
4652 /// # Example
4653 /// ```ignore,no_run
4654 /// # use google_cloud_build_v1::model::GitConfig;
4655 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4656 /// let x = GitConfig::new().set_http(HttpConfig::default()/* use setters */);
4657 /// ```
4658 pub fn set_http<T>(mut self, v: T) -> Self
4659 where
4660 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4661 {
4662 self.http = std::option::Option::Some(v.into());
4663 self
4664 }
4665
4666 /// Sets or clears the value of [http][crate::model::GitConfig::http].
4667 ///
4668 /// # Example
4669 /// ```ignore,no_run
4670 /// # use google_cloud_build_v1::model::GitConfig;
4671 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4672 /// let x = GitConfig::new().set_or_clear_http(Some(HttpConfig::default()/* use setters */));
4673 /// let x = GitConfig::new().set_or_clear_http(None::<HttpConfig>);
4674 /// ```
4675 pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
4676 where
4677 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4678 {
4679 self.http = v.map(|x| x.into());
4680 self
4681 }
4682}
4683
4684impl wkt::message::Message for GitConfig {
4685 fn typename() -> &'static str {
4686 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig"
4687 }
4688}
4689
4690/// Defines additional types related to [GitConfig].
4691pub mod git_config {
4692 #[allow(unused_imports)]
4693 use super::*;
4694
4695 /// HttpConfig is a configuration for HTTP related git operations.
4696 #[derive(Clone, Default, PartialEq)]
4697 #[non_exhaustive]
4698 pub struct HttpConfig {
4699 /// SecretVersion resource of the HTTP proxy URL. The Service Account used in
4700 /// the build (either the default Service Account or
4701 /// user-specified Service Account) should have
4702 /// `secretmanager.versions.access` permissions on this secret. The proxy URL
4703 /// should be in format `[protocol://][user[:password]@]proxyhost[:port]`.
4704 pub proxy_secret_version_name: std::string::String,
4705
4706 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4707 }
4708
4709 impl HttpConfig {
4710 pub fn new() -> Self {
4711 std::default::Default::default()
4712 }
4713
4714 /// Sets the value of [proxy_secret_version_name][crate::model::git_config::HttpConfig::proxy_secret_version_name].
4715 ///
4716 /// # Example
4717 /// ```ignore,no_run
4718 /// # use google_cloud_build_v1::model::git_config::HttpConfig;
4719 /// let x = HttpConfig::new().set_proxy_secret_version_name("example");
4720 /// ```
4721 pub fn set_proxy_secret_version_name<T: std::convert::Into<std::string::String>>(
4722 mut self,
4723 v: T,
4724 ) -> Self {
4725 self.proxy_secret_version_name = v.into();
4726 self
4727 }
4728 }
4729
4730 impl wkt::message::Message for HttpConfig {
4731 fn typename() -> &'static str {
4732 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig.HttpConfig"
4733 }
4734 }
4735}
4736
4737/// Artifacts produced by a build that should be uploaded upon
4738/// successful completion of all build steps.
4739#[derive(Clone, Default, PartialEq)]
4740#[non_exhaustive]
4741pub struct Artifacts {
4742 /// A list of images to be pushed upon the successful completion of all build
4743 /// steps.
4744 ///
4745 /// The images will be pushed using the builder service account's credentials.
4746 ///
4747 /// The digests of the pushed images will be stored in the Build resource's
4748 /// results field.
4749 ///
4750 /// If any of the images fail to be pushed, the build is marked FAILURE.
4751 pub images: std::vec::Vec<std::string::String>,
4752
4753 /// A list of objects to be uploaded to Cloud Storage upon successful
4754 /// completion of all build steps.
4755 ///
4756 /// Files in the workspace matching specified paths globs will be uploaded to
4757 /// the specified Cloud Storage location using the builder service account's
4758 /// credentials.
4759 ///
4760 /// The location and generation of the uploaded objects will be stored in the
4761 /// Build resource's results field.
4762 ///
4763 /// If any objects fail to be pushed, the build is marked FAILURE.
4764 pub objects: std::option::Option<crate::model::artifacts::ArtifactObjects>,
4765
4766 /// A list of Maven artifacts to be uploaded to Artifact Registry upon
4767 /// successful completion of all build steps.
4768 ///
4769 /// Artifacts in the workspace matching specified paths globs will be uploaded
4770 /// to the specified Artifact Registry repository using the builder service
4771 /// account's credentials.
4772 ///
4773 /// If any artifacts fail to be pushed, the build is marked FAILURE.
4774 pub maven_artifacts: std::vec::Vec<crate::model::artifacts::MavenArtifact>,
4775
4776 /// Optional. A list of Go modules to be uploaded to Artifact Registry upon
4777 /// successful completion of all build steps.
4778 ///
4779 /// If any objects fail to be pushed, the build is marked FAILURE.
4780 pub go_modules: std::vec::Vec<crate::model::artifacts::GoModule>,
4781
4782 /// A list of Python packages to be uploaded to Artifact Registry upon
4783 /// successful completion of all build steps.
4784 ///
4785 /// The build service account credentials will be used to perform the upload.
4786 ///
4787 /// If any objects fail to be pushed, the build is marked FAILURE.
4788 pub python_packages: std::vec::Vec<crate::model::artifacts::PythonPackage>,
4789
4790 /// A list of npm packages to be uploaded to Artifact Registry upon
4791 /// successful completion of all build steps.
4792 ///
4793 /// Npm packages in the specified paths will be uploaded
4794 /// to the specified Artifact Registry repository using the builder service
4795 /// account's credentials.
4796 ///
4797 /// If any packages fail to be pushed, the build is marked FAILURE.
4798 pub npm_packages: std::vec::Vec<crate::model::artifacts::NpmPackage>,
4799
4800 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4801}
4802
4803impl Artifacts {
4804 pub fn new() -> Self {
4805 std::default::Default::default()
4806 }
4807
4808 /// Sets the value of [images][crate::model::Artifacts::images].
4809 ///
4810 /// # Example
4811 /// ```ignore,no_run
4812 /// # use google_cloud_build_v1::model::Artifacts;
4813 /// let x = Artifacts::new().set_images(["a", "b", "c"]);
4814 /// ```
4815 pub fn set_images<T, V>(mut self, v: T) -> Self
4816 where
4817 T: std::iter::IntoIterator<Item = V>,
4818 V: std::convert::Into<std::string::String>,
4819 {
4820 use std::iter::Iterator;
4821 self.images = v.into_iter().map(|i| i.into()).collect();
4822 self
4823 }
4824
4825 /// Sets the value of [objects][crate::model::Artifacts::objects].
4826 ///
4827 /// # Example
4828 /// ```ignore,no_run
4829 /// # use google_cloud_build_v1::model::Artifacts;
4830 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4831 /// let x = Artifacts::new().set_objects(ArtifactObjects::default()/* use setters */);
4832 /// ```
4833 pub fn set_objects<T>(mut self, v: T) -> Self
4834 where
4835 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4836 {
4837 self.objects = std::option::Option::Some(v.into());
4838 self
4839 }
4840
4841 /// Sets or clears the value of [objects][crate::model::Artifacts::objects].
4842 ///
4843 /// # Example
4844 /// ```ignore,no_run
4845 /// # use google_cloud_build_v1::model::Artifacts;
4846 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4847 /// let x = Artifacts::new().set_or_clear_objects(Some(ArtifactObjects::default()/* use setters */));
4848 /// let x = Artifacts::new().set_or_clear_objects(None::<ArtifactObjects>);
4849 /// ```
4850 pub fn set_or_clear_objects<T>(mut self, v: std::option::Option<T>) -> Self
4851 where
4852 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4853 {
4854 self.objects = v.map(|x| x.into());
4855 self
4856 }
4857
4858 /// Sets the value of [maven_artifacts][crate::model::Artifacts::maven_artifacts].
4859 ///
4860 /// # Example
4861 /// ```ignore,no_run
4862 /// # use google_cloud_build_v1::model::Artifacts;
4863 /// use google_cloud_build_v1::model::artifacts::MavenArtifact;
4864 /// let x = Artifacts::new()
4865 /// .set_maven_artifacts([
4866 /// MavenArtifact::default()/* use setters */,
4867 /// MavenArtifact::default()/* use (different) setters */,
4868 /// ]);
4869 /// ```
4870 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
4871 where
4872 T: std::iter::IntoIterator<Item = V>,
4873 V: std::convert::Into<crate::model::artifacts::MavenArtifact>,
4874 {
4875 use std::iter::Iterator;
4876 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
4877 self
4878 }
4879
4880 /// Sets the value of [go_modules][crate::model::Artifacts::go_modules].
4881 ///
4882 /// # Example
4883 /// ```ignore,no_run
4884 /// # use google_cloud_build_v1::model::Artifacts;
4885 /// use google_cloud_build_v1::model::artifacts::GoModule;
4886 /// let x = Artifacts::new()
4887 /// .set_go_modules([
4888 /// GoModule::default()/* use setters */,
4889 /// GoModule::default()/* use (different) setters */,
4890 /// ]);
4891 /// ```
4892 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
4893 where
4894 T: std::iter::IntoIterator<Item = V>,
4895 V: std::convert::Into<crate::model::artifacts::GoModule>,
4896 {
4897 use std::iter::Iterator;
4898 self.go_modules = v.into_iter().map(|i| i.into()).collect();
4899 self
4900 }
4901
4902 /// Sets the value of [python_packages][crate::model::Artifacts::python_packages].
4903 ///
4904 /// # Example
4905 /// ```ignore,no_run
4906 /// # use google_cloud_build_v1::model::Artifacts;
4907 /// use google_cloud_build_v1::model::artifacts::PythonPackage;
4908 /// let x = Artifacts::new()
4909 /// .set_python_packages([
4910 /// PythonPackage::default()/* use setters */,
4911 /// PythonPackage::default()/* use (different) setters */,
4912 /// ]);
4913 /// ```
4914 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
4915 where
4916 T: std::iter::IntoIterator<Item = V>,
4917 V: std::convert::Into<crate::model::artifacts::PythonPackage>,
4918 {
4919 use std::iter::Iterator;
4920 self.python_packages = v.into_iter().map(|i| i.into()).collect();
4921 self
4922 }
4923
4924 /// Sets the value of [npm_packages][crate::model::Artifacts::npm_packages].
4925 ///
4926 /// # Example
4927 /// ```ignore,no_run
4928 /// # use google_cloud_build_v1::model::Artifacts;
4929 /// use google_cloud_build_v1::model::artifacts::NpmPackage;
4930 /// let x = Artifacts::new()
4931 /// .set_npm_packages([
4932 /// NpmPackage::default()/* use setters */,
4933 /// NpmPackage::default()/* use (different) setters */,
4934 /// ]);
4935 /// ```
4936 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
4937 where
4938 T: std::iter::IntoIterator<Item = V>,
4939 V: std::convert::Into<crate::model::artifacts::NpmPackage>,
4940 {
4941 use std::iter::Iterator;
4942 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
4943 self
4944 }
4945}
4946
4947impl wkt::message::Message for Artifacts {
4948 fn typename() -> &'static str {
4949 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts"
4950 }
4951}
4952
4953/// Defines additional types related to [Artifacts].
4954pub mod artifacts {
4955 #[allow(unused_imports)]
4956 use super::*;
4957
4958 /// Files in the workspace to upload to Cloud Storage upon successful
4959 /// completion of all build steps.
4960 #[derive(Clone, Default, PartialEq)]
4961 #[non_exhaustive]
4962 pub struct ArtifactObjects {
4963 /// Cloud Storage bucket and optional object path, in the form
4964 /// "gs://bucket/path/to/somewhere/". (see [Bucket Name
4965 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
4966 ///
4967 /// Files in the workspace matching any path pattern will be uploaded to
4968 /// Cloud Storage with this location as a prefix.
4969 pub location: std::string::String,
4970
4971 /// Path globs used to match files in the build's workspace.
4972 pub paths: std::vec::Vec<std::string::String>,
4973
4974 /// Output only. Stores timing information for pushing all artifact objects.
4975 pub timing: std::option::Option<crate::model::TimeSpan>,
4976
4977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4978 }
4979
4980 impl ArtifactObjects {
4981 pub fn new() -> Self {
4982 std::default::Default::default()
4983 }
4984
4985 /// Sets the value of [location][crate::model::artifacts::ArtifactObjects::location].
4986 ///
4987 /// # Example
4988 /// ```ignore,no_run
4989 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4990 /// let x = ArtifactObjects::new().set_location("example");
4991 /// ```
4992 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4993 self.location = v.into();
4994 self
4995 }
4996
4997 /// Sets the value of [paths][crate::model::artifacts::ArtifactObjects::paths].
4998 ///
4999 /// # Example
5000 /// ```ignore,no_run
5001 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5002 /// let x = ArtifactObjects::new().set_paths(["a", "b", "c"]);
5003 /// ```
5004 pub fn set_paths<T, V>(mut self, v: T) -> Self
5005 where
5006 T: std::iter::IntoIterator<Item = V>,
5007 V: std::convert::Into<std::string::String>,
5008 {
5009 use std::iter::Iterator;
5010 self.paths = v.into_iter().map(|i| i.into()).collect();
5011 self
5012 }
5013
5014 /// Sets the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5015 ///
5016 /// # Example
5017 /// ```ignore,no_run
5018 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5019 /// use google_cloud_build_v1::model::TimeSpan;
5020 /// let x = ArtifactObjects::new().set_timing(TimeSpan::default()/* use setters */);
5021 /// ```
5022 pub fn set_timing<T>(mut self, v: T) -> Self
5023 where
5024 T: std::convert::Into<crate::model::TimeSpan>,
5025 {
5026 self.timing = std::option::Option::Some(v.into());
5027 self
5028 }
5029
5030 /// Sets or clears the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5031 ///
5032 /// # Example
5033 /// ```ignore,no_run
5034 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5035 /// use google_cloud_build_v1::model::TimeSpan;
5036 /// let x = ArtifactObjects::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
5037 /// let x = ArtifactObjects::new().set_or_clear_timing(None::<TimeSpan>);
5038 /// ```
5039 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
5040 where
5041 T: std::convert::Into<crate::model::TimeSpan>,
5042 {
5043 self.timing = v.map(|x| x.into());
5044 self
5045 }
5046 }
5047
5048 impl wkt::message::Message for ArtifactObjects {
5049 fn typename() -> &'static str {
5050 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects"
5051 }
5052 }
5053
5054 /// A Maven artifact to upload to Artifact Registry upon successful completion
5055 /// of all build steps.
5056 #[derive(Clone, Default, PartialEq)]
5057 #[non_exhaustive]
5058 pub struct MavenArtifact {
5059 /// Artifact Registry repository, in the form
5060 /// "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY"
5061 ///
5062 /// Artifact in the workspace specified by path will be uploaded to
5063 /// Artifact Registry with this location as a prefix.
5064 pub repository: std::string::String,
5065
5066 /// Optional. Path to an artifact in the build's workspace to be uploaded to
5067 /// Artifact Registry.
5068 /// This can be either an absolute path,
5069 /// e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar
5070 /// or a relative path from /workspace,
5071 /// e.g. my-app/target/my-app-1.0.SNAPSHOT.jar.
5072 pub path: std::string::String,
5073
5074 /// Maven `artifactId` value used when uploading the artifact to Artifact
5075 /// Registry.
5076 pub artifact_id: std::string::String,
5077
5078 /// Maven `groupId` value used when uploading the artifact to Artifact
5079 /// Registry.
5080 pub group_id: std::string::String,
5081
5082 /// Maven `version` value used when uploading the artifact to Artifact
5083 /// Registry.
5084 pub version: std::string::String,
5085
5086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5087 }
5088
5089 impl MavenArtifact {
5090 pub fn new() -> Self {
5091 std::default::Default::default()
5092 }
5093
5094 /// Sets the value of [repository][crate::model::artifacts::MavenArtifact::repository].
5095 ///
5096 /// # Example
5097 /// ```ignore,no_run
5098 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5099 /// let x = MavenArtifact::new().set_repository("example");
5100 /// ```
5101 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5102 self.repository = v.into();
5103 self
5104 }
5105
5106 /// Sets the value of [path][crate::model::artifacts::MavenArtifact::path].
5107 ///
5108 /// # Example
5109 /// ```ignore,no_run
5110 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5111 /// let x = MavenArtifact::new().set_path("example");
5112 /// ```
5113 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5114 self.path = v.into();
5115 self
5116 }
5117
5118 /// Sets the value of [artifact_id][crate::model::artifacts::MavenArtifact::artifact_id].
5119 ///
5120 /// # Example
5121 /// ```ignore,no_run
5122 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5123 /// let x = MavenArtifact::new().set_artifact_id("example");
5124 /// ```
5125 pub fn set_artifact_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5126 self.artifact_id = v.into();
5127 self
5128 }
5129
5130 /// Sets the value of [group_id][crate::model::artifacts::MavenArtifact::group_id].
5131 ///
5132 /// # Example
5133 /// ```ignore,no_run
5134 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5135 /// let x = MavenArtifact::new().set_group_id("example");
5136 /// ```
5137 pub fn set_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5138 self.group_id = v.into();
5139 self
5140 }
5141
5142 /// Sets the value of [version][crate::model::artifacts::MavenArtifact::version].
5143 ///
5144 /// # Example
5145 /// ```ignore,no_run
5146 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5147 /// let x = MavenArtifact::new().set_version("example");
5148 /// ```
5149 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5150 self.version = v.into();
5151 self
5152 }
5153 }
5154
5155 impl wkt::message::Message for MavenArtifact {
5156 fn typename() -> &'static str {
5157 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.MavenArtifact"
5158 }
5159 }
5160
5161 /// Go module to upload to Artifact Registry upon successful completion of all
5162 /// build steps. A module refers to all dependencies in a go.mod file.
5163 #[derive(Clone, Default, PartialEq)]
5164 #[non_exhaustive]
5165 pub struct GoModule {
5166 /// Optional. Artifact Registry repository name.
5167 ///
5168 /// Specified Go modules will be zipped and uploaded to Artifact Registry
5169 /// with this location as a prefix.
5170 /// e.g. my-go-repo
5171 pub repository_name: std::string::String,
5172
5173 /// Optional. Location of the Artifact Registry repository. i.e. us-east1
5174 /// Defaults to the build’s location.
5175 pub repository_location: std::string::String,
5176
5177 /// Optional. Project ID of the Artifact Registry repository.
5178 /// Defaults to the build project.
5179 pub repository_project_id: std::string::String,
5180
5181 /// Optional. Source path of the go.mod file in the build's workspace. If not
5182 /// specified, this will default to the current directory.
5183 /// e.g. ~/code/go/mypackage
5184 pub source_path: std::string::String,
5185
5186 /// Optional. The Go module's "module path".
5187 /// e.g. example.com/foo/v2
5188 pub module_path: std::string::String,
5189
5190 /// Optional. The Go module's semantic version in the form vX.Y.Z. e.g.
5191 /// v0.1.1 Pre-release identifiers can also be added by appending a dash and
5192 /// dot separated ASCII alphanumeric characters and hyphens.
5193 /// e.g. v0.2.3-alpha.x.12m.5
5194 pub module_version: std::string::String,
5195
5196 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5197 }
5198
5199 impl GoModule {
5200 pub fn new() -> Self {
5201 std::default::Default::default()
5202 }
5203
5204 /// Sets the value of [repository_name][crate::model::artifacts::GoModule::repository_name].
5205 ///
5206 /// # Example
5207 /// ```ignore,no_run
5208 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5209 /// let x = GoModule::new().set_repository_name("example");
5210 /// ```
5211 pub fn set_repository_name<T: std::convert::Into<std::string::String>>(
5212 mut self,
5213 v: T,
5214 ) -> Self {
5215 self.repository_name = v.into();
5216 self
5217 }
5218
5219 /// Sets the value of [repository_location][crate::model::artifacts::GoModule::repository_location].
5220 ///
5221 /// # Example
5222 /// ```ignore,no_run
5223 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5224 /// let x = GoModule::new().set_repository_location("example");
5225 /// ```
5226 pub fn set_repository_location<T: std::convert::Into<std::string::String>>(
5227 mut self,
5228 v: T,
5229 ) -> Self {
5230 self.repository_location = v.into();
5231 self
5232 }
5233
5234 /// Sets the value of [repository_project_id][crate::model::artifacts::GoModule::repository_project_id].
5235 ///
5236 /// # Example
5237 /// ```ignore,no_run
5238 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5239 /// let x = GoModule::new().set_repository_project_id("example");
5240 /// ```
5241 pub fn set_repository_project_id<T: std::convert::Into<std::string::String>>(
5242 mut self,
5243 v: T,
5244 ) -> Self {
5245 self.repository_project_id = v.into();
5246 self
5247 }
5248
5249 /// Sets the value of [source_path][crate::model::artifacts::GoModule::source_path].
5250 ///
5251 /// # Example
5252 /// ```ignore,no_run
5253 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5254 /// let x = GoModule::new().set_source_path("example");
5255 /// ```
5256 pub fn set_source_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5257 self.source_path = v.into();
5258 self
5259 }
5260
5261 /// Sets the value of [module_path][crate::model::artifacts::GoModule::module_path].
5262 ///
5263 /// # Example
5264 /// ```ignore,no_run
5265 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5266 /// let x = GoModule::new().set_module_path("example");
5267 /// ```
5268 pub fn set_module_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5269 self.module_path = v.into();
5270 self
5271 }
5272
5273 /// Sets the value of [module_version][crate::model::artifacts::GoModule::module_version].
5274 ///
5275 /// # Example
5276 /// ```ignore,no_run
5277 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5278 /// let x = GoModule::new().set_module_version("example");
5279 /// ```
5280 pub fn set_module_version<T: std::convert::Into<std::string::String>>(
5281 mut self,
5282 v: T,
5283 ) -> Self {
5284 self.module_version = v.into();
5285 self
5286 }
5287 }
5288
5289 impl wkt::message::Message for GoModule {
5290 fn typename() -> &'static str {
5291 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.GoModule"
5292 }
5293 }
5294
5295 /// Python package to upload to Artifact Registry upon successful completion
5296 /// of all build steps. A package can encapsulate multiple objects to be
5297 /// uploaded to a single repository.
5298 #[derive(Clone, Default, PartialEq)]
5299 #[non_exhaustive]
5300 pub struct PythonPackage {
5301 /// Artifact Registry repository, in the form
5302 /// "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY"
5303 ///
5304 /// Files in the workspace matching any path pattern will be uploaded to
5305 /// Artifact Registry with this location as a prefix.
5306 pub repository: std::string::String,
5307
5308 /// Path globs used to match files in the build's workspace. For Python/
5309 /// Twine, this is usually `dist/*`, and sometimes additionally an `.asc`
5310 /// file.
5311 pub paths: std::vec::Vec<std::string::String>,
5312
5313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5314 }
5315
5316 impl PythonPackage {
5317 pub fn new() -> Self {
5318 std::default::Default::default()
5319 }
5320
5321 /// Sets the value of [repository][crate::model::artifacts::PythonPackage::repository].
5322 ///
5323 /// # Example
5324 /// ```ignore,no_run
5325 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5326 /// let x = PythonPackage::new().set_repository("example");
5327 /// ```
5328 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5329 self.repository = v.into();
5330 self
5331 }
5332
5333 /// Sets the value of [paths][crate::model::artifacts::PythonPackage::paths].
5334 ///
5335 /// # Example
5336 /// ```ignore,no_run
5337 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5338 /// let x = PythonPackage::new().set_paths(["a", "b", "c"]);
5339 /// ```
5340 pub fn set_paths<T, V>(mut self, v: T) -> Self
5341 where
5342 T: std::iter::IntoIterator<Item = V>,
5343 V: std::convert::Into<std::string::String>,
5344 {
5345 use std::iter::Iterator;
5346 self.paths = v.into_iter().map(|i| i.into()).collect();
5347 self
5348 }
5349 }
5350
5351 impl wkt::message::Message for PythonPackage {
5352 fn typename() -> &'static str {
5353 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.PythonPackage"
5354 }
5355 }
5356
5357 /// Npm package to upload to Artifact Registry upon successful completion
5358 /// of all build steps.
5359 #[derive(Clone, Default, PartialEq)]
5360 #[non_exhaustive]
5361 pub struct NpmPackage {
5362 /// Artifact Registry repository, in the form
5363 /// "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY"
5364 ///
5365 /// Npm package in the workspace specified by path will be zipped and
5366 /// uploaded to Artifact Registry with this location as a prefix.
5367 pub repository: std::string::String,
5368
5369 /// Optional. Path to the package.json.
5370 /// e.g. workspace/path/to/package
5371 ///
5372 /// Only one of `archive` or `package_path` can be specified.
5373 pub package_path: std::string::String,
5374
5375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5376 }
5377
5378 impl NpmPackage {
5379 pub fn new() -> Self {
5380 std::default::Default::default()
5381 }
5382
5383 /// Sets the value of [repository][crate::model::artifacts::NpmPackage::repository].
5384 ///
5385 /// # Example
5386 /// ```ignore,no_run
5387 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5388 /// let x = NpmPackage::new().set_repository("example");
5389 /// ```
5390 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5391 self.repository = v.into();
5392 self
5393 }
5394
5395 /// Sets the value of [package_path][crate::model::artifacts::NpmPackage::package_path].
5396 ///
5397 /// # Example
5398 /// ```ignore,no_run
5399 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5400 /// let x = NpmPackage::new().set_package_path("example");
5401 /// ```
5402 pub fn set_package_path<T: std::convert::Into<std::string::String>>(
5403 mut self,
5404 v: T,
5405 ) -> Self {
5406 self.package_path = v.into();
5407 self
5408 }
5409 }
5410
5411 impl wkt::message::Message for NpmPackage {
5412 fn typename() -> &'static str {
5413 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.NpmPackage"
5414 }
5415 }
5416}
5417
5418/// Start and end times for a build execution phase.
5419#[derive(Clone, Default, PartialEq)]
5420#[non_exhaustive]
5421pub struct TimeSpan {
5422 /// Start of time span.
5423 pub start_time: std::option::Option<wkt::Timestamp>,
5424
5425 /// End of time span.
5426 pub end_time: std::option::Option<wkt::Timestamp>,
5427
5428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5429}
5430
5431impl TimeSpan {
5432 pub fn new() -> Self {
5433 std::default::Default::default()
5434 }
5435
5436 /// Sets the value of [start_time][crate::model::TimeSpan::start_time].
5437 ///
5438 /// # Example
5439 /// ```ignore,no_run
5440 /// # use google_cloud_build_v1::model::TimeSpan;
5441 /// use wkt::Timestamp;
5442 /// let x = TimeSpan::new().set_start_time(Timestamp::default()/* use setters */);
5443 /// ```
5444 pub fn set_start_time<T>(mut self, v: T) -> Self
5445 where
5446 T: std::convert::Into<wkt::Timestamp>,
5447 {
5448 self.start_time = std::option::Option::Some(v.into());
5449 self
5450 }
5451
5452 /// Sets or clears the value of [start_time][crate::model::TimeSpan::start_time].
5453 ///
5454 /// # Example
5455 /// ```ignore,no_run
5456 /// # use google_cloud_build_v1::model::TimeSpan;
5457 /// use wkt::Timestamp;
5458 /// let x = TimeSpan::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
5459 /// let x = TimeSpan::new().set_or_clear_start_time(None::<Timestamp>);
5460 /// ```
5461 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5462 where
5463 T: std::convert::Into<wkt::Timestamp>,
5464 {
5465 self.start_time = v.map(|x| x.into());
5466 self
5467 }
5468
5469 /// Sets the value of [end_time][crate::model::TimeSpan::end_time].
5470 ///
5471 /// # Example
5472 /// ```ignore,no_run
5473 /// # use google_cloud_build_v1::model::TimeSpan;
5474 /// use wkt::Timestamp;
5475 /// let x = TimeSpan::new().set_end_time(Timestamp::default()/* use setters */);
5476 /// ```
5477 pub fn set_end_time<T>(mut self, v: T) -> Self
5478 where
5479 T: std::convert::Into<wkt::Timestamp>,
5480 {
5481 self.end_time = std::option::Option::Some(v.into());
5482 self
5483 }
5484
5485 /// Sets or clears the value of [end_time][crate::model::TimeSpan::end_time].
5486 ///
5487 /// # Example
5488 /// ```ignore,no_run
5489 /// # use google_cloud_build_v1::model::TimeSpan;
5490 /// use wkt::Timestamp;
5491 /// let x = TimeSpan::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5492 /// let x = TimeSpan::new().set_or_clear_end_time(None::<Timestamp>);
5493 /// ```
5494 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5495 where
5496 T: std::convert::Into<wkt::Timestamp>,
5497 {
5498 self.end_time = v.map(|x| x.into());
5499 self
5500 }
5501}
5502
5503impl wkt::message::Message for TimeSpan {
5504 fn typename() -> &'static str {
5505 "type.googleapis.com/google.devtools.cloudbuild.v1.TimeSpan"
5506 }
5507}
5508
5509/// Metadata for build operations.
5510#[derive(Clone, Default, PartialEq)]
5511#[non_exhaustive]
5512pub struct BuildOperationMetadata {
5513 /// The build that the operation is tracking.
5514 pub build: std::option::Option<crate::model::Build>,
5515
5516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5517}
5518
5519impl BuildOperationMetadata {
5520 pub fn new() -> Self {
5521 std::default::Default::default()
5522 }
5523
5524 /// Sets the value of [build][crate::model::BuildOperationMetadata::build].
5525 ///
5526 /// # Example
5527 /// ```ignore,no_run
5528 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5529 /// use google_cloud_build_v1::model::Build;
5530 /// let x = BuildOperationMetadata::new().set_build(Build::default()/* use setters */);
5531 /// ```
5532 pub fn set_build<T>(mut self, v: T) -> Self
5533 where
5534 T: std::convert::Into<crate::model::Build>,
5535 {
5536 self.build = std::option::Option::Some(v.into());
5537 self
5538 }
5539
5540 /// Sets or clears the value of [build][crate::model::BuildOperationMetadata::build].
5541 ///
5542 /// # Example
5543 /// ```ignore,no_run
5544 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5545 /// use google_cloud_build_v1::model::Build;
5546 /// let x = BuildOperationMetadata::new().set_or_clear_build(Some(Build::default()/* use setters */));
5547 /// let x = BuildOperationMetadata::new().set_or_clear_build(None::<Build>);
5548 /// ```
5549 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
5550 where
5551 T: std::convert::Into<crate::model::Build>,
5552 {
5553 self.build = v.map(|x| x.into());
5554 self
5555 }
5556}
5557
5558impl wkt::message::Message for BuildOperationMetadata {
5559 fn typename() -> &'static str {
5560 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata"
5561 }
5562}
5563
5564/// Provenance of the source. Ways to find the original source, or verify that
5565/// some source was used for this build.
5566#[derive(Clone, Default, PartialEq)]
5567#[non_exhaustive]
5568pub struct SourceProvenance {
5569 /// A copy of the build's `source.storage_source`, if exists, with any
5570 /// generations resolved.
5571 pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
5572
5573 /// A copy of the build's `source.repo_source`, if exists, with any
5574 /// revisions resolved.
5575 pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
5576
5577 /// A copy of the build's `source.storage_source_manifest`, if exists, with any
5578 /// revisions resolved.
5579 /// This feature is in Preview.
5580 pub resolved_storage_source_manifest: std::option::Option<crate::model::StorageSourceManifest>,
5581
5582 /// Output only. A copy of the build's `source.connected_repository`, if
5583 /// exists, with any revisions resolved.
5584 pub resolved_connected_repository: std::option::Option<crate::model::ConnectedRepository>,
5585
5586 /// Output only. A copy of the build's `source.git_source`, if exists, with any
5587 /// revisions resolved.
5588 pub resolved_git_source: std::option::Option<crate::model::GitSource>,
5589
5590 /// Output only. Hash(es) of the build source, which can be used to verify that
5591 /// the original source integrity was maintained in the build. Note that
5592 /// `FileHashes` will only be populated if `BuildOptions` has requested a
5593 /// `SourceProvenanceHash`.
5594 ///
5595 /// The keys to this map are file paths used as build source and the values
5596 /// contain the hash values for those files.
5597 ///
5598 /// If the build source came in a single package such as a gzipped tarfile
5599 /// (`.tar.gz`), the `FileHash` will be for the single path to that file.
5600 pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
5601
5602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5603}
5604
5605impl SourceProvenance {
5606 pub fn new() -> Self {
5607 std::default::Default::default()
5608 }
5609
5610 /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5611 ///
5612 /// # Example
5613 /// ```ignore,no_run
5614 /// # use google_cloud_build_v1::model::SourceProvenance;
5615 /// use google_cloud_build_v1::model::StorageSource;
5616 /// let x = SourceProvenance::new().set_resolved_storage_source(StorageSource::default()/* use setters */);
5617 /// ```
5618 pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
5619 where
5620 T: std::convert::Into<crate::model::StorageSource>,
5621 {
5622 self.resolved_storage_source = std::option::Option::Some(v.into());
5623 self
5624 }
5625
5626 /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5627 ///
5628 /// # Example
5629 /// ```ignore,no_run
5630 /// # use google_cloud_build_v1::model::SourceProvenance;
5631 /// use google_cloud_build_v1::model::StorageSource;
5632 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(Some(StorageSource::default()/* use setters */));
5633 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(None::<StorageSource>);
5634 /// ```
5635 pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
5636 where
5637 T: std::convert::Into<crate::model::StorageSource>,
5638 {
5639 self.resolved_storage_source = v.map(|x| x.into());
5640 self
5641 }
5642
5643 /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5644 ///
5645 /// # Example
5646 /// ```ignore,no_run
5647 /// # use google_cloud_build_v1::model::SourceProvenance;
5648 /// use google_cloud_build_v1::model::RepoSource;
5649 /// let x = SourceProvenance::new().set_resolved_repo_source(RepoSource::default()/* use setters */);
5650 /// ```
5651 pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
5652 where
5653 T: std::convert::Into<crate::model::RepoSource>,
5654 {
5655 self.resolved_repo_source = std::option::Option::Some(v.into());
5656 self
5657 }
5658
5659 /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5660 ///
5661 /// # Example
5662 /// ```ignore,no_run
5663 /// # use google_cloud_build_v1::model::SourceProvenance;
5664 /// use google_cloud_build_v1::model::RepoSource;
5665 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(Some(RepoSource::default()/* use setters */));
5666 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(None::<RepoSource>);
5667 /// ```
5668 pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
5669 where
5670 T: std::convert::Into<crate::model::RepoSource>,
5671 {
5672 self.resolved_repo_source = v.map(|x| x.into());
5673 self
5674 }
5675
5676 /// Sets the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5677 ///
5678 /// # Example
5679 /// ```ignore,no_run
5680 /// # use google_cloud_build_v1::model::SourceProvenance;
5681 /// use google_cloud_build_v1::model::StorageSourceManifest;
5682 /// let x = SourceProvenance::new().set_resolved_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
5683 /// ```
5684 pub fn set_resolved_storage_source_manifest<T>(mut self, v: T) -> Self
5685 where
5686 T: std::convert::Into<crate::model::StorageSourceManifest>,
5687 {
5688 self.resolved_storage_source_manifest = std::option::Option::Some(v.into());
5689 self
5690 }
5691
5692 /// Sets or clears the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5693 ///
5694 /// # Example
5695 /// ```ignore,no_run
5696 /// # use google_cloud_build_v1::model::SourceProvenance;
5697 /// use google_cloud_build_v1::model::StorageSourceManifest;
5698 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(Some(StorageSourceManifest::default()/* use setters */));
5699 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(None::<StorageSourceManifest>);
5700 /// ```
5701 pub fn set_or_clear_resolved_storage_source_manifest<T>(
5702 mut self,
5703 v: std::option::Option<T>,
5704 ) -> Self
5705 where
5706 T: std::convert::Into<crate::model::StorageSourceManifest>,
5707 {
5708 self.resolved_storage_source_manifest = v.map(|x| x.into());
5709 self
5710 }
5711
5712 /// Sets the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5713 ///
5714 /// # Example
5715 /// ```ignore,no_run
5716 /// # use google_cloud_build_v1::model::SourceProvenance;
5717 /// use google_cloud_build_v1::model::ConnectedRepository;
5718 /// let x = SourceProvenance::new().set_resolved_connected_repository(ConnectedRepository::default()/* use setters */);
5719 /// ```
5720 pub fn set_resolved_connected_repository<T>(mut self, v: T) -> Self
5721 where
5722 T: std::convert::Into<crate::model::ConnectedRepository>,
5723 {
5724 self.resolved_connected_repository = std::option::Option::Some(v.into());
5725 self
5726 }
5727
5728 /// Sets or clears the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5729 ///
5730 /// # Example
5731 /// ```ignore,no_run
5732 /// # use google_cloud_build_v1::model::SourceProvenance;
5733 /// use google_cloud_build_v1::model::ConnectedRepository;
5734 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(Some(ConnectedRepository::default()/* use setters */));
5735 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(None::<ConnectedRepository>);
5736 /// ```
5737 pub fn set_or_clear_resolved_connected_repository<T>(
5738 mut self,
5739 v: std::option::Option<T>,
5740 ) -> Self
5741 where
5742 T: std::convert::Into<crate::model::ConnectedRepository>,
5743 {
5744 self.resolved_connected_repository = v.map(|x| x.into());
5745 self
5746 }
5747
5748 /// Sets the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5749 ///
5750 /// # Example
5751 /// ```ignore,no_run
5752 /// # use google_cloud_build_v1::model::SourceProvenance;
5753 /// use google_cloud_build_v1::model::GitSource;
5754 /// let x = SourceProvenance::new().set_resolved_git_source(GitSource::default()/* use setters */);
5755 /// ```
5756 pub fn set_resolved_git_source<T>(mut self, v: T) -> Self
5757 where
5758 T: std::convert::Into<crate::model::GitSource>,
5759 {
5760 self.resolved_git_source = std::option::Option::Some(v.into());
5761 self
5762 }
5763
5764 /// Sets or clears the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5765 ///
5766 /// # Example
5767 /// ```ignore,no_run
5768 /// # use google_cloud_build_v1::model::SourceProvenance;
5769 /// use google_cloud_build_v1::model::GitSource;
5770 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(Some(GitSource::default()/* use setters */));
5771 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(None::<GitSource>);
5772 /// ```
5773 pub fn set_or_clear_resolved_git_source<T>(mut self, v: std::option::Option<T>) -> Self
5774 where
5775 T: std::convert::Into<crate::model::GitSource>,
5776 {
5777 self.resolved_git_source = v.map(|x| x.into());
5778 self
5779 }
5780
5781 /// Sets the value of [file_hashes][crate::model::SourceProvenance::file_hashes].
5782 ///
5783 /// # Example
5784 /// ```ignore,no_run
5785 /// # use google_cloud_build_v1::model::SourceProvenance;
5786 /// use google_cloud_build_v1::model::FileHashes;
5787 /// let x = SourceProvenance::new().set_file_hashes([
5788 /// ("key0", FileHashes::default()/* use setters */),
5789 /// ("key1", FileHashes::default()/* use (different) setters */),
5790 /// ]);
5791 /// ```
5792 pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
5793 where
5794 T: std::iter::IntoIterator<Item = (K, V)>,
5795 K: std::convert::Into<std::string::String>,
5796 V: std::convert::Into<crate::model::FileHashes>,
5797 {
5798 use std::iter::Iterator;
5799 self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5800 self
5801 }
5802}
5803
5804impl wkt::message::Message for SourceProvenance {
5805 fn typename() -> &'static str {
5806 "type.googleapis.com/google.devtools.cloudbuild.v1.SourceProvenance"
5807 }
5808}
5809
5810/// Container message for hashes of byte content of files, used in
5811/// SourceProvenance messages to verify integrity of source input to the build.
5812#[derive(Clone, Default, PartialEq)]
5813#[non_exhaustive]
5814pub struct FileHashes {
5815 /// Collection of file hashes.
5816 pub file_hash: std::vec::Vec<crate::model::Hash>,
5817
5818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5819}
5820
5821impl FileHashes {
5822 pub fn new() -> Self {
5823 std::default::Default::default()
5824 }
5825
5826 /// Sets the value of [file_hash][crate::model::FileHashes::file_hash].
5827 ///
5828 /// # Example
5829 /// ```ignore,no_run
5830 /// # use google_cloud_build_v1::model::FileHashes;
5831 /// use google_cloud_build_v1::model::Hash;
5832 /// let x = FileHashes::new()
5833 /// .set_file_hash([
5834 /// Hash::default()/* use setters */,
5835 /// Hash::default()/* use (different) setters */,
5836 /// ]);
5837 /// ```
5838 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
5839 where
5840 T: std::iter::IntoIterator<Item = V>,
5841 V: std::convert::Into<crate::model::Hash>,
5842 {
5843 use std::iter::Iterator;
5844 self.file_hash = v.into_iter().map(|i| i.into()).collect();
5845 self
5846 }
5847}
5848
5849impl wkt::message::Message for FileHashes {
5850 fn typename() -> &'static str {
5851 "type.googleapis.com/google.devtools.cloudbuild.v1.FileHashes"
5852 }
5853}
5854
5855/// Container message for hash values.
5856#[derive(Clone, Default, PartialEq)]
5857#[non_exhaustive]
5858pub struct Hash {
5859 /// The type of hash that was performed.
5860 pub r#type: crate::model::hash::HashType,
5861
5862 /// The hash value.
5863 pub value: ::bytes::Bytes,
5864
5865 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5866}
5867
5868impl Hash {
5869 pub fn new() -> Self {
5870 std::default::Default::default()
5871 }
5872
5873 /// Sets the value of [r#type][crate::model::Hash::type].
5874 ///
5875 /// # Example
5876 /// ```ignore,no_run
5877 /// # use google_cloud_build_v1::model::Hash;
5878 /// use google_cloud_build_v1::model::hash::HashType;
5879 /// let x0 = Hash::new().set_type(HashType::Sha256);
5880 /// let x1 = Hash::new().set_type(HashType::Md5);
5881 /// let x2 = Hash::new().set_type(HashType::GoModuleH1);
5882 /// ```
5883 pub fn set_type<T: std::convert::Into<crate::model::hash::HashType>>(mut self, v: T) -> Self {
5884 self.r#type = v.into();
5885 self
5886 }
5887
5888 /// Sets the value of [value][crate::model::Hash::value].
5889 ///
5890 /// # Example
5891 /// ```ignore,no_run
5892 /// # use google_cloud_build_v1::model::Hash;
5893 /// let x = Hash::new().set_value(bytes::Bytes::from_static(b"example"));
5894 /// ```
5895 pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5896 self.value = v.into();
5897 self
5898 }
5899}
5900
5901impl wkt::message::Message for Hash {
5902 fn typename() -> &'static str {
5903 "type.googleapis.com/google.devtools.cloudbuild.v1.Hash"
5904 }
5905}
5906
5907/// Defines additional types related to [Hash].
5908pub mod hash {
5909 #[allow(unused_imports)]
5910 use super::*;
5911
5912 /// Specifies the hash algorithm, if any.
5913 ///
5914 /// # Working with unknown values
5915 ///
5916 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5917 /// additional enum variants at any time. Adding new variants is not considered
5918 /// a breaking change. Applications should write their code in anticipation of:
5919 ///
5920 /// - New values appearing in future releases of the client library, **and**
5921 /// - New values received dynamically, without application changes.
5922 ///
5923 /// Please consult the [Working with enums] section in the user guide for some
5924 /// guidelines.
5925 ///
5926 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5927 #[derive(Clone, Debug, PartialEq)]
5928 #[non_exhaustive]
5929 pub enum HashType {
5930 /// No hash requested.
5931 None,
5932 /// Use a sha256 hash.
5933 Sha256,
5934 /// Use a md5 hash.
5935 Md5,
5936 /// Dirhash of a Go module's source code which is then hex-encoded.
5937 GoModuleH1,
5938 /// Use a sha512 hash.
5939 Sha512,
5940 /// If set, the enum was initialized with an unknown value.
5941 ///
5942 /// Applications can examine the value using [HashType::value] or
5943 /// [HashType::name].
5944 UnknownValue(hash_type::UnknownValue),
5945 }
5946
5947 #[doc(hidden)]
5948 pub mod hash_type {
5949 #[allow(unused_imports)]
5950 use super::*;
5951 #[derive(Clone, Debug, PartialEq)]
5952 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5953 }
5954
5955 impl HashType {
5956 /// Gets the enum value.
5957 ///
5958 /// Returns `None` if the enum contains an unknown value deserialized from
5959 /// the string representation of enums.
5960 pub fn value(&self) -> std::option::Option<i32> {
5961 match self {
5962 Self::None => std::option::Option::Some(0),
5963 Self::Sha256 => std::option::Option::Some(1),
5964 Self::Md5 => std::option::Option::Some(2),
5965 Self::GoModuleH1 => std::option::Option::Some(3),
5966 Self::Sha512 => std::option::Option::Some(4),
5967 Self::UnknownValue(u) => u.0.value(),
5968 }
5969 }
5970
5971 /// Gets the enum value as a string.
5972 ///
5973 /// Returns `None` if the enum contains an unknown value deserialized from
5974 /// the integer representation of enums.
5975 pub fn name(&self) -> std::option::Option<&str> {
5976 match self {
5977 Self::None => std::option::Option::Some("NONE"),
5978 Self::Sha256 => std::option::Option::Some("SHA256"),
5979 Self::Md5 => std::option::Option::Some("MD5"),
5980 Self::GoModuleH1 => std::option::Option::Some("GO_MODULE_H1"),
5981 Self::Sha512 => std::option::Option::Some("SHA512"),
5982 Self::UnknownValue(u) => u.0.name(),
5983 }
5984 }
5985 }
5986
5987 impl std::default::Default for HashType {
5988 fn default() -> Self {
5989 use std::convert::From;
5990 Self::from(0)
5991 }
5992 }
5993
5994 impl std::fmt::Display for HashType {
5995 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5996 wkt::internal::display_enum(f, self.name(), self.value())
5997 }
5998 }
5999
6000 impl std::convert::From<i32> for HashType {
6001 fn from(value: i32) -> Self {
6002 match value {
6003 0 => Self::None,
6004 1 => Self::Sha256,
6005 2 => Self::Md5,
6006 3 => Self::GoModuleH1,
6007 4 => Self::Sha512,
6008 _ => Self::UnknownValue(hash_type::UnknownValue(
6009 wkt::internal::UnknownEnumValue::Integer(value),
6010 )),
6011 }
6012 }
6013 }
6014
6015 impl std::convert::From<&str> for HashType {
6016 fn from(value: &str) -> Self {
6017 use std::string::ToString;
6018 match value {
6019 "NONE" => Self::None,
6020 "SHA256" => Self::Sha256,
6021 "MD5" => Self::Md5,
6022 "GO_MODULE_H1" => Self::GoModuleH1,
6023 "SHA512" => Self::Sha512,
6024 _ => Self::UnknownValue(hash_type::UnknownValue(
6025 wkt::internal::UnknownEnumValue::String(value.to_string()),
6026 )),
6027 }
6028 }
6029 }
6030
6031 impl serde::ser::Serialize for HashType {
6032 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6033 where
6034 S: serde::Serializer,
6035 {
6036 match self {
6037 Self::None => serializer.serialize_i32(0),
6038 Self::Sha256 => serializer.serialize_i32(1),
6039 Self::Md5 => serializer.serialize_i32(2),
6040 Self::GoModuleH1 => serializer.serialize_i32(3),
6041 Self::Sha512 => serializer.serialize_i32(4),
6042 Self::UnknownValue(u) => u.0.serialize(serializer),
6043 }
6044 }
6045 }
6046
6047 impl<'de> serde::de::Deserialize<'de> for HashType {
6048 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6049 where
6050 D: serde::Deserializer<'de>,
6051 {
6052 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HashType>::new(
6053 ".google.devtools.cloudbuild.v1.Hash.HashType",
6054 ))
6055 }
6056 }
6057}
6058
6059/// Secrets and secret environment variables.
6060#[derive(Clone, Default, PartialEq)]
6061#[non_exhaustive]
6062pub struct Secrets {
6063 /// Secrets in Secret Manager and associated secret environment variable.
6064 pub secret_manager: std::vec::Vec<crate::model::SecretManagerSecret>,
6065
6066 /// Secrets encrypted with KMS key and the associated secret environment
6067 /// variable.
6068 pub inline: std::vec::Vec<crate::model::InlineSecret>,
6069
6070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6071}
6072
6073impl Secrets {
6074 pub fn new() -> Self {
6075 std::default::Default::default()
6076 }
6077
6078 /// Sets the value of [secret_manager][crate::model::Secrets::secret_manager].
6079 ///
6080 /// # Example
6081 /// ```ignore,no_run
6082 /// # use google_cloud_build_v1::model::Secrets;
6083 /// use google_cloud_build_v1::model::SecretManagerSecret;
6084 /// let x = Secrets::new()
6085 /// .set_secret_manager([
6086 /// SecretManagerSecret::default()/* use setters */,
6087 /// SecretManagerSecret::default()/* use (different) setters */,
6088 /// ]);
6089 /// ```
6090 pub fn set_secret_manager<T, V>(mut self, v: T) -> Self
6091 where
6092 T: std::iter::IntoIterator<Item = V>,
6093 V: std::convert::Into<crate::model::SecretManagerSecret>,
6094 {
6095 use std::iter::Iterator;
6096 self.secret_manager = v.into_iter().map(|i| i.into()).collect();
6097 self
6098 }
6099
6100 /// Sets the value of [inline][crate::model::Secrets::inline].
6101 ///
6102 /// # Example
6103 /// ```ignore,no_run
6104 /// # use google_cloud_build_v1::model::Secrets;
6105 /// use google_cloud_build_v1::model::InlineSecret;
6106 /// let x = Secrets::new()
6107 /// .set_inline([
6108 /// InlineSecret::default()/* use setters */,
6109 /// InlineSecret::default()/* use (different) setters */,
6110 /// ]);
6111 /// ```
6112 pub fn set_inline<T, V>(mut self, v: T) -> Self
6113 where
6114 T: std::iter::IntoIterator<Item = V>,
6115 V: std::convert::Into<crate::model::InlineSecret>,
6116 {
6117 use std::iter::Iterator;
6118 self.inline = v.into_iter().map(|i| i.into()).collect();
6119 self
6120 }
6121}
6122
6123impl wkt::message::Message for Secrets {
6124 fn typename() -> &'static str {
6125 "type.googleapis.com/google.devtools.cloudbuild.v1.Secrets"
6126 }
6127}
6128
6129/// Pairs a set of secret environment variables mapped to encrypted
6130/// values with the Cloud KMS key to use to decrypt the value.
6131#[derive(Clone, Default, PartialEq)]
6132#[non_exhaustive]
6133pub struct InlineSecret {
6134 /// Resource name of Cloud KMS crypto key to decrypt the encrypted value.
6135 /// In format: projects/*/locations/*/keyRings/*/cryptoKeys/*
6136 pub kms_key_name: std::string::String,
6137
6138 /// Map of environment variable name to its encrypted value.
6139 ///
6140 /// Secret environment variables must be unique across all of a build's
6141 /// secrets, and must be used by at least one build step. Values can be at most
6142 /// 64 KB in size. There can be at most 100 secret values across all of a
6143 /// build's secrets.
6144 pub env_map: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6145
6146 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6147}
6148
6149impl InlineSecret {
6150 pub fn new() -> Self {
6151 std::default::Default::default()
6152 }
6153
6154 /// Sets the value of [kms_key_name][crate::model::InlineSecret::kms_key_name].
6155 ///
6156 /// # Example
6157 /// ```ignore,no_run
6158 /// # use google_cloud_build_v1::model::InlineSecret;
6159 /// let x = InlineSecret::new().set_kms_key_name("example");
6160 /// ```
6161 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6162 self.kms_key_name = v.into();
6163 self
6164 }
6165
6166 /// Sets the value of [env_map][crate::model::InlineSecret::env_map].
6167 ///
6168 /// # Example
6169 /// ```ignore,no_run
6170 /// # use google_cloud_build_v1::model::InlineSecret;
6171 /// let x = InlineSecret::new().set_env_map([
6172 /// ("key0", bytes::Bytes::from_static(b"abc")),
6173 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6174 /// ]);
6175 /// ```
6176 pub fn set_env_map<T, K, V>(mut self, v: T) -> Self
6177 where
6178 T: std::iter::IntoIterator<Item = (K, V)>,
6179 K: std::convert::Into<std::string::String>,
6180 V: std::convert::Into<::bytes::Bytes>,
6181 {
6182 use std::iter::Iterator;
6183 self.env_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6184 self
6185 }
6186}
6187
6188impl wkt::message::Message for InlineSecret {
6189 fn typename() -> &'static str {
6190 "type.googleapis.com/google.devtools.cloudbuild.v1.InlineSecret"
6191 }
6192}
6193
6194/// Pairs a secret environment variable with a SecretVersion in Secret Manager.
6195#[derive(Clone, Default, PartialEq)]
6196#[non_exhaustive]
6197pub struct SecretManagerSecret {
6198 /// Resource name of the SecretVersion. In format:
6199 /// projects/*/secrets/*/versions/*
6200 pub version_name: std::string::String,
6201
6202 /// Environment variable name to associate with the secret.
6203 /// Secret environment variables must be unique across all of a build's
6204 /// secrets, and must be used by at least one build step.
6205 pub env: std::string::String,
6206
6207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6208}
6209
6210impl SecretManagerSecret {
6211 pub fn new() -> Self {
6212 std::default::Default::default()
6213 }
6214
6215 /// Sets the value of [version_name][crate::model::SecretManagerSecret::version_name].
6216 ///
6217 /// # Example
6218 /// ```ignore,no_run
6219 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6220 /// let x = SecretManagerSecret::new().set_version_name("example");
6221 /// ```
6222 pub fn set_version_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6223 self.version_name = v.into();
6224 self
6225 }
6226
6227 /// Sets the value of [env][crate::model::SecretManagerSecret::env].
6228 ///
6229 /// # Example
6230 /// ```ignore,no_run
6231 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6232 /// let x = SecretManagerSecret::new().set_env("example");
6233 /// ```
6234 pub fn set_env<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6235 self.env = v.into();
6236 self
6237 }
6238}
6239
6240impl wkt::message::Message for SecretManagerSecret {
6241 fn typename() -> &'static str {
6242 "type.googleapis.com/google.devtools.cloudbuild.v1.SecretManagerSecret"
6243 }
6244}
6245
6246/// Pairs a set of secret environment variables containing encrypted
6247/// values with the Cloud KMS key to use to decrypt the value.
6248/// Note: Use `kmsKeyName` with `available_secrets` instead of using
6249/// `kmsKeyName` with `secret`. For instructions see:
6250/// <https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials>.
6251#[derive(Clone, Default, PartialEq)]
6252#[non_exhaustive]
6253pub struct Secret {
6254 /// Cloud KMS key name to use to decrypt these envs.
6255 pub kms_key_name: std::string::String,
6256
6257 /// Map of environment variable name to its encrypted value.
6258 ///
6259 /// Secret environment variables must be unique across all of a build's
6260 /// secrets, and must be used by at least one build step. Values can be at most
6261 /// 64 KB in size. There can be at most 100 secret values across all of a
6262 /// build's secrets.
6263 pub secret_env: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6264
6265 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6266}
6267
6268impl Secret {
6269 pub fn new() -> Self {
6270 std::default::Default::default()
6271 }
6272
6273 /// Sets the value of [kms_key_name][crate::model::Secret::kms_key_name].
6274 ///
6275 /// # Example
6276 /// ```ignore,no_run
6277 /// # use google_cloud_build_v1::model::Secret;
6278 /// let x = Secret::new().set_kms_key_name("example");
6279 /// ```
6280 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6281 self.kms_key_name = v.into();
6282 self
6283 }
6284
6285 /// Sets the value of [secret_env][crate::model::Secret::secret_env].
6286 ///
6287 /// # Example
6288 /// ```ignore,no_run
6289 /// # use google_cloud_build_v1::model::Secret;
6290 /// let x = Secret::new().set_secret_env([
6291 /// ("key0", bytes::Bytes::from_static(b"abc")),
6292 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6293 /// ]);
6294 /// ```
6295 pub fn set_secret_env<T, K, V>(mut self, v: T) -> Self
6296 where
6297 T: std::iter::IntoIterator<Item = (K, V)>,
6298 K: std::convert::Into<std::string::String>,
6299 V: std::convert::Into<::bytes::Bytes>,
6300 {
6301 use std::iter::Iterator;
6302 self.secret_env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6303 self
6304 }
6305}
6306
6307impl wkt::message::Message for Secret {
6308 fn typename() -> &'static str {
6309 "type.googleapis.com/google.devtools.cloudbuild.v1.Secret"
6310 }
6311}
6312
6313/// Request to create a new build.
6314#[derive(Clone, Default, PartialEq)]
6315#[non_exhaustive]
6316pub struct CreateBuildRequest {
6317 /// The parent resource where this build will be created.
6318 /// Format: `projects/{project}/locations/{location}`
6319 pub parent: std::string::String,
6320
6321 /// Required. ID of the project.
6322 pub project_id: std::string::String,
6323
6324 /// Required. Build resource to create.
6325 pub build: std::option::Option<crate::model::Build>,
6326
6327 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6328}
6329
6330impl CreateBuildRequest {
6331 pub fn new() -> Self {
6332 std::default::Default::default()
6333 }
6334
6335 /// Sets the value of [parent][crate::model::CreateBuildRequest::parent].
6336 ///
6337 /// # Example
6338 /// ```ignore,no_run
6339 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6340 /// let x = CreateBuildRequest::new().set_parent("example");
6341 /// ```
6342 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6343 self.parent = v.into();
6344 self
6345 }
6346
6347 /// Sets the value of [project_id][crate::model::CreateBuildRequest::project_id].
6348 ///
6349 /// # Example
6350 /// ```ignore,no_run
6351 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6352 /// let x = CreateBuildRequest::new().set_project_id("example");
6353 /// ```
6354 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6355 self.project_id = v.into();
6356 self
6357 }
6358
6359 /// Sets the value of [build][crate::model::CreateBuildRequest::build].
6360 ///
6361 /// # Example
6362 /// ```ignore,no_run
6363 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6364 /// use google_cloud_build_v1::model::Build;
6365 /// let x = CreateBuildRequest::new().set_build(Build::default()/* use setters */);
6366 /// ```
6367 pub fn set_build<T>(mut self, v: T) -> Self
6368 where
6369 T: std::convert::Into<crate::model::Build>,
6370 {
6371 self.build = std::option::Option::Some(v.into());
6372 self
6373 }
6374
6375 /// Sets or clears the value of [build][crate::model::CreateBuildRequest::build].
6376 ///
6377 /// # Example
6378 /// ```ignore,no_run
6379 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6380 /// use google_cloud_build_v1::model::Build;
6381 /// let x = CreateBuildRequest::new().set_or_clear_build(Some(Build::default()/* use setters */));
6382 /// let x = CreateBuildRequest::new().set_or_clear_build(None::<Build>);
6383 /// ```
6384 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
6385 where
6386 T: std::convert::Into<crate::model::Build>,
6387 {
6388 self.build = v.map(|x| x.into());
6389 self
6390 }
6391}
6392
6393impl wkt::message::Message for CreateBuildRequest {
6394 fn typename() -> &'static str {
6395 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildRequest"
6396 }
6397}
6398
6399/// Request to get a build.
6400#[derive(Clone, Default, PartialEq)]
6401#[non_exhaustive]
6402pub struct GetBuildRequest {
6403 /// The name of the `Build` to retrieve.
6404 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6405 pub name: std::string::String,
6406
6407 /// Required. ID of the project.
6408 pub project_id: std::string::String,
6409
6410 /// Required. ID of the build.
6411 pub id: std::string::String,
6412
6413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6414}
6415
6416impl GetBuildRequest {
6417 pub fn new() -> Self {
6418 std::default::Default::default()
6419 }
6420
6421 /// Sets the value of [name][crate::model::GetBuildRequest::name].
6422 ///
6423 /// # Example
6424 /// ```ignore,no_run
6425 /// # use google_cloud_build_v1::model::GetBuildRequest;
6426 /// let x = GetBuildRequest::new().set_name("example");
6427 /// ```
6428 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6429 self.name = v.into();
6430 self
6431 }
6432
6433 /// Sets the value of [project_id][crate::model::GetBuildRequest::project_id].
6434 ///
6435 /// # Example
6436 /// ```ignore,no_run
6437 /// # use google_cloud_build_v1::model::GetBuildRequest;
6438 /// let x = GetBuildRequest::new().set_project_id("example");
6439 /// ```
6440 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6441 self.project_id = v.into();
6442 self
6443 }
6444
6445 /// Sets the value of [id][crate::model::GetBuildRequest::id].
6446 ///
6447 /// # Example
6448 /// ```ignore,no_run
6449 /// # use google_cloud_build_v1::model::GetBuildRequest;
6450 /// let x = GetBuildRequest::new().set_id("example");
6451 /// ```
6452 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6453 self.id = v.into();
6454 self
6455 }
6456}
6457
6458impl wkt::message::Message for GetBuildRequest {
6459 fn typename() -> &'static str {
6460 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildRequest"
6461 }
6462}
6463
6464/// Request to list builds.
6465#[derive(Clone, Default, PartialEq)]
6466#[non_exhaustive]
6467pub struct ListBuildsRequest {
6468 /// The parent of the collection of `Builds`.
6469 /// Format: `projects/{project}/locations/{location}`
6470 pub parent: std::string::String,
6471
6472 /// Required. ID of the project.
6473 pub project_id: std::string::String,
6474
6475 /// Number of results to return in the list.
6476 pub page_size: i32,
6477
6478 /// The page token for the next page of Builds.
6479 ///
6480 /// If unspecified, the first page of results is returned.
6481 ///
6482 /// If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
6483 /// In this case, the token should be discarded, and pagination should be
6484 /// restarted from the first page of results.
6485 ///
6486 /// See <https://google.aip.dev/158> for more.
6487 pub page_token: std::string::String,
6488
6489 /// The raw filter text to constrain the results.
6490 pub filter: std::string::String,
6491
6492 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6493}
6494
6495impl ListBuildsRequest {
6496 pub fn new() -> Self {
6497 std::default::Default::default()
6498 }
6499
6500 /// Sets the value of [parent][crate::model::ListBuildsRequest::parent].
6501 ///
6502 /// # Example
6503 /// ```ignore,no_run
6504 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6505 /// let x = ListBuildsRequest::new().set_parent("example");
6506 /// ```
6507 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6508 self.parent = v.into();
6509 self
6510 }
6511
6512 /// Sets the value of [project_id][crate::model::ListBuildsRequest::project_id].
6513 ///
6514 /// # Example
6515 /// ```ignore,no_run
6516 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6517 /// let x = ListBuildsRequest::new().set_project_id("example");
6518 /// ```
6519 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6520 self.project_id = v.into();
6521 self
6522 }
6523
6524 /// Sets the value of [page_size][crate::model::ListBuildsRequest::page_size].
6525 ///
6526 /// # Example
6527 /// ```ignore,no_run
6528 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6529 /// let x = ListBuildsRequest::new().set_page_size(42);
6530 /// ```
6531 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6532 self.page_size = v.into();
6533 self
6534 }
6535
6536 /// Sets the value of [page_token][crate::model::ListBuildsRequest::page_token].
6537 ///
6538 /// # Example
6539 /// ```ignore,no_run
6540 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6541 /// let x = ListBuildsRequest::new().set_page_token("example");
6542 /// ```
6543 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6544 self.page_token = v.into();
6545 self
6546 }
6547
6548 /// Sets the value of [filter][crate::model::ListBuildsRequest::filter].
6549 ///
6550 /// # Example
6551 /// ```ignore,no_run
6552 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6553 /// let x = ListBuildsRequest::new().set_filter("example");
6554 /// ```
6555 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6556 self.filter = v.into();
6557 self
6558 }
6559}
6560
6561impl wkt::message::Message for ListBuildsRequest {
6562 fn typename() -> &'static str {
6563 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsRequest"
6564 }
6565}
6566
6567/// Response including listed builds.
6568#[derive(Clone, Default, PartialEq)]
6569#[non_exhaustive]
6570pub struct ListBuildsResponse {
6571 /// Builds will be sorted by `create_time`, descending.
6572 pub builds: std::vec::Vec<crate::model::Build>,
6573
6574 /// Token to receive the next page of results.
6575 /// This will be absent if the end of the response list has been reached.
6576 pub next_page_token: std::string::String,
6577
6578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6579}
6580
6581impl ListBuildsResponse {
6582 pub fn new() -> Self {
6583 std::default::Default::default()
6584 }
6585
6586 /// Sets the value of [builds][crate::model::ListBuildsResponse::builds].
6587 ///
6588 /// # Example
6589 /// ```ignore,no_run
6590 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6591 /// use google_cloud_build_v1::model::Build;
6592 /// let x = ListBuildsResponse::new()
6593 /// .set_builds([
6594 /// Build::default()/* use setters */,
6595 /// Build::default()/* use (different) setters */,
6596 /// ]);
6597 /// ```
6598 pub fn set_builds<T, V>(mut self, v: T) -> Self
6599 where
6600 T: std::iter::IntoIterator<Item = V>,
6601 V: std::convert::Into<crate::model::Build>,
6602 {
6603 use std::iter::Iterator;
6604 self.builds = v.into_iter().map(|i| i.into()).collect();
6605 self
6606 }
6607
6608 /// Sets the value of [next_page_token][crate::model::ListBuildsResponse::next_page_token].
6609 ///
6610 /// # Example
6611 /// ```ignore,no_run
6612 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6613 /// let x = ListBuildsResponse::new().set_next_page_token("example");
6614 /// ```
6615 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6616 self.next_page_token = v.into();
6617 self
6618 }
6619}
6620
6621impl wkt::message::Message for ListBuildsResponse {
6622 fn typename() -> &'static str {
6623 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsResponse"
6624 }
6625}
6626
6627#[doc(hidden)]
6628impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildsResponse {
6629 type PageItem = crate::model::Build;
6630
6631 fn items(self) -> std::vec::Vec<Self::PageItem> {
6632 self.builds
6633 }
6634
6635 fn next_page_token(&self) -> std::string::String {
6636 use std::clone::Clone;
6637 self.next_page_token.clone()
6638 }
6639}
6640
6641/// Request to cancel an ongoing build.
6642#[derive(Clone, Default, PartialEq)]
6643#[non_exhaustive]
6644pub struct CancelBuildRequest {
6645 /// The name of the `Build` to cancel.
6646 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6647 pub name: std::string::String,
6648
6649 /// Required. ID of the project.
6650 pub project_id: std::string::String,
6651
6652 /// Required. ID of the build.
6653 pub id: std::string::String,
6654
6655 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6656}
6657
6658impl CancelBuildRequest {
6659 pub fn new() -> Self {
6660 std::default::Default::default()
6661 }
6662
6663 /// Sets the value of [name][crate::model::CancelBuildRequest::name].
6664 ///
6665 /// # Example
6666 /// ```ignore,no_run
6667 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6668 /// let x = CancelBuildRequest::new().set_name("example");
6669 /// ```
6670 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6671 self.name = v.into();
6672 self
6673 }
6674
6675 /// Sets the value of [project_id][crate::model::CancelBuildRequest::project_id].
6676 ///
6677 /// # Example
6678 /// ```ignore,no_run
6679 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6680 /// let x = CancelBuildRequest::new().set_project_id("example");
6681 /// ```
6682 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6683 self.project_id = v.into();
6684 self
6685 }
6686
6687 /// Sets the value of [id][crate::model::CancelBuildRequest::id].
6688 ///
6689 /// # Example
6690 /// ```ignore,no_run
6691 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6692 /// let x = CancelBuildRequest::new().set_id("example");
6693 /// ```
6694 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6695 self.id = v.into();
6696 self
6697 }
6698}
6699
6700impl wkt::message::Message for CancelBuildRequest {
6701 fn typename() -> &'static str {
6702 "type.googleapis.com/google.devtools.cloudbuild.v1.CancelBuildRequest"
6703 }
6704}
6705
6706/// Request to approve or reject a pending build.
6707#[derive(Clone, Default, PartialEq)]
6708#[non_exhaustive]
6709pub struct ApproveBuildRequest {
6710 /// Required. Name of the target build.
6711 /// For example: "projects/{$project_id}/builds/{$build_id}"
6712 pub name: std::string::String,
6713
6714 /// Approval decision and metadata.
6715 pub approval_result: std::option::Option<crate::model::ApprovalResult>,
6716
6717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6718}
6719
6720impl ApproveBuildRequest {
6721 pub fn new() -> Self {
6722 std::default::Default::default()
6723 }
6724
6725 /// Sets the value of [name][crate::model::ApproveBuildRequest::name].
6726 ///
6727 /// # Example
6728 /// ```ignore,no_run
6729 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6730 /// let x = ApproveBuildRequest::new().set_name("example");
6731 /// ```
6732 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6733 self.name = v.into();
6734 self
6735 }
6736
6737 /// Sets the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6738 ///
6739 /// # Example
6740 /// ```ignore,no_run
6741 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6742 /// use google_cloud_build_v1::model::ApprovalResult;
6743 /// let x = ApproveBuildRequest::new().set_approval_result(ApprovalResult::default()/* use setters */);
6744 /// ```
6745 pub fn set_approval_result<T>(mut self, v: T) -> Self
6746 where
6747 T: std::convert::Into<crate::model::ApprovalResult>,
6748 {
6749 self.approval_result = std::option::Option::Some(v.into());
6750 self
6751 }
6752
6753 /// Sets or clears the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6754 ///
6755 /// # Example
6756 /// ```ignore,no_run
6757 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6758 /// use google_cloud_build_v1::model::ApprovalResult;
6759 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(Some(ApprovalResult::default()/* use setters */));
6760 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(None::<ApprovalResult>);
6761 /// ```
6762 pub fn set_or_clear_approval_result<T>(mut self, v: std::option::Option<T>) -> Self
6763 where
6764 T: std::convert::Into<crate::model::ApprovalResult>,
6765 {
6766 self.approval_result = v.map(|x| x.into());
6767 self
6768 }
6769}
6770
6771impl wkt::message::Message for ApproveBuildRequest {
6772 fn typename() -> &'static str {
6773 "type.googleapis.com/google.devtools.cloudbuild.v1.ApproveBuildRequest"
6774 }
6775}
6776
6777/// BuildApproval describes a build's approval configuration, state, and
6778/// result.
6779#[derive(Clone, Default, PartialEq)]
6780#[non_exhaustive]
6781pub struct BuildApproval {
6782 /// Output only. The state of this build's approval.
6783 pub state: crate::model::build_approval::State,
6784
6785 /// Output only. Configuration for manual approval of this build.
6786 pub config: std::option::Option<crate::model::ApprovalConfig>,
6787
6788 /// Output only. Result of manual approval for this Build.
6789 pub result: std::option::Option<crate::model::ApprovalResult>,
6790
6791 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6792}
6793
6794impl BuildApproval {
6795 pub fn new() -> Self {
6796 std::default::Default::default()
6797 }
6798
6799 /// Sets the value of [state][crate::model::BuildApproval::state].
6800 ///
6801 /// # Example
6802 /// ```ignore,no_run
6803 /// # use google_cloud_build_v1::model::BuildApproval;
6804 /// use google_cloud_build_v1::model::build_approval::State;
6805 /// let x0 = BuildApproval::new().set_state(State::Pending);
6806 /// let x1 = BuildApproval::new().set_state(State::Approved);
6807 /// let x2 = BuildApproval::new().set_state(State::Rejected);
6808 /// ```
6809 pub fn set_state<T: std::convert::Into<crate::model::build_approval::State>>(
6810 mut self,
6811 v: T,
6812 ) -> Self {
6813 self.state = v.into();
6814 self
6815 }
6816
6817 /// Sets the value of [config][crate::model::BuildApproval::config].
6818 ///
6819 /// # Example
6820 /// ```ignore,no_run
6821 /// # use google_cloud_build_v1::model::BuildApproval;
6822 /// use google_cloud_build_v1::model::ApprovalConfig;
6823 /// let x = BuildApproval::new().set_config(ApprovalConfig::default()/* use setters */);
6824 /// ```
6825 pub fn set_config<T>(mut self, v: T) -> Self
6826 where
6827 T: std::convert::Into<crate::model::ApprovalConfig>,
6828 {
6829 self.config = std::option::Option::Some(v.into());
6830 self
6831 }
6832
6833 /// Sets or clears the value of [config][crate::model::BuildApproval::config].
6834 ///
6835 /// # Example
6836 /// ```ignore,no_run
6837 /// # use google_cloud_build_v1::model::BuildApproval;
6838 /// use google_cloud_build_v1::model::ApprovalConfig;
6839 /// let x = BuildApproval::new().set_or_clear_config(Some(ApprovalConfig::default()/* use setters */));
6840 /// let x = BuildApproval::new().set_or_clear_config(None::<ApprovalConfig>);
6841 /// ```
6842 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
6843 where
6844 T: std::convert::Into<crate::model::ApprovalConfig>,
6845 {
6846 self.config = v.map(|x| x.into());
6847 self
6848 }
6849
6850 /// Sets the value of [result][crate::model::BuildApproval::result].
6851 ///
6852 /// # Example
6853 /// ```ignore,no_run
6854 /// # use google_cloud_build_v1::model::BuildApproval;
6855 /// use google_cloud_build_v1::model::ApprovalResult;
6856 /// let x = BuildApproval::new().set_result(ApprovalResult::default()/* use setters */);
6857 /// ```
6858 pub fn set_result<T>(mut self, v: T) -> Self
6859 where
6860 T: std::convert::Into<crate::model::ApprovalResult>,
6861 {
6862 self.result = std::option::Option::Some(v.into());
6863 self
6864 }
6865
6866 /// Sets or clears the value of [result][crate::model::BuildApproval::result].
6867 ///
6868 /// # Example
6869 /// ```ignore,no_run
6870 /// # use google_cloud_build_v1::model::BuildApproval;
6871 /// use google_cloud_build_v1::model::ApprovalResult;
6872 /// let x = BuildApproval::new().set_or_clear_result(Some(ApprovalResult::default()/* use setters */));
6873 /// let x = BuildApproval::new().set_or_clear_result(None::<ApprovalResult>);
6874 /// ```
6875 pub fn set_or_clear_result<T>(mut self, v: std::option::Option<T>) -> Self
6876 where
6877 T: std::convert::Into<crate::model::ApprovalResult>,
6878 {
6879 self.result = v.map(|x| x.into());
6880 self
6881 }
6882}
6883
6884impl wkt::message::Message for BuildApproval {
6885 fn typename() -> &'static str {
6886 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildApproval"
6887 }
6888}
6889
6890/// Defines additional types related to [BuildApproval].
6891pub mod build_approval {
6892 #[allow(unused_imports)]
6893 use super::*;
6894
6895 /// Specifies the current state of a build's approval.
6896 ///
6897 /// # Working with unknown values
6898 ///
6899 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6900 /// additional enum variants at any time. Adding new variants is not considered
6901 /// a breaking change. Applications should write their code in anticipation of:
6902 ///
6903 /// - New values appearing in future releases of the client library, **and**
6904 /// - New values received dynamically, without application changes.
6905 ///
6906 /// Please consult the [Working with enums] section in the user guide for some
6907 /// guidelines.
6908 ///
6909 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6910 #[derive(Clone, Debug, PartialEq)]
6911 #[non_exhaustive]
6912 pub enum State {
6913 /// Default enum type. This should not be used.
6914 Unspecified,
6915 /// Build approval is pending.
6916 Pending,
6917 /// Build approval has been approved.
6918 Approved,
6919 /// Build approval has been rejected.
6920 Rejected,
6921 /// Build was cancelled while it was still pending approval.
6922 Cancelled,
6923 /// If set, the enum was initialized with an unknown value.
6924 ///
6925 /// Applications can examine the value using [State::value] or
6926 /// [State::name].
6927 UnknownValue(state::UnknownValue),
6928 }
6929
6930 #[doc(hidden)]
6931 pub mod state {
6932 #[allow(unused_imports)]
6933 use super::*;
6934 #[derive(Clone, Debug, PartialEq)]
6935 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6936 }
6937
6938 impl State {
6939 /// Gets the enum value.
6940 ///
6941 /// Returns `None` if the enum contains an unknown value deserialized from
6942 /// the string representation of enums.
6943 pub fn value(&self) -> std::option::Option<i32> {
6944 match self {
6945 Self::Unspecified => std::option::Option::Some(0),
6946 Self::Pending => std::option::Option::Some(1),
6947 Self::Approved => std::option::Option::Some(2),
6948 Self::Rejected => std::option::Option::Some(3),
6949 Self::Cancelled => std::option::Option::Some(5),
6950 Self::UnknownValue(u) => u.0.value(),
6951 }
6952 }
6953
6954 /// Gets the enum value as a string.
6955 ///
6956 /// Returns `None` if the enum contains an unknown value deserialized from
6957 /// the integer representation of enums.
6958 pub fn name(&self) -> std::option::Option<&str> {
6959 match self {
6960 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6961 Self::Pending => std::option::Option::Some("PENDING"),
6962 Self::Approved => std::option::Option::Some("APPROVED"),
6963 Self::Rejected => std::option::Option::Some("REJECTED"),
6964 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6965 Self::UnknownValue(u) => u.0.name(),
6966 }
6967 }
6968 }
6969
6970 impl std::default::Default for State {
6971 fn default() -> Self {
6972 use std::convert::From;
6973 Self::from(0)
6974 }
6975 }
6976
6977 impl std::fmt::Display for State {
6978 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6979 wkt::internal::display_enum(f, self.name(), self.value())
6980 }
6981 }
6982
6983 impl std::convert::From<i32> for State {
6984 fn from(value: i32) -> Self {
6985 match value {
6986 0 => Self::Unspecified,
6987 1 => Self::Pending,
6988 2 => Self::Approved,
6989 3 => Self::Rejected,
6990 5 => Self::Cancelled,
6991 _ => Self::UnknownValue(state::UnknownValue(
6992 wkt::internal::UnknownEnumValue::Integer(value),
6993 )),
6994 }
6995 }
6996 }
6997
6998 impl std::convert::From<&str> for State {
6999 fn from(value: &str) -> Self {
7000 use std::string::ToString;
7001 match value {
7002 "STATE_UNSPECIFIED" => Self::Unspecified,
7003 "PENDING" => Self::Pending,
7004 "APPROVED" => Self::Approved,
7005 "REJECTED" => Self::Rejected,
7006 "CANCELLED" => Self::Cancelled,
7007 _ => Self::UnknownValue(state::UnknownValue(
7008 wkt::internal::UnknownEnumValue::String(value.to_string()),
7009 )),
7010 }
7011 }
7012 }
7013
7014 impl serde::ser::Serialize for State {
7015 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7016 where
7017 S: serde::Serializer,
7018 {
7019 match self {
7020 Self::Unspecified => serializer.serialize_i32(0),
7021 Self::Pending => serializer.serialize_i32(1),
7022 Self::Approved => serializer.serialize_i32(2),
7023 Self::Rejected => serializer.serialize_i32(3),
7024 Self::Cancelled => serializer.serialize_i32(5),
7025 Self::UnknownValue(u) => u.0.serialize(serializer),
7026 }
7027 }
7028 }
7029
7030 impl<'de> serde::de::Deserialize<'de> for State {
7031 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7032 where
7033 D: serde::Deserializer<'de>,
7034 {
7035 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7036 ".google.devtools.cloudbuild.v1.BuildApproval.State",
7037 ))
7038 }
7039 }
7040}
7041
7042/// ApprovalConfig describes configuration for manual approval of a build.
7043#[derive(Clone, Default, PartialEq)]
7044#[non_exhaustive]
7045pub struct ApprovalConfig {
7046 /// Whether or not approval is needed. If this is set on a build, it will
7047 /// become pending when created, and will need to be explicitly approved
7048 /// to start.
7049 pub approval_required: bool,
7050
7051 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7052}
7053
7054impl ApprovalConfig {
7055 pub fn new() -> Self {
7056 std::default::Default::default()
7057 }
7058
7059 /// Sets the value of [approval_required][crate::model::ApprovalConfig::approval_required].
7060 ///
7061 /// # Example
7062 /// ```ignore,no_run
7063 /// # use google_cloud_build_v1::model::ApprovalConfig;
7064 /// let x = ApprovalConfig::new().set_approval_required(true);
7065 /// ```
7066 pub fn set_approval_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7067 self.approval_required = v.into();
7068 self
7069 }
7070}
7071
7072impl wkt::message::Message for ApprovalConfig {
7073 fn typename() -> &'static str {
7074 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalConfig"
7075 }
7076}
7077
7078/// ApprovalResult describes the decision and associated metadata of a manual
7079/// approval of a build.
7080#[derive(Clone, Default, PartialEq)]
7081#[non_exhaustive]
7082pub struct ApprovalResult {
7083 /// Output only. Email of the user that called the ApproveBuild API to
7084 /// approve or reject a build at the time that the API was called.
7085 pub approver_account: std::string::String,
7086
7087 /// Output only. The time when the approval decision was made.
7088 pub approval_time: std::option::Option<wkt::Timestamp>,
7089
7090 /// Required. The decision of this manual approval.
7091 pub decision: crate::model::approval_result::Decision,
7092
7093 /// Optional. An optional comment for this manual approval result.
7094 pub comment: std::string::String,
7095
7096 /// Optional. An optional URL tied to this manual approval result. This field
7097 /// is essentially the same as comment, except that it will be rendered by the
7098 /// UI differently. An example use case is a link to an external job that
7099 /// approved this Build.
7100 pub url: std::string::String,
7101
7102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7103}
7104
7105impl ApprovalResult {
7106 pub fn new() -> Self {
7107 std::default::Default::default()
7108 }
7109
7110 /// Sets the value of [approver_account][crate::model::ApprovalResult::approver_account].
7111 ///
7112 /// # Example
7113 /// ```ignore,no_run
7114 /// # use google_cloud_build_v1::model::ApprovalResult;
7115 /// let x = ApprovalResult::new().set_approver_account("example");
7116 /// ```
7117 pub fn set_approver_account<T: std::convert::Into<std::string::String>>(
7118 mut self,
7119 v: T,
7120 ) -> Self {
7121 self.approver_account = v.into();
7122 self
7123 }
7124
7125 /// Sets the value of [approval_time][crate::model::ApprovalResult::approval_time].
7126 ///
7127 /// # Example
7128 /// ```ignore,no_run
7129 /// # use google_cloud_build_v1::model::ApprovalResult;
7130 /// use wkt::Timestamp;
7131 /// let x = ApprovalResult::new().set_approval_time(Timestamp::default()/* use setters */);
7132 /// ```
7133 pub fn set_approval_time<T>(mut self, v: T) -> Self
7134 where
7135 T: std::convert::Into<wkt::Timestamp>,
7136 {
7137 self.approval_time = std::option::Option::Some(v.into());
7138 self
7139 }
7140
7141 /// Sets or clears the value of [approval_time][crate::model::ApprovalResult::approval_time].
7142 ///
7143 /// # Example
7144 /// ```ignore,no_run
7145 /// # use google_cloud_build_v1::model::ApprovalResult;
7146 /// use wkt::Timestamp;
7147 /// let x = ApprovalResult::new().set_or_clear_approval_time(Some(Timestamp::default()/* use setters */));
7148 /// let x = ApprovalResult::new().set_or_clear_approval_time(None::<Timestamp>);
7149 /// ```
7150 pub fn set_or_clear_approval_time<T>(mut self, v: std::option::Option<T>) -> Self
7151 where
7152 T: std::convert::Into<wkt::Timestamp>,
7153 {
7154 self.approval_time = v.map(|x| x.into());
7155 self
7156 }
7157
7158 /// Sets the value of [decision][crate::model::ApprovalResult::decision].
7159 ///
7160 /// # Example
7161 /// ```ignore,no_run
7162 /// # use google_cloud_build_v1::model::ApprovalResult;
7163 /// use google_cloud_build_v1::model::approval_result::Decision;
7164 /// let x0 = ApprovalResult::new().set_decision(Decision::Approved);
7165 /// let x1 = ApprovalResult::new().set_decision(Decision::Rejected);
7166 /// ```
7167 pub fn set_decision<T: std::convert::Into<crate::model::approval_result::Decision>>(
7168 mut self,
7169 v: T,
7170 ) -> Self {
7171 self.decision = v.into();
7172 self
7173 }
7174
7175 /// Sets the value of [comment][crate::model::ApprovalResult::comment].
7176 ///
7177 /// # Example
7178 /// ```ignore,no_run
7179 /// # use google_cloud_build_v1::model::ApprovalResult;
7180 /// let x = ApprovalResult::new().set_comment("example");
7181 /// ```
7182 pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7183 self.comment = v.into();
7184 self
7185 }
7186
7187 /// Sets the value of [url][crate::model::ApprovalResult::url].
7188 ///
7189 /// # Example
7190 /// ```ignore,no_run
7191 /// # use google_cloud_build_v1::model::ApprovalResult;
7192 /// let x = ApprovalResult::new().set_url("example");
7193 /// ```
7194 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7195 self.url = v.into();
7196 self
7197 }
7198}
7199
7200impl wkt::message::Message for ApprovalResult {
7201 fn typename() -> &'static str {
7202 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalResult"
7203 }
7204}
7205
7206/// Defines additional types related to [ApprovalResult].
7207pub mod approval_result {
7208 #[allow(unused_imports)]
7209 use super::*;
7210
7211 /// Specifies whether or not this manual approval result is to approve
7212 /// or reject a build.
7213 ///
7214 /// # Working with unknown values
7215 ///
7216 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7217 /// additional enum variants at any time. Adding new variants is not considered
7218 /// a breaking change. Applications should write their code in anticipation of:
7219 ///
7220 /// - New values appearing in future releases of the client library, **and**
7221 /// - New values received dynamically, without application changes.
7222 ///
7223 /// Please consult the [Working with enums] section in the user guide for some
7224 /// guidelines.
7225 ///
7226 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7227 #[derive(Clone, Debug, PartialEq)]
7228 #[non_exhaustive]
7229 pub enum Decision {
7230 /// Default enum type. This should not be used.
7231 Unspecified,
7232 /// Build is approved.
7233 Approved,
7234 /// Build is rejected.
7235 Rejected,
7236 /// If set, the enum was initialized with an unknown value.
7237 ///
7238 /// Applications can examine the value using [Decision::value] or
7239 /// [Decision::name].
7240 UnknownValue(decision::UnknownValue),
7241 }
7242
7243 #[doc(hidden)]
7244 pub mod decision {
7245 #[allow(unused_imports)]
7246 use super::*;
7247 #[derive(Clone, Debug, PartialEq)]
7248 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7249 }
7250
7251 impl Decision {
7252 /// Gets the enum value.
7253 ///
7254 /// Returns `None` if the enum contains an unknown value deserialized from
7255 /// the string representation of enums.
7256 pub fn value(&self) -> std::option::Option<i32> {
7257 match self {
7258 Self::Unspecified => std::option::Option::Some(0),
7259 Self::Approved => std::option::Option::Some(1),
7260 Self::Rejected => std::option::Option::Some(2),
7261 Self::UnknownValue(u) => u.0.value(),
7262 }
7263 }
7264
7265 /// Gets the enum value as a string.
7266 ///
7267 /// Returns `None` if the enum contains an unknown value deserialized from
7268 /// the integer representation of enums.
7269 pub fn name(&self) -> std::option::Option<&str> {
7270 match self {
7271 Self::Unspecified => std::option::Option::Some("DECISION_UNSPECIFIED"),
7272 Self::Approved => std::option::Option::Some("APPROVED"),
7273 Self::Rejected => std::option::Option::Some("REJECTED"),
7274 Self::UnknownValue(u) => u.0.name(),
7275 }
7276 }
7277 }
7278
7279 impl std::default::Default for Decision {
7280 fn default() -> Self {
7281 use std::convert::From;
7282 Self::from(0)
7283 }
7284 }
7285
7286 impl std::fmt::Display for Decision {
7287 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7288 wkt::internal::display_enum(f, self.name(), self.value())
7289 }
7290 }
7291
7292 impl std::convert::From<i32> for Decision {
7293 fn from(value: i32) -> Self {
7294 match value {
7295 0 => Self::Unspecified,
7296 1 => Self::Approved,
7297 2 => Self::Rejected,
7298 _ => Self::UnknownValue(decision::UnknownValue(
7299 wkt::internal::UnknownEnumValue::Integer(value),
7300 )),
7301 }
7302 }
7303 }
7304
7305 impl std::convert::From<&str> for Decision {
7306 fn from(value: &str) -> Self {
7307 use std::string::ToString;
7308 match value {
7309 "DECISION_UNSPECIFIED" => Self::Unspecified,
7310 "APPROVED" => Self::Approved,
7311 "REJECTED" => Self::Rejected,
7312 _ => Self::UnknownValue(decision::UnknownValue(
7313 wkt::internal::UnknownEnumValue::String(value.to_string()),
7314 )),
7315 }
7316 }
7317 }
7318
7319 impl serde::ser::Serialize for Decision {
7320 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7321 where
7322 S: serde::Serializer,
7323 {
7324 match self {
7325 Self::Unspecified => serializer.serialize_i32(0),
7326 Self::Approved => serializer.serialize_i32(1),
7327 Self::Rejected => serializer.serialize_i32(2),
7328 Self::UnknownValue(u) => u.0.serialize(serializer),
7329 }
7330 }
7331 }
7332
7333 impl<'de> serde::de::Deserialize<'de> for Decision {
7334 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7335 where
7336 D: serde::Deserializer<'de>,
7337 {
7338 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Decision>::new(
7339 ".google.devtools.cloudbuild.v1.ApprovalResult.Decision",
7340 ))
7341 }
7342 }
7343}
7344
7345/// GitRepoSource describes a repo and ref of a code repository.
7346#[derive(Clone, Default, PartialEq)]
7347#[non_exhaustive]
7348pub struct GitRepoSource {
7349 /// The URI of the repo (e.g. <https://github.com/user/repo.git>).
7350 /// Either `uri` or `repository` can be specified and is required.
7351 pub uri: std::string::String,
7352
7353 /// The branch or tag to use. Must start with "refs/" (required).
7354 pub r#ref: std::string::String,
7355
7356 /// See RepoType below.
7357 pub repo_type: crate::model::git_file_source::RepoType,
7358
7359 /// The source of the SCM repo.
7360 pub source: std::option::Option<crate::model::git_repo_source::Source>,
7361
7362 /// The resource name of the enterprise config that should be applied
7363 /// to this source.
7364 pub enterprise_config: std::option::Option<crate::model::git_repo_source::EnterpriseConfig>,
7365
7366 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7367}
7368
7369impl GitRepoSource {
7370 pub fn new() -> Self {
7371 std::default::Default::default()
7372 }
7373
7374 /// Sets the value of [uri][crate::model::GitRepoSource::uri].
7375 ///
7376 /// # Example
7377 /// ```ignore,no_run
7378 /// # use google_cloud_build_v1::model::GitRepoSource;
7379 /// let x = GitRepoSource::new().set_uri("example");
7380 /// ```
7381 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7382 self.uri = v.into();
7383 self
7384 }
7385
7386 /// Sets the value of [r#ref][crate::model::GitRepoSource::ref].
7387 ///
7388 /// # Example
7389 /// ```ignore,no_run
7390 /// # use google_cloud_build_v1::model::GitRepoSource;
7391 /// let x = GitRepoSource::new().set_ref("example");
7392 /// ```
7393 pub fn set_ref<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7394 self.r#ref = v.into();
7395 self
7396 }
7397
7398 /// Sets the value of [repo_type][crate::model::GitRepoSource::repo_type].
7399 ///
7400 /// # Example
7401 /// ```ignore,no_run
7402 /// # use google_cloud_build_v1::model::GitRepoSource;
7403 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7404 /// let x0 = GitRepoSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7405 /// let x1 = GitRepoSource::new().set_repo_type(RepoType::Github);
7406 /// let x2 = GitRepoSource::new().set_repo_type(RepoType::BitbucketServer);
7407 /// ```
7408 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7409 mut self,
7410 v: T,
7411 ) -> Self {
7412 self.repo_type = v.into();
7413 self
7414 }
7415
7416 /// Sets the value of [source][crate::model::GitRepoSource::source].
7417 ///
7418 /// Note that all the setters affecting `source` are mutually
7419 /// exclusive.
7420 ///
7421 /// # Example
7422 /// ```ignore,no_run
7423 /// # use google_cloud_build_v1::model::GitRepoSource;
7424 /// use google_cloud_build_v1::model::git_repo_source::Source;
7425 /// let x = GitRepoSource::new().set_source(Some(Source::Repository("example".to_string())));
7426 /// ```
7427 pub fn set_source<
7428 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::Source>>,
7429 >(
7430 mut self,
7431 v: T,
7432 ) -> Self {
7433 self.source = v.into();
7434 self
7435 }
7436
7437 /// The value of [source][crate::model::GitRepoSource::source]
7438 /// if it holds a `Repository`, `None` if the field is not set or
7439 /// holds a different branch.
7440 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7441 #[allow(unreachable_patterns)]
7442 self.source.as_ref().and_then(|v| match v {
7443 crate::model::git_repo_source::Source::Repository(v) => std::option::Option::Some(v),
7444 _ => std::option::Option::None,
7445 })
7446 }
7447
7448 /// Sets the value of [source][crate::model::GitRepoSource::source]
7449 /// to hold a `Repository`.
7450 ///
7451 /// Note that all the setters affecting `source` are
7452 /// mutually exclusive.
7453 ///
7454 /// # Example
7455 /// ```ignore,no_run
7456 /// # use google_cloud_build_v1::model::GitRepoSource;
7457 /// let x = GitRepoSource::new().set_repository("example");
7458 /// assert!(x.repository().is_some());
7459 /// ```
7460 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7461 self.source =
7462 std::option::Option::Some(crate::model::git_repo_source::Source::Repository(v.into()));
7463 self
7464 }
7465
7466 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config].
7467 ///
7468 /// Note that all the setters affecting `enterprise_config` are mutually
7469 /// exclusive.
7470 ///
7471 /// # Example
7472 /// ```ignore,no_run
7473 /// # use google_cloud_build_v1::model::GitRepoSource;
7474 /// use google_cloud_build_v1::model::git_repo_source::EnterpriseConfig;
7475 /// let x = GitRepoSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7476 /// ```
7477 pub fn set_enterprise_config<
7478 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::EnterpriseConfig>>,
7479 >(
7480 mut self,
7481 v: T,
7482 ) -> Self {
7483 self.enterprise_config = v.into();
7484 self
7485 }
7486
7487 /// The value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7488 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7489 /// holds a different branch.
7490 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7491 #[allow(unreachable_patterns)]
7492 self.enterprise_config.as_ref().and_then(|v| match v {
7493 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7494 std::option::Option::Some(v)
7495 }
7496 _ => std::option::Option::None,
7497 })
7498 }
7499
7500 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7501 /// to hold a `GithubEnterpriseConfig`.
7502 ///
7503 /// Note that all the setters affecting `enterprise_config` are
7504 /// mutually exclusive.
7505 ///
7506 /// # Example
7507 /// ```ignore,no_run
7508 /// # use google_cloud_build_v1::model::GitRepoSource;
7509 /// let x = GitRepoSource::new().set_github_enterprise_config("example");
7510 /// assert!(x.github_enterprise_config().is_some());
7511 /// ```
7512 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7513 mut self,
7514 v: T,
7515 ) -> Self {
7516 self.enterprise_config = std::option::Option::Some(
7517 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7518 );
7519 self
7520 }
7521}
7522
7523impl wkt::message::Message for GitRepoSource {
7524 fn typename() -> &'static str {
7525 "type.googleapis.com/google.devtools.cloudbuild.v1.GitRepoSource"
7526 }
7527}
7528
7529/// Defines additional types related to [GitRepoSource].
7530pub mod git_repo_source {
7531 #[allow(unused_imports)]
7532 use super::*;
7533
7534 /// The source of the SCM repo.
7535 #[derive(Clone, Debug, PartialEq)]
7536 #[non_exhaustive]
7537 pub enum Source {
7538 /// The connected repository resource name, in the format
7539 /// `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or
7540 /// `repository` can be specified and is required.
7541 Repository(std::string::String),
7542 }
7543
7544 /// The resource name of the enterprise config that should be applied
7545 /// to this source.
7546 #[derive(Clone, Debug, PartialEq)]
7547 #[non_exhaustive]
7548 pub enum EnterpriseConfig {
7549 /// The full resource name of the github enterprise config.
7550 /// Format:
7551 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7552 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7553 GithubEnterpriseConfig(std::string::String),
7554 }
7555}
7556
7557/// GitFileSource describes a file within a (possibly remote) code repository.
7558#[derive(Clone, Default, PartialEq)]
7559#[non_exhaustive]
7560pub struct GitFileSource {
7561 /// The path of the file, with the repo root as the root of the path.
7562 pub path: std::string::String,
7563
7564 /// The URI of the repo.
7565 /// Either uri or repository can be specified.
7566 /// If unspecified, the repo from which the trigger invocation originated is
7567 /// assumed to be the repo from which to read the specified path.
7568 pub uri: std::string::String,
7569
7570 /// See RepoType above.
7571 pub repo_type: crate::model::git_file_source::RepoType,
7572
7573 /// The branch, tag, arbitrary ref, or SHA version of the repo to use when
7574 /// resolving the filename (optional).
7575 /// This field respects the same syntax/resolution as described here:
7576 /// <https://git-scm.com/docs/gitrevisions>
7577 /// If unspecified, the revision from which the trigger invocation originated
7578 /// is assumed to be the revision from which to read the specified path.
7579 pub revision: std::string::String,
7580
7581 /// The source of the SCM repo.
7582 pub source: std::option::Option<crate::model::git_file_source::Source>,
7583
7584 /// The resource name of the enterprise config that should be applied
7585 /// to this source.
7586 pub enterprise_config: std::option::Option<crate::model::git_file_source::EnterpriseConfig>,
7587
7588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7589}
7590
7591impl GitFileSource {
7592 pub fn new() -> Self {
7593 std::default::Default::default()
7594 }
7595
7596 /// Sets the value of [path][crate::model::GitFileSource::path].
7597 ///
7598 /// # Example
7599 /// ```ignore,no_run
7600 /// # use google_cloud_build_v1::model::GitFileSource;
7601 /// let x = GitFileSource::new().set_path("example");
7602 /// ```
7603 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7604 self.path = v.into();
7605 self
7606 }
7607
7608 /// Sets the value of [uri][crate::model::GitFileSource::uri].
7609 ///
7610 /// # Example
7611 /// ```ignore,no_run
7612 /// # use google_cloud_build_v1::model::GitFileSource;
7613 /// let x = GitFileSource::new().set_uri("example");
7614 /// ```
7615 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7616 self.uri = v.into();
7617 self
7618 }
7619
7620 /// Sets the value of [repo_type][crate::model::GitFileSource::repo_type].
7621 ///
7622 /// # Example
7623 /// ```ignore,no_run
7624 /// # use google_cloud_build_v1::model::GitFileSource;
7625 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7626 /// let x0 = GitFileSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7627 /// let x1 = GitFileSource::new().set_repo_type(RepoType::Github);
7628 /// let x2 = GitFileSource::new().set_repo_type(RepoType::BitbucketServer);
7629 /// ```
7630 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7631 mut self,
7632 v: T,
7633 ) -> Self {
7634 self.repo_type = v.into();
7635 self
7636 }
7637
7638 /// Sets the value of [revision][crate::model::GitFileSource::revision].
7639 ///
7640 /// # Example
7641 /// ```ignore,no_run
7642 /// # use google_cloud_build_v1::model::GitFileSource;
7643 /// let x = GitFileSource::new().set_revision("example");
7644 /// ```
7645 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7646 self.revision = v.into();
7647 self
7648 }
7649
7650 /// Sets the value of [source][crate::model::GitFileSource::source].
7651 ///
7652 /// Note that all the setters affecting `source` are mutually
7653 /// exclusive.
7654 ///
7655 /// # Example
7656 /// ```ignore,no_run
7657 /// # use google_cloud_build_v1::model::GitFileSource;
7658 /// use google_cloud_build_v1::model::git_file_source::Source;
7659 /// let x = GitFileSource::new().set_source(Some(Source::Repository("example".to_string())));
7660 /// ```
7661 pub fn set_source<
7662 T: std::convert::Into<std::option::Option<crate::model::git_file_source::Source>>,
7663 >(
7664 mut self,
7665 v: T,
7666 ) -> Self {
7667 self.source = v.into();
7668 self
7669 }
7670
7671 /// The value of [source][crate::model::GitFileSource::source]
7672 /// if it holds a `Repository`, `None` if the field is not set or
7673 /// holds a different branch.
7674 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7675 #[allow(unreachable_patterns)]
7676 self.source.as_ref().and_then(|v| match v {
7677 crate::model::git_file_source::Source::Repository(v) => std::option::Option::Some(v),
7678 _ => std::option::Option::None,
7679 })
7680 }
7681
7682 /// Sets the value of [source][crate::model::GitFileSource::source]
7683 /// to hold a `Repository`.
7684 ///
7685 /// Note that all the setters affecting `source` are
7686 /// mutually exclusive.
7687 ///
7688 /// # Example
7689 /// ```ignore,no_run
7690 /// # use google_cloud_build_v1::model::GitFileSource;
7691 /// let x = GitFileSource::new().set_repository("example");
7692 /// assert!(x.repository().is_some());
7693 /// ```
7694 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7695 self.source =
7696 std::option::Option::Some(crate::model::git_file_source::Source::Repository(v.into()));
7697 self
7698 }
7699
7700 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config].
7701 ///
7702 /// Note that all the setters affecting `enterprise_config` are mutually
7703 /// exclusive.
7704 ///
7705 /// # Example
7706 /// ```ignore,no_run
7707 /// # use google_cloud_build_v1::model::GitFileSource;
7708 /// use google_cloud_build_v1::model::git_file_source::EnterpriseConfig;
7709 /// let x = GitFileSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7710 /// ```
7711 pub fn set_enterprise_config<
7712 T: std::convert::Into<std::option::Option<crate::model::git_file_source::EnterpriseConfig>>,
7713 >(
7714 mut self,
7715 v: T,
7716 ) -> Self {
7717 self.enterprise_config = v.into();
7718 self
7719 }
7720
7721 /// The value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7722 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7723 /// holds a different branch.
7724 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7725 #[allow(unreachable_patterns)]
7726 self.enterprise_config.as_ref().and_then(|v| match v {
7727 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7728 std::option::Option::Some(v)
7729 }
7730 _ => std::option::Option::None,
7731 })
7732 }
7733
7734 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7735 /// to hold a `GithubEnterpriseConfig`.
7736 ///
7737 /// Note that all the setters affecting `enterprise_config` are
7738 /// mutually exclusive.
7739 ///
7740 /// # Example
7741 /// ```ignore,no_run
7742 /// # use google_cloud_build_v1::model::GitFileSource;
7743 /// let x = GitFileSource::new().set_github_enterprise_config("example");
7744 /// assert!(x.github_enterprise_config().is_some());
7745 /// ```
7746 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7747 mut self,
7748 v: T,
7749 ) -> Self {
7750 self.enterprise_config = std::option::Option::Some(
7751 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7752 );
7753 self
7754 }
7755}
7756
7757impl wkt::message::Message for GitFileSource {
7758 fn typename() -> &'static str {
7759 "type.googleapis.com/google.devtools.cloudbuild.v1.GitFileSource"
7760 }
7761}
7762
7763/// Defines additional types related to [GitFileSource].
7764pub mod git_file_source {
7765 #[allow(unused_imports)]
7766 use super::*;
7767
7768 /// The type of the repo, since it may not be explicit from the `repo` field
7769 /// (e.g from a URL).
7770 ///
7771 /// # Working with unknown values
7772 ///
7773 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7774 /// additional enum variants at any time. Adding new variants is not considered
7775 /// a breaking change. Applications should write their code in anticipation of:
7776 ///
7777 /// - New values appearing in future releases of the client library, **and**
7778 /// - New values received dynamically, without application changes.
7779 ///
7780 /// Please consult the [Working with enums] section in the user guide for some
7781 /// guidelines.
7782 ///
7783 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7784 #[derive(Clone, Debug, PartialEq)]
7785 #[non_exhaustive]
7786 pub enum RepoType {
7787 /// The default, unknown repo type. Don't use it, instead use one of
7788 /// the other repo types.
7789 Unknown,
7790 /// A Google Cloud Source Repositories-hosted repo.
7791 CloudSourceRepositories,
7792 /// A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub
7793 /// Enterprise).
7794 Github,
7795 /// A Bitbucket Server-hosted repo.
7796 BitbucketServer,
7797 /// A GitLab-hosted repo.
7798 Gitlab,
7799 /// If set, the enum was initialized with an unknown value.
7800 ///
7801 /// Applications can examine the value using [RepoType::value] or
7802 /// [RepoType::name].
7803 UnknownValue(repo_type::UnknownValue),
7804 }
7805
7806 #[doc(hidden)]
7807 pub mod repo_type {
7808 #[allow(unused_imports)]
7809 use super::*;
7810 #[derive(Clone, Debug, PartialEq)]
7811 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7812 }
7813
7814 impl RepoType {
7815 /// Gets the enum value.
7816 ///
7817 /// Returns `None` if the enum contains an unknown value deserialized from
7818 /// the string representation of enums.
7819 pub fn value(&self) -> std::option::Option<i32> {
7820 match self {
7821 Self::Unknown => std::option::Option::Some(0),
7822 Self::CloudSourceRepositories => std::option::Option::Some(1),
7823 Self::Github => std::option::Option::Some(2),
7824 Self::BitbucketServer => std::option::Option::Some(3),
7825 Self::Gitlab => std::option::Option::Some(4),
7826 Self::UnknownValue(u) => u.0.value(),
7827 }
7828 }
7829
7830 /// Gets the enum value as a string.
7831 ///
7832 /// Returns `None` if the enum contains an unknown value deserialized from
7833 /// the integer representation of enums.
7834 pub fn name(&self) -> std::option::Option<&str> {
7835 match self {
7836 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7837 Self::CloudSourceRepositories => {
7838 std::option::Option::Some("CLOUD_SOURCE_REPOSITORIES")
7839 }
7840 Self::Github => std::option::Option::Some("GITHUB"),
7841 Self::BitbucketServer => std::option::Option::Some("BITBUCKET_SERVER"),
7842 Self::Gitlab => std::option::Option::Some("GITLAB"),
7843 Self::UnknownValue(u) => u.0.name(),
7844 }
7845 }
7846 }
7847
7848 impl std::default::Default for RepoType {
7849 fn default() -> Self {
7850 use std::convert::From;
7851 Self::from(0)
7852 }
7853 }
7854
7855 impl std::fmt::Display for RepoType {
7856 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7857 wkt::internal::display_enum(f, self.name(), self.value())
7858 }
7859 }
7860
7861 impl std::convert::From<i32> for RepoType {
7862 fn from(value: i32) -> Self {
7863 match value {
7864 0 => Self::Unknown,
7865 1 => Self::CloudSourceRepositories,
7866 2 => Self::Github,
7867 3 => Self::BitbucketServer,
7868 4 => Self::Gitlab,
7869 _ => Self::UnknownValue(repo_type::UnknownValue(
7870 wkt::internal::UnknownEnumValue::Integer(value),
7871 )),
7872 }
7873 }
7874 }
7875
7876 impl std::convert::From<&str> for RepoType {
7877 fn from(value: &str) -> Self {
7878 use std::string::ToString;
7879 match value {
7880 "UNKNOWN" => Self::Unknown,
7881 "CLOUD_SOURCE_REPOSITORIES" => Self::CloudSourceRepositories,
7882 "GITHUB" => Self::Github,
7883 "BITBUCKET_SERVER" => Self::BitbucketServer,
7884 "GITLAB" => Self::Gitlab,
7885 _ => Self::UnknownValue(repo_type::UnknownValue(
7886 wkt::internal::UnknownEnumValue::String(value.to_string()),
7887 )),
7888 }
7889 }
7890 }
7891
7892 impl serde::ser::Serialize for RepoType {
7893 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7894 where
7895 S: serde::Serializer,
7896 {
7897 match self {
7898 Self::Unknown => serializer.serialize_i32(0),
7899 Self::CloudSourceRepositories => serializer.serialize_i32(1),
7900 Self::Github => serializer.serialize_i32(2),
7901 Self::BitbucketServer => serializer.serialize_i32(3),
7902 Self::Gitlab => serializer.serialize_i32(4),
7903 Self::UnknownValue(u) => u.0.serialize(serializer),
7904 }
7905 }
7906 }
7907
7908 impl<'de> serde::de::Deserialize<'de> for RepoType {
7909 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7910 where
7911 D: serde::Deserializer<'de>,
7912 {
7913 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepoType>::new(
7914 ".google.devtools.cloudbuild.v1.GitFileSource.RepoType",
7915 ))
7916 }
7917 }
7918
7919 /// The source of the SCM repo.
7920 #[derive(Clone, Debug, PartialEq)]
7921 #[non_exhaustive]
7922 pub enum Source {
7923 /// The fully qualified resource name of the Repos API repository.
7924 /// Either URI or repository can be specified.
7925 /// If unspecified, the repo from which the trigger invocation originated is
7926 /// assumed to be the repo from which to read the specified path.
7927 Repository(std::string::String),
7928 }
7929
7930 /// The resource name of the enterprise config that should be applied
7931 /// to this source.
7932 #[derive(Clone, Debug, PartialEq)]
7933 #[non_exhaustive]
7934 pub enum EnterpriseConfig {
7935 /// The full resource name of the github enterprise config.
7936 /// Format:
7937 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7938 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7939 GithubEnterpriseConfig(std::string::String),
7940 }
7941}
7942
7943/// Configuration for an automated build in response to source repository
7944/// changes.
7945#[derive(Clone, Default, PartialEq)]
7946#[non_exhaustive]
7947pub struct BuildTrigger {
7948 /// The `Trigger` name with format:
7949 /// `projects/{project}/locations/{location}/triggers/{trigger}`, where
7950 /// {trigger} is a unique identifier generated by the service.
7951 pub resource_name: std::string::String,
7952
7953 /// Output only. Unique identifier of the trigger.
7954 pub id: std::string::String,
7955
7956 /// Human-readable description of this trigger.
7957 pub description: std::string::String,
7958
7959 /// User-assigned name of the trigger. Must be unique within the project.
7960 /// Trigger names must meet the following requirements:
7961 ///
7962 /// + They must contain only alphanumeric characters and dashes.
7963 /// + They can be 1-64 characters long.
7964 /// + They must begin and end with an alphanumeric character.
7965 pub name: std::string::String,
7966
7967 /// Tags for annotation of a `BuildTrigger`
7968 pub tags: std::vec::Vec<std::string::String>,
7969
7970 /// Template describing the types of source changes to trigger a build.
7971 ///
7972 /// Branch and tag names in trigger templates are interpreted as regular
7973 /// expressions. Any branch or tag change that matches that regular expression
7974 /// will trigger a build.
7975 ///
7976 /// Mutually exclusive with `github`.
7977 pub trigger_template: std::option::Option<crate::model::RepoSource>,
7978
7979 /// GitHubEventsConfig describes the configuration of a trigger that creates
7980 /// a build whenever a GitHub event is received.
7981 ///
7982 /// Mutually exclusive with `trigger_template`.
7983 pub github: std::option::Option<crate::model::GitHubEventsConfig>,
7984
7985 /// PubsubConfig describes the configuration of a trigger that
7986 /// creates a build whenever a Pub/Sub message is published.
7987 pub pubsub_config: std::option::Option<crate::model::PubsubConfig>,
7988
7989 /// WebhookConfig describes the configuration of a trigger that
7990 /// creates a build whenever a webhook is sent to a trigger's webhook URL.
7991 pub webhook_config: std::option::Option<crate::model::WebhookConfig>,
7992
7993 /// Output only. Time when the trigger was created.
7994 pub create_time: std::option::Option<wkt::Timestamp>,
7995
7996 /// If true, the trigger will never automatically execute a build.
7997 pub disabled: bool,
7998
7999 /// Substitutions for Build resource. The keys must match the following
8000 /// regular expression: `^_[A-Z0-9_]+$`.
8001 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
8002
8003 /// ignored_files and included_files are file glob matches using
8004 /// <https://golang.org/pkg/path/filepath/#Match> extended with support for "**".
8005 ///
8006 /// If ignored_files and changed files are both empty, then they are
8007 /// not used to determine whether or not to trigger a build.
8008 ///
8009 /// If ignored_files is not empty, then we ignore any files that match
8010 /// any of the ignored_file globs. If the change has no files that are
8011 /// outside of the ignored_files globs, then we do not trigger a build.
8012 pub ignored_files: std::vec::Vec<std::string::String>,
8013
8014 /// If any of the files altered in the commit pass the ignored_files
8015 /// filter and included_files is empty, then as far as this filter is
8016 /// concerned, we should trigger the build.
8017 ///
8018 /// If any of the files altered in the commit pass the ignored_files
8019 /// filter and included_files is not empty, then we make sure that at
8020 /// least one of those files matches a included_files glob. If not,
8021 /// then we do not trigger a build.
8022 pub included_files: std::vec::Vec<std::string::String>,
8023
8024 /// Optional. A Common Expression Language string.
8025 pub filter: std::string::String,
8026
8027 /// The repo and ref of the repository from which to build. This field
8028 /// is used only for those triggers that do not respond to SCM events.
8029 /// Triggers that respond to such events build source at whatever commit
8030 /// caused the event.
8031 /// This field is currently only used by Webhook, Pub/Sub, Manual, and Cron
8032 /// triggers.
8033 pub source_to_build: std::option::Option<crate::model::GitRepoSource>,
8034
8035 /// The service account used for all user-controlled operations including
8036 /// UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
8037 /// If no service account is set and the legacy Cloud Build service account
8038 /// (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the
8039 /// project then it will be used instead.
8040 /// Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
8041 pub service_account: std::string::String,
8042
8043 /// The configuration of a trigger that creates a build whenever an event from
8044 /// Repo API is received.
8045 pub repository_event_config: std::option::Option<crate::model::RepositoryEventConfig>,
8046
8047 /// Template describing the Build request to make when the trigger is matched.
8048 /// At least one of the template fields must be provided.
8049 pub build_template: std::option::Option<crate::model::build_trigger::BuildTemplate>,
8050
8051 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8052}
8053
8054impl BuildTrigger {
8055 pub fn new() -> Self {
8056 std::default::Default::default()
8057 }
8058
8059 /// Sets the value of [resource_name][crate::model::BuildTrigger::resource_name].
8060 ///
8061 /// # Example
8062 /// ```ignore,no_run
8063 /// # use google_cloud_build_v1::model::BuildTrigger;
8064 /// let x = BuildTrigger::new().set_resource_name("example");
8065 /// ```
8066 pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8067 self.resource_name = v.into();
8068 self
8069 }
8070
8071 /// Sets the value of [id][crate::model::BuildTrigger::id].
8072 ///
8073 /// # Example
8074 /// ```ignore,no_run
8075 /// # use google_cloud_build_v1::model::BuildTrigger;
8076 /// let x = BuildTrigger::new().set_id("example");
8077 /// ```
8078 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8079 self.id = v.into();
8080 self
8081 }
8082
8083 /// Sets the value of [description][crate::model::BuildTrigger::description].
8084 ///
8085 /// # Example
8086 /// ```ignore,no_run
8087 /// # use google_cloud_build_v1::model::BuildTrigger;
8088 /// let x = BuildTrigger::new().set_description("example");
8089 /// ```
8090 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8091 self.description = v.into();
8092 self
8093 }
8094
8095 /// Sets the value of [name][crate::model::BuildTrigger::name].
8096 ///
8097 /// # Example
8098 /// ```ignore,no_run
8099 /// # use google_cloud_build_v1::model::BuildTrigger;
8100 /// let x = BuildTrigger::new().set_name("example");
8101 /// ```
8102 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8103 self.name = v.into();
8104 self
8105 }
8106
8107 /// Sets the value of [tags][crate::model::BuildTrigger::tags].
8108 ///
8109 /// # Example
8110 /// ```ignore,no_run
8111 /// # use google_cloud_build_v1::model::BuildTrigger;
8112 /// let x = BuildTrigger::new().set_tags(["a", "b", "c"]);
8113 /// ```
8114 pub fn set_tags<T, V>(mut self, v: T) -> Self
8115 where
8116 T: std::iter::IntoIterator<Item = V>,
8117 V: std::convert::Into<std::string::String>,
8118 {
8119 use std::iter::Iterator;
8120 self.tags = v.into_iter().map(|i| i.into()).collect();
8121 self
8122 }
8123
8124 /// Sets the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8125 ///
8126 /// # Example
8127 /// ```ignore,no_run
8128 /// # use google_cloud_build_v1::model::BuildTrigger;
8129 /// use google_cloud_build_v1::model::RepoSource;
8130 /// let x = BuildTrigger::new().set_trigger_template(RepoSource::default()/* use setters */);
8131 /// ```
8132 pub fn set_trigger_template<T>(mut self, v: T) -> Self
8133 where
8134 T: std::convert::Into<crate::model::RepoSource>,
8135 {
8136 self.trigger_template = std::option::Option::Some(v.into());
8137 self
8138 }
8139
8140 /// Sets or clears the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8141 ///
8142 /// # Example
8143 /// ```ignore,no_run
8144 /// # use google_cloud_build_v1::model::BuildTrigger;
8145 /// use google_cloud_build_v1::model::RepoSource;
8146 /// let x = BuildTrigger::new().set_or_clear_trigger_template(Some(RepoSource::default()/* use setters */));
8147 /// let x = BuildTrigger::new().set_or_clear_trigger_template(None::<RepoSource>);
8148 /// ```
8149 pub fn set_or_clear_trigger_template<T>(mut self, v: std::option::Option<T>) -> Self
8150 where
8151 T: std::convert::Into<crate::model::RepoSource>,
8152 {
8153 self.trigger_template = v.map(|x| x.into());
8154 self
8155 }
8156
8157 /// Sets the value of [github][crate::model::BuildTrigger::github].
8158 ///
8159 /// # Example
8160 /// ```ignore,no_run
8161 /// # use google_cloud_build_v1::model::BuildTrigger;
8162 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8163 /// let x = BuildTrigger::new().set_github(GitHubEventsConfig::default()/* use setters */);
8164 /// ```
8165 pub fn set_github<T>(mut self, v: T) -> Self
8166 where
8167 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8168 {
8169 self.github = std::option::Option::Some(v.into());
8170 self
8171 }
8172
8173 /// Sets or clears the value of [github][crate::model::BuildTrigger::github].
8174 ///
8175 /// # Example
8176 /// ```ignore,no_run
8177 /// # use google_cloud_build_v1::model::BuildTrigger;
8178 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8179 /// let x = BuildTrigger::new().set_or_clear_github(Some(GitHubEventsConfig::default()/* use setters */));
8180 /// let x = BuildTrigger::new().set_or_clear_github(None::<GitHubEventsConfig>);
8181 /// ```
8182 pub fn set_or_clear_github<T>(mut self, v: std::option::Option<T>) -> Self
8183 where
8184 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8185 {
8186 self.github = v.map(|x| x.into());
8187 self
8188 }
8189
8190 /// Sets the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8191 ///
8192 /// # Example
8193 /// ```ignore,no_run
8194 /// # use google_cloud_build_v1::model::BuildTrigger;
8195 /// use google_cloud_build_v1::model::PubsubConfig;
8196 /// let x = BuildTrigger::new().set_pubsub_config(PubsubConfig::default()/* use setters */);
8197 /// ```
8198 pub fn set_pubsub_config<T>(mut self, v: T) -> Self
8199 where
8200 T: std::convert::Into<crate::model::PubsubConfig>,
8201 {
8202 self.pubsub_config = std::option::Option::Some(v.into());
8203 self
8204 }
8205
8206 /// Sets or clears the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8207 ///
8208 /// # Example
8209 /// ```ignore,no_run
8210 /// # use google_cloud_build_v1::model::BuildTrigger;
8211 /// use google_cloud_build_v1::model::PubsubConfig;
8212 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(Some(PubsubConfig::default()/* use setters */));
8213 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(None::<PubsubConfig>);
8214 /// ```
8215 pub fn set_or_clear_pubsub_config<T>(mut self, v: std::option::Option<T>) -> Self
8216 where
8217 T: std::convert::Into<crate::model::PubsubConfig>,
8218 {
8219 self.pubsub_config = v.map(|x| x.into());
8220 self
8221 }
8222
8223 /// Sets the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8224 ///
8225 /// # Example
8226 /// ```ignore,no_run
8227 /// # use google_cloud_build_v1::model::BuildTrigger;
8228 /// use google_cloud_build_v1::model::WebhookConfig;
8229 /// let x = BuildTrigger::new().set_webhook_config(WebhookConfig::default()/* use setters */);
8230 /// ```
8231 pub fn set_webhook_config<T>(mut self, v: T) -> Self
8232 where
8233 T: std::convert::Into<crate::model::WebhookConfig>,
8234 {
8235 self.webhook_config = std::option::Option::Some(v.into());
8236 self
8237 }
8238
8239 /// Sets or clears the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8240 ///
8241 /// # Example
8242 /// ```ignore,no_run
8243 /// # use google_cloud_build_v1::model::BuildTrigger;
8244 /// use google_cloud_build_v1::model::WebhookConfig;
8245 /// let x = BuildTrigger::new().set_or_clear_webhook_config(Some(WebhookConfig::default()/* use setters */));
8246 /// let x = BuildTrigger::new().set_or_clear_webhook_config(None::<WebhookConfig>);
8247 /// ```
8248 pub fn set_or_clear_webhook_config<T>(mut self, v: std::option::Option<T>) -> Self
8249 where
8250 T: std::convert::Into<crate::model::WebhookConfig>,
8251 {
8252 self.webhook_config = v.map(|x| x.into());
8253 self
8254 }
8255
8256 /// Sets the value of [create_time][crate::model::BuildTrigger::create_time].
8257 ///
8258 /// # Example
8259 /// ```ignore,no_run
8260 /// # use google_cloud_build_v1::model::BuildTrigger;
8261 /// use wkt::Timestamp;
8262 /// let x = BuildTrigger::new().set_create_time(Timestamp::default()/* use setters */);
8263 /// ```
8264 pub fn set_create_time<T>(mut self, v: T) -> Self
8265 where
8266 T: std::convert::Into<wkt::Timestamp>,
8267 {
8268 self.create_time = std::option::Option::Some(v.into());
8269 self
8270 }
8271
8272 /// Sets or clears the value of [create_time][crate::model::BuildTrigger::create_time].
8273 ///
8274 /// # Example
8275 /// ```ignore,no_run
8276 /// # use google_cloud_build_v1::model::BuildTrigger;
8277 /// use wkt::Timestamp;
8278 /// let x = BuildTrigger::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8279 /// let x = BuildTrigger::new().set_or_clear_create_time(None::<Timestamp>);
8280 /// ```
8281 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8282 where
8283 T: std::convert::Into<wkt::Timestamp>,
8284 {
8285 self.create_time = v.map(|x| x.into());
8286 self
8287 }
8288
8289 /// Sets the value of [disabled][crate::model::BuildTrigger::disabled].
8290 ///
8291 /// # Example
8292 /// ```ignore,no_run
8293 /// # use google_cloud_build_v1::model::BuildTrigger;
8294 /// let x = BuildTrigger::new().set_disabled(true);
8295 /// ```
8296 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8297 self.disabled = v.into();
8298 self
8299 }
8300
8301 /// Sets the value of [substitutions][crate::model::BuildTrigger::substitutions].
8302 ///
8303 /// # Example
8304 /// ```ignore,no_run
8305 /// # use google_cloud_build_v1::model::BuildTrigger;
8306 /// let x = BuildTrigger::new().set_substitutions([
8307 /// ("key0", "abc"),
8308 /// ("key1", "xyz"),
8309 /// ]);
8310 /// ```
8311 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
8312 where
8313 T: std::iter::IntoIterator<Item = (K, V)>,
8314 K: std::convert::Into<std::string::String>,
8315 V: std::convert::Into<std::string::String>,
8316 {
8317 use std::iter::Iterator;
8318 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8319 self
8320 }
8321
8322 /// Sets the value of [ignored_files][crate::model::BuildTrigger::ignored_files].
8323 ///
8324 /// # Example
8325 /// ```ignore,no_run
8326 /// # use google_cloud_build_v1::model::BuildTrigger;
8327 /// let x = BuildTrigger::new().set_ignored_files(["a", "b", "c"]);
8328 /// ```
8329 pub fn set_ignored_files<T, V>(mut self, v: T) -> Self
8330 where
8331 T: std::iter::IntoIterator<Item = V>,
8332 V: std::convert::Into<std::string::String>,
8333 {
8334 use std::iter::Iterator;
8335 self.ignored_files = v.into_iter().map(|i| i.into()).collect();
8336 self
8337 }
8338
8339 /// Sets the value of [included_files][crate::model::BuildTrigger::included_files].
8340 ///
8341 /// # Example
8342 /// ```ignore,no_run
8343 /// # use google_cloud_build_v1::model::BuildTrigger;
8344 /// let x = BuildTrigger::new().set_included_files(["a", "b", "c"]);
8345 /// ```
8346 pub fn set_included_files<T, V>(mut self, v: T) -> Self
8347 where
8348 T: std::iter::IntoIterator<Item = V>,
8349 V: std::convert::Into<std::string::String>,
8350 {
8351 use std::iter::Iterator;
8352 self.included_files = v.into_iter().map(|i| i.into()).collect();
8353 self
8354 }
8355
8356 /// Sets the value of [filter][crate::model::BuildTrigger::filter].
8357 ///
8358 /// # Example
8359 /// ```ignore,no_run
8360 /// # use google_cloud_build_v1::model::BuildTrigger;
8361 /// let x = BuildTrigger::new().set_filter("example");
8362 /// ```
8363 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8364 self.filter = v.into();
8365 self
8366 }
8367
8368 /// Sets the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8369 ///
8370 /// # Example
8371 /// ```ignore,no_run
8372 /// # use google_cloud_build_v1::model::BuildTrigger;
8373 /// use google_cloud_build_v1::model::GitRepoSource;
8374 /// let x = BuildTrigger::new().set_source_to_build(GitRepoSource::default()/* use setters */);
8375 /// ```
8376 pub fn set_source_to_build<T>(mut self, v: T) -> Self
8377 where
8378 T: std::convert::Into<crate::model::GitRepoSource>,
8379 {
8380 self.source_to_build = std::option::Option::Some(v.into());
8381 self
8382 }
8383
8384 /// Sets or clears the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8385 ///
8386 /// # Example
8387 /// ```ignore,no_run
8388 /// # use google_cloud_build_v1::model::BuildTrigger;
8389 /// use google_cloud_build_v1::model::GitRepoSource;
8390 /// let x = BuildTrigger::new().set_or_clear_source_to_build(Some(GitRepoSource::default()/* use setters */));
8391 /// let x = BuildTrigger::new().set_or_clear_source_to_build(None::<GitRepoSource>);
8392 /// ```
8393 pub fn set_or_clear_source_to_build<T>(mut self, v: std::option::Option<T>) -> Self
8394 where
8395 T: std::convert::Into<crate::model::GitRepoSource>,
8396 {
8397 self.source_to_build = v.map(|x| x.into());
8398 self
8399 }
8400
8401 /// Sets the value of [service_account][crate::model::BuildTrigger::service_account].
8402 ///
8403 /// # Example
8404 /// ```ignore,no_run
8405 /// # use google_cloud_build_v1::model::BuildTrigger;
8406 /// let x = BuildTrigger::new().set_service_account("example");
8407 /// ```
8408 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8409 self.service_account = v.into();
8410 self
8411 }
8412
8413 /// Sets the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8414 ///
8415 /// # Example
8416 /// ```ignore,no_run
8417 /// # use google_cloud_build_v1::model::BuildTrigger;
8418 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8419 /// let x = BuildTrigger::new().set_repository_event_config(RepositoryEventConfig::default()/* use setters */);
8420 /// ```
8421 pub fn set_repository_event_config<T>(mut self, v: T) -> Self
8422 where
8423 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8424 {
8425 self.repository_event_config = std::option::Option::Some(v.into());
8426 self
8427 }
8428
8429 /// Sets or clears the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8430 ///
8431 /// # Example
8432 /// ```ignore,no_run
8433 /// # use google_cloud_build_v1::model::BuildTrigger;
8434 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8435 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(Some(RepositoryEventConfig::default()/* use setters */));
8436 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(None::<RepositoryEventConfig>);
8437 /// ```
8438 pub fn set_or_clear_repository_event_config<T>(mut self, v: std::option::Option<T>) -> Self
8439 where
8440 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8441 {
8442 self.repository_event_config = v.map(|x| x.into());
8443 self
8444 }
8445
8446 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template].
8447 ///
8448 /// Note that all the setters affecting `build_template` are mutually
8449 /// exclusive.
8450 ///
8451 /// # Example
8452 /// ```ignore,no_run
8453 /// # use google_cloud_build_v1::model::BuildTrigger;
8454 /// use google_cloud_build_v1::model::build_trigger::BuildTemplate;
8455 /// let x = BuildTrigger::new().set_build_template(Some(BuildTemplate::Autodetect(true)));
8456 /// ```
8457 pub fn set_build_template<
8458 T: std::convert::Into<std::option::Option<crate::model::build_trigger::BuildTemplate>>,
8459 >(
8460 mut self,
8461 v: T,
8462 ) -> Self {
8463 self.build_template = v.into();
8464 self
8465 }
8466
8467 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8468 /// if it holds a `Autodetect`, `None` if the field is not set or
8469 /// holds a different branch.
8470 pub fn autodetect(&self) -> std::option::Option<&bool> {
8471 #[allow(unreachable_patterns)]
8472 self.build_template.as_ref().and_then(|v| match v {
8473 crate::model::build_trigger::BuildTemplate::Autodetect(v) => {
8474 std::option::Option::Some(v)
8475 }
8476 _ => std::option::Option::None,
8477 })
8478 }
8479
8480 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8481 /// to hold a `Autodetect`.
8482 ///
8483 /// Note that all the setters affecting `build_template` are
8484 /// mutually exclusive.
8485 ///
8486 /// # Example
8487 /// ```ignore,no_run
8488 /// # use google_cloud_build_v1::model::BuildTrigger;
8489 /// let x = BuildTrigger::new().set_autodetect(true);
8490 /// assert!(x.autodetect().is_some());
8491 /// assert!(x.build().is_none());
8492 /// assert!(x.filename().is_none());
8493 /// assert!(x.git_file_source().is_none());
8494 /// ```
8495 pub fn set_autodetect<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8496 self.build_template = std::option::Option::Some(
8497 crate::model::build_trigger::BuildTemplate::Autodetect(v.into()),
8498 );
8499 self
8500 }
8501
8502 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8503 /// if it holds a `Build`, `None` if the field is not set or
8504 /// holds a different branch.
8505 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::Build>> {
8506 #[allow(unreachable_patterns)]
8507 self.build_template.as_ref().and_then(|v| match v {
8508 crate::model::build_trigger::BuildTemplate::Build(v) => std::option::Option::Some(v),
8509 _ => std::option::Option::None,
8510 })
8511 }
8512
8513 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8514 /// to hold a `Build`.
8515 ///
8516 /// Note that all the setters affecting `build_template` are
8517 /// mutually exclusive.
8518 ///
8519 /// # Example
8520 /// ```ignore,no_run
8521 /// # use google_cloud_build_v1::model::BuildTrigger;
8522 /// use google_cloud_build_v1::model::Build;
8523 /// let x = BuildTrigger::new().set_build(Build::default()/* use setters */);
8524 /// assert!(x.build().is_some());
8525 /// assert!(x.autodetect().is_none());
8526 /// assert!(x.filename().is_none());
8527 /// assert!(x.git_file_source().is_none());
8528 /// ```
8529 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::Build>>>(
8530 mut self,
8531 v: T,
8532 ) -> Self {
8533 self.build_template =
8534 std::option::Option::Some(crate::model::build_trigger::BuildTemplate::Build(v.into()));
8535 self
8536 }
8537
8538 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8539 /// if it holds a `Filename`, `None` if the field is not set or
8540 /// holds a different branch.
8541 pub fn filename(&self) -> std::option::Option<&std::string::String> {
8542 #[allow(unreachable_patterns)]
8543 self.build_template.as_ref().and_then(|v| match v {
8544 crate::model::build_trigger::BuildTemplate::Filename(v) => std::option::Option::Some(v),
8545 _ => std::option::Option::None,
8546 })
8547 }
8548
8549 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8550 /// to hold a `Filename`.
8551 ///
8552 /// Note that all the setters affecting `build_template` are
8553 /// mutually exclusive.
8554 ///
8555 /// # Example
8556 /// ```ignore,no_run
8557 /// # use google_cloud_build_v1::model::BuildTrigger;
8558 /// let x = BuildTrigger::new().set_filename("example");
8559 /// assert!(x.filename().is_some());
8560 /// assert!(x.autodetect().is_none());
8561 /// assert!(x.build().is_none());
8562 /// assert!(x.git_file_source().is_none());
8563 /// ```
8564 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8565 self.build_template = std::option::Option::Some(
8566 crate::model::build_trigger::BuildTemplate::Filename(v.into()),
8567 );
8568 self
8569 }
8570
8571 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8572 /// if it holds a `GitFileSource`, `None` if the field is not set or
8573 /// holds a different branch.
8574 pub fn git_file_source(
8575 &self,
8576 ) -> std::option::Option<&std::boxed::Box<crate::model::GitFileSource>> {
8577 #[allow(unreachable_patterns)]
8578 self.build_template.as_ref().and_then(|v| match v {
8579 crate::model::build_trigger::BuildTemplate::GitFileSource(v) => {
8580 std::option::Option::Some(v)
8581 }
8582 _ => std::option::Option::None,
8583 })
8584 }
8585
8586 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8587 /// to hold a `GitFileSource`.
8588 ///
8589 /// Note that all the setters affecting `build_template` are
8590 /// mutually exclusive.
8591 ///
8592 /// # Example
8593 /// ```ignore,no_run
8594 /// # use google_cloud_build_v1::model::BuildTrigger;
8595 /// use google_cloud_build_v1::model::GitFileSource;
8596 /// let x = BuildTrigger::new().set_git_file_source(GitFileSource::default()/* use setters */);
8597 /// assert!(x.git_file_source().is_some());
8598 /// assert!(x.autodetect().is_none());
8599 /// assert!(x.build().is_none());
8600 /// assert!(x.filename().is_none());
8601 /// ```
8602 pub fn set_git_file_source<
8603 T: std::convert::Into<std::boxed::Box<crate::model::GitFileSource>>,
8604 >(
8605 mut self,
8606 v: T,
8607 ) -> Self {
8608 self.build_template = std::option::Option::Some(
8609 crate::model::build_trigger::BuildTemplate::GitFileSource(v.into()),
8610 );
8611 self
8612 }
8613}
8614
8615impl wkt::message::Message for BuildTrigger {
8616 fn typename() -> &'static str {
8617 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildTrigger"
8618 }
8619}
8620
8621/// Defines additional types related to [BuildTrigger].
8622pub mod build_trigger {
8623 #[allow(unused_imports)]
8624 use super::*;
8625
8626 /// Template describing the Build request to make when the trigger is matched.
8627 /// At least one of the template fields must be provided.
8628 #[derive(Clone, Debug, PartialEq)]
8629 #[non_exhaustive]
8630 pub enum BuildTemplate {
8631 /// Autodetect build configuration. The following precedence is used (case
8632 /// insensitive):
8633 ///
8634 /// 1. cloudbuild.yaml
8635 /// 1. cloudbuild.yml
8636 /// 1. cloudbuild.json
8637 /// 1. Dockerfile
8638 ///
8639 /// Currently only available for GitHub App Triggers.
8640 Autodetect(bool),
8641 /// Contents of the build template.
8642 Build(std::boxed::Box<crate::model::Build>),
8643 /// Path, from the source root, to the build configuration file
8644 /// (i.e. cloudbuild.yaml).
8645 Filename(std::string::String),
8646 /// The file source describing the local or remote Build template.
8647 GitFileSource(std::boxed::Box<crate::model::GitFileSource>),
8648 }
8649}
8650
8651/// The configuration of a trigger that creates a build whenever an event from
8652/// Repo API is received.
8653#[derive(Clone, Default, PartialEq)]
8654#[non_exhaustive]
8655pub struct RepositoryEventConfig {
8656 /// The resource name of the Repo API resource.
8657 pub repository: std::string::String,
8658
8659 /// Output only. The type of the SCM vendor the repository points to.
8660 pub repository_type: crate::model::repository_event_config::RepositoryType,
8661
8662 /// The types of filter to trigger a build.
8663 pub filter: std::option::Option<crate::model::repository_event_config::Filter>,
8664
8665 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8666}
8667
8668impl RepositoryEventConfig {
8669 pub fn new() -> Self {
8670 std::default::Default::default()
8671 }
8672
8673 /// Sets the value of [repository][crate::model::RepositoryEventConfig::repository].
8674 ///
8675 /// # Example
8676 /// ```ignore,no_run
8677 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8678 /// let x = RepositoryEventConfig::new().set_repository("example");
8679 /// ```
8680 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8681 self.repository = v.into();
8682 self
8683 }
8684
8685 /// Sets the value of [repository_type][crate::model::RepositoryEventConfig::repository_type].
8686 ///
8687 /// # Example
8688 /// ```ignore,no_run
8689 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8690 /// use google_cloud_build_v1::model::repository_event_config::RepositoryType;
8691 /// let x0 = RepositoryEventConfig::new().set_repository_type(RepositoryType::Github);
8692 /// let x1 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GithubEnterprise);
8693 /// let x2 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GitlabEnterprise);
8694 /// ```
8695 pub fn set_repository_type<
8696 T: std::convert::Into<crate::model::repository_event_config::RepositoryType>,
8697 >(
8698 mut self,
8699 v: T,
8700 ) -> Self {
8701 self.repository_type = v.into();
8702 self
8703 }
8704
8705 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter].
8706 ///
8707 /// Note that all the setters affecting `filter` are mutually
8708 /// exclusive.
8709 ///
8710 /// # Example
8711 /// ```ignore,no_run
8712 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8713 /// use google_cloud_build_v1::model::PullRequestFilter;
8714 /// let x = RepositoryEventConfig::new().set_filter(Some(
8715 /// google_cloud_build_v1::model::repository_event_config::Filter::PullRequest(PullRequestFilter::default().into())));
8716 /// ```
8717 pub fn set_filter<
8718 T: std::convert::Into<std::option::Option<crate::model::repository_event_config::Filter>>,
8719 >(
8720 mut self,
8721 v: T,
8722 ) -> Self {
8723 self.filter = v.into();
8724 self
8725 }
8726
8727 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8728 /// if it holds a `PullRequest`, `None` if the field is not set or
8729 /// holds a different branch.
8730 pub fn pull_request(
8731 &self,
8732 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
8733 #[allow(unreachable_patterns)]
8734 self.filter.as_ref().and_then(|v| match v {
8735 crate::model::repository_event_config::Filter::PullRequest(v) => {
8736 std::option::Option::Some(v)
8737 }
8738 _ => std::option::Option::None,
8739 })
8740 }
8741
8742 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8743 /// to hold a `PullRequest`.
8744 ///
8745 /// Note that all the setters affecting `filter` are
8746 /// mutually exclusive.
8747 ///
8748 /// # Example
8749 /// ```ignore,no_run
8750 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8751 /// use google_cloud_build_v1::model::PullRequestFilter;
8752 /// let x = RepositoryEventConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
8753 /// assert!(x.pull_request().is_some());
8754 /// assert!(x.push().is_none());
8755 /// ```
8756 pub fn set_pull_request<
8757 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
8758 >(
8759 mut self,
8760 v: T,
8761 ) -> Self {
8762 self.filter = std::option::Option::Some(
8763 crate::model::repository_event_config::Filter::PullRequest(v.into()),
8764 );
8765 self
8766 }
8767
8768 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8769 /// if it holds a `Push`, `None` if the field is not set or
8770 /// holds a different branch.
8771 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
8772 #[allow(unreachable_patterns)]
8773 self.filter.as_ref().and_then(|v| match v {
8774 crate::model::repository_event_config::Filter::Push(v) => std::option::Option::Some(v),
8775 _ => std::option::Option::None,
8776 })
8777 }
8778
8779 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8780 /// to hold a `Push`.
8781 ///
8782 /// Note that all the setters affecting `filter` are
8783 /// mutually exclusive.
8784 ///
8785 /// # Example
8786 /// ```ignore,no_run
8787 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8788 /// use google_cloud_build_v1::model::PushFilter;
8789 /// let x = RepositoryEventConfig::new().set_push(PushFilter::default()/* use setters */);
8790 /// assert!(x.push().is_some());
8791 /// assert!(x.pull_request().is_none());
8792 /// ```
8793 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
8794 mut self,
8795 v: T,
8796 ) -> Self {
8797 self.filter = std::option::Option::Some(
8798 crate::model::repository_event_config::Filter::Push(v.into()),
8799 );
8800 self
8801 }
8802}
8803
8804impl wkt::message::Message for RepositoryEventConfig {
8805 fn typename() -> &'static str {
8806 "type.googleapis.com/google.devtools.cloudbuild.v1.RepositoryEventConfig"
8807 }
8808}
8809
8810/// Defines additional types related to [RepositoryEventConfig].
8811pub mod repository_event_config {
8812 #[allow(unused_imports)]
8813 use super::*;
8814
8815 /// All possible SCM repo types from Repo API.
8816 ///
8817 /// # Working with unknown values
8818 ///
8819 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8820 /// additional enum variants at any time. Adding new variants is not considered
8821 /// a breaking change. Applications should write their code in anticipation of:
8822 ///
8823 /// - New values appearing in future releases of the client library, **and**
8824 /// - New values received dynamically, without application changes.
8825 ///
8826 /// Please consult the [Working with enums] section in the user guide for some
8827 /// guidelines.
8828 ///
8829 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8830 #[derive(Clone, Debug, PartialEq)]
8831 #[non_exhaustive]
8832 pub enum RepositoryType {
8833 /// If unspecified, RepositoryType defaults to GITHUB.
8834 Unspecified,
8835 /// The SCM repo is GITHUB.
8836 Github,
8837 /// The SCM repo is GITHUB Enterprise.
8838 GithubEnterprise,
8839 /// The SCM repo is GITLAB Enterprise.
8840 GitlabEnterprise,
8841 /// If set, the enum was initialized with an unknown value.
8842 ///
8843 /// Applications can examine the value using [RepositoryType::value] or
8844 /// [RepositoryType::name].
8845 UnknownValue(repository_type::UnknownValue),
8846 }
8847
8848 #[doc(hidden)]
8849 pub mod repository_type {
8850 #[allow(unused_imports)]
8851 use super::*;
8852 #[derive(Clone, Debug, PartialEq)]
8853 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8854 }
8855
8856 impl RepositoryType {
8857 /// Gets the enum value.
8858 ///
8859 /// Returns `None` if the enum contains an unknown value deserialized from
8860 /// the string representation of enums.
8861 pub fn value(&self) -> std::option::Option<i32> {
8862 match self {
8863 Self::Unspecified => std::option::Option::Some(0),
8864 Self::Github => std::option::Option::Some(1),
8865 Self::GithubEnterprise => std::option::Option::Some(2),
8866 Self::GitlabEnterprise => std::option::Option::Some(3),
8867 Self::UnknownValue(u) => u.0.value(),
8868 }
8869 }
8870
8871 /// Gets the enum value as a string.
8872 ///
8873 /// Returns `None` if the enum contains an unknown value deserialized from
8874 /// the integer representation of enums.
8875 pub fn name(&self) -> std::option::Option<&str> {
8876 match self {
8877 Self::Unspecified => std::option::Option::Some("REPOSITORY_TYPE_UNSPECIFIED"),
8878 Self::Github => std::option::Option::Some("GITHUB"),
8879 Self::GithubEnterprise => std::option::Option::Some("GITHUB_ENTERPRISE"),
8880 Self::GitlabEnterprise => std::option::Option::Some("GITLAB_ENTERPRISE"),
8881 Self::UnknownValue(u) => u.0.name(),
8882 }
8883 }
8884 }
8885
8886 impl std::default::Default for RepositoryType {
8887 fn default() -> Self {
8888 use std::convert::From;
8889 Self::from(0)
8890 }
8891 }
8892
8893 impl std::fmt::Display for RepositoryType {
8894 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8895 wkt::internal::display_enum(f, self.name(), self.value())
8896 }
8897 }
8898
8899 impl std::convert::From<i32> for RepositoryType {
8900 fn from(value: i32) -> Self {
8901 match value {
8902 0 => Self::Unspecified,
8903 1 => Self::Github,
8904 2 => Self::GithubEnterprise,
8905 3 => Self::GitlabEnterprise,
8906 _ => Self::UnknownValue(repository_type::UnknownValue(
8907 wkt::internal::UnknownEnumValue::Integer(value),
8908 )),
8909 }
8910 }
8911 }
8912
8913 impl std::convert::From<&str> for RepositoryType {
8914 fn from(value: &str) -> Self {
8915 use std::string::ToString;
8916 match value {
8917 "REPOSITORY_TYPE_UNSPECIFIED" => Self::Unspecified,
8918 "GITHUB" => Self::Github,
8919 "GITHUB_ENTERPRISE" => Self::GithubEnterprise,
8920 "GITLAB_ENTERPRISE" => Self::GitlabEnterprise,
8921 _ => Self::UnknownValue(repository_type::UnknownValue(
8922 wkt::internal::UnknownEnumValue::String(value.to_string()),
8923 )),
8924 }
8925 }
8926 }
8927
8928 impl serde::ser::Serialize for RepositoryType {
8929 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8930 where
8931 S: serde::Serializer,
8932 {
8933 match self {
8934 Self::Unspecified => serializer.serialize_i32(0),
8935 Self::Github => serializer.serialize_i32(1),
8936 Self::GithubEnterprise => serializer.serialize_i32(2),
8937 Self::GitlabEnterprise => serializer.serialize_i32(3),
8938 Self::UnknownValue(u) => u.0.serialize(serializer),
8939 }
8940 }
8941 }
8942
8943 impl<'de> serde::de::Deserialize<'de> for RepositoryType {
8944 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8945 where
8946 D: serde::Deserializer<'de>,
8947 {
8948 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepositoryType>::new(
8949 ".google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType",
8950 ))
8951 }
8952 }
8953
8954 /// The types of filter to trigger a build.
8955 #[derive(Clone, Debug, PartialEq)]
8956 #[non_exhaustive]
8957 pub enum Filter {
8958 /// Filter to match changes in pull requests.
8959 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
8960 /// Filter to match changes in refs like branches, tags.
8961 Push(std::boxed::Box<crate::model::PushFilter>),
8962 }
8963}
8964
8965/// GitHubEventsConfig describes the configuration of a trigger that creates a
8966/// build whenever a GitHub event is received.
8967#[derive(Clone, Default, PartialEq)]
8968#[non_exhaustive]
8969pub struct GitHubEventsConfig {
8970 /// The installationID that emits the GitHub event.
8971 #[deprecated]
8972 pub installation_id: i64,
8973
8974 /// Owner of the repository. For example: The owner for
8975 /// <https://github.com/googlecloudplatform/cloud-builders> is
8976 /// "googlecloudplatform".
8977 pub owner: std::string::String,
8978
8979 /// Name of the repository. For example: The name for
8980 /// <https://github.com/googlecloudplatform/cloud-builders> is "cloud-builders".
8981 pub name: std::string::String,
8982
8983 /// Filter describing the types of events to trigger a build.
8984 /// Currently supported event types: push, pull_request.
8985 pub event: std::option::Option<crate::model::git_hub_events_config::Event>,
8986
8987 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8988}
8989
8990impl GitHubEventsConfig {
8991 pub fn new() -> Self {
8992 std::default::Default::default()
8993 }
8994
8995 /// Sets the value of [installation_id][crate::model::GitHubEventsConfig::installation_id].
8996 ///
8997 /// # Example
8998 /// ```ignore,no_run
8999 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9000 /// let x = GitHubEventsConfig::new().set_installation_id(42);
9001 /// ```
9002 #[deprecated]
9003 pub fn set_installation_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9004 self.installation_id = v.into();
9005 self
9006 }
9007
9008 /// Sets the value of [owner][crate::model::GitHubEventsConfig::owner].
9009 ///
9010 /// # Example
9011 /// ```ignore,no_run
9012 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9013 /// let x = GitHubEventsConfig::new().set_owner("example");
9014 /// ```
9015 pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9016 self.owner = v.into();
9017 self
9018 }
9019
9020 /// Sets the value of [name][crate::model::GitHubEventsConfig::name].
9021 ///
9022 /// # Example
9023 /// ```ignore,no_run
9024 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9025 /// let x = GitHubEventsConfig::new().set_name("example");
9026 /// ```
9027 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9028 self.name = v.into();
9029 self
9030 }
9031
9032 /// Sets the value of [event][crate::model::GitHubEventsConfig::event].
9033 ///
9034 /// Note that all the setters affecting `event` are mutually
9035 /// exclusive.
9036 ///
9037 /// # Example
9038 /// ```ignore,no_run
9039 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9040 /// use google_cloud_build_v1::model::PullRequestFilter;
9041 /// let x = GitHubEventsConfig::new().set_event(Some(
9042 /// google_cloud_build_v1::model::git_hub_events_config::Event::PullRequest(PullRequestFilter::default().into())));
9043 /// ```
9044 pub fn set_event<
9045 T: std::convert::Into<std::option::Option<crate::model::git_hub_events_config::Event>>,
9046 >(
9047 mut self,
9048 v: T,
9049 ) -> Self {
9050 self.event = v.into();
9051 self
9052 }
9053
9054 /// The value of [event][crate::model::GitHubEventsConfig::event]
9055 /// if it holds a `PullRequest`, `None` if the field is not set or
9056 /// holds a different branch.
9057 pub fn pull_request(
9058 &self,
9059 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
9060 #[allow(unreachable_patterns)]
9061 self.event.as_ref().and_then(|v| match v {
9062 crate::model::git_hub_events_config::Event::PullRequest(v) => {
9063 std::option::Option::Some(v)
9064 }
9065 _ => std::option::Option::None,
9066 })
9067 }
9068
9069 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9070 /// to hold a `PullRequest`.
9071 ///
9072 /// Note that all the setters affecting `event` are
9073 /// mutually exclusive.
9074 ///
9075 /// # Example
9076 /// ```ignore,no_run
9077 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9078 /// use google_cloud_build_v1::model::PullRequestFilter;
9079 /// let x = GitHubEventsConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
9080 /// assert!(x.pull_request().is_some());
9081 /// assert!(x.push().is_none());
9082 /// ```
9083 pub fn set_pull_request<
9084 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
9085 >(
9086 mut self,
9087 v: T,
9088 ) -> Self {
9089 self.event = std::option::Option::Some(
9090 crate::model::git_hub_events_config::Event::PullRequest(v.into()),
9091 );
9092 self
9093 }
9094
9095 /// The value of [event][crate::model::GitHubEventsConfig::event]
9096 /// if it holds a `Push`, `None` if the field is not set or
9097 /// holds a different branch.
9098 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
9099 #[allow(unreachable_patterns)]
9100 self.event.as_ref().and_then(|v| match v {
9101 crate::model::git_hub_events_config::Event::Push(v) => std::option::Option::Some(v),
9102 _ => std::option::Option::None,
9103 })
9104 }
9105
9106 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9107 /// to hold a `Push`.
9108 ///
9109 /// Note that all the setters affecting `event` are
9110 /// mutually exclusive.
9111 ///
9112 /// # Example
9113 /// ```ignore,no_run
9114 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9115 /// use google_cloud_build_v1::model::PushFilter;
9116 /// let x = GitHubEventsConfig::new().set_push(PushFilter::default()/* use setters */);
9117 /// assert!(x.push().is_some());
9118 /// assert!(x.pull_request().is_none());
9119 /// ```
9120 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
9121 mut self,
9122 v: T,
9123 ) -> Self {
9124 self.event =
9125 std::option::Option::Some(crate::model::git_hub_events_config::Event::Push(v.into()));
9126 self
9127 }
9128}
9129
9130impl wkt::message::Message for GitHubEventsConfig {
9131 fn typename() -> &'static str {
9132 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEventsConfig"
9133 }
9134}
9135
9136/// Defines additional types related to [GitHubEventsConfig].
9137pub mod git_hub_events_config {
9138 #[allow(unused_imports)]
9139 use super::*;
9140
9141 /// Filter describing the types of events to trigger a build.
9142 /// Currently supported event types: push, pull_request.
9143 #[derive(Clone, Debug, PartialEq)]
9144 #[non_exhaustive]
9145 pub enum Event {
9146 /// filter to match changes in pull requests.
9147 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9148 /// filter to match changes in refs like branches, tags.
9149 Push(std::boxed::Box<crate::model::PushFilter>),
9150 }
9151}
9152
9153/// PubsubConfig describes the configuration of a trigger that
9154/// creates a build whenever a Pub/Sub message is published.
9155#[derive(Clone, Default, PartialEq)]
9156#[non_exhaustive]
9157pub struct PubsubConfig {
9158 /// Output only. Name of the subscription. Format is
9159 /// `projects/{project}/subscriptions/{subscription}`.
9160 pub subscription: std::string::String,
9161
9162 /// Optional. The name of the topic from which this subscription is receiving
9163 /// messages. Format is `projects/{project}/topics/{topic}`.
9164 pub topic: std::string::String,
9165
9166 /// Service account that will make the push request.
9167 pub service_account_email: std::string::String,
9168
9169 /// Potential issues with the underlying Pub/Sub subscription configuration.
9170 /// Only populated on get requests.
9171 pub state: crate::model::pubsub_config::State,
9172
9173 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9174}
9175
9176impl PubsubConfig {
9177 pub fn new() -> Self {
9178 std::default::Default::default()
9179 }
9180
9181 /// Sets the value of [subscription][crate::model::PubsubConfig::subscription].
9182 ///
9183 /// # Example
9184 /// ```ignore,no_run
9185 /// # use google_cloud_build_v1::model::PubsubConfig;
9186 /// let x = PubsubConfig::new().set_subscription("example");
9187 /// ```
9188 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9189 self.subscription = v.into();
9190 self
9191 }
9192
9193 /// Sets the value of [topic][crate::model::PubsubConfig::topic].
9194 ///
9195 /// # Example
9196 /// ```ignore,no_run
9197 /// # use google_cloud_build_v1::model::PubsubConfig;
9198 /// let x = PubsubConfig::new().set_topic("example");
9199 /// ```
9200 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9201 self.topic = v.into();
9202 self
9203 }
9204
9205 /// Sets the value of [service_account_email][crate::model::PubsubConfig::service_account_email].
9206 ///
9207 /// # Example
9208 /// ```ignore,no_run
9209 /// # use google_cloud_build_v1::model::PubsubConfig;
9210 /// let x = PubsubConfig::new().set_service_account_email("example");
9211 /// ```
9212 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
9213 mut self,
9214 v: T,
9215 ) -> Self {
9216 self.service_account_email = v.into();
9217 self
9218 }
9219
9220 /// Sets the value of [state][crate::model::PubsubConfig::state].
9221 ///
9222 /// # Example
9223 /// ```ignore,no_run
9224 /// # use google_cloud_build_v1::model::PubsubConfig;
9225 /// use google_cloud_build_v1::model::pubsub_config::State;
9226 /// let x0 = PubsubConfig::new().set_state(State::Ok);
9227 /// let x1 = PubsubConfig::new().set_state(State::SubscriptionDeleted);
9228 /// let x2 = PubsubConfig::new().set_state(State::TopicDeleted);
9229 /// ```
9230 pub fn set_state<T: std::convert::Into<crate::model::pubsub_config::State>>(
9231 mut self,
9232 v: T,
9233 ) -> Self {
9234 self.state = v.into();
9235 self
9236 }
9237}
9238
9239impl wkt::message::Message for PubsubConfig {
9240 fn typename() -> &'static str {
9241 "type.googleapis.com/google.devtools.cloudbuild.v1.PubsubConfig"
9242 }
9243}
9244
9245/// Defines additional types related to [PubsubConfig].
9246pub mod pubsub_config {
9247 #[allow(unused_imports)]
9248 use super::*;
9249
9250 /// Enumerates potential issues with the underlying Pub/Sub subscription
9251 /// configuration.
9252 ///
9253 /// # Working with unknown values
9254 ///
9255 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9256 /// additional enum variants at any time. Adding new variants is not considered
9257 /// a breaking change. Applications should write their code in anticipation of:
9258 ///
9259 /// - New values appearing in future releases of the client library, **and**
9260 /// - New values received dynamically, without application changes.
9261 ///
9262 /// Please consult the [Working with enums] section in the user guide for some
9263 /// guidelines.
9264 ///
9265 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9266 #[derive(Clone, Debug, PartialEq)]
9267 #[non_exhaustive]
9268 pub enum State {
9269 /// The subscription configuration has not been checked.
9270 Unspecified,
9271 /// The Pub/Sub subscription is properly configured.
9272 Ok,
9273 /// The subscription has been deleted.
9274 SubscriptionDeleted,
9275 /// The topic has been deleted.
9276 TopicDeleted,
9277 /// Some of the subscription's field are misconfigured.
9278 SubscriptionMisconfigured,
9279 /// If set, the enum was initialized with an unknown value.
9280 ///
9281 /// Applications can examine the value using [State::value] or
9282 /// [State::name].
9283 UnknownValue(state::UnknownValue),
9284 }
9285
9286 #[doc(hidden)]
9287 pub mod state {
9288 #[allow(unused_imports)]
9289 use super::*;
9290 #[derive(Clone, Debug, PartialEq)]
9291 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9292 }
9293
9294 impl State {
9295 /// Gets the enum value.
9296 ///
9297 /// Returns `None` if the enum contains an unknown value deserialized from
9298 /// the string representation of enums.
9299 pub fn value(&self) -> std::option::Option<i32> {
9300 match self {
9301 Self::Unspecified => std::option::Option::Some(0),
9302 Self::Ok => std::option::Option::Some(1),
9303 Self::SubscriptionDeleted => std::option::Option::Some(2),
9304 Self::TopicDeleted => std::option::Option::Some(3),
9305 Self::SubscriptionMisconfigured => std::option::Option::Some(4),
9306 Self::UnknownValue(u) => u.0.value(),
9307 }
9308 }
9309
9310 /// Gets the enum value as a string.
9311 ///
9312 /// Returns `None` if the enum contains an unknown value deserialized from
9313 /// the integer representation of enums.
9314 pub fn name(&self) -> std::option::Option<&str> {
9315 match self {
9316 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9317 Self::Ok => std::option::Option::Some("OK"),
9318 Self::SubscriptionDeleted => std::option::Option::Some("SUBSCRIPTION_DELETED"),
9319 Self::TopicDeleted => std::option::Option::Some("TOPIC_DELETED"),
9320 Self::SubscriptionMisconfigured => {
9321 std::option::Option::Some("SUBSCRIPTION_MISCONFIGURED")
9322 }
9323 Self::UnknownValue(u) => u.0.name(),
9324 }
9325 }
9326 }
9327
9328 impl std::default::Default for State {
9329 fn default() -> Self {
9330 use std::convert::From;
9331 Self::from(0)
9332 }
9333 }
9334
9335 impl std::fmt::Display for State {
9336 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9337 wkt::internal::display_enum(f, self.name(), self.value())
9338 }
9339 }
9340
9341 impl std::convert::From<i32> for State {
9342 fn from(value: i32) -> Self {
9343 match value {
9344 0 => Self::Unspecified,
9345 1 => Self::Ok,
9346 2 => Self::SubscriptionDeleted,
9347 3 => Self::TopicDeleted,
9348 4 => Self::SubscriptionMisconfigured,
9349 _ => Self::UnknownValue(state::UnknownValue(
9350 wkt::internal::UnknownEnumValue::Integer(value),
9351 )),
9352 }
9353 }
9354 }
9355
9356 impl std::convert::From<&str> for State {
9357 fn from(value: &str) -> Self {
9358 use std::string::ToString;
9359 match value {
9360 "STATE_UNSPECIFIED" => Self::Unspecified,
9361 "OK" => Self::Ok,
9362 "SUBSCRIPTION_DELETED" => Self::SubscriptionDeleted,
9363 "TOPIC_DELETED" => Self::TopicDeleted,
9364 "SUBSCRIPTION_MISCONFIGURED" => Self::SubscriptionMisconfigured,
9365 _ => Self::UnknownValue(state::UnknownValue(
9366 wkt::internal::UnknownEnumValue::String(value.to_string()),
9367 )),
9368 }
9369 }
9370 }
9371
9372 impl serde::ser::Serialize for State {
9373 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9374 where
9375 S: serde::Serializer,
9376 {
9377 match self {
9378 Self::Unspecified => serializer.serialize_i32(0),
9379 Self::Ok => serializer.serialize_i32(1),
9380 Self::SubscriptionDeleted => serializer.serialize_i32(2),
9381 Self::TopicDeleted => serializer.serialize_i32(3),
9382 Self::SubscriptionMisconfigured => serializer.serialize_i32(4),
9383 Self::UnknownValue(u) => u.0.serialize(serializer),
9384 }
9385 }
9386 }
9387
9388 impl<'de> serde::de::Deserialize<'de> for State {
9389 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9390 where
9391 D: serde::Deserializer<'de>,
9392 {
9393 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9394 ".google.devtools.cloudbuild.v1.PubsubConfig.State",
9395 ))
9396 }
9397 }
9398}
9399
9400/// WebhookConfig describes the configuration of a trigger that
9401/// creates a build whenever a webhook is sent to a trigger's webhook URL.
9402#[derive(Clone, Default, PartialEq)]
9403#[non_exhaustive]
9404pub struct WebhookConfig {
9405 /// Potential issues with the underlying Pub/Sub subscription configuration.
9406 /// Only populated on get requests.
9407 pub state: crate::model::webhook_config::State,
9408
9409 /// Auth method specifies how the webhook authenticates with GCP.
9410 pub auth_method: std::option::Option<crate::model::webhook_config::AuthMethod>,
9411
9412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9413}
9414
9415impl WebhookConfig {
9416 pub fn new() -> Self {
9417 std::default::Default::default()
9418 }
9419
9420 /// Sets the value of [state][crate::model::WebhookConfig::state].
9421 ///
9422 /// # Example
9423 /// ```ignore,no_run
9424 /// # use google_cloud_build_v1::model::WebhookConfig;
9425 /// use google_cloud_build_v1::model::webhook_config::State;
9426 /// let x0 = WebhookConfig::new().set_state(State::Ok);
9427 /// let x1 = WebhookConfig::new().set_state(State::SecretDeleted);
9428 /// ```
9429 pub fn set_state<T: std::convert::Into<crate::model::webhook_config::State>>(
9430 mut self,
9431 v: T,
9432 ) -> Self {
9433 self.state = v.into();
9434 self
9435 }
9436
9437 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method].
9438 ///
9439 /// Note that all the setters affecting `auth_method` are mutually
9440 /// exclusive.
9441 ///
9442 /// # Example
9443 /// ```ignore,no_run
9444 /// # use google_cloud_build_v1::model::WebhookConfig;
9445 /// use google_cloud_build_v1::model::webhook_config::AuthMethod;
9446 /// let x = WebhookConfig::new().set_auth_method(Some(AuthMethod::Secret("example".to_string())));
9447 /// ```
9448 pub fn set_auth_method<
9449 T: std::convert::Into<std::option::Option<crate::model::webhook_config::AuthMethod>>,
9450 >(
9451 mut self,
9452 v: T,
9453 ) -> Self {
9454 self.auth_method = v.into();
9455 self
9456 }
9457
9458 /// The value of [auth_method][crate::model::WebhookConfig::auth_method]
9459 /// if it holds a `Secret`, `None` if the field is not set or
9460 /// holds a different branch.
9461 pub fn secret(&self) -> std::option::Option<&std::string::String> {
9462 #[allow(unreachable_patterns)]
9463 self.auth_method.as_ref().and_then(|v| match v {
9464 crate::model::webhook_config::AuthMethod::Secret(v) => std::option::Option::Some(v),
9465 _ => std::option::Option::None,
9466 })
9467 }
9468
9469 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method]
9470 /// to hold a `Secret`.
9471 ///
9472 /// Note that all the setters affecting `auth_method` are
9473 /// mutually exclusive.
9474 ///
9475 /// # Example
9476 /// ```ignore,no_run
9477 /// # use google_cloud_build_v1::model::WebhookConfig;
9478 /// let x = WebhookConfig::new().set_secret("example");
9479 /// assert!(x.secret().is_some());
9480 /// ```
9481 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9482 self.auth_method =
9483 std::option::Option::Some(crate::model::webhook_config::AuthMethod::Secret(v.into()));
9484 self
9485 }
9486}
9487
9488impl wkt::message::Message for WebhookConfig {
9489 fn typename() -> &'static str {
9490 "type.googleapis.com/google.devtools.cloudbuild.v1.WebhookConfig"
9491 }
9492}
9493
9494/// Defines additional types related to [WebhookConfig].
9495pub mod webhook_config {
9496 #[allow(unused_imports)]
9497 use super::*;
9498
9499 /// Enumerates potential issues with the Secret Manager secret provided by the
9500 /// user.
9501 ///
9502 /// # Working with unknown values
9503 ///
9504 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9505 /// additional enum variants at any time. Adding new variants is not considered
9506 /// a breaking change. Applications should write their code in anticipation of:
9507 ///
9508 /// - New values appearing in future releases of the client library, **and**
9509 /// - New values received dynamically, without application changes.
9510 ///
9511 /// Please consult the [Working with enums] section in the user guide for some
9512 /// guidelines.
9513 ///
9514 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9515 #[derive(Clone, Debug, PartialEq)]
9516 #[non_exhaustive]
9517 pub enum State {
9518 /// The webhook auth configuration not been checked.
9519 Unspecified,
9520 /// The auth configuration is properly setup.
9521 Ok,
9522 /// The secret provided in auth_method has been deleted.
9523 SecretDeleted,
9524 /// If set, the enum was initialized with an unknown value.
9525 ///
9526 /// Applications can examine the value using [State::value] or
9527 /// [State::name].
9528 UnknownValue(state::UnknownValue),
9529 }
9530
9531 #[doc(hidden)]
9532 pub mod state {
9533 #[allow(unused_imports)]
9534 use super::*;
9535 #[derive(Clone, Debug, PartialEq)]
9536 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9537 }
9538
9539 impl State {
9540 /// Gets the enum value.
9541 ///
9542 /// Returns `None` if the enum contains an unknown value deserialized from
9543 /// the string representation of enums.
9544 pub fn value(&self) -> std::option::Option<i32> {
9545 match self {
9546 Self::Unspecified => std::option::Option::Some(0),
9547 Self::Ok => std::option::Option::Some(1),
9548 Self::SecretDeleted => std::option::Option::Some(2),
9549 Self::UnknownValue(u) => u.0.value(),
9550 }
9551 }
9552
9553 /// Gets the enum value as a string.
9554 ///
9555 /// Returns `None` if the enum contains an unknown value deserialized from
9556 /// the integer representation of enums.
9557 pub fn name(&self) -> std::option::Option<&str> {
9558 match self {
9559 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9560 Self::Ok => std::option::Option::Some("OK"),
9561 Self::SecretDeleted => std::option::Option::Some("SECRET_DELETED"),
9562 Self::UnknownValue(u) => u.0.name(),
9563 }
9564 }
9565 }
9566
9567 impl std::default::Default for State {
9568 fn default() -> Self {
9569 use std::convert::From;
9570 Self::from(0)
9571 }
9572 }
9573
9574 impl std::fmt::Display for State {
9575 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9576 wkt::internal::display_enum(f, self.name(), self.value())
9577 }
9578 }
9579
9580 impl std::convert::From<i32> for State {
9581 fn from(value: i32) -> Self {
9582 match value {
9583 0 => Self::Unspecified,
9584 1 => Self::Ok,
9585 2 => Self::SecretDeleted,
9586 _ => Self::UnknownValue(state::UnknownValue(
9587 wkt::internal::UnknownEnumValue::Integer(value),
9588 )),
9589 }
9590 }
9591 }
9592
9593 impl std::convert::From<&str> for State {
9594 fn from(value: &str) -> Self {
9595 use std::string::ToString;
9596 match value {
9597 "STATE_UNSPECIFIED" => Self::Unspecified,
9598 "OK" => Self::Ok,
9599 "SECRET_DELETED" => Self::SecretDeleted,
9600 _ => Self::UnknownValue(state::UnknownValue(
9601 wkt::internal::UnknownEnumValue::String(value.to_string()),
9602 )),
9603 }
9604 }
9605 }
9606
9607 impl serde::ser::Serialize for State {
9608 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9609 where
9610 S: serde::Serializer,
9611 {
9612 match self {
9613 Self::Unspecified => serializer.serialize_i32(0),
9614 Self::Ok => serializer.serialize_i32(1),
9615 Self::SecretDeleted => serializer.serialize_i32(2),
9616 Self::UnknownValue(u) => u.0.serialize(serializer),
9617 }
9618 }
9619 }
9620
9621 impl<'de> serde::de::Deserialize<'de> for State {
9622 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9623 where
9624 D: serde::Deserializer<'de>,
9625 {
9626 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9627 ".google.devtools.cloudbuild.v1.WebhookConfig.State",
9628 ))
9629 }
9630 }
9631
9632 /// Auth method specifies how the webhook authenticates with GCP.
9633 #[derive(Clone, Debug, PartialEq)]
9634 #[non_exhaustive]
9635 pub enum AuthMethod {
9636 /// Required. Resource name for the secret required as a URL parameter.
9637 Secret(std::string::String),
9638 }
9639}
9640
9641/// PullRequestFilter contains filter properties for matching GitHub Pull
9642/// Requests.
9643#[derive(Clone, Default, PartialEq)]
9644#[non_exhaustive]
9645pub struct PullRequestFilter {
9646 /// If CommentControl is enabled, depending on the setting, builds may not
9647 /// fire until a repository writer comments `/gcbrun` on a pull
9648 /// request or `/gcbrun` is in the pull request description.
9649 /// Only PR comments that contain `/gcbrun` will trigger builds.
9650 ///
9651 /// If CommentControl is set to disabled, comments with `/gcbrun` from a user
9652 /// with repository write permission or above will
9653 /// still trigger builds to run.
9654 pub comment_control: crate::model::pull_request_filter::CommentControl,
9655
9656 /// If true, branches that do NOT match the git_ref will trigger a build.
9657 pub invert_regex: bool,
9658
9659 /// Target refs to match.
9660 /// A target ref is the git reference where the pull request will be applied.
9661 pub git_ref: std::option::Option<crate::model::pull_request_filter::GitRef>,
9662
9663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9664}
9665
9666impl PullRequestFilter {
9667 pub fn new() -> Self {
9668 std::default::Default::default()
9669 }
9670
9671 /// Sets the value of [comment_control][crate::model::PullRequestFilter::comment_control].
9672 ///
9673 /// # Example
9674 /// ```ignore,no_run
9675 /// # use google_cloud_build_v1::model::PullRequestFilter;
9676 /// use google_cloud_build_v1::model::pull_request_filter::CommentControl;
9677 /// let x0 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabled);
9678 /// let x1 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabledForExternalContributorsOnly);
9679 /// ```
9680 pub fn set_comment_control<
9681 T: std::convert::Into<crate::model::pull_request_filter::CommentControl>,
9682 >(
9683 mut self,
9684 v: T,
9685 ) -> Self {
9686 self.comment_control = v.into();
9687 self
9688 }
9689
9690 /// Sets the value of [invert_regex][crate::model::PullRequestFilter::invert_regex].
9691 ///
9692 /// # Example
9693 /// ```ignore,no_run
9694 /// # use google_cloud_build_v1::model::PullRequestFilter;
9695 /// let x = PullRequestFilter::new().set_invert_regex(true);
9696 /// ```
9697 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9698 self.invert_regex = v.into();
9699 self
9700 }
9701
9702 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref].
9703 ///
9704 /// Note that all the setters affecting `git_ref` are mutually
9705 /// exclusive.
9706 ///
9707 /// # Example
9708 /// ```ignore,no_run
9709 /// # use google_cloud_build_v1::model::PullRequestFilter;
9710 /// use google_cloud_build_v1::model::pull_request_filter::GitRef;
9711 /// let x = PullRequestFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9712 /// ```
9713 pub fn set_git_ref<
9714 T: std::convert::Into<std::option::Option<crate::model::pull_request_filter::GitRef>>,
9715 >(
9716 mut self,
9717 v: T,
9718 ) -> Self {
9719 self.git_ref = v.into();
9720 self
9721 }
9722
9723 /// The value of [git_ref][crate::model::PullRequestFilter::git_ref]
9724 /// if it holds a `Branch`, `None` if the field is not set or
9725 /// holds a different branch.
9726 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9727 #[allow(unreachable_patterns)]
9728 self.git_ref.as_ref().and_then(|v| match v {
9729 crate::model::pull_request_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9730 _ => std::option::Option::None,
9731 })
9732 }
9733
9734 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref]
9735 /// to hold a `Branch`.
9736 ///
9737 /// Note that all the setters affecting `git_ref` are
9738 /// mutually exclusive.
9739 ///
9740 /// # Example
9741 /// ```ignore,no_run
9742 /// # use google_cloud_build_v1::model::PullRequestFilter;
9743 /// let x = PullRequestFilter::new().set_branch("example");
9744 /// assert!(x.branch().is_some());
9745 /// ```
9746 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9747 self.git_ref =
9748 std::option::Option::Some(crate::model::pull_request_filter::GitRef::Branch(v.into()));
9749 self
9750 }
9751}
9752
9753impl wkt::message::Message for PullRequestFilter {
9754 fn typename() -> &'static str {
9755 "type.googleapis.com/google.devtools.cloudbuild.v1.PullRequestFilter"
9756 }
9757}
9758
9759/// Defines additional types related to [PullRequestFilter].
9760pub mod pull_request_filter {
9761 #[allow(unused_imports)]
9762 use super::*;
9763
9764 /// Controls whether or not a `/gcbrun` comment is required from a user with
9765 /// repository write permission or above in order to
9766 /// trigger Build runs for pull requests. Pull Request update events differ
9767 /// between repo types.
9768 /// Check repo specific guides
9769 /// ([GitHub](https://cloud.google.com/build/docs/automating-builds/github/build-repos-from-github-enterprise#creating_a_github_enterprise_trigger),
9770 /// [Bitbucket](https://cloud.google.com/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-server#creating_a_bitbucket_server_trigger),
9771 /// [GitLab](https://cloud.google.com/build/docs/automating-builds/gitlab/build-repos-from-gitlab#creating_a_gitlab_trigger)
9772 /// for details.
9773 ///
9774 /// # Working with unknown values
9775 ///
9776 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9777 /// additional enum variants at any time. Adding new variants is not considered
9778 /// a breaking change. Applications should write their code in anticipation of:
9779 ///
9780 /// - New values appearing in future releases of the client library, **and**
9781 /// - New values received dynamically, without application changes.
9782 ///
9783 /// Please consult the [Working with enums] section in the user guide for some
9784 /// guidelines.
9785 ///
9786 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9787 #[derive(Clone, Debug, PartialEq)]
9788 #[non_exhaustive]
9789 pub enum CommentControl {
9790 /// Do not require `/gcbrun` comments from a user with repository write
9791 /// permission or above on pull requests before builds are triggered.
9792 /// Comments that contain `/gcbrun` will still fire builds so this should
9793 /// be thought of as comments not required.
9794 CommentsDisabled,
9795 /// Builds will only fire in response to pull requests if:
9796 ///
9797 /// 1. The pull request author has repository write permission or above and
9798 /// `/gcbrun` is in the PR description.
9799 /// 1. A user with repository writer permissions or above comments `/gcbrun`
9800 /// on a pull request authored by any user.
9801 CommentsEnabled,
9802 /// Builds will only fire in response to pull requests if:
9803 ///
9804 /// 1. The pull request author is a repository writer or above.
9805 /// 1. If the author does not have write permissions, a user with write
9806 /// permissions or above must comment `/gcbrun` in order to fire a build.
9807 CommentsEnabledForExternalContributorsOnly,
9808 /// If set, the enum was initialized with an unknown value.
9809 ///
9810 /// Applications can examine the value using [CommentControl::value] or
9811 /// [CommentControl::name].
9812 UnknownValue(comment_control::UnknownValue),
9813 }
9814
9815 #[doc(hidden)]
9816 pub mod comment_control {
9817 #[allow(unused_imports)]
9818 use super::*;
9819 #[derive(Clone, Debug, PartialEq)]
9820 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9821 }
9822
9823 impl CommentControl {
9824 /// Gets the enum value.
9825 ///
9826 /// Returns `None` if the enum contains an unknown value deserialized from
9827 /// the string representation of enums.
9828 pub fn value(&self) -> std::option::Option<i32> {
9829 match self {
9830 Self::CommentsDisabled => std::option::Option::Some(0),
9831 Self::CommentsEnabled => std::option::Option::Some(1),
9832 Self::CommentsEnabledForExternalContributorsOnly => std::option::Option::Some(2),
9833 Self::UnknownValue(u) => u.0.value(),
9834 }
9835 }
9836
9837 /// Gets the enum value as a string.
9838 ///
9839 /// Returns `None` if the enum contains an unknown value deserialized from
9840 /// the integer representation of enums.
9841 pub fn name(&self) -> std::option::Option<&str> {
9842 match self {
9843 Self::CommentsDisabled => std::option::Option::Some("COMMENTS_DISABLED"),
9844 Self::CommentsEnabled => std::option::Option::Some("COMMENTS_ENABLED"),
9845 Self::CommentsEnabledForExternalContributorsOnly => {
9846 std::option::Option::Some("COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY")
9847 }
9848 Self::UnknownValue(u) => u.0.name(),
9849 }
9850 }
9851 }
9852
9853 impl std::default::Default for CommentControl {
9854 fn default() -> Self {
9855 use std::convert::From;
9856 Self::from(0)
9857 }
9858 }
9859
9860 impl std::fmt::Display for CommentControl {
9861 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9862 wkt::internal::display_enum(f, self.name(), self.value())
9863 }
9864 }
9865
9866 impl std::convert::From<i32> for CommentControl {
9867 fn from(value: i32) -> Self {
9868 match value {
9869 0 => Self::CommentsDisabled,
9870 1 => Self::CommentsEnabled,
9871 2 => Self::CommentsEnabledForExternalContributorsOnly,
9872 _ => Self::UnknownValue(comment_control::UnknownValue(
9873 wkt::internal::UnknownEnumValue::Integer(value),
9874 )),
9875 }
9876 }
9877 }
9878
9879 impl std::convert::From<&str> for CommentControl {
9880 fn from(value: &str) -> Self {
9881 use std::string::ToString;
9882 match value {
9883 "COMMENTS_DISABLED" => Self::CommentsDisabled,
9884 "COMMENTS_ENABLED" => Self::CommentsEnabled,
9885 "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" => {
9886 Self::CommentsEnabledForExternalContributorsOnly
9887 }
9888 _ => Self::UnknownValue(comment_control::UnknownValue(
9889 wkt::internal::UnknownEnumValue::String(value.to_string()),
9890 )),
9891 }
9892 }
9893 }
9894
9895 impl serde::ser::Serialize for CommentControl {
9896 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9897 where
9898 S: serde::Serializer,
9899 {
9900 match self {
9901 Self::CommentsDisabled => serializer.serialize_i32(0),
9902 Self::CommentsEnabled => serializer.serialize_i32(1),
9903 Self::CommentsEnabledForExternalContributorsOnly => serializer.serialize_i32(2),
9904 Self::UnknownValue(u) => u.0.serialize(serializer),
9905 }
9906 }
9907 }
9908
9909 impl<'de> serde::de::Deserialize<'de> for CommentControl {
9910 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9911 where
9912 D: serde::Deserializer<'de>,
9913 {
9914 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommentControl>::new(
9915 ".google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl",
9916 ))
9917 }
9918 }
9919
9920 /// Target refs to match.
9921 /// A target ref is the git reference where the pull request will be applied.
9922 #[derive(Clone, Debug, PartialEq)]
9923 #[non_exhaustive]
9924 pub enum GitRef {
9925 /// Regex of branches to match.
9926 ///
9927 /// The syntax of the regular expressions accepted is the syntax accepted by
9928 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
9929 Branch(std::string::String),
9930 }
9931}
9932
9933/// Push contains filter properties for matching GitHub git pushes.
9934#[derive(Clone, Default, PartialEq)]
9935#[non_exhaustive]
9936pub struct PushFilter {
9937 /// When true, only trigger a build if the revision regex does NOT match the
9938 /// git_ref regex.
9939 pub invert_regex: bool,
9940
9941 /// Modified refs to match.
9942 /// A modified refs are the refs modified by a git push operation.
9943 pub git_ref: std::option::Option<crate::model::push_filter::GitRef>,
9944
9945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9946}
9947
9948impl PushFilter {
9949 pub fn new() -> Self {
9950 std::default::Default::default()
9951 }
9952
9953 /// Sets the value of [invert_regex][crate::model::PushFilter::invert_regex].
9954 ///
9955 /// # Example
9956 /// ```ignore,no_run
9957 /// # use google_cloud_build_v1::model::PushFilter;
9958 /// let x = PushFilter::new().set_invert_regex(true);
9959 /// ```
9960 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9961 self.invert_regex = v.into();
9962 self
9963 }
9964
9965 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref].
9966 ///
9967 /// Note that all the setters affecting `git_ref` are mutually
9968 /// exclusive.
9969 ///
9970 /// # Example
9971 /// ```ignore,no_run
9972 /// # use google_cloud_build_v1::model::PushFilter;
9973 /// use google_cloud_build_v1::model::push_filter::GitRef;
9974 /// let x = PushFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9975 /// ```
9976 pub fn set_git_ref<
9977 T: std::convert::Into<std::option::Option<crate::model::push_filter::GitRef>>,
9978 >(
9979 mut self,
9980 v: T,
9981 ) -> Self {
9982 self.git_ref = v.into();
9983 self
9984 }
9985
9986 /// The value of [git_ref][crate::model::PushFilter::git_ref]
9987 /// if it holds a `Branch`, `None` if the field is not set or
9988 /// holds a different branch.
9989 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9990 #[allow(unreachable_patterns)]
9991 self.git_ref.as_ref().and_then(|v| match v {
9992 crate::model::push_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9993 _ => std::option::Option::None,
9994 })
9995 }
9996
9997 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
9998 /// to hold a `Branch`.
9999 ///
10000 /// Note that all the setters affecting `git_ref` are
10001 /// mutually exclusive.
10002 ///
10003 /// # Example
10004 /// ```ignore,no_run
10005 /// # use google_cloud_build_v1::model::PushFilter;
10006 /// let x = PushFilter::new().set_branch("example");
10007 /// assert!(x.branch().is_some());
10008 /// assert!(x.tag().is_none());
10009 /// ```
10010 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10011 self.git_ref =
10012 std::option::Option::Some(crate::model::push_filter::GitRef::Branch(v.into()));
10013 self
10014 }
10015
10016 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10017 /// if it holds a `Tag`, `None` if the field is not set or
10018 /// holds a different branch.
10019 pub fn tag(&self) -> std::option::Option<&std::string::String> {
10020 #[allow(unreachable_patterns)]
10021 self.git_ref.as_ref().and_then(|v| match v {
10022 crate::model::push_filter::GitRef::Tag(v) => std::option::Option::Some(v),
10023 _ => std::option::Option::None,
10024 })
10025 }
10026
10027 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10028 /// to hold a `Tag`.
10029 ///
10030 /// Note that all the setters affecting `git_ref` are
10031 /// mutually exclusive.
10032 ///
10033 /// # Example
10034 /// ```ignore,no_run
10035 /// # use google_cloud_build_v1::model::PushFilter;
10036 /// let x = PushFilter::new().set_tag("example");
10037 /// assert!(x.tag().is_some());
10038 /// assert!(x.branch().is_none());
10039 /// ```
10040 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10041 self.git_ref = std::option::Option::Some(crate::model::push_filter::GitRef::Tag(v.into()));
10042 self
10043 }
10044}
10045
10046impl wkt::message::Message for PushFilter {
10047 fn typename() -> &'static str {
10048 "type.googleapis.com/google.devtools.cloudbuild.v1.PushFilter"
10049 }
10050}
10051
10052/// Defines additional types related to [PushFilter].
10053pub mod push_filter {
10054 #[allow(unused_imports)]
10055 use super::*;
10056
10057 /// Modified refs to match.
10058 /// A modified refs are the refs modified by a git push operation.
10059 #[derive(Clone, Debug, PartialEq)]
10060 #[non_exhaustive]
10061 pub enum GitRef {
10062 /// Regexes matching branches to build.
10063 ///
10064 /// The syntax of the regular expressions accepted is the syntax accepted by
10065 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10066 Branch(std::string::String),
10067 /// Regexes matching tags to build.
10068 ///
10069 /// The syntax of the regular expressions accepted is the syntax accepted by
10070 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10071 Tag(std::string::String),
10072 }
10073}
10074
10075/// Request to create a new `BuildTrigger`.
10076#[derive(Clone, Default, PartialEq)]
10077#[non_exhaustive]
10078pub struct CreateBuildTriggerRequest {
10079 /// The parent resource where this trigger will be created.
10080 /// Format: `projects/{project}/locations/{location}`
10081 pub parent: std::string::String,
10082
10083 /// Required. ID of the project for which to configure automatic builds.
10084 pub project_id: std::string::String,
10085
10086 /// Required. `BuildTrigger` to create.
10087 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10088
10089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10090}
10091
10092impl CreateBuildTriggerRequest {
10093 pub fn new() -> Self {
10094 std::default::Default::default()
10095 }
10096
10097 /// Sets the value of [parent][crate::model::CreateBuildTriggerRequest::parent].
10098 ///
10099 /// # Example
10100 /// ```ignore,no_run
10101 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10102 /// let x = CreateBuildTriggerRequest::new().set_parent("example");
10103 /// ```
10104 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10105 self.parent = v.into();
10106 self
10107 }
10108
10109 /// Sets the value of [project_id][crate::model::CreateBuildTriggerRequest::project_id].
10110 ///
10111 /// # Example
10112 /// ```ignore,no_run
10113 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10114 /// let x = CreateBuildTriggerRequest::new().set_project_id("example");
10115 /// ```
10116 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10117 self.project_id = v.into();
10118 self
10119 }
10120
10121 /// Sets the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10122 ///
10123 /// # Example
10124 /// ```ignore,no_run
10125 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10126 /// use google_cloud_build_v1::model::BuildTrigger;
10127 /// let x = CreateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10128 /// ```
10129 pub fn set_trigger<T>(mut self, v: T) -> Self
10130 where
10131 T: std::convert::Into<crate::model::BuildTrigger>,
10132 {
10133 self.trigger = std::option::Option::Some(v.into());
10134 self
10135 }
10136
10137 /// Sets or clears the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10138 ///
10139 /// # Example
10140 /// ```ignore,no_run
10141 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10142 /// use google_cloud_build_v1::model::BuildTrigger;
10143 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10144 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10145 /// ```
10146 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10147 where
10148 T: std::convert::Into<crate::model::BuildTrigger>,
10149 {
10150 self.trigger = v.map(|x| x.into());
10151 self
10152 }
10153}
10154
10155impl wkt::message::Message for CreateBuildTriggerRequest {
10156 fn typename() -> &'static str {
10157 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildTriggerRequest"
10158 }
10159}
10160
10161/// Returns the `BuildTrigger` with the specified ID.
10162#[derive(Clone, Default, PartialEq)]
10163#[non_exhaustive]
10164pub struct GetBuildTriggerRequest {
10165 /// The name of the `Trigger` to retrieve.
10166 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10167 pub name: std::string::String,
10168
10169 /// Required. ID of the project that owns the trigger.
10170 pub project_id: std::string::String,
10171
10172 /// Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
10173 pub trigger_id: std::string::String,
10174
10175 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10176}
10177
10178impl GetBuildTriggerRequest {
10179 pub fn new() -> Self {
10180 std::default::Default::default()
10181 }
10182
10183 /// Sets the value of [name][crate::model::GetBuildTriggerRequest::name].
10184 ///
10185 /// # Example
10186 /// ```ignore,no_run
10187 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10188 /// let x = GetBuildTriggerRequest::new().set_name("example");
10189 /// ```
10190 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10191 self.name = v.into();
10192 self
10193 }
10194
10195 /// Sets the value of [project_id][crate::model::GetBuildTriggerRequest::project_id].
10196 ///
10197 /// # Example
10198 /// ```ignore,no_run
10199 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10200 /// let x = GetBuildTriggerRequest::new().set_project_id("example");
10201 /// ```
10202 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10203 self.project_id = v.into();
10204 self
10205 }
10206
10207 /// Sets the value of [trigger_id][crate::model::GetBuildTriggerRequest::trigger_id].
10208 ///
10209 /// # Example
10210 /// ```ignore,no_run
10211 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10212 /// let x = GetBuildTriggerRequest::new().set_trigger_id("example");
10213 /// ```
10214 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10215 self.trigger_id = v.into();
10216 self
10217 }
10218}
10219
10220impl wkt::message::Message for GetBuildTriggerRequest {
10221 fn typename() -> &'static str {
10222 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildTriggerRequest"
10223 }
10224}
10225
10226/// Request to list existing `BuildTriggers`.
10227#[derive(Clone, Default, PartialEq)]
10228#[non_exhaustive]
10229pub struct ListBuildTriggersRequest {
10230 /// The parent of the collection of `Triggers`.
10231 /// Format: `projects/{project}/locations/{location}`
10232 pub parent: std::string::String,
10233
10234 /// Required. ID of the project for which to list BuildTriggers.
10235 pub project_id: std::string::String,
10236
10237 /// Number of results to return in the list.
10238 pub page_size: i32,
10239
10240 /// Token to provide to skip to a particular spot in the list.
10241 pub page_token: std::string::String,
10242
10243 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10244}
10245
10246impl ListBuildTriggersRequest {
10247 pub fn new() -> Self {
10248 std::default::Default::default()
10249 }
10250
10251 /// Sets the value of [parent][crate::model::ListBuildTriggersRequest::parent].
10252 ///
10253 /// # Example
10254 /// ```ignore,no_run
10255 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10256 /// let x = ListBuildTriggersRequest::new().set_parent("example");
10257 /// ```
10258 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10259 self.parent = v.into();
10260 self
10261 }
10262
10263 /// Sets the value of [project_id][crate::model::ListBuildTriggersRequest::project_id].
10264 ///
10265 /// # Example
10266 /// ```ignore,no_run
10267 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10268 /// let x = ListBuildTriggersRequest::new().set_project_id("example");
10269 /// ```
10270 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10271 self.project_id = v.into();
10272 self
10273 }
10274
10275 /// Sets the value of [page_size][crate::model::ListBuildTriggersRequest::page_size].
10276 ///
10277 /// # Example
10278 /// ```ignore,no_run
10279 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10280 /// let x = ListBuildTriggersRequest::new().set_page_size(42);
10281 /// ```
10282 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10283 self.page_size = v.into();
10284 self
10285 }
10286
10287 /// Sets the value of [page_token][crate::model::ListBuildTriggersRequest::page_token].
10288 ///
10289 /// # Example
10290 /// ```ignore,no_run
10291 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10292 /// let x = ListBuildTriggersRequest::new().set_page_token("example");
10293 /// ```
10294 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10295 self.page_token = v.into();
10296 self
10297 }
10298}
10299
10300impl wkt::message::Message for ListBuildTriggersRequest {
10301 fn typename() -> &'static str {
10302 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersRequest"
10303 }
10304}
10305
10306/// Response containing existing `BuildTriggers`.
10307#[derive(Clone, Default, PartialEq)]
10308#[non_exhaustive]
10309pub struct ListBuildTriggersResponse {
10310 /// `BuildTriggers` for the project, sorted by `create_time` descending.
10311 pub triggers: std::vec::Vec<crate::model::BuildTrigger>,
10312
10313 /// Token to receive the next page of results.
10314 pub next_page_token: std::string::String,
10315
10316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10317}
10318
10319impl ListBuildTriggersResponse {
10320 pub fn new() -> Self {
10321 std::default::Default::default()
10322 }
10323
10324 /// Sets the value of [triggers][crate::model::ListBuildTriggersResponse::triggers].
10325 ///
10326 /// # Example
10327 /// ```ignore,no_run
10328 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10329 /// use google_cloud_build_v1::model::BuildTrigger;
10330 /// let x = ListBuildTriggersResponse::new()
10331 /// .set_triggers([
10332 /// BuildTrigger::default()/* use setters */,
10333 /// BuildTrigger::default()/* use (different) setters */,
10334 /// ]);
10335 /// ```
10336 pub fn set_triggers<T, V>(mut self, v: T) -> Self
10337 where
10338 T: std::iter::IntoIterator<Item = V>,
10339 V: std::convert::Into<crate::model::BuildTrigger>,
10340 {
10341 use std::iter::Iterator;
10342 self.triggers = v.into_iter().map(|i| i.into()).collect();
10343 self
10344 }
10345
10346 /// Sets the value of [next_page_token][crate::model::ListBuildTriggersResponse::next_page_token].
10347 ///
10348 /// # Example
10349 /// ```ignore,no_run
10350 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10351 /// let x = ListBuildTriggersResponse::new().set_next_page_token("example");
10352 /// ```
10353 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10354 self.next_page_token = v.into();
10355 self
10356 }
10357}
10358
10359impl wkt::message::Message for ListBuildTriggersResponse {
10360 fn typename() -> &'static str {
10361 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersResponse"
10362 }
10363}
10364
10365#[doc(hidden)]
10366impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildTriggersResponse {
10367 type PageItem = crate::model::BuildTrigger;
10368
10369 fn items(self) -> std::vec::Vec<Self::PageItem> {
10370 self.triggers
10371 }
10372
10373 fn next_page_token(&self) -> std::string::String {
10374 use std::clone::Clone;
10375 self.next_page_token.clone()
10376 }
10377}
10378
10379/// Request to delete a `BuildTrigger`.
10380#[derive(Clone, Default, PartialEq)]
10381#[non_exhaustive]
10382pub struct DeleteBuildTriggerRequest {
10383 /// The name of the `Trigger` to delete.
10384 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10385 pub name: std::string::String,
10386
10387 /// Required. ID of the project that owns the trigger.
10388 pub project_id: std::string::String,
10389
10390 /// Required. ID of the `BuildTrigger` to delete.
10391 pub trigger_id: std::string::String,
10392
10393 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10394}
10395
10396impl DeleteBuildTriggerRequest {
10397 pub fn new() -> Self {
10398 std::default::Default::default()
10399 }
10400
10401 /// Sets the value of [name][crate::model::DeleteBuildTriggerRequest::name].
10402 ///
10403 /// # Example
10404 /// ```ignore,no_run
10405 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10406 /// let x = DeleteBuildTriggerRequest::new().set_name("example");
10407 /// ```
10408 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10409 self.name = v.into();
10410 self
10411 }
10412
10413 /// Sets the value of [project_id][crate::model::DeleteBuildTriggerRequest::project_id].
10414 ///
10415 /// # Example
10416 /// ```ignore,no_run
10417 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10418 /// let x = DeleteBuildTriggerRequest::new().set_project_id("example");
10419 /// ```
10420 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10421 self.project_id = v.into();
10422 self
10423 }
10424
10425 /// Sets the value of [trigger_id][crate::model::DeleteBuildTriggerRequest::trigger_id].
10426 ///
10427 /// # Example
10428 /// ```ignore,no_run
10429 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10430 /// let x = DeleteBuildTriggerRequest::new().set_trigger_id("example");
10431 /// ```
10432 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10433 self.trigger_id = v.into();
10434 self
10435 }
10436}
10437
10438impl wkt::message::Message for DeleteBuildTriggerRequest {
10439 fn typename() -> &'static str {
10440 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest"
10441 }
10442}
10443
10444/// Request to update an existing `BuildTrigger`.
10445#[derive(Clone, Default, PartialEq)]
10446#[non_exhaustive]
10447pub struct UpdateBuildTriggerRequest {
10448 /// Required. ID of the project that owns the trigger.
10449 pub project_id: std::string::String,
10450
10451 /// Required. ID of the `BuildTrigger` to update.
10452 pub trigger_id: std::string::String,
10453
10454 /// Required. `BuildTrigger` to update.
10455 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10456
10457 /// Update mask for the resource. If this is set,
10458 /// the server will only update the fields specified in the field mask.
10459 /// Otherwise, a full update of the mutable resource fields will be performed.
10460 pub update_mask: std::option::Option<wkt::FieldMask>,
10461
10462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10463}
10464
10465impl UpdateBuildTriggerRequest {
10466 pub fn new() -> Self {
10467 std::default::Default::default()
10468 }
10469
10470 /// Sets the value of [project_id][crate::model::UpdateBuildTriggerRequest::project_id].
10471 ///
10472 /// # Example
10473 /// ```ignore,no_run
10474 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10475 /// let x = UpdateBuildTriggerRequest::new().set_project_id("example");
10476 /// ```
10477 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10478 self.project_id = v.into();
10479 self
10480 }
10481
10482 /// Sets the value of [trigger_id][crate::model::UpdateBuildTriggerRequest::trigger_id].
10483 ///
10484 /// # Example
10485 /// ```ignore,no_run
10486 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10487 /// let x = UpdateBuildTriggerRequest::new().set_trigger_id("example");
10488 /// ```
10489 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10490 self.trigger_id = v.into();
10491 self
10492 }
10493
10494 /// Sets the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10495 ///
10496 /// # Example
10497 /// ```ignore,no_run
10498 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10499 /// use google_cloud_build_v1::model::BuildTrigger;
10500 /// let x = UpdateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10501 /// ```
10502 pub fn set_trigger<T>(mut self, v: T) -> Self
10503 where
10504 T: std::convert::Into<crate::model::BuildTrigger>,
10505 {
10506 self.trigger = std::option::Option::Some(v.into());
10507 self
10508 }
10509
10510 /// Sets or clears the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10511 ///
10512 /// # Example
10513 /// ```ignore,no_run
10514 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10515 /// use google_cloud_build_v1::model::BuildTrigger;
10516 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10517 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10518 /// ```
10519 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10520 where
10521 T: std::convert::Into<crate::model::BuildTrigger>,
10522 {
10523 self.trigger = v.map(|x| x.into());
10524 self
10525 }
10526
10527 /// Sets the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10528 ///
10529 /// # Example
10530 /// ```ignore,no_run
10531 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10532 /// use wkt::FieldMask;
10533 /// let x = UpdateBuildTriggerRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10534 /// ```
10535 pub fn set_update_mask<T>(mut self, v: T) -> Self
10536 where
10537 T: std::convert::Into<wkt::FieldMask>,
10538 {
10539 self.update_mask = std::option::Option::Some(v.into());
10540 self
10541 }
10542
10543 /// Sets or clears the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10544 ///
10545 /// # Example
10546 /// ```ignore,no_run
10547 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10548 /// use wkt::FieldMask;
10549 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10550 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10551 /// ```
10552 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10553 where
10554 T: std::convert::Into<wkt::FieldMask>,
10555 {
10556 self.update_mask = v.map(|x| x.into());
10557 self
10558 }
10559}
10560
10561impl wkt::message::Message for UpdateBuildTriggerRequest {
10562 fn typename() -> &'static str {
10563 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest"
10564 }
10565}
10566
10567/// Optional arguments to enable specific features of builds.
10568#[derive(Clone, Default, PartialEq)]
10569#[non_exhaustive]
10570pub struct BuildOptions {
10571 /// Requested hash for SourceProvenance.
10572 pub source_provenance_hash: std::vec::Vec<crate::model::hash::HashType>,
10573
10574 /// Requested verifiability options.
10575 pub requested_verify_option: crate::model::build_options::VerifyOption,
10576
10577 /// Compute Engine machine type on which to run the build.
10578 pub machine_type: crate::model::build_options::MachineType,
10579
10580 /// Requested disk size for the VM that runs the build. Note that this is *NOT*
10581 /// "disk free"; some of the space will be used by the operating system and
10582 /// build utilities. Also note that this is the minimum disk size that will be
10583 /// allocated for the build -- the build may run with a larger disk than
10584 /// requested. At present, the maximum disk size is 4000GB; builds that request
10585 /// more than the maximum are rejected with an error.
10586 pub disk_size_gb: i64,
10587
10588 /// Option to specify behavior when there is an error in the substitution
10589 /// checks.
10590 ///
10591 /// NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot
10592 /// be overridden in the build configuration file.
10593 pub substitution_option: crate::model::build_options::SubstitutionOption,
10594
10595 /// Option to specify whether or not to apply bash style string
10596 /// operations to the substitutions.
10597 ///
10598 /// NOTE: this is always enabled for triggered builds and cannot be
10599 /// overridden in the build configuration file.
10600 pub dynamic_substitutions: bool,
10601
10602 /// Option to include built-in and custom substitutions as env variables
10603 /// for all build steps.
10604 pub automap_substitutions: bool,
10605
10606 /// Option to define build log streaming behavior to Cloud
10607 /// Storage.
10608 pub log_streaming_option: crate::model::build_options::LogStreamingOption,
10609
10610 /// This field deprecated; please use `pool.name` instead.
10611 #[deprecated]
10612 pub worker_pool: std::string::String,
10613
10614 /// Optional. Specification for execution on a `WorkerPool`.
10615 ///
10616 /// See [running builds in a private
10617 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10618 /// for more information.
10619 pub pool: std::option::Option<crate::model::build_options::PoolOption>,
10620
10621 /// Option to specify the logging mode, which determines if and where build
10622 /// logs are stored.
10623 pub logging: crate::model::build_options::LoggingMode,
10624
10625 /// A list of global environment variable definitions that will exist for all
10626 /// build steps in this build. If a variable is defined in both globally and in
10627 /// a build step, the variable will use the build step value.
10628 ///
10629 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
10630 /// being given the value "VALUE".
10631 pub env: std::vec::Vec<std::string::String>,
10632
10633 /// A list of global environment variables, which are encrypted using a Cloud
10634 /// Key Management Service crypto key. These values must be specified in the
10635 /// build's `Secret`. These variables will be available to all build steps
10636 /// in this build.
10637 pub secret_env: std::vec::Vec<std::string::String>,
10638
10639 /// Global list of volumes to mount for ALL build steps
10640 ///
10641 /// Each volume is created as an empty volume prior to starting the build
10642 /// process. Upon completion of the build, volumes and their contents are
10643 /// discarded. Global volume names and paths cannot conflict with the volumes
10644 /// defined a build step.
10645 ///
10646 /// Using a global volume in a build with only one step is not valid as
10647 /// it is indicative of a build request with an incorrect configuration.
10648 pub volumes: std::vec::Vec<crate::model::Volume>,
10649
10650 /// Optional. Option to specify how default logs buckets are setup.
10651 pub default_logs_bucket_behavior: crate::model::build_options::DefaultLogsBucketBehavior,
10652
10653 /// Optional. Option to specify whether structured logging is enabled.
10654 ///
10655 /// If true, JSON-formatted logs are parsed as structured logs.
10656 pub enable_structured_logging: bool,
10657
10658 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10659}
10660
10661impl BuildOptions {
10662 pub fn new() -> Self {
10663 std::default::Default::default()
10664 }
10665
10666 /// Sets the value of [source_provenance_hash][crate::model::BuildOptions::source_provenance_hash].
10667 ///
10668 /// # Example
10669 /// ```ignore,no_run
10670 /// # use google_cloud_build_v1::model::BuildOptions;
10671 /// use google_cloud_build_v1::model::hash::HashType;
10672 /// let x = BuildOptions::new().set_source_provenance_hash([
10673 /// HashType::Sha256,
10674 /// HashType::Md5,
10675 /// HashType::GoModuleH1,
10676 /// ]);
10677 /// ```
10678 pub fn set_source_provenance_hash<T, V>(mut self, v: T) -> Self
10679 where
10680 T: std::iter::IntoIterator<Item = V>,
10681 V: std::convert::Into<crate::model::hash::HashType>,
10682 {
10683 use std::iter::Iterator;
10684 self.source_provenance_hash = v.into_iter().map(|i| i.into()).collect();
10685 self
10686 }
10687
10688 /// Sets the value of [requested_verify_option][crate::model::BuildOptions::requested_verify_option].
10689 ///
10690 /// # Example
10691 /// ```ignore,no_run
10692 /// # use google_cloud_build_v1::model::BuildOptions;
10693 /// use google_cloud_build_v1::model::build_options::VerifyOption;
10694 /// let x0 = BuildOptions::new().set_requested_verify_option(VerifyOption::Verified);
10695 /// ```
10696 pub fn set_requested_verify_option<
10697 T: std::convert::Into<crate::model::build_options::VerifyOption>,
10698 >(
10699 mut self,
10700 v: T,
10701 ) -> Self {
10702 self.requested_verify_option = v.into();
10703 self
10704 }
10705
10706 /// Sets the value of [machine_type][crate::model::BuildOptions::machine_type].
10707 ///
10708 /// # Example
10709 /// ```ignore,no_run
10710 /// # use google_cloud_build_v1::model::BuildOptions;
10711 /// use google_cloud_build_v1::model::build_options::MachineType;
10712 /// let x0 = BuildOptions::new().set_machine_type(MachineType::N1Highcpu8);
10713 /// let x1 = BuildOptions::new().set_machine_type(MachineType::N1Highcpu32);
10714 /// let x2 = BuildOptions::new().set_machine_type(MachineType::E2Highcpu8);
10715 /// ```
10716 pub fn set_machine_type<T: std::convert::Into<crate::model::build_options::MachineType>>(
10717 mut self,
10718 v: T,
10719 ) -> Self {
10720 self.machine_type = v.into();
10721 self
10722 }
10723
10724 /// Sets the value of [disk_size_gb][crate::model::BuildOptions::disk_size_gb].
10725 ///
10726 /// # Example
10727 /// ```ignore,no_run
10728 /// # use google_cloud_build_v1::model::BuildOptions;
10729 /// let x = BuildOptions::new().set_disk_size_gb(42);
10730 /// ```
10731 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10732 self.disk_size_gb = v.into();
10733 self
10734 }
10735
10736 /// Sets the value of [substitution_option][crate::model::BuildOptions::substitution_option].
10737 ///
10738 /// # Example
10739 /// ```ignore,no_run
10740 /// # use google_cloud_build_v1::model::BuildOptions;
10741 /// use google_cloud_build_v1::model::build_options::SubstitutionOption;
10742 /// let x0 = BuildOptions::new().set_substitution_option(SubstitutionOption::AllowLoose);
10743 /// ```
10744 pub fn set_substitution_option<
10745 T: std::convert::Into<crate::model::build_options::SubstitutionOption>,
10746 >(
10747 mut self,
10748 v: T,
10749 ) -> Self {
10750 self.substitution_option = v.into();
10751 self
10752 }
10753
10754 /// Sets the value of [dynamic_substitutions][crate::model::BuildOptions::dynamic_substitutions].
10755 ///
10756 /// # Example
10757 /// ```ignore,no_run
10758 /// # use google_cloud_build_v1::model::BuildOptions;
10759 /// let x = BuildOptions::new().set_dynamic_substitutions(true);
10760 /// ```
10761 pub fn set_dynamic_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10762 self.dynamic_substitutions = v.into();
10763 self
10764 }
10765
10766 /// Sets the value of [automap_substitutions][crate::model::BuildOptions::automap_substitutions].
10767 ///
10768 /// # Example
10769 /// ```ignore,no_run
10770 /// # use google_cloud_build_v1::model::BuildOptions;
10771 /// let x = BuildOptions::new().set_automap_substitutions(true);
10772 /// ```
10773 pub fn set_automap_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10774 self.automap_substitutions = v.into();
10775 self
10776 }
10777
10778 /// Sets the value of [log_streaming_option][crate::model::BuildOptions::log_streaming_option].
10779 ///
10780 /// # Example
10781 /// ```ignore,no_run
10782 /// # use google_cloud_build_v1::model::BuildOptions;
10783 /// use google_cloud_build_v1::model::build_options::LogStreamingOption;
10784 /// let x0 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOn);
10785 /// let x1 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOff);
10786 /// ```
10787 pub fn set_log_streaming_option<
10788 T: std::convert::Into<crate::model::build_options::LogStreamingOption>,
10789 >(
10790 mut self,
10791 v: T,
10792 ) -> Self {
10793 self.log_streaming_option = v.into();
10794 self
10795 }
10796
10797 /// Sets the value of [worker_pool][crate::model::BuildOptions::worker_pool].
10798 ///
10799 /// # Example
10800 /// ```ignore,no_run
10801 /// # use google_cloud_build_v1::model::BuildOptions;
10802 /// let x = BuildOptions::new().set_worker_pool("example");
10803 /// ```
10804 #[deprecated]
10805 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10806 self.worker_pool = v.into();
10807 self
10808 }
10809
10810 /// Sets the value of [pool][crate::model::BuildOptions::pool].
10811 ///
10812 /// # Example
10813 /// ```ignore,no_run
10814 /// # use google_cloud_build_v1::model::BuildOptions;
10815 /// use google_cloud_build_v1::model::build_options::PoolOption;
10816 /// let x = BuildOptions::new().set_pool(PoolOption::default()/* use setters */);
10817 /// ```
10818 pub fn set_pool<T>(mut self, v: T) -> Self
10819 where
10820 T: std::convert::Into<crate::model::build_options::PoolOption>,
10821 {
10822 self.pool = std::option::Option::Some(v.into());
10823 self
10824 }
10825
10826 /// Sets or clears the value of [pool][crate::model::BuildOptions::pool].
10827 ///
10828 /// # Example
10829 /// ```ignore,no_run
10830 /// # use google_cloud_build_v1::model::BuildOptions;
10831 /// use google_cloud_build_v1::model::build_options::PoolOption;
10832 /// let x = BuildOptions::new().set_or_clear_pool(Some(PoolOption::default()/* use setters */));
10833 /// let x = BuildOptions::new().set_or_clear_pool(None::<PoolOption>);
10834 /// ```
10835 pub fn set_or_clear_pool<T>(mut self, v: std::option::Option<T>) -> Self
10836 where
10837 T: std::convert::Into<crate::model::build_options::PoolOption>,
10838 {
10839 self.pool = v.map(|x| x.into());
10840 self
10841 }
10842
10843 /// Sets the value of [logging][crate::model::BuildOptions::logging].
10844 ///
10845 /// # Example
10846 /// ```ignore,no_run
10847 /// # use google_cloud_build_v1::model::BuildOptions;
10848 /// use google_cloud_build_v1::model::build_options::LoggingMode;
10849 /// let x0 = BuildOptions::new().set_logging(LoggingMode::Legacy);
10850 /// let x1 = BuildOptions::new().set_logging(LoggingMode::GcsOnly);
10851 /// let x2 = BuildOptions::new().set_logging(LoggingMode::CloudLoggingOnly);
10852 /// ```
10853 pub fn set_logging<T: std::convert::Into<crate::model::build_options::LoggingMode>>(
10854 mut self,
10855 v: T,
10856 ) -> Self {
10857 self.logging = v.into();
10858 self
10859 }
10860
10861 /// Sets the value of [env][crate::model::BuildOptions::env].
10862 ///
10863 /// # Example
10864 /// ```ignore,no_run
10865 /// # use google_cloud_build_v1::model::BuildOptions;
10866 /// let x = BuildOptions::new().set_env(["a", "b", "c"]);
10867 /// ```
10868 pub fn set_env<T, V>(mut self, v: T) -> Self
10869 where
10870 T: std::iter::IntoIterator<Item = V>,
10871 V: std::convert::Into<std::string::String>,
10872 {
10873 use std::iter::Iterator;
10874 self.env = v.into_iter().map(|i| i.into()).collect();
10875 self
10876 }
10877
10878 /// Sets the value of [secret_env][crate::model::BuildOptions::secret_env].
10879 ///
10880 /// # Example
10881 /// ```ignore,no_run
10882 /// # use google_cloud_build_v1::model::BuildOptions;
10883 /// let x = BuildOptions::new().set_secret_env(["a", "b", "c"]);
10884 /// ```
10885 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
10886 where
10887 T: std::iter::IntoIterator<Item = V>,
10888 V: std::convert::Into<std::string::String>,
10889 {
10890 use std::iter::Iterator;
10891 self.secret_env = v.into_iter().map(|i| i.into()).collect();
10892 self
10893 }
10894
10895 /// Sets the value of [volumes][crate::model::BuildOptions::volumes].
10896 ///
10897 /// # Example
10898 /// ```ignore,no_run
10899 /// # use google_cloud_build_v1::model::BuildOptions;
10900 /// use google_cloud_build_v1::model::Volume;
10901 /// let x = BuildOptions::new()
10902 /// .set_volumes([
10903 /// Volume::default()/* use setters */,
10904 /// Volume::default()/* use (different) setters */,
10905 /// ]);
10906 /// ```
10907 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10908 where
10909 T: std::iter::IntoIterator<Item = V>,
10910 V: std::convert::Into<crate::model::Volume>,
10911 {
10912 use std::iter::Iterator;
10913 self.volumes = v.into_iter().map(|i| i.into()).collect();
10914 self
10915 }
10916
10917 /// Sets the value of [default_logs_bucket_behavior][crate::model::BuildOptions::default_logs_bucket_behavior].
10918 ///
10919 /// # Example
10920 /// ```ignore,no_run
10921 /// # use google_cloud_build_v1::model::BuildOptions;
10922 /// use google_cloud_build_v1::model::build_options::DefaultLogsBucketBehavior;
10923 /// let x0 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::RegionalUserOwnedBucket);
10924 /// let x1 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::LegacyBucket);
10925 /// ```
10926 pub fn set_default_logs_bucket_behavior<
10927 T: std::convert::Into<crate::model::build_options::DefaultLogsBucketBehavior>,
10928 >(
10929 mut self,
10930 v: T,
10931 ) -> Self {
10932 self.default_logs_bucket_behavior = v.into();
10933 self
10934 }
10935
10936 /// Sets the value of [enable_structured_logging][crate::model::BuildOptions::enable_structured_logging].
10937 ///
10938 /// # Example
10939 /// ```ignore,no_run
10940 /// # use google_cloud_build_v1::model::BuildOptions;
10941 /// let x = BuildOptions::new().set_enable_structured_logging(true);
10942 /// ```
10943 pub fn set_enable_structured_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10944 self.enable_structured_logging = v.into();
10945 self
10946 }
10947}
10948
10949impl wkt::message::Message for BuildOptions {
10950 fn typename() -> &'static str {
10951 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions"
10952 }
10953}
10954
10955/// Defines additional types related to [BuildOptions].
10956pub mod build_options {
10957 #[allow(unused_imports)]
10958 use super::*;
10959
10960 /// Details about how a build should be executed on a `WorkerPool`.
10961 ///
10962 /// See [running builds in a private
10963 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10964 /// for more information.
10965 #[derive(Clone, Default, PartialEq)]
10966 #[non_exhaustive]
10967 pub struct PoolOption {
10968 /// The `WorkerPool` resource to execute the build on.
10969 /// You must have `cloudbuild.workerpools.use` on the project hosting the
10970 /// WorkerPool.
10971 ///
10972 /// Format projects/{project}/locations/{location}/workerPools/{workerPoolId}
10973 pub name: std::string::String,
10974
10975 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10976 }
10977
10978 impl PoolOption {
10979 pub fn new() -> Self {
10980 std::default::Default::default()
10981 }
10982
10983 /// Sets the value of [name][crate::model::build_options::PoolOption::name].
10984 ///
10985 /// # Example
10986 /// ```ignore,no_run
10987 /// # use google_cloud_build_v1::model::build_options::PoolOption;
10988 /// let x = PoolOption::new().set_name("example");
10989 /// ```
10990 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10991 self.name = v.into();
10992 self
10993 }
10994 }
10995
10996 impl wkt::message::Message for PoolOption {
10997 fn typename() -> &'static str {
10998 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions.PoolOption"
10999 }
11000 }
11001
11002 /// Specifies the manner in which the build should be verified, if at all.
11003 ///
11004 /// If a verified build is requested, and any part of the process to generate
11005 /// and upload provenance fails, the build will also fail.
11006 ///
11007 /// If the build does not request verification then that process may occur, but
11008 /// is not guaranteed to. If it does occur and fails, the build will not fail.
11009 ///
11010 /// For more information, see [Viewing Build
11011 /// Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance).
11012 ///
11013 /// # Working with unknown values
11014 ///
11015 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11016 /// additional enum variants at any time. Adding new variants is not considered
11017 /// a breaking change. Applications should write their code in anticipation of:
11018 ///
11019 /// - New values appearing in future releases of the client library, **and**
11020 /// - New values received dynamically, without application changes.
11021 ///
11022 /// Please consult the [Working with enums] section in the user guide for some
11023 /// guidelines.
11024 ///
11025 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11026 #[derive(Clone, Debug, PartialEq)]
11027 #[non_exhaustive]
11028 pub enum VerifyOption {
11029 /// Not a verifiable build (the default).
11030 NotVerified,
11031 /// Build must be verified.
11032 Verified,
11033 /// If set, the enum was initialized with an unknown value.
11034 ///
11035 /// Applications can examine the value using [VerifyOption::value] or
11036 /// [VerifyOption::name].
11037 UnknownValue(verify_option::UnknownValue),
11038 }
11039
11040 #[doc(hidden)]
11041 pub mod verify_option {
11042 #[allow(unused_imports)]
11043 use super::*;
11044 #[derive(Clone, Debug, PartialEq)]
11045 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11046 }
11047
11048 impl VerifyOption {
11049 /// Gets the enum value.
11050 ///
11051 /// Returns `None` if the enum contains an unknown value deserialized from
11052 /// the string representation of enums.
11053 pub fn value(&self) -> std::option::Option<i32> {
11054 match self {
11055 Self::NotVerified => std::option::Option::Some(0),
11056 Self::Verified => std::option::Option::Some(1),
11057 Self::UnknownValue(u) => u.0.value(),
11058 }
11059 }
11060
11061 /// Gets the enum value as a string.
11062 ///
11063 /// Returns `None` if the enum contains an unknown value deserialized from
11064 /// the integer representation of enums.
11065 pub fn name(&self) -> std::option::Option<&str> {
11066 match self {
11067 Self::NotVerified => std::option::Option::Some("NOT_VERIFIED"),
11068 Self::Verified => std::option::Option::Some("VERIFIED"),
11069 Self::UnknownValue(u) => u.0.name(),
11070 }
11071 }
11072 }
11073
11074 impl std::default::Default for VerifyOption {
11075 fn default() -> Self {
11076 use std::convert::From;
11077 Self::from(0)
11078 }
11079 }
11080
11081 impl std::fmt::Display for VerifyOption {
11082 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11083 wkt::internal::display_enum(f, self.name(), self.value())
11084 }
11085 }
11086
11087 impl std::convert::From<i32> for VerifyOption {
11088 fn from(value: i32) -> Self {
11089 match value {
11090 0 => Self::NotVerified,
11091 1 => Self::Verified,
11092 _ => Self::UnknownValue(verify_option::UnknownValue(
11093 wkt::internal::UnknownEnumValue::Integer(value),
11094 )),
11095 }
11096 }
11097 }
11098
11099 impl std::convert::From<&str> for VerifyOption {
11100 fn from(value: &str) -> Self {
11101 use std::string::ToString;
11102 match value {
11103 "NOT_VERIFIED" => Self::NotVerified,
11104 "VERIFIED" => Self::Verified,
11105 _ => Self::UnknownValue(verify_option::UnknownValue(
11106 wkt::internal::UnknownEnumValue::String(value.to_string()),
11107 )),
11108 }
11109 }
11110 }
11111
11112 impl serde::ser::Serialize for VerifyOption {
11113 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11114 where
11115 S: serde::Serializer,
11116 {
11117 match self {
11118 Self::NotVerified => serializer.serialize_i32(0),
11119 Self::Verified => serializer.serialize_i32(1),
11120 Self::UnknownValue(u) => u.0.serialize(serializer),
11121 }
11122 }
11123 }
11124
11125 impl<'de> serde::de::Deserialize<'de> for VerifyOption {
11126 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11127 where
11128 D: serde::Deserializer<'de>,
11129 {
11130 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerifyOption>::new(
11131 ".google.devtools.cloudbuild.v1.BuildOptions.VerifyOption",
11132 ))
11133 }
11134 }
11135
11136 /// Supported Compute Engine machine types.
11137 /// For more information, see [Machine
11138 /// types](https://cloud.google.com/compute/docs/machine-types).
11139 ///
11140 /// # Working with unknown values
11141 ///
11142 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11143 /// additional enum variants at any time. Adding new variants is not considered
11144 /// a breaking change. Applications should write their code in anticipation of:
11145 ///
11146 /// - New values appearing in future releases of the client library, **and**
11147 /// - New values received dynamically, without application changes.
11148 ///
11149 /// Please consult the [Working with enums] section in the user guide for some
11150 /// guidelines.
11151 ///
11152 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11153 #[derive(Clone, Debug, PartialEq)]
11154 #[non_exhaustive]
11155 pub enum MachineType {
11156 /// Standard machine type.
11157 Unspecified,
11158 /// Highcpu machine with 8 CPUs.
11159 N1Highcpu8,
11160 /// Highcpu machine with 32 CPUs.
11161 N1Highcpu32,
11162 /// Highcpu e2 machine with 8 CPUs.
11163 E2Highcpu8,
11164 /// Highcpu e2 machine with 32 CPUs.
11165 E2Highcpu32,
11166 /// E2 machine with 1 CPU.
11167 E2Medium,
11168 /// If set, the enum was initialized with an unknown value.
11169 ///
11170 /// Applications can examine the value using [MachineType::value] or
11171 /// [MachineType::name].
11172 UnknownValue(machine_type::UnknownValue),
11173 }
11174
11175 #[doc(hidden)]
11176 pub mod machine_type {
11177 #[allow(unused_imports)]
11178 use super::*;
11179 #[derive(Clone, Debug, PartialEq)]
11180 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11181 }
11182
11183 impl MachineType {
11184 /// Gets the enum value.
11185 ///
11186 /// Returns `None` if the enum contains an unknown value deserialized from
11187 /// the string representation of enums.
11188 pub fn value(&self) -> std::option::Option<i32> {
11189 match self {
11190 Self::Unspecified => std::option::Option::Some(0),
11191 Self::N1Highcpu8 => std::option::Option::Some(1),
11192 Self::N1Highcpu32 => std::option::Option::Some(2),
11193 Self::E2Highcpu8 => std::option::Option::Some(5),
11194 Self::E2Highcpu32 => std::option::Option::Some(6),
11195 Self::E2Medium => std::option::Option::Some(7),
11196 Self::UnknownValue(u) => u.0.value(),
11197 }
11198 }
11199
11200 /// Gets the enum value as a string.
11201 ///
11202 /// Returns `None` if the enum contains an unknown value deserialized from
11203 /// the integer representation of enums.
11204 pub fn name(&self) -> std::option::Option<&str> {
11205 match self {
11206 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
11207 Self::N1Highcpu8 => std::option::Option::Some("N1_HIGHCPU_8"),
11208 Self::N1Highcpu32 => std::option::Option::Some("N1_HIGHCPU_32"),
11209 Self::E2Highcpu8 => std::option::Option::Some("E2_HIGHCPU_8"),
11210 Self::E2Highcpu32 => std::option::Option::Some("E2_HIGHCPU_32"),
11211 Self::E2Medium => std::option::Option::Some("E2_MEDIUM"),
11212 Self::UnknownValue(u) => u.0.name(),
11213 }
11214 }
11215 }
11216
11217 impl std::default::Default for MachineType {
11218 fn default() -> Self {
11219 use std::convert::From;
11220 Self::from(0)
11221 }
11222 }
11223
11224 impl std::fmt::Display for MachineType {
11225 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11226 wkt::internal::display_enum(f, self.name(), self.value())
11227 }
11228 }
11229
11230 impl std::convert::From<i32> for MachineType {
11231 fn from(value: i32) -> Self {
11232 match value {
11233 0 => Self::Unspecified,
11234 1 => Self::N1Highcpu8,
11235 2 => Self::N1Highcpu32,
11236 5 => Self::E2Highcpu8,
11237 6 => Self::E2Highcpu32,
11238 7 => Self::E2Medium,
11239 _ => Self::UnknownValue(machine_type::UnknownValue(
11240 wkt::internal::UnknownEnumValue::Integer(value),
11241 )),
11242 }
11243 }
11244 }
11245
11246 impl std::convert::From<&str> for MachineType {
11247 fn from(value: &str) -> Self {
11248 use std::string::ToString;
11249 match value {
11250 "UNSPECIFIED" => Self::Unspecified,
11251 "N1_HIGHCPU_8" => Self::N1Highcpu8,
11252 "N1_HIGHCPU_32" => Self::N1Highcpu32,
11253 "E2_HIGHCPU_8" => Self::E2Highcpu8,
11254 "E2_HIGHCPU_32" => Self::E2Highcpu32,
11255 "E2_MEDIUM" => Self::E2Medium,
11256 _ => Self::UnknownValue(machine_type::UnknownValue(
11257 wkt::internal::UnknownEnumValue::String(value.to_string()),
11258 )),
11259 }
11260 }
11261 }
11262
11263 impl serde::ser::Serialize for MachineType {
11264 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11265 where
11266 S: serde::Serializer,
11267 {
11268 match self {
11269 Self::Unspecified => serializer.serialize_i32(0),
11270 Self::N1Highcpu8 => serializer.serialize_i32(1),
11271 Self::N1Highcpu32 => serializer.serialize_i32(2),
11272 Self::E2Highcpu8 => serializer.serialize_i32(5),
11273 Self::E2Highcpu32 => serializer.serialize_i32(6),
11274 Self::E2Medium => serializer.serialize_i32(7),
11275 Self::UnknownValue(u) => u.0.serialize(serializer),
11276 }
11277 }
11278 }
11279
11280 impl<'de> serde::de::Deserialize<'de> for MachineType {
11281 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11282 where
11283 D: serde::Deserializer<'de>,
11284 {
11285 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MachineType>::new(
11286 ".google.devtools.cloudbuild.v1.BuildOptions.MachineType",
11287 ))
11288 }
11289 }
11290
11291 /// Specifies the behavior when there is an error in the substitution checks.
11292 ///
11293 /// # Working with unknown values
11294 ///
11295 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11296 /// additional enum variants at any time. Adding new variants is not considered
11297 /// a breaking change. Applications should write their code in anticipation of:
11298 ///
11299 /// - New values appearing in future releases of the client library, **and**
11300 /// - New values received dynamically, without application changes.
11301 ///
11302 /// Please consult the [Working with enums] section in the user guide for some
11303 /// guidelines.
11304 ///
11305 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11306 #[derive(Clone, Debug, PartialEq)]
11307 #[non_exhaustive]
11308 pub enum SubstitutionOption {
11309 /// Fails the build if error in substitutions checks, like missing
11310 /// a substitution in the template or in the map.
11311 MustMatch,
11312 /// Do not fail the build if error in substitutions checks.
11313 AllowLoose,
11314 /// If set, the enum was initialized with an unknown value.
11315 ///
11316 /// Applications can examine the value using [SubstitutionOption::value] or
11317 /// [SubstitutionOption::name].
11318 UnknownValue(substitution_option::UnknownValue),
11319 }
11320
11321 #[doc(hidden)]
11322 pub mod substitution_option {
11323 #[allow(unused_imports)]
11324 use super::*;
11325 #[derive(Clone, Debug, PartialEq)]
11326 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11327 }
11328
11329 impl SubstitutionOption {
11330 /// Gets the enum value.
11331 ///
11332 /// Returns `None` if the enum contains an unknown value deserialized from
11333 /// the string representation of enums.
11334 pub fn value(&self) -> std::option::Option<i32> {
11335 match self {
11336 Self::MustMatch => std::option::Option::Some(0),
11337 Self::AllowLoose => std::option::Option::Some(1),
11338 Self::UnknownValue(u) => u.0.value(),
11339 }
11340 }
11341
11342 /// Gets the enum value as a string.
11343 ///
11344 /// Returns `None` if the enum contains an unknown value deserialized from
11345 /// the integer representation of enums.
11346 pub fn name(&self) -> std::option::Option<&str> {
11347 match self {
11348 Self::MustMatch => std::option::Option::Some("MUST_MATCH"),
11349 Self::AllowLoose => std::option::Option::Some("ALLOW_LOOSE"),
11350 Self::UnknownValue(u) => u.0.name(),
11351 }
11352 }
11353 }
11354
11355 impl std::default::Default for SubstitutionOption {
11356 fn default() -> Self {
11357 use std::convert::From;
11358 Self::from(0)
11359 }
11360 }
11361
11362 impl std::fmt::Display for SubstitutionOption {
11363 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11364 wkt::internal::display_enum(f, self.name(), self.value())
11365 }
11366 }
11367
11368 impl std::convert::From<i32> for SubstitutionOption {
11369 fn from(value: i32) -> Self {
11370 match value {
11371 0 => Self::MustMatch,
11372 1 => Self::AllowLoose,
11373 _ => Self::UnknownValue(substitution_option::UnknownValue(
11374 wkt::internal::UnknownEnumValue::Integer(value),
11375 )),
11376 }
11377 }
11378 }
11379
11380 impl std::convert::From<&str> for SubstitutionOption {
11381 fn from(value: &str) -> Self {
11382 use std::string::ToString;
11383 match value {
11384 "MUST_MATCH" => Self::MustMatch,
11385 "ALLOW_LOOSE" => Self::AllowLoose,
11386 _ => Self::UnknownValue(substitution_option::UnknownValue(
11387 wkt::internal::UnknownEnumValue::String(value.to_string()),
11388 )),
11389 }
11390 }
11391 }
11392
11393 impl serde::ser::Serialize for SubstitutionOption {
11394 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11395 where
11396 S: serde::Serializer,
11397 {
11398 match self {
11399 Self::MustMatch => serializer.serialize_i32(0),
11400 Self::AllowLoose => serializer.serialize_i32(1),
11401 Self::UnknownValue(u) => u.0.serialize(serializer),
11402 }
11403 }
11404 }
11405
11406 impl<'de> serde::de::Deserialize<'de> for SubstitutionOption {
11407 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11408 where
11409 D: serde::Deserializer<'de>,
11410 {
11411 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SubstitutionOption>::new(
11412 ".google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption",
11413 ))
11414 }
11415 }
11416
11417 /// Specifies the behavior when writing build logs to Cloud Storage.
11418 ///
11419 /// # Working with unknown values
11420 ///
11421 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11422 /// additional enum variants at any time. Adding new variants is not considered
11423 /// a breaking change. Applications should write their code in anticipation of:
11424 ///
11425 /// - New values appearing in future releases of the client library, **and**
11426 /// - New values received dynamically, without application changes.
11427 ///
11428 /// Please consult the [Working with enums] section in the user guide for some
11429 /// guidelines.
11430 ///
11431 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11432 #[derive(Clone, Debug, PartialEq)]
11433 #[non_exhaustive]
11434 pub enum LogStreamingOption {
11435 /// Service may automatically determine build log streaming behavior.
11436 StreamDefault,
11437 /// Build logs should be streamed to Cloud Storage.
11438 StreamOn,
11439 /// Build logs should not be streamed to Cloud Storage; they will be
11440 /// written when the build is completed.
11441 StreamOff,
11442 /// If set, the enum was initialized with an unknown value.
11443 ///
11444 /// Applications can examine the value using [LogStreamingOption::value] or
11445 /// [LogStreamingOption::name].
11446 UnknownValue(log_streaming_option::UnknownValue),
11447 }
11448
11449 #[doc(hidden)]
11450 pub mod log_streaming_option {
11451 #[allow(unused_imports)]
11452 use super::*;
11453 #[derive(Clone, Debug, PartialEq)]
11454 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11455 }
11456
11457 impl LogStreamingOption {
11458 /// Gets the enum value.
11459 ///
11460 /// Returns `None` if the enum contains an unknown value deserialized from
11461 /// the string representation of enums.
11462 pub fn value(&self) -> std::option::Option<i32> {
11463 match self {
11464 Self::StreamDefault => std::option::Option::Some(0),
11465 Self::StreamOn => std::option::Option::Some(1),
11466 Self::StreamOff => std::option::Option::Some(2),
11467 Self::UnknownValue(u) => u.0.value(),
11468 }
11469 }
11470
11471 /// Gets the enum value as a string.
11472 ///
11473 /// Returns `None` if the enum contains an unknown value deserialized from
11474 /// the integer representation of enums.
11475 pub fn name(&self) -> std::option::Option<&str> {
11476 match self {
11477 Self::StreamDefault => std::option::Option::Some("STREAM_DEFAULT"),
11478 Self::StreamOn => std::option::Option::Some("STREAM_ON"),
11479 Self::StreamOff => std::option::Option::Some("STREAM_OFF"),
11480 Self::UnknownValue(u) => u.0.name(),
11481 }
11482 }
11483 }
11484
11485 impl std::default::Default for LogStreamingOption {
11486 fn default() -> Self {
11487 use std::convert::From;
11488 Self::from(0)
11489 }
11490 }
11491
11492 impl std::fmt::Display for LogStreamingOption {
11493 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11494 wkt::internal::display_enum(f, self.name(), self.value())
11495 }
11496 }
11497
11498 impl std::convert::From<i32> for LogStreamingOption {
11499 fn from(value: i32) -> Self {
11500 match value {
11501 0 => Self::StreamDefault,
11502 1 => Self::StreamOn,
11503 2 => Self::StreamOff,
11504 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11505 wkt::internal::UnknownEnumValue::Integer(value),
11506 )),
11507 }
11508 }
11509 }
11510
11511 impl std::convert::From<&str> for LogStreamingOption {
11512 fn from(value: &str) -> Self {
11513 use std::string::ToString;
11514 match value {
11515 "STREAM_DEFAULT" => Self::StreamDefault,
11516 "STREAM_ON" => Self::StreamOn,
11517 "STREAM_OFF" => Self::StreamOff,
11518 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11519 wkt::internal::UnknownEnumValue::String(value.to_string()),
11520 )),
11521 }
11522 }
11523 }
11524
11525 impl serde::ser::Serialize for LogStreamingOption {
11526 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11527 where
11528 S: serde::Serializer,
11529 {
11530 match self {
11531 Self::StreamDefault => serializer.serialize_i32(0),
11532 Self::StreamOn => serializer.serialize_i32(1),
11533 Self::StreamOff => serializer.serialize_i32(2),
11534 Self::UnknownValue(u) => u.0.serialize(serializer),
11535 }
11536 }
11537 }
11538
11539 impl<'de> serde::de::Deserialize<'de> for LogStreamingOption {
11540 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11541 where
11542 D: serde::Deserializer<'de>,
11543 {
11544 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogStreamingOption>::new(
11545 ".google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption",
11546 ))
11547 }
11548 }
11549
11550 /// Specifies the logging mode.
11551 ///
11552 /// # Working with unknown values
11553 ///
11554 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11555 /// additional enum variants at any time. Adding new variants is not considered
11556 /// a breaking change. Applications should write their code in anticipation of:
11557 ///
11558 /// - New values appearing in future releases of the client library, **and**
11559 /// - New values received dynamically, without application changes.
11560 ///
11561 /// Please consult the [Working with enums] section in the user guide for some
11562 /// guidelines.
11563 ///
11564 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11565 #[derive(Clone, Debug, PartialEq)]
11566 #[non_exhaustive]
11567 pub enum LoggingMode {
11568 /// The service determines the logging mode. The default is `LEGACY`. Do not
11569 /// rely on the default logging behavior as it may change in the future.
11570 LoggingUnspecified,
11571 /// Build logs are stored in Cloud Logging and Cloud Storage.
11572 Legacy,
11573 /// Build logs are stored in Cloud Storage.
11574 GcsOnly,
11575 /// This option is the same as CLOUD_LOGGING_ONLY.
11576 #[deprecated]
11577 StackdriverOnly,
11578 /// Build logs are stored in Cloud Logging. Selecting this option will not
11579 /// allow [logs
11580 /// streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log).
11581 CloudLoggingOnly,
11582 /// Turn off all logging. No build logs will be captured.
11583 None,
11584 /// If set, the enum was initialized with an unknown value.
11585 ///
11586 /// Applications can examine the value using [LoggingMode::value] or
11587 /// [LoggingMode::name].
11588 UnknownValue(logging_mode::UnknownValue),
11589 }
11590
11591 #[doc(hidden)]
11592 pub mod logging_mode {
11593 #[allow(unused_imports)]
11594 use super::*;
11595 #[derive(Clone, Debug, PartialEq)]
11596 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11597 }
11598
11599 impl LoggingMode {
11600 /// Gets the enum value.
11601 ///
11602 /// Returns `None` if the enum contains an unknown value deserialized from
11603 /// the string representation of enums.
11604 pub fn value(&self) -> std::option::Option<i32> {
11605 match self {
11606 Self::LoggingUnspecified => std::option::Option::Some(0),
11607 Self::Legacy => std::option::Option::Some(1),
11608 Self::GcsOnly => std::option::Option::Some(2),
11609 Self::StackdriverOnly => std::option::Option::Some(3),
11610 Self::CloudLoggingOnly => std::option::Option::Some(5),
11611 Self::None => std::option::Option::Some(4),
11612 Self::UnknownValue(u) => u.0.value(),
11613 }
11614 }
11615
11616 /// Gets the enum value as a string.
11617 ///
11618 /// Returns `None` if the enum contains an unknown value deserialized from
11619 /// the integer representation of enums.
11620 pub fn name(&self) -> std::option::Option<&str> {
11621 match self {
11622 Self::LoggingUnspecified => std::option::Option::Some("LOGGING_UNSPECIFIED"),
11623 Self::Legacy => std::option::Option::Some("LEGACY"),
11624 Self::GcsOnly => std::option::Option::Some("GCS_ONLY"),
11625 Self::StackdriverOnly => std::option::Option::Some("STACKDRIVER_ONLY"),
11626 Self::CloudLoggingOnly => std::option::Option::Some("CLOUD_LOGGING_ONLY"),
11627 Self::None => std::option::Option::Some("NONE"),
11628 Self::UnknownValue(u) => u.0.name(),
11629 }
11630 }
11631 }
11632
11633 impl std::default::Default for LoggingMode {
11634 fn default() -> Self {
11635 use std::convert::From;
11636 Self::from(0)
11637 }
11638 }
11639
11640 impl std::fmt::Display for LoggingMode {
11641 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11642 wkt::internal::display_enum(f, self.name(), self.value())
11643 }
11644 }
11645
11646 impl std::convert::From<i32> for LoggingMode {
11647 fn from(value: i32) -> Self {
11648 match value {
11649 0 => Self::LoggingUnspecified,
11650 1 => Self::Legacy,
11651 2 => Self::GcsOnly,
11652 3 => Self::StackdriverOnly,
11653 4 => Self::None,
11654 5 => Self::CloudLoggingOnly,
11655 _ => Self::UnknownValue(logging_mode::UnknownValue(
11656 wkt::internal::UnknownEnumValue::Integer(value),
11657 )),
11658 }
11659 }
11660 }
11661
11662 impl std::convert::From<&str> for LoggingMode {
11663 fn from(value: &str) -> Self {
11664 use std::string::ToString;
11665 match value {
11666 "LOGGING_UNSPECIFIED" => Self::LoggingUnspecified,
11667 "LEGACY" => Self::Legacy,
11668 "GCS_ONLY" => Self::GcsOnly,
11669 "STACKDRIVER_ONLY" => Self::StackdriverOnly,
11670 "CLOUD_LOGGING_ONLY" => Self::CloudLoggingOnly,
11671 "NONE" => Self::None,
11672 _ => Self::UnknownValue(logging_mode::UnknownValue(
11673 wkt::internal::UnknownEnumValue::String(value.to_string()),
11674 )),
11675 }
11676 }
11677 }
11678
11679 impl serde::ser::Serialize for LoggingMode {
11680 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11681 where
11682 S: serde::Serializer,
11683 {
11684 match self {
11685 Self::LoggingUnspecified => serializer.serialize_i32(0),
11686 Self::Legacy => serializer.serialize_i32(1),
11687 Self::GcsOnly => serializer.serialize_i32(2),
11688 Self::StackdriverOnly => serializer.serialize_i32(3),
11689 Self::CloudLoggingOnly => serializer.serialize_i32(5),
11690 Self::None => serializer.serialize_i32(4),
11691 Self::UnknownValue(u) => u.0.serialize(serializer),
11692 }
11693 }
11694 }
11695
11696 impl<'de> serde::de::Deserialize<'de> for LoggingMode {
11697 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11698 where
11699 D: serde::Deserializer<'de>,
11700 {
11701 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggingMode>::new(
11702 ".google.devtools.cloudbuild.v1.BuildOptions.LoggingMode",
11703 ))
11704 }
11705 }
11706
11707 /// Default Cloud Storage log bucket behavior options.
11708 ///
11709 /// # Working with unknown values
11710 ///
11711 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11712 /// additional enum variants at any time. Adding new variants is not considered
11713 /// a breaking change. Applications should write their code in anticipation of:
11714 ///
11715 /// - New values appearing in future releases of the client library, **and**
11716 /// - New values received dynamically, without application changes.
11717 ///
11718 /// Please consult the [Working with enums] section in the user guide for some
11719 /// guidelines.
11720 ///
11721 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11722 #[derive(Clone, Debug, PartialEq)]
11723 #[non_exhaustive]
11724 pub enum DefaultLogsBucketBehavior {
11725 /// Unspecified.
11726 Unspecified,
11727 /// Bucket is located in user-owned project in the same region as the
11728 /// build. The builder service account must have access to create and write
11729 /// to Cloud Storage buckets in the build project.
11730 RegionalUserOwnedBucket,
11731 /// Bucket is located in a Google-owned project and is not regionalized.
11732 LegacyBucket,
11733 /// If set, the enum was initialized with an unknown value.
11734 ///
11735 /// Applications can examine the value using [DefaultLogsBucketBehavior::value] or
11736 /// [DefaultLogsBucketBehavior::name].
11737 UnknownValue(default_logs_bucket_behavior::UnknownValue),
11738 }
11739
11740 #[doc(hidden)]
11741 pub mod default_logs_bucket_behavior {
11742 #[allow(unused_imports)]
11743 use super::*;
11744 #[derive(Clone, Debug, PartialEq)]
11745 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11746 }
11747
11748 impl DefaultLogsBucketBehavior {
11749 /// Gets the enum value.
11750 ///
11751 /// Returns `None` if the enum contains an unknown value deserialized from
11752 /// the string representation of enums.
11753 pub fn value(&self) -> std::option::Option<i32> {
11754 match self {
11755 Self::Unspecified => std::option::Option::Some(0),
11756 Self::RegionalUserOwnedBucket => std::option::Option::Some(1),
11757 Self::LegacyBucket => std::option::Option::Some(2),
11758 Self::UnknownValue(u) => u.0.value(),
11759 }
11760 }
11761
11762 /// Gets the enum value as a string.
11763 ///
11764 /// Returns `None` if the enum contains an unknown value deserialized from
11765 /// the integer representation of enums.
11766 pub fn name(&self) -> std::option::Option<&str> {
11767 match self {
11768 Self::Unspecified => {
11769 std::option::Option::Some("DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED")
11770 }
11771 Self::RegionalUserOwnedBucket => {
11772 std::option::Option::Some("REGIONAL_USER_OWNED_BUCKET")
11773 }
11774 Self::LegacyBucket => std::option::Option::Some("LEGACY_BUCKET"),
11775 Self::UnknownValue(u) => u.0.name(),
11776 }
11777 }
11778 }
11779
11780 impl std::default::Default for DefaultLogsBucketBehavior {
11781 fn default() -> Self {
11782 use std::convert::From;
11783 Self::from(0)
11784 }
11785 }
11786
11787 impl std::fmt::Display for DefaultLogsBucketBehavior {
11788 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11789 wkt::internal::display_enum(f, self.name(), self.value())
11790 }
11791 }
11792
11793 impl std::convert::From<i32> for DefaultLogsBucketBehavior {
11794 fn from(value: i32) -> Self {
11795 match value {
11796 0 => Self::Unspecified,
11797 1 => Self::RegionalUserOwnedBucket,
11798 2 => Self::LegacyBucket,
11799 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11800 wkt::internal::UnknownEnumValue::Integer(value),
11801 )),
11802 }
11803 }
11804 }
11805
11806 impl std::convert::From<&str> for DefaultLogsBucketBehavior {
11807 fn from(value: &str) -> Self {
11808 use std::string::ToString;
11809 match value {
11810 "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11811 "REGIONAL_USER_OWNED_BUCKET" => Self::RegionalUserOwnedBucket,
11812 "LEGACY_BUCKET" => Self::LegacyBucket,
11813 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11814 wkt::internal::UnknownEnumValue::String(value.to_string()),
11815 )),
11816 }
11817 }
11818 }
11819
11820 impl serde::ser::Serialize for DefaultLogsBucketBehavior {
11821 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11822 where
11823 S: serde::Serializer,
11824 {
11825 match self {
11826 Self::Unspecified => serializer.serialize_i32(0),
11827 Self::RegionalUserOwnedBucket => serializer.serialize_i32(1),
11828 Self::LegacyBucket => serializer.serialize_i32(2),
11829 Self::UnknownValue(u) => u.0.serialize(serializer),
11830 }
11831 }
11832 }
11833
11834 impl<'de> serde::de::Deserialize<'de> for DefaultLogsBucketBehavior {
11835 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11836 where
11837 D: serde::Deserializer<'de>,
11838 {
11839 deserializer.deserialize_any(
11840 wkt::internal::EnumVisitor::<DefaultLogsBucketBehavior>::new(
11841 ".google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior",
11842 ),
11843 )
11844 }
11845 }
11846}
11847
11848/// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by
11849/// the ReceiveTriggerWebhook method.
11850#[derive(Clone, Default, PartialEq)]
11851#[non_exhaustive]
11852pub struct ReceiveTriggerWebhookRequest {
11853 /// The name of the `ReceiveTriggerWebhook` to retrieve.
11854 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
11855 pub name: std::string::String,
11856
11857 /// HTTP request body.
11858 pub body: std::option::Option<google_cloud_api::model::HttpBody>,
11859
11860 /// Project in which the specified trigger lives
11861 pub project_id: std::string::String,
11862
11863 /// Name of the trigger to run the payload against
11864 pub trigger: std::string::String,
11865
11866 /// Secret token used for authorization if an OAuth token isn't provided.
11867 pub secret: std::string::String,
11868
11869 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11870}
11871
11872impl ReceiveTriggerWebhookRequest {
11873 pub fn new() -> Self {
11874 std::default::Default::default()
11875 }
11876
11877 /// Sets the value of [name][crate::model::ReceiveTriggerWebhookRequest::name].
11878 ///
11879 /// # Example
11880 /// ```ignore,no_run
11881 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11882 /// let x = ReceiveTriggerWebhookRequest::new().set_name("example");
11883 /// ```
11884 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11885 self.name = v.into();
11886 self
11887 }
11888
11889 /// Sets the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
11890 ///
11891 /// # Example
11892 /// ```ignore,no_run
11893 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11894 /// use google_cloud_api::model::HttpBody;
11895 /// let x = ReceiveTriggerWebhookRequest::new().set_body(HttpBody::default()/* use setters */);
11896 /// ```
11897 pub fn set_body<T>(mut self, v: T) -> Self
11898 where
11899 T: std::convert::Into<google_cloud_api::model::HttpBody>,
11900 {
11901 self.body = std::option::Option::Some(v.into());
11902 self
11903 }
11904
11905 /// Sets or clears the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
11906 ///
11907 /// # Example
11908 /// ```ignore,no_run
11909 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11910 /// use google_cloud_api::model::HttpBody;
11911 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(Some(HttpBody::default()/* use setters */));
11912 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(None::<HttpBody>);
11913 /// ```
11914 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
11915 where
11916 T: std::convert::Into<google_cloud_api::model::HttpBody>,
11917 {
11918 self.body = v.map(|x| x.into());
11919 self
11920 }
11921
11922 /// Sets the value of [project_id][crate::model::ReceiveTriggerWebhookRequest::project_id].
11923 ///
11924 /// # Example
11925 /// ```ignore,no_run
11926 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11927 /// let x = ReceiveTriggerWebhookRequest::new().set_project_id("example");
11928 /// ```
11929 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11930 self.project_id = v.into();
11931 self
11932 }
11933
11934 /// Sets the value of [trigger][crate::model::ReceiveTriggerWebhookRequest::trigger].
11935 ///
11936 /// # Example
11937 /// ```ignore,no_run
11938 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11939 /// let x = ReceiveTriggerWebhookRequest::new().set_trigger("example");
11940 /// ```
11941 pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11942 self.trigger = v.into();
11943 self
11944 }
11945
11946 /// Sets the value of [secret][crate::model::ReceiveTriggerWebhookRequest::secret].
11947 ///
11948 /// # Example
11949 /// ```ignore,no_run
11950 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11951 /// let x = ReceiveTriggerWebhookRequest::new().set_secret("example");
11952 /// ```
11953 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11954 self.secret = v.into();
11955 self
11956 }
11957}
11958
11959impl wkt::message::Message for ReceiveTriggerWebhookRequest {
11960 fn typename() -> &'static str {
11961 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest"
11962 }
11963}
11964
11965/// ReceiveTriggerWebhookResponse [Experimental] is the response object for the
11966/// ReceiveTriggerWebhook method.
11967#[derive(Clone, Default, PartialEq)]
11968#[non_exhaustive]
11969pub struct ReceiveTriggerWebhookResponse {
11970 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11971}
11972
11973impl ReceiveTriggerWebhookResponse {
11974 pub fn new() -> Self {
11975 std::default::Default::default()
11976 }
11977}
11978
11979impl wkt::message::Message for ReceiveTriggerWebhookResponse {
11980 fn typename() -> &'static str {
11981 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse"
11982 }
11983}
11984
11985/// GitHubEnterpriseConfig represents a configuration for a GitHub Enterprise
11986/// server.
11987#[derive(Clone, Default, PartialEq)]
11988#[non_exhaustive]
11989pub struct GitHubEnterpriseConfig {
11990 /// The full resource name for the GitHubEnterpriseConfig
11991 /// For example:
11992 /// "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}"
11993 pub name: std::string::String,
11994
11995 /// The URL of the github enterprise host the configuration is for.
11996 pub host_url: std::string::String,
11997
11998 /// Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise
11999 /// server.
12000 pub app_id: i64,
12001
12002 /// Output only. Time when the installation was associated with the project.
12003 pub create_time: std::option::Option<wkt::Timestamp>,
12004
12005 /// The key that should be attached to webhook calls to the ReceiveWebhook
12006 /// endpoint.
12007 pub webhook_key: std::string::String,
12008
12009 /// Optional. The network to be used when reaching out to the GitHub
12010 /// Enterprise server. The VPC network must be enabled for private
12011 /// service connection. This should be set if the GitHub Enterprise server is
12012 /// hosted on-premises and not reachable by public internet.
12013 /// If this field is left empty, no network peering will occur and calls to
12014 /// the GitHub Enterprise server will be made over the public internet.
12015 /// Must be in the format
12016 /// `projects/{project}/global/networks/{network}`, where {project}
12017 /// is a project number or id and {network} is the name of a
12018 /// VPC network in the project.
12019 pub peered_network: std::string::String,
12020
12021 /// Optional. Names of secrets in Secret Manager.
12022 pub secrets: std::option::Option<crate::model::GitHubEnterpriseSecrets>,
12023
12024 /// Optional. Name to display for this config.
12025 pub display_name: std::string::String,
12026
12027 /// Optional. SSL certificate to use for requests to GitHub Enterprise.
12028 pub ssl_ca: std::string::String,
12029
12030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12031}
12032
12033impl GitHubEnterpriseConfig {
12034 pub fn new() -> Self {
12035 std::default::Default::default()
12036 }
12037
12038 /// Sets the value of [name][crate::model::GitHubEnterpriseConfig::name].
12039 ///
12040 /// # Example
12041 /// ```ignore,no_run
12042 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12043 /// let x = GitHubEnterpriseConfig::new().set_name("example");
12044 /// ```
12045 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12046 self.name = v.into();
12047 self
12048 }
12049
12050 /// Sets the value of [host_url][crate::model::GitHubEnterpriseConfig::host_url].
12051 ///
12052 /// # Example
12053 /// ```ignore,no_run
12054 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12055 /// let x = GitHubEnterpriseConfig::new().set_host_url("example");
12056 /// ```
12057 pub fn set_host_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12058 self.host_url = v.into();
12059 self
12060 }
12061
12062 /// Sets the value of [app_id][crate::model::GitHubEnterpriseConfig::app_id].
12063 ///
12064 /// # Example
12065 /// ```ignore,no_run
12066 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12067 /// let x = GitHubEnterpriseConfig::new().set_app_id(42);
12068 /// ```
12069 pub fn set_app_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12070 self.app_id = v.into();
12071 self
12072 }
12073
12074 /// Sets the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12075 ///
12076 /// # Example
12077 /// ```ignore,no_run
12078 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12079 /// use wkt::Timestamp;
12080 /// let x = GitHubEnterpriseConfig::new().set_create_time(Timestamp::default()/* use setters */);
12081 /// ```
12082 pub fn set_create_time<T>(mut self, v: T) -> Self
12083 where
12084 T: std::convert::Into<wkt::Timestamp>,
12085 {
12086 self.create_time = std::option::Option::Some(v.into());
12087 self
12088 }
12089
12090 /// Sets or clears the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12091 ///
12092 /// # Example
12093 /// ```ignore,no_run
12094 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12095 /// use wkt::Timestamp;
12096 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12097 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(None::<Timestamp>);
12098 /// ```
12099 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12100 where
12101 T: std::convert::Into<wkt::Timestamp>,
12102 {
12103 self.create_time = v.map(|x| x.into());
12104 self
12105 }
12106
12107 /// Sets the value of [webhook_key][crate::model::GitHubEnterpriseConfig::webhook_key].
12108 ///
12109 /// # Example
12110 /// ```ignore,no_run
12111 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12112 /// let x = GitHubEnterpriseConfig::new().set_webhook_key("example");
12113 /// ```
12114 pub fn set_webhook_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12115 self.webhook_key = v.into();
12116 self
12117 }
12118
12119 /// Sets the value of [peered_network][crate::model::GitHubEnterpriseConfig::peered_network].
12120 ///
12121 /// # Example
12122 /// ```ignore,no_run
12123 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12124 /// let x = GitHubEnterpriseConfig::new().set_peered_network("example");
12125 /// ```
12126 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12127 self.peered_network = v.into();
12128 self
12129 }
12130
12131 /// Sets the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12132 ///
12133 /// # Example
12134 /// ```ignore,no_run
12135 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12136 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12137 /// let x = GitHubEnterpriseConfig::new().set_secrets(GitHubEnterpriseSecrets::default()/* use setters */);
12138 /// ```
12139 pub fn set_secrets<T>(mut self, v: T) -> Self
12140 where
12141 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12142 {
12143 self.secrets = std::option::Option::Some(v.into());
12144 self
12145 }
12146
12147 /// Sets or clears the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12148 ///
12149 /// # Example
12150 /// ```ignore,no_run
12151 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12152 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12153 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(Some(GitHubEnterpriseSecrets::default()/* use setters */));
12154 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(None::<GitHubEnterpriseSecrets>);
12155 /// ```
12156 pub fn set_or_clear_secrets<T>(mut self, v: std::option::Option<T>) -> Self
12157 where
12158 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12159 {
12160 self.secrets = v.map(|x| x.into());
12161 self
12162 }
12163
12164 /// Sets the value of [display_name][crate::model::GitHubEnterpriseConfig::display_name].
12165 ///
12166 /// # Example
12167 /// ```ignore,no_run
12168 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12169 /// let x = GitHubEnterpriseConfig::new().set_display_name("example");
12170 /// ```
12171 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12172 self.display_name = v.into();
12173 self
12174 }
12175
12176 /// Sets the value of [ssl_ca][crate::model::GitHubEnterpriseConfig::ssl_ca].
12177 ///
12178 /// # Example
12179 /// ```ignore,no_run
12180 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12181 /// let x = GitHubEnterpriseConfig::new().set_ssl_ca("example");
12182 /// ```
12183 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12184 self.ssl_ca = v.into();
12185 self
12186 }
12187}
12188
12189impl wkt::message::Message for GitHubEnterpriseConfig {
12190 fn typename() -> &'static str {
12191 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseConfig"
12192 }
12193}
12194
12195/// GitHubEnterpriseSecrets represents the names of all necessary secrets in
12196/// Secret Manager for a GitHub Enterprise server.
12197/// Format is: projects/\<project number\>/secrets/\<secret name\>.
12198#[derive(Clone, Default, PartialEq)]
12199#[non_exhaustive]
12200pub struct GitHubEnterpriseSecrets {
12201 /// The resource name for the private key secret version.
12202 pub private_key_version_name: std::string::String,
12203
12204 /// The resource name for the webhook secret secret version in Secret Manager.
12205 pub webhook_secret_version_name: std::string::String,
12206
12207 /// The resource name for the OAuth secret secret version in Secret Manager.
12208 pub oauth_secret_version_name: std::string::String,
12209
12210 /// The resource name for the OAuth client ID secret version in Secret Manager.
12211 pub oauth_client_id_version_name: std::string::String,
12212
12213 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12214}
12215
12216impl GitHubEnterpriseSecrets {
12217 pub fn new() -> Self {
12218 std::default::Default::default()
12219 }
12220
12221 /// Sets the value of [private_key_version_name][crate::model::GitHubEnterpriseSecrets::private_key_version_name].
12222 ///
12223 /// # Example
12224 /// ```ignore,no_run
12225 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12226 /// let x = GitHubEnterpriseSecrets::new().set_private_key_version_name("example");
12227 /// ```
12228 pub fn set_private_key_version_name<T: std::convert::Into<std::string::String>>(
12229 mut self,
12230 v: T,
12231 ) -> Self {
12232 self.private_key_version_name = v.into();
12233 self
12234 }
12235
12236 /// Sets the value of [webhook_secret_version_name][crate::model::GitHubEnterpriseSecrets::webhook_secret_version_name].
12237 ///
12238 /// # Example
12239 /// ```ignore,no_run
12240 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12241 /// let x = GitHubEnterpriseSecrets::new().set_webhook_secret_version_name("example");
12242 /// ```
12243 pub fn set_webhook_secret_version_name<T: std::convert::Into<std::string::String>>(
12244 mut self,
12245 v: T,
12246 ) -> Self {
12247 self.webhook_secret_version_name = v.into();
12248 self
12249 }
12250
12251 /// Sets the value of [oauth_secret_version_name][crate::model::GitHubEnterpriseSecrets::oauth_secret_version_name].
12252 ///
12253 /// # Example
12254 /// ```ignore,no_run
12255 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12256 /// let x = GitHubEnterpriseSecrets::new().set_oauth_secret_version_name("example");
12257 /// ```
12258 pub fn set_oauth_secret_version_name<T: std::convert::Into<std::string::String>>(
12259 mut self,
12260 v: T,
12261 ) -> Self {
12262 self.oauth_secret_version_name = v.into();
12263 self
12264 }
12265
12266 /// Sets the value of [oauth_client_id_version_name][crate::model::GitHubEnterpriseSecrets::oauth_client_id_version_name].
12267 ///
12268 /// # Example
12269 /// ```ignore,no_run
12270 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12271 /// let x = GitHubEnterpriseSecrets::new().set_oauth_client_id_version_name("example");
12272 /// ```
12273 pub fn set_oauth_client_id_version_name<T: std::convert::Into<std::string::String>>(
12274 mut self,
12275 v: T,
12276 ) -> Self {
12277 self.oauth_client_id_version_name = v.into();
12278 self
12279 }
12280}
12281
12282impl wkt::message::Message for GitHubEnterpriseSecrets {
12283 fn typename() -> &'static str {
12284 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets"
12285 }
12286}
12287
12288/// Configuration for a `WorkerPool`.
12289///
12290/// Cloud Build owns and maintains a pool of workers for general use and have no
12291/// access to a project's private network. By default, builds submitted to
12292/// Cloud Build will use a worker from this pool.
12293///
12294/// If your build needs access to resources on a private network,
12295/// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give
12296/// your builds access to any single VPC network that you
12297/// administer, including any on-prem resources connected to that VPC
12298/// network. For an overview of private pools, see
12299/// [Private pools
12300/// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview).
12301#[derive(Clone, Default, PartialEq)]
12302#[non_exhaustive]
12303pub struct WorkerPool {
12304 /// Output only. The resource name of the `WorkerPool`, with format
12305 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
12306 /// The value of `{worker_pool}` is provided by `worker_pool_id` in
12307 /// `CreateWorkerPool` request and the value of `{location}` is determined by
12308 /// the endpoint accessed.
12309 pub name: std::string::String,
12310
12311 /// A user-specified, human-readable name for the `WorkerPool`. If provided,
12312 /// this value must be 1-63 characters.
12313 pub display_name: std::string::String,
12314
12315 /// Output only. A unique identifier for the `WorkerPool`.
12316 pub uid: std::string::String,
12317
12318 /// User specified annotations. See <https://google.aip.dev/128#annotations>
12319 /// for more details such as format and size limitations.
12320 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12321
12322 /// Output only. Time at which the request to create the `WorkerPool` was
12323 /// received.
12324 pub create_time: std::option::Option<wkt::Timestamp>,
12325
12326 /// Output only. Time at which the request to update the `WorkerPool` was
12327 /// received.
12328 pub update_time: std::option::Option<wkt::Timestamp>,
12329
12330 /// Output only. Time at which the request to delete the `WorkerPool` was
12331 /// received.
12332 pub delete_time: std::option::Option<wkt::Timestamp>,
12333
12334 /// Output only. `WorkerPool` state.
12335 pub state: crate::model::worker_pool::State,
12336
12337 /// Output only. Checksum computed by the server. May be sent on update and
12338 /// delete requests to ensure that the client has an up-to-date value before
12339 /// proceeding.
12340 pub etag: std::string::String,
12341
12342 /// Configuration for the `WorkerPool`.
12343 pub config: std::option::Option<crate::model::worker_pool::Config>,
12344
12345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12346}
12347
12348impl WorkerPool {
12349 pub fn new() -> Self {
12350 std::default::Default::default()
12351 }
12352
12353 /// Sets the value of [name][crate::model::WorkerPool::name].
12354 ///
12355 /// # Example
12356 /// ```ignore,no_run
12357 /// # use google_cloud_build_v1::model::WorkerPool;
12358 /// let x = WorkerPool::new().set_name("example");
12359 /// ```
12360 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12361 self.name = v.into();
12362 self
12363 }
12364
12365 /// Sets the value of [display_name][crate::model::WorkerPool::display_name].
12366 ///
12367 /// # Example
12368 /// ```ignore,no_run
12369 /// # use google_cloud_build_v1::model::WorkerPool;
12370 /// let x = WorkerPool::new().set_display_name("example");
12371 /// ```
12372 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12373 self.display_name = v.into();
12374 self
12375 }
12376
12377 /// Sets the value of [uid][crate::model::WorkerPool::uid].
12378 ///
12379 /// # Example
12380 /// ```ignore,no_run
12381 /// # use google_cloud_build_v1::model::WorkerPool;
12382 /// let x = WorkerPool::new().set_uid("example");
12383 /// ```
12384 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12385 self.uid = v.into();
12386 self
12387 }
12388
12389 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
12390 ///
12391 /// # Example
12392 /// ```ignore,no_run
12393 /// # use google_cloud_build_v1::model::WorkerPool;
12394 /// let x = WorkerPool::new().set_annotations([
12395 /// ("key0", "abc"),
12396 /// ("key1", "xyz"),
12397 /// ]);
12398 /// ```
12399 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12400 where
12401 T: std::iter::IntoIterator<Item = (K, V)>,
12402 K: std::convert::Into<std::string::String>,
12403 V: std::convert::Into<std::string::String>,
12404 {
12405 use std::iter::Iterator;
12406 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12407 self
12408 }
12409
12410 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
12411 ///
12412 /// # Example
12413 /// ```ignore,no_run
12414 /// # use google_cloud_build_v1::model::WorkerPool;
12415 /// use wkt::Timestamp;
12416 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
12417 /// ```
12418 pub fn set_create_time<T>(mut self, v: T) -> Self
12419 where
12420 T: std::convert::Into<wkt::Timestamp>,
12421 {
12422 self.create_time = std::option::Option::Some(v.into());
12423 self
12424 }
12425
12426 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
12427 ///
12428 /// # Example
12429 /// ```ignore,no_run
12430 /// # use google_cloud_build_v1::model::WorkerPool;
12431 /// use wkt::Timestamp;
12432 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12433 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
12434 /// ```
12435 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12436 where
12437 T: std::convert::Into<wkt::Timestamp>,
12438 {
12439 self.create_time = v.map(|x| x.into());
12440 self
12441 }
12442
12443 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
12444 ///
12445 /// # Example
12446 /// ```ignore,no_run
12447 /// # use google_cloud_build_v1::model::WorkerPool;
12448 /// use wkt::Timestamp;
12449 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
12450 /// ```
12451 pub fn set_update_time<T>(mut self, v: T) -> Self
12452 where
12453 T: std::convert::Into<wkt::Timestamp>,
12454 {
12455 self.update_time = std::option::Option::Some(v.into());
12456 self
12457 }
12458
12459 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
12460 ///
12461 /// # Example
12462 /// ```ignore,no_run
12463 /// # use google_cloud_build_v1::model::WorkerPool;
12464 /// use wkt::Timestamp;
12465 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12466 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
12467 /// ```
12468 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12469 where
12470 T: std::convert::Into<wkt::Timestamp>,
12471 {
12472 self.update_time = v.map(|x| x.into());
12473 self
12474 }
12475
12476 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
12477 ///
12478 /// # Example
12479 /// ```ignore,no_run
12480 /// # use google_cloud_build_v1::model::WorkerPool;
12481 /// use wkt::Timestamp;
12482 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
12483 /// ```
12484 pub fn set_delete_time<T>(mut self, v: T) -> Self
12485 where
12486 T: std::convert::Into<wkt::Timestamp>,
12487 {
12488 self.delete_time = std::option::Option::Some(v.into());
12489 self
12490 }
12491
12492 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
12493 ///
12494 /// # Example
12495 /// ```ignore,no_run
12496 /// # use google_cloud_build_v1::model::WorkerPool;
12497 /// use wkt::Timestamp;
12498 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12499 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
12500 /// ```
12501 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12502 where
12503 T: std::convert::Into<wkt::Timestamp>,
12504 {
12505 self.delete_time = v.map(|x| x.into());
12506 self
12507 }
12508
12509 /// Sets the value of [state][crate::model::WorkerPool::state].
12510 ///
12511 /// # Example
12512 /// ```ignore,no_run
12513 /// # use google_cloud_build_v1::model::WorkerPool;
12514 /// use google_cloud_build_v1::model::worker_pool::State;
12515 /// let x0 = WorkerPool::new().set_state(State::Creating);
12516 /// let x1 = WorkerPool::new().set_state(State::Running);
12517 /// let x2 = WorkerPool::new().set_state(State::Deleting);
12518 /// ```
12519 pub fn set_state<T: std::convert::Into<crate::model::worker_pool::State>>(
12520 mut self,
12521 v: T,
12522 ) -> Self {
12523 self.state = v.into();
12524 self
12525 }
12526
12527 /// Sets the value of [etag][crate::model::WorkerPool::etag].
12528 ///
12529 /// # Example
12530 /// ```ignore,no_run
12531 /// # use google_cloud_build_v1::model::WorkerPool;
12532 /// let x = WorkerPool::new().set_etag("example");
12533 /// ```
12534 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12535 self.etag = v.into();
12536 self
12537 }
12538
12539 /// Sets the value of [config][crate::model::WorkerPool::config].
12540 ///
12541 /// Note that all the setters affecting `config` are mutually
12542 /// exclusive.
12543 ///
12544 /// # Example
12545 /// ```ignore,no_run
12546 /// # use google_cloud_build_v1::model::WorkerPool;
12547 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12548 /// let x = WorkerPool::new().set_config(Some(
12549 /// google_cloud_build_v1::model::worker_pool::Config::PrivatePoolV1Config(PrivatePoolV1Config::default().into())));
12550 /// ```
12551 pub fn set_config<
12552 T: std::convert::Into<std::option::Option<crate::model::worker_pool::Config>>,
12553 >(
12554 mut self,
12555 v: T,
12556 ) -> Self {
12557 self.config = v.into();
12558 self
12559 }
12560
12561 /// The value of [config][crate::model::WorkerPool::config]
12562 /// if it holds a `PrivatePoolV1Config`, `None` if the field is not set or
12563 /// holds a different branch.
12564 pub fn private_pool_v1_config(
12565 &self,
12566 ) -> std::option::Option<&std::boxed::Box<crate::model::PrivatePoolV1Config>> {
12567 #[allow(unreachable_patterns)]
12568 self.config.as_ref().and_then(|v| match v {
12569 crate::model::worker_pool::Config::PrivatePoolV1Config(v) => {
12570 std::option::Option::Some(v)
12571 }
12572 _ => std::option::Option::None,
12573 })
12574 }
12575
12576 /// Sets the value of [config][crate::model::WorkerPool::config]
12577 /// to hold a `PrivatePoolV1Config`.
12578 ///
12579 /// Note that all the setters affecting `config` are
12580 /// mutually exclusive.
12581 ///
12582 /// # Example
12583 /// ```ignore,no_run
12584 /// # use google_cloud_build_v1::model::WorkerPool;
12585 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12586 /// let x = WorkerPool::new().set_private_pool_v1_config(PrivatePoolV1Config::default()/* use setters */);
12587 /// assert!(x.private_pool_v1_config().is_some());
12588 /// ```
12589 pub fn set_private_pool_v1_config<
12590 T: std::convert::Into<std::boxed::Box<crate::model::PrivatePoolV1Config>>,
12591 >(
12592 mut self,
12593 v: T,
12594 ) -> Self {
12595 self.config = std::option::Option::Some(
12596 crate::model::worker_pool::Config::PrivatePoolV1Config(v.into()),
12597 );
12598 self
12599 }
12600}
12601
12602impl wkt::message::Message for WorkerPool {
12603 fn typename() -> &'static str {
12604 "type.googleapis.com/google.devtools.cloudbuild.v1.WorkerPool"
12605 }
12606}
12607
12608/// Defines additional types related to [WorkerPool].
12609pub mod worker_pool {
12610 #[allow(unused_imports)]
12611 use super::*;
12612
12613 /// State of the `WorkerPool`.
12614 ///
12615 /// # Working with unknown values
12616 ///
12617 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12618 /// additional enum variants at any time. Adding new variants is not considered
12619 /// a breaking change. Applications should write their code in anticipation of:
12620 ///
12621 /// - New values appearing in future releases of the client library, **and**
12622 /// - New values received dynamically, without application changes.
12623 ///
12624 /// Please consult the [Working with enums] section in the user guide for some
12625 /// guidelines.
12626 ///
12627 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12628 #[derive(Clone, Debug, PartialEq)]
12629 #[non_exhaustive]
12630 pub enum State {
12631 /// State of the `WorkerPool` is unknown.
12632 Unspecified,
12633 /// `WorkerPool` is being created.
12634 Creating,
12635 /// `WorkerPool` is running.
12636 Running,
12637 /// `WorkerPool` is being deleted: cancelling builds and draining workers.
12638 Deleting,
12639 /// `WorkerPool` is deleted.
12640 Deleted,
12641 /// `WorkerPool` is being updated; new builds cannot be run.
12642 Updating,
12643 /// If set, the enum was initialized with an unknown value.
12644 ///
12645 /// Applications can examine the value using [State::value] or
12646 /// [State::name].
12647 UnknownValue(state::UnknownValue),
12648 }
12649
12650 #[doc(hidden)]
12651 pub mod state {
12652 #[allow(unused_imports)]
12653 use super::*;
12654 #[derive(Clone, Debug, PartialEq)]
12655 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12656 }
12657
12658 impl State {
12659 /// Gets the enum value.
12660 ///
12661 /// Returns `None` if the enum contains an unknown value deserialized from
12662 /// the string representation of enums.
12663 pub fn value(&self) -> std::option::Option<i32> {
12664 match self {
12665 Self::Unspecified => std::option::Option::Some(0),
12666 Self::Creating => std::option::Option::Some(1),
12667 Self::Running => std::option::Option::Some(2),
12668 Self::Deleting => std::option::Option::Some(3),
12669 Self::Deleted => std::option::Option::Some(4),
12670 Self::Updating => std::option::Option::Some(5),
12671 Self::UnknownValue(u) => u.0.value(),
12672 }
12673 }
12674
12675 /// Gets the enum value as a string.
12676 ///
12677 /// Returns `None` if the enum contains an unknown value deserialized from
12678 /// the integer representation of enums.
12679 pub fn name(&self) -> std::option::Option<&str> {
12680 match self {
12681 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12682 Self::Creating => std::option::Option::Some("CREATING"),
12683 Self::Running => std::option::Option::Some("RUNNING"),
12684 Self::Deleting => std::option::Option::Some("DELETING"),
12685 Self::Deleted => std::option::Option::Some("DELETED"),
12686 Self::Updating => std::option::Option::Some("UPDATING"),
12687 Self::UnknownValue(u) => u.0.name(),
12688 }
12689 }
12690 }
12691
12692 impl std::default::Default for State {
12693 fn default() -> Self {
12694 use std::convert::From;
12695 Self::from(0)
12696 }
12697 }
12698
12699 impl std::fmt::Display for State {
12700 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12701 wkt::internal::display_enum(f, self.name(), self.value())
12702 }
12703 }
12704
12705 impl std::convert::From<i32> for State {
12706 fn from(value: i32) -> Self {
12707 match value {
12708 0 => Self::Unspecified,
12709 1 => Self::Creating,
12710 2 => Self::Running,
12711 3 => Self::Deleting,
12712 4 => Self::Deleted,
12713 5 => Self::Updating,
12714 _ => Self::UnknownValue(state::UnknownValue(
12715 wkt::internal::UnknownEnumValue::Integer(value),
12716 )),
12717 }
12718 }
12719 }
12720
12721 impl std::convert::From<&str> for State {
12722 fn from(value: &str) -> Self {
12723 use std::string::ToString;
12724 match value {
12725 "STATE_UNSPECIFIED" => Self::Unspecified,
12726 "CREATING" => Self::Creating,
12727 "RUNNING" => Self::Running,
12728 "DELETING" => Self::Deleting,
12729 "DELETED" => Self::Deleted,
12730 "UPDATING" => Self::Updating,
12731 _ => Self::UnknownValue(state::UnknownValue(
12732 wkt::internal::UnknownEnumValue::String(value.to_string()),
12733 )),
12734 }
12735 }
12736 }
12737
12738 impl serde::ser::Serialize for State {
12739 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12740 where
12741 S: serde::Serializer,
12742 {
12743 match self {
12744 Self::Unspecified => serializer.serialize_i32(0),
12745 Self::Creating => serializer.serialize_i32(1),
12746 Self::Running => serializer.serialize_i32(2),
12747 Self::Deleting => serializer.serialize_i32(3),
12748 Self::Deleted => serializer.serialize_i32(4),
12749 Self::Updating => serializer.serialize_i32(5),
12750 Self::UnknownValue(u) => u.0.serialize(serializer),
12751 }
12752 }
12753 }
12754
12755 impl<'de> serde::de::Deserialize<'de> for State {
12756 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12757 where
12758 D: serde::Deserializer<'de>,
12759 {
12760 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12761 ".google.devtools.cloudbuild.v1.WorkerPool.State",
12762 ))
12763 }
12764 }
12765
12766 /// Configuration for the `WorkerPool`.
12767 #[derive(Clone, Debug, PartialEq)]
12768 #[non_exhaustive]
12769 pub enum Config {
12770 /// Private Pool configuration.
12771 PrivatePoolV1Config(std::boxed::Box<crate::model::PrivatePoolV1Config>),
12772 }
12773}
12774
12775/// Configuration for a V1 `PrivatePool`.
12776#[derive(Clone, Default, PartialEq)]
12777#[non_exhaustive]
12778pub struct PrivatePoolV1Config {
12779 /// Machine configuration for the workers in the pool.
12780 pub worker_config: std::option::Option<crate::model::private_pool_v_1_config::WorkerConfig>,
12781
12782 /// Network configuration for the pool.
12783 pub network_config: std::option::Option<crate::model::private_pool_v_1_config::NetworkConfig>,
12784
12785 /// Immutable. Private Service Connect(PSC) Network configuration for the pool.
12786 pub private_service_connect:
12787 std::option::Option<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12788
12789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12790}
12791
12792impl PrivatePoolV1Config {
12793 pub fn new() -> Self {
12794 std::default::Default::default()
12795 }
12796
12797 /// Sets the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12798 ///
12799 /// # Example
12800 /// ```ignore,no_run
12801 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12802 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12803 /// let x = PrivatePoolV1Config::new().set_worker_config(WorkerConfig::default()/* use setters */);
12804 /// ```
12805 pub fn set_worker_config<T>(mut self, v: T) -> Self
12806 where
12807 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12808 {
12809 self.worker_config = std::option::Option::Some(v.into());
12810 self
12811 }
12812
12813 /// Sets or clears the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12814 ///
12815 /// # Example
12816 /// ```ignore,no_run
12817 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12818 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12819 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(Some(WorkerConfig::default()/* use setters */));
12820 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(None::<WorkerConfig>);
12821 /// ```
12822 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
12823 where
12824 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12825 {
12826 self.worker_config = v.map(|x| x.into());
12827 self
12828 }
12829
12830 /// Sets the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12831 ///
12832 /// # Example
12833 /// ```ignore,no_run
12834 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12835 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12836 /// let x = PrivatePoolV1Config::new().set_network_config(NetworkConfig::default()/* use setters */);
12837 /// ```
12838 pub fn set_network_config<T>(mut self, v: T) -> Self
12839 where
12840 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12841 {
12842 self.network_config = std::option::Option::Some(v.into());
12843 self
12844 }
12845
12846 /// Sets or clears the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12847 ///
12848 /// # Example
12849 /// ```ignore,no_run
12850 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12851 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12852 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(Some(NetworkConfig::default()/* use setters */));
12853 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(None::<NetworkConfig>);
12854 /// ```
12855 pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
12856 where
12857 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12858 {
12859 self.network_config = v.map(|x| x.into());
12860 self
12861 }
12862
12863 /// Sets the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12864 ///
12865 /// # Example
12866 /// ```ignore,no_run
12867 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12868 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12869 /// let x = PrivatePoolV1Config::new().set_private_service_connect(PrivateServiceConnect::default()/* use setters */);
12870 /// ```
12871 pub fn set_private_service_connect<T>(mut self, v: T) -> Self
12872 where
12873 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12874 {
12875 self.private_service_connect = std::option::Option::Some(v.into());
12876 self
12877 }
12878
12879 /// Sets or clears the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12880 ///
12881 /// # Example
12882 /// ```ignore,no_run
12883 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12884 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12885 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(Some(PrivateServiceConnect::default()/* use setters */));
12886 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(None::<PrivateServiceConnect>);
12887 /// ```
12888 pub fn set_or_clear_private_service_connect<T>(mut self, v: std::option::Option<T>) -> Self
12889 where
12890 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12891 {
12892 self.private_service_connect = v.map(|x| x.into());
12893 self
12894 }
12895}
12896
12897impl wkt::message::Message for PrivatePoolV1Config {
12898 fn typename() -> &'static str {
12899 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config"
12900 }
12901}
12902
12903/// Defines additional types related to [PrivatePoolV1Config].
12904pub mod private_pool_v_1_config {
12905 #[allow(unused_imports)]
12906 use super::*;
12907
12908 /// Defines the configuration to be used for creating workers in
12909 /// the pool.
12910 #[derive(Clone, Default, PartialEq)]
12911 #[non_exhaustive]
12912 pub struct WorkerConfig {
12913 /// Optional. Machine type of a worker, such as `e2-medium`.
12914 /// See [Worker pool config
12915 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
12916 /// If left blank, Cloud Build will use a sensible default.
12917 pub machine_type: std::string::String,
12918
12919 /// Size of the disk attached to the worker, in GB.
12920 /// See [Worker pool config
12921 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
12922 /// Specify a value of up to 4000. If `0` is specified, Cloud Build will use
12923 /// a standard disk size.
12924 pub disk_size_gb: i64,
12925
12926 /// Optional. Enable nested virtualization on the worker, if supported by the
12927 /// machine type. By default, nested virtualization is disabled.
12928 pub enable_nested_virtualization: std::option::Option<bool>,
12929
12930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12931 }
12932
12933 impl WorkerConfig {
12934 pub fn new() -> Self {
12935 std::default::Default::default()
12936 }
12937
12938 /// Sets the value of [machine_type][crate::model::private_pool_v_1_config::WorkerConfig::machine_type].
12939 ///
12940 /// # Example
12941 /// ```ignore,no_run
12942 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12943 /// let x = WorkerConfig::new().set_machine_type("example");
12944 /// ```
12945 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
12946 mut self,
12947 v: T,
12948 ) -> Self {
12949 self.machine_type = v.into();
12950 self
12951 }
12952
12953 /// Sets the value of [disk_size_gb][crate::model::private_pool_v_1_config::WorkerConfig::disk_size_gb].
12954 ///
12955 /// # Example
12956 /// ```ignore,no_run
12957 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12958 /// let x = WorkerConfig::new().set_disk_size_gb(42);
12959 /// ```
12960 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12961 self.disk_size_gb = v.into();
12962 self
12963 }
12964
12965 /// Sets the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
12966 ///
12967 /// # Example
12968 /// ```ignore,no_run
12969 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12970 /// let x = WorkerConfig::new().set_enable_nested_virtualization(true);
12971 /// ```
12972 pub fn set_enable_nested_virtualization<T>(mut self, v: T) -> Self
12973 where
12974 T: std::convert::Into<bool>,
12975 {
12976 self.enable_nested_virtualization = std::option::Option::Some(v.into());
12977 self
12978 }
12979
12980 /// Sets or clears the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
12981 ///
12982 /// # Example
12983 /// ```ignore,no_run
12984 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12985 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(Some(false));
12986 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(None::<bool>);
12987 /// ```
12988 pub fn set_or_clear_enable_nested_virtualization<T>(
12989 mut self,
12990 v: std::option::Option<T>,
12991 ) -> Self
12992 where
12993 T: std::convert::Into<bool>,
12994 {
12995 self.enable_nested_virtualization = v.map(|x| x.into());
12996 self
12997 }
12998 }
12999
13000 impl wkt::message::Message for WorkerConfig {
13001 fn typename() -> &'static str {
13002 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.WorkerConfig"
13003 }
13004 }
13005
13006 /// Defines the network configuration for the pool.
13007 #[derive(Clone, Default, PartialEq)]
13008 #[non_exhaustive]
13009 pub struct NetworkConfig {
13010 /// Required. Immutable. The network definition that the workers are peered
13011 /// to. If this section is left empty, the workers will be peered to
13012 /// `WorkerPool.project_id` on the service producer network. Must be in the
13013 /// format `projects/{project}/global/networks/{network}`, where `{project}`
13014 /// is a project number, such as `12345`, and `{network}` is the name of a
13015 /// VPC network in the project. See
13016 /// [Understanding network configuration
13017 /// options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment)
13018 pub peered_network: std::string::String,
13019
13020 /// Option to configure network egress for the workers.
13021 pub egress_option: crate::model::private_pool_v_1_config::network_config::EgressOption,
13022
13023 /// Immutable. Subnet IP range within the peered network. This is specified
13024 /// in CIDR notation with a slash and the subnet prefix size. You can
13025 /// optionally specify an IP address before the subnet prefix value. e.g.
13026 /// `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a
13027 /// prefix size of 29 bits.
13028 /// `/16` would specify a prefix size of 16 bits, with an automatically
13029 /// determined IP within the peered VPC.
13030 /// If unspecified, a value of `/24` will be used.
13031 pub peered_network_ip_range: std::string::String,
13032
13033 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13034 }
13035
13036 impl NetworkConfig {
13037 pub fn new() -> Self {
13038 std::default::Default::default()
13039 }
13040
13041 /// Sets the value of [peered_network][crate::model::private_pool_v_1_config::NetworkConfig::peered_network].
13042 ///
13043 /// # Example
13044 /// ```ignore,no_run
13045 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13046 /// let x = NetworkConfig::new().set_peered_network("example");
13047 /// ```
13048 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(
13049 mut self,
13050 v: T,
13051 ) -> Self {
13052 self.peered_network = v.into();
13053 self
13054 }
13055
13056 /// Sets the value of [egress_option][crate::model::private_pool_v_1_config::NetworkConfig::egress_option].
13057 ///
13058 /// # Example
13059 /// ```ignore,no_run
13060 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13061 /// use google_cloud_build_v1::model::private_pool_v_1_config::network_config::EgressOption;
13062 /// let x0 = NetworkConfig::new().set_egress_option(EgressOption::NoPublicEgress);
13063 /// let x1 = NetworkConfig::new().set_egress_option(EgressOption::PublicEgress);
13064 /// ```
13065 pub fn set_egress_option<
13066 T: std::convert::Into<crate::model::private_pool_v_1_config::network_config::EgressOption>,
13067 >(
13068 mut self,
13069 v: T,
13070 ) -> Self {
13071 self.egress_option = v.into();
13072 self
13073 }
13074
13075 /// Sets the value of [peered_network_ip_range][crate::model::private_pool_v_1_config::NetworkConfig::peered_network_ip_range].
13076 ///
13077 /// # Example
13078 /// ```ignore,no_run
13079 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13080 /// let x = NetworkConfig::new().set_peered_network_ip_range("example");
13081 /// ```
13082 pub fn set_peered_network_ip_range<T: std::convert::Into<std::string::String>>(
13083 mut self,
13084 v: T,
13085 ) -> Self {
13086 self.peered_network_ip_range = v.into();
13087 self
13088 }
13089 }
13090
13091 impl wkt::message::Message for NetworkConfig {
13092 fn typename() -> &'static str {
13093 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig"
13094 }
13095 }
13096
13097 /// Defines additional types related to [NetworkConfig].
13098 pub mod network_config {
13099 #[allow(unused_imports)]
13100 use super::*;
13101
13102 /// Defines the egress option for the pool.
13103 ///
13104 /// # Working with unknown values
13105 ///
13106 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13107 /// additional enum variants at any time. Adding new variants is not considered
13108 /// a breaking change. Applications should write their code in anticipation of:
13109 ///
13110 /// - New values appearing in future releases of the client library, **and**
13111 /// - New values received dynamically, without application changes.
13112 ///
13113 /// Please consult the [Working with enums] section in the user guide for some
13114 /// guidelines.
13115 ///
13116 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13117 #[derive(Clone, Debug, PartialEq)]
13118 #[non_exhaustive]
13119 pub enum EgressOption {
13120 /// If set, defaults to PUBLIC_EGRESS.
13121 Unspecified,
13122 /// If set, workers are created without any public address, which prevents
13123 /// network egress to public IPs unless a network proxy is configured.
13124 NoPublicEgress,
13125 /// If set, workers are created with a public address which allows for
13126 /// public internet egress.
13127 PublicEgress,
13128 /// If set, the enum was initialized with an unknown value.
13129 ///
13130 /// Applications can examine the value using [EgressOption::value] or
13131 /// [EgressOption::name].
13132 UnknownValue(egress_option::UnknownValue),
13133 }
13134
13135 #[doc(hidden)]
13136 pub mod egress_option {
13137 #[allow(unused_imports)]
13138 use super::*;
13139 #[derive(Clone, Debug, PartialEq)]
13140 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13141 }
13142
13143 impl EgressOption {
13144 /// Gets the enum value.
13145 ///
13146 /// Returns `None` if the enum contains an unknown value deserialized from
13147 /// the string representation of enums.
13148 pub fn value(&self) -> std::option::Option<i32> {
13149 match self {
13150 Self::Unspecified => std::option::Option::Some(0),
13151 Self::NoPublicEgress => std::option::Option::Some(1),
13152 Self::PublicEgress => std::option::Option::Some(2),
13153 Self::UnknownValue(u) => u.0.value(),
13154 }
13155 }
13156
13157 /// Gets the enum value as a string.
13158 ///
13159 /// Returns `None` if the enum contains an unknown value deserialized from
13160 /// the integer representation of enums.
13161 pub fn name(&self) -> std::option::Option<&str> {
13162 match self {
13163 Self::Unspecified => std::option::Option::Some("EGRESS_OPTION_UNSPECIFIED"),
13164 Self::NoPublicEgress => std::option::Option::Some("NO_PUBLIC_EGRESS"),
13165 Self::PublicEgress => std::option::Option::Some("PUBLIC_EGRESS"),
13166 Self::UnknownValue(u) => u.0.name(),
13167 }
13168 }
13169 }
13170
13171 impl std::default::Default for EgressOption {
13172 fn default() -> Self {
13173 use std::convert::From;
13174 Self::from(0)
13175 }
13176 }
13177
13178 impl std::fmt::Display for EgressOption {
13179 fn fmt(
13180 &self,
13181 f: &mut std::fmt::Formatter<'_>,
13182 ) -> std::result::Result<(), std::fmt::Error> {
13183 wkt::internal::display_enum(f, self.name(), self.value())
13184 }
13185 }
13186
13187 impl std::convert::From<i32> for EgressOption {
13188 fn from(value: i32) -> Self {
13189 match value {
13190 0 => Self::Unspecified,
13191 1 => Self::NoPublicEgress,
13192 2 => Self::PublicEgress,
13193 _ => Self::UnknownValue(egress_option::UnknownValue(
13194 wkt::internal::UnknownEnumValue::Integer(value),
13195 )),
13196 }
13197 }
13198 }
13199
13200 impl std::convert::From<&str> for EgressOption {
13201 fn from(value: &str) -> Self {
13202 use std::string::ToString;
13203 match value {
13204 "EGRESS_OPTION_UNSPECIFIED" => Self::Unspecified,
13205 "NO_PUBLIC_EGRESS" => Self::NoPublicEgress,
13206 "PUBLIC_EGRESS" => Self::PublicEgress,
13207 _ => Self::UnknownValue(egress_option::UnknownValue(
13208 wkt::internal::UnknownEnumValue::String(value.to_string()),
13209 )),
13210 }
13211 }
13212 }
13213
13214 impl serde::ser::Serialize for EgressOption {
13215 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13216 where
13217 S: serde::Serializer,
13218 {
13219 match self {
13220 Self::Unspecified => serializer.serialize_i32(0),
13221 Self::NoPublicEgress => serializer.serialize_i32(1),
13222 Self::PublicEgress => serializer.serialize_i32(2),
13223 Self::UnknownValue(u) => u.0.serialize(serializer),
13224 }
13225 }
13226 }
13227
13228 impl<'de> serde::de::Deserialize<'de> for EgressOption {
13229 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13230 where
13231 D: serde::Deserializer<'de>,
13232 {
13233 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EgressOption>::new(
13234 ".google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig.EgressOption",
13235 ))
13236 }
13237 }
13238 }
13239
13240 /// Defines the Private Service Connect network configuration for the pool.
13241 #[derive(Clone, Default, PartialEq)]
13242 #[non_exhaustive]
13243 pub struct PrivateServiceConnect {
13244 /// Required. Immutable. The network attachment that the worker network
13245 /// interface is peered to. Must be in the format
13246 /// `projects/{project}/regions/{region}/networkAttachments/{networkAttachment}`.
13247 /// The region of network attachment must be the same as the worker pool.
13248 /// See [Network
13249 /// Attachments](https://cloud.google.com/vpc/docs/about-network-attachments)
13250 pub network_attachment: std::string::String,
13251
13252 /// Required. Immutable. Disable public IP on the primary network interface.
13253 ///
13254 /// If true, workers are created without any public address, which prevents
13255 /// network egress to public IPs unless a network proxy is configured.
13256 /// If false, workers are created with a public address which allows for
13257 /// public internet egress. The public address only applies to traffic
13258 /// through the primary network interface.
13259 /// If `route_all_traffic` is set to true, all traffic will go through the
13260 /// non-primary network interface, this boolean has no effect.
13261 pub public_ip_address_disabled: bool,
13262
13263 /// Immutable. Route all traffic through PSC interface. Enable this if you
13264 /// want full control of traffic in the private pool. Configure Cloud NAT for
13265 /// the subnet of network attachment if you need to access public Internet.
13266 ///
13267 /// If false, Only route RFC 1918 (10.0.0.0/8, 172.16.0.0/12, and
13268 /// 192.168.0.0/16) and RFC 6598 (100.64.0.0/10) through PSC interface.
13269 pub route_all_traffic: bool,
13270
13271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13272 }
13273
13274 impl PrivateServiceConnect {
13275 pub fn new() -> Self {
13276 std::default::Default::default()
13277 }
13278
13279 /// Sets the value of [network_attachment][crate::model::private_pool_v_1_config::PrivateServiceConnect::network_attachment].
13280 ///
13281 /// # Example
13282 /// ```ignore,no_run
13283 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13284 /// let x = PrivateServiceConnect::new().set_network_attachment("example");
13285 /// ```
13286 pub fn set_network_attachment<T: std::convert::Into<std::string::String>>(
13287 mut self,
13288 v: T,
13289 ) -> Self {
13290 self.network_attachment = v.into();
13291 self
13292 }
13293
13294 /// Sets the value of [public_ip_address_disabled][crate::model::private_pool_v_1_config::PrivateServiceConnect::public_ip_address_disabled].
13295 ///
13296 /// # Example
13297 /// ```ignore,no_run
13298 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13299 /// let x = PrivateServiceConnect::new().set_public_ip_address_disabled(true);
13300 /// ```
13301 pub fn set_public_ip_address_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13302 self.public_ip_address_disabled = v.into();
13303 self
13304 }
13305
13306 /// Sets the value of [route_all_traffic][crate::model::private_pool_v_1_config::PrivateServiceConnect::route_all_traffic].
13307 ///
13308 /// # Example
13309 /// ```ignore,no_run
13310 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13311 /// let x = PrivateServiceConnect::new().set_route_all_traffic(true);
13312 /// ```
13313 pub fn set_route_all_traffic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13314 self.route_all_traffic = v.into();
13315 self
13316 }
13317 }
13318
13319 impl wkt::message::Message for PrivateServiceConnect {
13320 fn typename() -> &'static str {
13321 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.PrivateServiceConnect"
13322 }
13323 }
13324}
13325
13326/// Request to create a new `WorkerPool`.
13327#[derive(Clone, Default, PartialEq)]
13328#[non_exhaustive]
13329pub struct CreateWorkerPoolRequest {
13330 /// Required. The parent resource where this worker pool will be created.
13331 /// Format: `projects/{project}/locations/{location}`.
13332 pub parent: std::string::String,
13333
13334 /// Required. `WorkerPool` resource to create.
13335 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13336
13337 /// Required. Immutable. The ID to use for the `WorkerPool`, which will become
13338 /// the final component of the resource name.
13339 ///
13340 /// This value should be 1-63 characters, and valid characters
13341 /// are /[a-z][0-9]-/.
13342 pub worker_pool_id: std::string::String,
13343
13344 /// If set, validate the request and preview the response, but do not actually
13345 /// post it.
13346 pub validate_only: bool,
13347
13348 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13349}
13350
13351impl CreateWorkerPoolRequest {
13352 pub fn new() -> Self {
13353 std::default::Default::default()
13354 }
13355
13356 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
13357 ///
13358 /// # Example
13359 /// ```ignore,no_run
13360 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13361 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
13362 /// ```
13363 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13364 self.parent = v.into();
13365 self
13366 }
13367
13368 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13369 ///
13370 /// # Example
13371 /// ```ignore,no_run
13372 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13373 /// use google_cloud_build_v1::model::WorkerPool;
13374 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13375 /// ```
13376 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13377 where
13378 T: std::convert::Into<crate::model::WorkerPool>,
13379 {
13380 self.worker_pool = std::option::Option::Some(v.into());
13381 self
13382 }
13383
13384 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13385 ///
13386 /// # Example
13387 /// ```ignore,no_run
13388 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13389 /// use google_cloud_build_v1::model::WorkerPool;
13390 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13391 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13392 /// ```
13393 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13394 where
13395 T: std::convert::Into<crate::model::WorkerPool>,
13396 {
13397 self.worker_pool = v.map(|x| x.into());
13398 self
13399 }
13400
13401 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
13402 ///
13403 /// # Example
13404 /// ```ignore,no_run
13405 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13406 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
13407 /// ```
13408 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13409 self.worker_pool_id = v.into();
13410 self
13411 }
13412
13413 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
13414 ///
13415 /// # Example
13416 /// ```ignore,no_run
13417 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13418 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
13419 /// ```
13420 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13421 self.validate_only = v.into();
13422 self
13423 }
13424}
13425
13426impl wkt::message::Message for CreateWorkerPoolRequest {
13427 fn typename() -> &'static str {
13428 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolRequest"
13429 }
13430}
13431
13432/// Request to get a `WorkerPool` with the specified name.
13433#[derive(Clone, Default, PartialEq)]
13434#[non_exhaustive]
13435pub struct GetWorkerPoolRequest {
13436 /// Required. The name of the `WorkerPool` to retrieve.
13437 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13438 pub name: std::string::String,
13439
13440 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13441}
13442
13443impl GetWorkerPoolRequest {
13444 pub fn new() -> Self {
13445 std::default::Default::default()
13446 }
13447
13448 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
13449 ///
13450 /// # Example
13451 /// ```ignore,no_run
13452 /// # use google_cloud_build_v1::model::GetWorkerPoolRequest;
13453 /// let x = GetWorkerPoolRequest::new().set_name("example");
13454 /// ```
13455 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13456 self.name = v.into();
13457 self
13458 }
13459}
13460
13461impl wkt::message::Message for GetWorkerPoolRequest {
13462 fn typename() -> &'static str {
13463 "type.googleapis.com/google.devtools.cloudbuild.v1.GetWorkerPoolRequest"
13464 }
13465}
13466
13467/// Request to delete a `WorkerPool`.
13468#[derive(Clone, Default, PartialEq)]
13469#[non_exhaustive]
13470pub struct DeleteWorkerPoolRequest {
13471 /// Required. The name of the `WorkerPool` to delete.
13472 /// Format:
13473 /// `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13474 pub name: std::string::String,
13475
13476 /// Optional. If provided, it must match the server's etag on the workerpool
13477 /// for the request to be processed.
13478 pub etag: std::string::String,
13479
13480 /// If set to true, and the `WorkerPool` is not found, the request will succeed
13481 /// but no action will be taken on the server.
13482 pub allow_missing: bool,
13483
13484 /// If set, validate the request and preview the response, but do not actually
13485 /// post it.
13486 pub validate_only: bool,
13487
13488 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13489}
13490
13491impl DeleteWorkerPoolRequest {
13492 pub fn new() -> Self {
13493 std::default::Default::default()
13494 }
13495
13496 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
13497 ///
13498 /// # Example
13499 /// ```ignore,no_run
13500 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13501 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
13502 /// ```
13503 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13504 self.name = v.into();
13505 self
13506 }
13507
13508 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
13509 ///
13510 /// # Example
13511 /// ```ignore,no_run
13512 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13513 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
13514 /// ```
13515 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13516 self.etag = v.into();
13517 self
13518 }
13519
13520 /// Sets the value of [allow_missing][crate::model::DeleteWorkerPoolRequest::allow_missing].
13521 ///
13522 /// # Example
13523 /// ```ignore,no_run
13524 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13525 /// let x = DeleteWorkerPoolRequest::new().set_allow_missing(true);
13526 /// ```
13527 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13528 self.allow_missing = v.into();
13529 self
13530 }
13531
13532 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
13533 ///
13534 /// # Example
13535 /// ```ignore,no_run
13536 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13537 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
13538 /// ```
13539 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13540 self.validate_only = v.into();
13541 self
13542 }
13543}
13544
13545impl wkt::message::Message for DeleteWorkerPoolRequest {
13546 fn typename() -> &'static str {
13547 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest"
13548 }
13549}
13550
13551/// Request to update a `WorkerPool`.
13552#[derive(Clone, Default, PartialEq)]
13553#[non_exhaustive]
13554pub struct UpdateWorkerPoolRequest {
13555 /// Required. The `WorkerPool` to update.
13556 ///
13557 /// The `name` field is used to identify the `WorkerPool` to update.
13558 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13559 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13560
13561 /// Optional. A mask specifying which fields in `worker_pool` to update.
13562 pub update_mask: std::option::Option<wkt::FieldMask>,
13563
13564 /// If set, validate the request and preview the response, but do not actually
13565 /// post it.
13566 pub validate_only: bool,
13567
13568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13569}
13570
13571impl UpdateWorkerPoolRequest {
13572 pub fn new() -> Self {
13573 std::default::Default::default()
13574 }
13575
13576 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13577 ///
13578 /// # Example
13579 /// ```ignore,no_run
13580 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13581 /// use google_cloud_build_v1::model::WorkerPool;
13582 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13583 /// ```
13584 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13585 where
13586 T: std::convert::Into<crate::model::WorkerPool>,
13587 {
13588 self.worker_pool = std::option::Option::Some(v.into());
13589 self
13590 }
13591
13592 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13593 ///
13594 /// # Example
13595 /// ```ignore,no_run
13596 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13597 /// use google_cloud_build_v1::model::WorkerPool;
13598 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13599 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13600 /// ```
13601 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13602 where
13603 T: std::convert::Into<crate::model::WorkerPool>,
13604 {
13605 self.worker_pool = v.map(|x| x.into());
13606 self
13607 }
13608
13609 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13610 ///
13611 /// # Example
13612 /// ```ignore,no_run
13613 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13614 /// use wkt::FieldMask;
13615 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13616 /// ```
13617 pub fn set_update_mask<T>(mut self, v: T) -> Self
13618 where
13619 T: std::convert::Into<wkt::FieldMask>,
13620 {
13621 self.update_mask = std::option::Option::Some(v.into());
13622 self
13623 }
13624
13625 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13626 ///
13627 /// # Example
13628 /// ```ignore,no_run
13629 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13630 /// use wkt::FieldMask;
13631 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13632 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13633 /// ```
13634 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13635 where
13636 T: std::convert::Into<wkt::FieldMask>,
13637 {
13638 self.update_mask = v.map(|x| x.into());
13639 self
13640 }
13641
13642 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
13643 ///
13644 /// # Example
13645 /// ```ignore,no_run
13646 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13647 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
13648 /// ```
13649 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13650 self.validate_only = v.into();
13651 self
13652 }
13653}
13654
13655impl wkt::message::Message for UpdateWorkerPoolRequest {
13656 fn typename() -> &'static str {
13657 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest"
13658 }
13659}
13660
13661/// Request to list `WorkerPool`s.
13662#[derive(Clone, Default, PartialEq)]
13663#[non_exhaustive]
13664pub struct ListWorkerPoolsRequest {
13665 /// Required. The parent of the collection of `WorkerPools`.
13666 /// Format: `projects/{project}/locations/{location}`.
13667 pub parent: std::string::String,
13668
13669 /// The maximum number of `WorkerPool`s to return. The service may return
13670 /// fewer than this value. If omitted, the server will use a sensible default.
13671 pub page_size: i32,
13672
13673 /// A page token, received from a previous `ListWorkerPools` call. Provide this
13674 /// to retrieve the subsequent page.
13675 pub page_token: std::string::String,
13676
13677 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13678}
13679
13680impl ListWorkerPoolsRequest {
13681 pub fn new() -> Self {
13682 std::default::Default::default()
13683 }
13684
13685 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
13686 ///
13687 /// # Example
13688 /// ```ignore,no_run
13689 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13690 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
13691 /// ```
13692 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13693 self.parent = v.into();
13694 self
13695 }
13696
13697 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
13698 ///
13699 /// # Example
13700 /// ```ignore,no_run
13701 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13702 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
13703 /// ```
13704 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13705 self.page_size = v.into();
13706 self
13707 }
13708
13709 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
13710 ///
13711 /// # Example
13712 /// ```ignore,no_run
13713 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13714 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
13715 /// ```
13716 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13717 self.page_token = v.into();
13718 self
13719 }
13720}
13721
13722impl wkt::message::Message for ListWorkerPoolsRequest {
13723 fn typename() -> &'static str {
13724 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsRequest"
13725 }
13726}
13727
13728/// Response containing existing `WorkerPools`.
13729#[derive(Clone, Default, PartialEq)]
13730#[non_exhaustive]
13731pub struct ListWorkerPoolsResponse {
13732 /// `WorkerPools` for the specified project.
13733 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
13734
13735 /// Continuation token used to page through large result sets. Provide this
13736 /// value in a subsequent ListWorkerPoolsRequest to return the next page of
13737 /// results.
13738 pub next_page_token: std::string::String,
13739
13740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13741}
13742
13743impl ListWorkerPoolsResponse {
13744 pub fn new() -> Self {
13745 std::default::Default::default()
13746 }
13747
13748 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
13749 ///
13750 /// # Example
13751 /// ```ignore,no_run
13752 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13753 /// use google_cloud_build_v1::model::WorkerPool;
13754 /// let x = ListWorkerPoolsResponse::new()
13755 /// .set_worker_pools([
13756 /// WorkerPool::default()/* use setters */,
13757 /// WorkerPool::default()/* use (different) setters */,
13758 /// ]);
13759 /// ```
13760 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
13761 where
13762 T: std::iter::IntoIterator<Item = V>,
13763 V: std::convert::Into<crate::model::WorkerPool>,
13764 {
13765 use std::iter::Iterator;
13766 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
13767 self
13768 }
13769
13770 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
13771 ///
13772 /// # Example
13773 /// ```ignore,no_run
13774 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13775 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
13776 /// ```
13777 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13778 self.next_page_token = v.into();
13779 self
13780 }
13781}
13782
13783impl wkt::message::Message for ListWorkerPoolsResponse {
13784 fn typename() -> &'static str {
13785 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsResponse"
13786 }
13787}
13788
13789#[doc(hidden)]
13790impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
13791 type PageItem = crate::model::WorkerPool;
13792
13793 fn items(self) -> std::vec::Vec<Self::PageItem> {
13794 self.worker_pools
13795 }
13796
13797 fn next_page_token(&self) -> std::string::String {
13798 use std::clone::Clone;
13799 self.next_page_token.clone()
13800 }
13801}
13802
13803/// Metadata for the `CreateWorkerPool` operation.
13804#[derive(Clone, Default, PartialEq)]
13805#[non_exhaustive]
13806pub struct CreateWorkerPoolOperationMetadata {
13807 /// The resource name of the `WorkerPool` to create.
13808 /// Format:
13809 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13810 pub worker_pool: std::string::String,
13811
13812 /// Time the operation was created.
13813 pub create_time: std::option::Option<wkt::Timestamp>,
13814
13815 /// Time the operation was completed.
13816 pub complete_time: std::option::Option<wkt::Timestamp>,
13817
13818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13819}
13820
13821impl CreateWorkerPoolOperationMetadata {
13822 pub fn new() -> Self {
13823 std::default::Default::default()
13824 }
13825
13826 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolOperationMetadata::worker_pool].
13827 ///
13828 /// # Example
13829 /// ```ignore,no_run
13830 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13831 /// let x = CreateWorkerPoolOperationMetadata::new().set_worker_pool("example");
13832 /// ```
13833 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13834 self.worker_pool = v.into();
13835 self
13836 }
13837
13838 /// Sets the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13839 ///
13840 /// # Example
13841 /// ```ignore,no_run
13842 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13843 /// use wkt::Timestamp;
13844 /// let x = CreateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
13845 /// ```
13846 pub fn set_create_time<T>(mut self, v: T) -> Self
13847 where
13848 T: std::convert::Into<wkt::Timestamp>,
13849 {
13850 self.create_time = std::option::Option::Some(v.into());
13851 self
13852 }
13853
13854 /// Sets or clears the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13855 ///
13856 /// # Example
13857 /// ```ignore,no_run
13858 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13859 /// use wkt::Timestamp;
13860 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13861 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
13862 /// ```
13863 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13864 where
13865 T: std::convert::Into<wkt::Timestamp>,
13866 {
13867 self.create_time = v.map(|x| x.into());
13868 self
13869 }
13870
13871 /// Sets the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
13872 ///
13873 /// # Example
13874 /// ```ignore,no_run
13875 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13876 /// use wkt::Timestamp;
13877 /// let x = CreateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
13878 /// ```
13879 pub fn set_complete_time<T>(mut self, v: T) -> Self
13880 where
13881 T: std::convert::Into<wkt::Timestamp>,
13882 {
13883 self.complete_time = std::option::Option::Some(v.into());
13884 self
13885 }
13886
13887 /// Sets or clears the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
13888 ///
13889 /// # Example
13890 /// ```ignore,no_run
13891 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13892 /// use wkt::Timestamp;
13893 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
13894 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
13895 /// ```
13896 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
13897 where
13898 T: std::convert::Into<wkt::Timestamp>,
13899 {
13900 self.complete_time = v.map(|x| x.into());
13901 self
13902 }
13903}
13904
13905impl wkt::message::Message for CreateWorkerPoolOperationMetadata {
13906 fn typename() -> &'static str {
13907 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata"
13908 }
13909}
13910
13911/// Metadata for the `UpdateWorkerPool` operation.
13912#[derive(Clone, Default, PartialEq)]
13913#[non_exhaustive]
13914pub struct UpdateWorkerPoolOperationMetadata {
13915 /// The resource name of the `WorkerPool` being updated.
13916 /// Format:
13917 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13918 pub worker_pool: std::string::String,
13919
13920 /// Time the operation was created.
13921 pub create_time: std::option::Option<wkt::Timestamp>,
13922
13923 /// Time the operation was completed.
13924 pub complete_time: std::option::Option<wkt::Timestamp>,
13925
13926 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13927}
13928
13929impl UpdateWorkerPoolOperationMetadata {
13930 pub fn new() -> Self {
13931 std::default::Default::default()
13932 }
13933
13934 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolOperationMetadata::worker_pool].
13935 ///
13936 /// # Example
13937 /// ```ignore,no_run
13938 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13939 /// let x = UpdateWorkerPoolOperationMetadata::new().set_worker_pool("example");
13940 /// ```
13941 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13942 self.worker_pool = v.into();
13943 self
13944 }
13945
13946 /// Sets the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
13947 ///
13948 /// # Example
13949 /// ```ignore,no_run
13950 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13951 /// use wkt::Timestamp;
13952 /// let x = UpdateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
13953 /// ```
13954 pub fn set_create_time<T>(mut self, v: T) -> Self
13955 where
13956 T: std::convert::Into<wkt::Timestamp>,
13957 {
13958 self.create_time = std::option::Option::Some(v.into());
13959 self
13960 }
13961
13962 /// Sets or clears the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
13963 ///
13964 /// # Example
13965 /// ```ignore,no_run
13966 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13967 /// use wkt::Timestamp;
13968 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13969 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
13970 /// ```
13971 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13972 where
13973 T: std::convert::Into<wkt::Timestamp>,
13974 {
13975 self.create_time = v.map(|x| x.into());
13976 self
13977 }
13978
13979 /// Sets the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
13980 ///
13981 /// # Example
13982 /// ```ignore,no_run
13983 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13984 /// use wkt::Timestamp;
13985 /// let x = UpdateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
13986 /// ```
13987 pub fn set_complete_time<T>(mut self, v: T) -> Self
13988 where
13989 T: std::convert::Into<wkt::Timestamp>,
13990 {
13991 self.complete_time = std::option::Option::Some(v.into());
13992 self
13993 }
13994
13995 /// Sets or clears the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
13996 ///
13997 /// # Example
13998 /// ```ignore,no_run
13999 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14000 /// use wkt::Timestamp;
14001 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14002 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14003 /// ```
14004 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14005 where
14006 T: std::convert::Into<wkt::Timestamp>,
14007 {
14008 self.complete_time = v.map(|x| x.into());
14009 self
14010 }
14011}
14012
14013impl wkt::message::Message for UpdateWorkerPoolOperationMetadata {
14014 fn typename() -> &'static str {
14015 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata"
14016 }
14017}
14018
14019/// Metadata for the `DeleteWorkerPool` operation.
14020#[derive(Clone, Default, PartialEq)]
14021#[non_exhaustive]
14022pub struct DeleteWorkerPoolOperationMetadata {
14023 /// The resource name of the `WorkerPool` being deleted.
14024 /// Format:
14025 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14026 pub worker_pool: std::string::String,
14027
14028 /// Time the operation was created.
14029 pub create_time: std::option::Option<wkt::Timestamp>,
14030
14031 /// Time the operation was completed.
14032 pub complete_time: std::option::Option<wkt::Timestamp>,
14033
14034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14035}
14036
14037impl DeleteWorkerPoolOperationMetadata {
14038 pub fn new() -> Self {
14039 std::default::Default::default()
14040 }
14041
14042 /// Sets the value of [worker_pool][crate::model::DeleteWorkerPoolOperationMetadata::worker_pool].
14043 ///
14044 /// # Example
14045 /// ```ignore,no_run
14046 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14047 /// let x = DeleteWorkerPoolOperationMetadata::new().set_worker_pool("example");
14048 /// ```
14049 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14050 self.worker_pool = v.into();
14051 self
14052 }
14053
14054 /// Sets the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14055 ///
14056 /// # Example
14057 /// ```ignore,no_run
14058 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14059 /// use wkt::Timestamp;
14060 /// let x = DeleteWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14061 /// ```
14062 pub fn set_create_time<T>(mut self, v: T) -> Self
14063 where
14064 T: std::convert::Into<wkt::Timestamp>,
14065 {
14066 self.create_time = std::option::Option::Some(v.into());
14067 self
14068 }
14069
14070 /// Sets or clears the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14071 ///
14072 /// # Example
14073 /// ```ignore,no_run
14074 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14075 /// use wkt::Timestamp;
14076 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14077 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14078 /// ```
14079 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14080 where
14081 T: std::convert::Into<wkt::Timestamp>,
14082 {
14083 self.create_time = v.map(|x| x.into());
14084 self
14085 }
14086
14087 /// Sets the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14088 ///
14089 /// # Example
14090 /// ```ignore,no_run
14091 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14092 /// use wkt::Timestamp;
14093 /// let x = DeleteWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14094 /// ```
14095 pub fn set_complete_time<T>(mut self, v: T) -> Self
14096 where
14097 T: std::convert::Into<wkt::Timestamp>,
14098 {
14099 self.complete_time = std::option::Option::Some(v.into());
14100 self
14101 }
14102
14103 /// Sets or clears the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14104 ///
14105 /// # Example
14106 /// ```ignore,no_run
14107 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14108 /// use wkt::Timestamp;
14109 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14110 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14111 /// ```
14112 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14113 where
14114 T: std::convert::Into<wkt::Timestamp>,
14115 {
14116 self.complete_time = v.map(|x| x.into());
14117 self
14118 }
14119}
14120
14121impl wkt::message::Message for DeleteWorkerPoolOperationMetadata {
14122 fn typename() -> &'static str {
14123 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata"
14124 }
14125}