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 /// Creates a new default instance.
52 pub fn new() -> Self {
53 std::default::Default::default()
54 }
55
56 /// Sets the value of [name][crate::model::GetDefaultServiceAccountRequest::name].
57 ///
58 /// # Example
59 /// ```ignore,no_run
60 /// # use google_cloud_build_v1::model::GetDefaultServiceAccountRequest;
61 /// let x = GetDefaultServiceAccountRequest::new().set_name("example");
62 /// ```
63 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
64 self.name = v.into();
65 self
66 }
67}
68
69impl wkt::message::Message for GetDefaultServiceAccountRequest {
70 fn typename() -> &'static str {
71 "type.googleapis.com/google.devtools.cloudbuild.v1.GetDefaultServiceAccountRequest"
72 }
73}
74
75/// The default service account used for `Builds`.
76#[derive(Clone, Default, PartialEq)]
77#[non_exhaustive]
78pub struct DefaultServiceAccount {
79 /// Identifier. Format:
80 /// `projects/{project}/locations/{location}/defaultServiceAccount`
81 pub name: std::string::String,
82
83 /// Output only. The email address of the service account identity that will be
84 /// used for a build by default.
85 ///
86 /// This is returned in the format
87 /// `projects/{project}/serviceAccounts/{service_account}` where
88 /// `{service_account}` could be the legacy Cloud Build SA, in the format
89 /// [PROJECT_NUMBER]@cloudbuild.gserviceaccount.com or the Compute SA, in the
90 /// format [PROJECT_NUMBER]-compute@developer.gserviceaccount.com.
91 ///
92 /// If no service account will be used by default, this will be empty.
93 pub service_account_email: std::string::String,
94
95 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
96}
97
98impl DefaultServiceAccount {
99 /// Creates a new default instance.
100 pub fn new() -> Self {
101 std::default::Default::default()
102 }
103
104 /// Sets the value of [name][crate::model::DefaultServiceAccount::name].
105 ///
106 /// # Example
107 /// ```ignore,no_run
108 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
109 /// let x = DefaultServiceAccount::new().set_name("example");
110 /// ```
111 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
112 self.name = v.into();
113 self
114 }
115
116 /// Sets the value of [service_account_email][crate::model::DefaultServiceAccount::service_account_email].
117 ///
118 /// # Example
119 /// ```ignore,no_run
120 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
121 /// let x = DefaultServiceAccount::new().set_service_account_email("example");
122 /// ```
123 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
124 mut self,
125 v: T,
126 ) -> Self {
127 self.service_account_email = v.into();
128 self
129 }
130}
131
132impl wkt::message::Message for DefaultServiceAccount {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.devtools.cloudbuild.v1.DefaultServiceAccount"
135 }
136}
137
138/// Specifies a build to retry.
139#[derive(Clone, Default, PartialEq)]
140#[non_exhaustive]
141pub struct RetryBuildRequest {
142 /// The name of the `Build` to retry.
143 /// Format: `projects/{project}/locations/{location}/builds/{build}`
144 pub name: std::string::String,
145
146 /// Required. ID of the project.
147 pub project_id: std::string::String,
148
149 /// Required. Build ID of the original build.
150 pub id: std::string::String,
151
152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
153}
154
155impl RetryBuildRequest {
156 /// Creates a new default instance.
157 pub fn new() -> Self {
158 std::default::Default::default()
159 }
160
161 /// Sets the value of [name][crate::model::RetryBuildRequest::name].
162 ///
163 /// # Example
164 /// ```ignore,no_run
165 /// # use google_cloud_build_v1::model::RetryBuildRequest;
166 /// let x = RetryBuildRequest::new().set_name("example");
167 /// ```
168 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
169 self.name = v.into();
170 self
171 }
172
173 /// Sets the value of [project_id][crate::model::RetryBuildRequest::project_id].
174 ///
175 /// # Example
176 /// ```ignore,no_run
177 /// # use google_cloud_build_v1::model::RetryBuildRequest;
178 /// let x = RetryBuildRequest::new().set_project_id("example");
179 /// ```
180 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
181 self.project_id = v.into();
182 self
183 }
184
185 /// Sets the value of [id][crate::model::RetryBuildRequest::id].
186 ///
187 /// # Example
188 /// ```ignore,no_run
189 /// # use google_cloud_build_v1::model::RetryBuildRequest;
190 /// let x = RetryBuildRequest::new().set_id("example");
191 /// ```
192 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
193 self.id = v.into();
194 self
195 }
196}
197
198impl wkt::message::Message for RetryBuildRequest {
199 fn typename() -> &'static str {
200 "type.googleapis.com/google.devtools.cloudbuild.v1.RetryBuildRequest"
201 }
202}
203
204/// Specifies a build trigger to run and the source to use.
205#[derive(Clone, Default, PartialEq)]
206#[non_exhaustive]
207pub struct RunBuildTriggerRequest {
208 /// The name of the `Trigger` to run.
209 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
210 pub name: std::string::String,
211
212 /// Required. ID of the project.
213 pub project_id: std::string::String,
214
215 /// Required. ID of the trigger.
216 pub trigger_id: std::string::String,
217
218 /// Source to build against this trigger.
219 /// Branch and tag names cannot consist of regular expressions.
220 pub source: std::option::Option<crate::model::RepoSource>,
221
222 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
223}
224
225impl RunBuildTriggerRequest {
226 /// Creates a new default instance.
227 pub fn new() -> Self {
228 std::default::Default::default()
229 }
230
231 /// Sets the value of [name][crate::model::RunBuildTriggerRequest::name].
232 ///
233 /// # Example
234 /// ```ignore,no_run
235 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
236 /// let x = RunBuildTriggerRequest::new().set_name("example");
237 /// ```
238 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
239 self.name = v.into();
240 self
241 }
242
243 /// Sets the value of [project_id][crate::model::RunBuildTriggerRequest::project_id].
244 ///
245 /// # Example
246 /// ```ignore,no_run
247 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
248 /// let x = RunBuildTriggerRequest::new().set_project_id("example");
249 /// ```
250 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
251 self.project_id = v.into();
252 self
253 }
254
255 /// Sets the value of [trigger_id][crate::model::RunBuildTriggerRequest::trigger_id].
256 ///
257 /// # Example
258 /// ```ignore,no_run
259 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
260 /// let x = RunBuildTriggerRequest::new().set_trigger_id("example");
261 /// ```
262 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
263 self.trigger_id = v.into();
264 self
265 }
266
267 /// Sets the value of [source][crate::model::RunBuildTriggerRequest::source].
268 ///
269 /// # Example
270 /// ```ignore,no_run
271 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
272 /// use google_cloud_build_v1::model::RepoSource;
273 /// let x = RunBuildTriggerRequest::new().set_source(RepoSource::default()/* use setters */);
274 /// ```
275 pub fn set_source<T>(mut self, v: T) -> Self
276 where
277 T: std::convert::Into<crate::model::RepoSource>,
278 {
279 self.source = std::option::Option::Some(v.into());
280 self
281 }
282
283 /// Sets or clears the value of [source][crate::model::RunBuildTriggerRequest::source].
284 ///
285 /// # Example
286 /// ```ignore,no_run
287 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
288 /// use google_cloud_build_v1::model::RepoSource;
289 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(Some(RepoSource::default()/* use setters */));
290 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(None::<RepoSource>);
291 /// ```
292 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
293 where
294 T: std::convert::Into<crate::model::RepoSource>,
295 {
296 self.source = v.map(|x| x.into());
297 self
298 }
299}
300
301impl wkt::message::Message for RunBuildTriggerRequest {
302 fn typename() -> &'static str {
303 "type.googleapis.com/google.devtools.cloudbuild.v1.RunBuildTriggerRequest"
304 }
305}
306
307/// Location of the source in an archive file in Cloud Storage.
308#[derive(Clone, Default, PartialEq)]
309#[non_exhaustive]
310pub struct StorageSource {
311 /// Cloud Storage bucket containing the source (see
312 /// [Bucket Name
313 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
314 pub bucket: std::string::String,
315
316 /// Required. Cloud Storage object containing the source.
317 ///
318 /// This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`)
319 /// containing source to build.
320 pub object: std::string::String,
321
322 /// Optional. Cloud Storage generation for the object. If the generation is
323 /// omitted, the latest generation will be used.
324 pub generation: i64,
325
326 /// Optional. Option to specify the tool to fetch the source file for the
327 /// build.
328 pub source_fetcher: crate::model::storage_source::SourceFetcher,
329
330 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
331}
332
333impl StorageSource {
334 /// Creates a new default instance.
335 pub fn new() -> Self {
336 std::default::Default::default()
337 }
338
339 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
340 ///
341 /// # Example
342 /// ```ignore,no_run
343 /// # use google_cloud_build_v1::model::StorageSource;
344 /// let x = StorageSource::new().set_bucket("example");
345 /// ```
346 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
347 self.bucket = v.into();
348 self
349 }
350
351 /// Sets the value of [object][crate::model::StorageSource::object].
352 ///
353 /// # Example
354 /// ```ignore,no_run
355 /// # use google_cloud_build_v1::model::StorageSource;
356 /// let x = StorageSource::new().set_object("example");
357 /// ```
358 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
359 self.object = v.into();
360 self
361 }
362
363 /// Sets the value of [generation][crate::model::StorageSource::generation].
364 ///
365 /// # Example
366 /// ```ignore,no_run
367 /// # use google_cloud_build_v1::model::StorageSource;
368 /// let x = StorageSource::new().set_generation(42);
369 /// ```
370 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
371 self.generation = v.into();
372 self
373 }
374
375 /// Sets the value of [source_fetcher][crate::model::StorageSource::source_fetcher].
376 ///
377 /// # Example
378 /// ```ignore,no_run
379 /// # use google_cloud_build_v1::model::StorageSource;
380 /// use google_cloud_build_v1::model::storage_source::SourceFetcher;
381 /// let x0 = StorageSource::new().set_source_fetcher(SourceFetcher::Gsutil);
382 /// let x1 = StorageSource::new().set_source_fetcher(SourceFetcher::GcsFetcher);
383 /// ```
384 pub fn set_source_fetcher<
385 T: std::convert::Into<crate::model::storage_source::SourceFetcher>,
386 >(
387 mut self,
388 v: T,
389 ) -> Self {
390 self.source_fetcher = v.into();
391 self
392 }
393}
394
395impl wkt::message::Message for StorageSource {
396 fn typename() -> &'static str {
397 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSource"
398 }
399}
400
401/// Defines additional types related to [StorageSource].
402pub mod storage_source {
403 #[allow(unused_imports)]
404 use super::*;
405
406 /// Specifies the tool to fetch the source file for the build.
407 ///
408 /// # Working with unknown values
409 ///
410 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
411 /// additional enum variants at any time. Adding new variants is not considered
412 /// a breaking change. Applications should write their code in anticipation of:
413 ///
414 /// - New values appearing in future releases of the client library, **and**
415 /// - New values received dynamically, without application changes.
416 ///
417 /// Please consult the [Working with enums] section in the user guide for some
418 /// guidelines.
419 ///
420 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
421 #[derive(Clone, Debug, PartialEq)]
422 #[non_exhaustive]
423 pub enum SourceFetcher {
424 /// Unspecified defaults to GSUTIL.
425 Unspecified,
426 /// Use the "gsutil" tool to download the source file.
427 Gsutil,
428 /// Use the Cloud Storage Fetcher tool to download the source file.
429 GcsFetcher,
430 /// If set, the enum was initialized with an unknown value.
431 ///
432 /// Applications can examine the value using [SourceFetcher::value] or
433 /// [SourceFetcher::name].
434 UnknownValue(source_fetcher::UnknownValue),
435 }
436
437 #[doc(hidden)]
438 pub mod source_fetcher {
439 #[allow(unused_imports)]
440 use super::*;
441 #[derive(Clone, Debug, PartialEq)]
442 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
443 }
444
445 impl SourceFetcher {
446 /// Gets the enum value.
447 ///
448 /// Returns `None` if the enum contains an unknown value deserialized from
449 /// the string representation of enums.
450 pub fn value(&self) -> std::option::Option<i32> {
451 match self {
452 Self::Unspecified => std::option::Option::Some(0),
453 Self::Gsutil => std::option::Option::Some(1),
454 Self::GcsFetcher => std::option::Option::Some(2),
455 Self::UnknownValue(u) => u.0.value(),
456 }
457 }
458
459 /// Gets the enum value as a string.
460 ///
461 /// Returns `None` if the enum contains an unknown value deserialized from
462 /// the integer representation of enums.
463 pub fn name(&self) -> std::option::Option<&str> {
464 match self {
465 Self::Unspecified => std::option::Option::Some("SOURCE_FETCHER_UNSPECIFIED"),
466 Self::Gsutil => std::option::Option::Some("GSUTIL"),
467 Self::GcsFetcher => std::option::Option::Some("GCS_FETCHER"),
468 Self::UnknownValue(u) => u.0.name(),
469 }
470 }
471 }
472
473 impl std::default::Default for SourceFetcher {
474 fn default() -> Self {
475 use std::convert::From;
476 Self::from(0)
477 }
478 }
479
480 impl std::fmt::Display for SourceFetcher {
481 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
482 wkt::internal::display_enum(f, self.name(), self.value())
483 }
484 }
485
486 impl std::convert::From<i32> for SourceFetcher {
487 fn from(value: i32) -> Self {
488 match value {
489 0 => Self::Unspecified,
490 1 => Self::Gsutil,
491 2 => Self::GcsFetcher,
492 _ => Self::UnknownValue(source_fetcher::UnknownValue(
493 wkt::internal::UnknownEnumValue::Integer(value),
494 )),
495 }
496 }
497 }
498
499 impl std::convert::From<&str> for SourceFetcher {
500 fn from(value: &str) -> Self {
501 use std::string::ToString;
502 match value {
503 "SOURCE_FETCHER_UNSPECIFIED" => Self::Unspecified,
504 "GSUTIL" => Self::Gsutil,
505 "GCS_FETCHER" => Self::GcsFetcher,
506 _ => Self::UnknownValue(source_fetcher::UnknownValue(
507 wkt::internal::UnknownEnumValue::String(value.to_string()),
508 )),
509 }
510 }
511 }
512
513 impl serde::ser::Serialize for SourceFetcher {
514 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
515 where
516 S: serde::Serializer,
517 {
518 match self {
519 Self::Unspecified => serializer.serialize_i32(0),
520 Self::Gsutil => serializer.serialize_i32(1),
521 Self::GcsFetcher => serializer.serialize_i32(2),
522 Self::UnknownValue(u) => u.0.serialize(serializer),
523 }
524 }
525 }
526
527 impl<'de> serde::de::Deserialize<'de> for SourceFetcher {
528 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
529 where
530 D: serde::Deserializer<'de>,
531 {
532 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SourceFetcher>::new(
533 ".google.devtools.cloudbuild.v1.StorageSource.SourceFetcher",
534 ))
535 }
536 }
537}
538
539/// Location of the source in any accessible Git repository.
540#[derive(Clone, Default, PartialEq)]
541#[non_exhaustive]
542pub struct GitSource {
543 /// Required. Location of the Git repo to build.
544 ///
545 /// This will be used as a `git remote`, see
546 /// <https://git-scm.com/docs/git-remote>.
547 pub url: std::string::String,
548
549 /// Optional. Directory, relative to the source root, in which to run the
550 /// build.
551 ///
552 /// This must be a relative path. If a step's `dir` is specified and is an
553 /// absolute path, this value is ignored for that step's execution.
554 pub dir: std::string::String,
555
556 /// Optional. The revision to fetch from the Git repository such as a branch, a
557 /// tag, a commit SHA, or any Git ref.
558 ///
559 /// Cloud Build uses `git fetch` to fetch the revision from the Git
560 /// repository; therefore make sure that the string you provide for `revision`
561 /// is parsable by the command. For information on string values accepted by
562 /// `git fetch`, see
563 /// <https://git-scm.com/docs/gitrevisions#_specifying_revisions>. For
564 /// information on `git fetch`, see <https://git-scm.com/docs/git-fetch>.
565 pub revision: std::string::String,
566
567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
568}
569
570impl GitSource {
571 /// Creates a new default instance.
572 pub fn new() -> Self {
573 std::default::Default::default()
574 }
575
576 /// Sets the value of [url][crate::model::GitSource::url].
577 ///
578 /// # Example
579 /// ```ignore,no_run
580 /// # use google_cloud_build_v1::model::GitSource;
581 /// let x = GitSource::new().set_url("example");
582 /// ```
583 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
584 self.url = v.into();
585 self
586 }
587
588 /// Sets the value of [dir][crate::model::GitSource::dir].
589 ///
590 /// # Example
591 /// ```ignore,no_run
592 /// # use google_cloud_build_v1::model::GitSource;
593 /// let x = GitSource::new().set_dir("example");
594 /// ```
595 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
596 self.dir = v.into();
597 self
598 }
599
600 /// Sets the value of [revision][crate::model::GitSource::revision].
601 ///
602 /// # Example
603 /// ```ignore,no_run
604 /// # use google_cloud_build_v1::model::GitSource;
605 /// let x = GitSource::new().set_revision("example");
606 /// ```
607 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
608 self.revision = v.into();
609 self
610 }
611}
612
613impl wkt::message::Message for GitSource {
614 fn typename() -> &'static str {
615 "type.googleapis.com/google.devtools.cloudbuild.v1.GitSource"
616 }
617}
618
619/// Location of the source in a Google Cloud Source Repository.
620#[derive(Clone, Default, PartialEq)]
621#[non_exhaustive]
622pub struct RepoSource {
623 /// Optional. ID of the project that owns the Cloud Source Repository. If
624 /// omitted, the project ID requesting the build is assumed.
625 pub project_id: std::string::String,
626
627 /// Required. Name of the Cloud Source Repository.
628 pub repo_name: std::string::String,
629
630 /// Optional. Directory, relative to the source root, in which to run the
631 /// build.
632 ///
633 /// This must be a relative path. If a step's `dir` is specified and is an
634 /// absolute path, this value is ignored for that step's execution.
635 pub dir: std::string::String,
636
637 /// Optional. Only trigger a build if the revision regex does NOT match the
638 /// revision regex.
639 pub invert_regex: bool,
640
641 /// Optional. Substitutions to use in a triggered build.
642 /// Should only be used with RunBuildTrigger
643 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
644
645 /// A revision within the Cloud Source Repository must be specified in
646 /// one of these ways.
647 pub revision: std::option::Option<crate::model::repo_source::Revision>,
648
649 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
650}
651
652impl RepoSource {
653 /// Creates a new default instance.
654 pub fn new() -> Self {
655 std::default::Default::default()
656 }
657
658 /// Sets the value of [project_id][crate::model::RepoSource::project_id].
659 ///
660 /// # Example
661 /// ```ignore,no_run
662 /// # use google_cloud_build_v1::model::RepoSource;
663 /// let x = RepoSource::new().set_project_id("example");
664 /// ```
665 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
666 self.project_id = v.into();
667 self
668 }
669
670 /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
671 ///
672 /// # Example
673 /// ```ignore,no_run
674 /// # use google_cloud_build_v1::model::RepoSource;
675 /// let x = RepoSource::new().set_repo_name("example");
676 /// ```
677 pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
678 self.repo_name = v.into();
679 self
680 }
681
682 /// Sets the value of [dir][crate::model::RepoSource::dir].
683 ///
684 /// # Example
685 /// ```ignore,no_run
686 /// # use google_cloud_build_v1::model::RepoSource;
687 /// let x = RepoSource::new().set_dir("example");
688 /// ```
689 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
690 self.dir = v.into();
691 self
692 }
693
694 /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
695 ///
696 /// # Example
697 /// ```ignore,no_run
698 /// # use google_cloud_build_v1::model::RepoSource;
699 /// let x = RepoSource::new().set_invert_regex(true);
700 /// ```
701 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
702 self.invert_regex = v.into();
703 self
704 }
705
706 /// Sets the value of [substitutions][crate::model::RepoSource::substitutions].
707 ///
708 /// # Example
709 /// ```ignore,no_run
710 /// # use google_cloud_build_v1::model::RepoSource;
711 /// let x = RepoSource::new().set_substitutions([
712 /// ("key0", "abc"),
713 /// ("key1", "xyz"),
714 /// ]);
715 /// ```
716 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
717 where
718 T: std::iter::IntoIterator<Item = (K, V)>,
719 K: std::convert::Into<std::string::String>,
720 V: std::convert::Into<std::string::String>,
721 {
722 use std::iter::Iterator;
723 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
724 self
725 }
726
727 /// Sets the value of [revision][crate::model::RepoSource::revision].
728 ///
729 /// Note that all the setters affecting `revision` are mutually
730 /// exclusive.
731 ///
732 /// # Example
733 /// ```ignore,no_run
734 /// # use google_cloud_build_v1::model::RepoSource;
735 /// use google_cloud_build_v1::model::repo_source::Revision;
736 /// let x = RepoSource::new().set_revision(Some(Revision::BranchName("example".to_string())));
737 /// ```
738 pub fn set_revision<
739 T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
740 >(
741 mut self,
742 v: T,
743 ) -> Self {
744 self.revision = v.into();
745 self
746 }
747
748 /// The value of [revision][crate::model::RepoSource::revision]
749 /// if it holds a `BranchName`, `None` if the field is not set or
750 /// holds a different branch.
751 pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
752 #[allow(unreachable_patterns)]
753 self.revision.as_ref().and_then(|v| match v {
754 crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
755 _ => std::option::Option::None,
756 })
757 }
758
759 /// Sets the value of [revision][crate::model::RepoSource::revision]
760 /// to hold a `BranchName`.
761 ///
762 /// Note that all the setters affecting `revision` are
763 /// mutually exclusive.
764 ///
765 /// # Example
766 /// ```ignore,no_run
767 /// # use google_cloud_build_v1::model::RepoSource;
768 /// let x = RepoSource::new().set_branch_name("example");
769 /// assert!(x.branch_name().is_some());
770 /// assert!(x.tag_name().is_none());
771 /// assert!(x.commit_sha().is_none());
772 /// ```
773 pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
774 self.revision =
775 std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
776 self
777 }
778
779 /// The value of [revision][crate::model::RepoSource::revision]
780 /// if it holds a `TagName`, `None` if the field is not set or
781 /// holds a different branch.
782 pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
783 #[allow(unreachable_patterns)]
784 self.revision.as_ref().and_then(|v| match v {
785 crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
786 _ => std::option::Option::None,
787 })
788 }
789
790 /// Sets the value of [revision][crate::model::RepoSource::revision]
791 /// to hold a `TagName`.
792 ///
793 /// Note that all the setters affecting `revision` are
794 /// mutually exclusive.
795 ///
796 /// # Example
797 /// ```ignore,no_run
798 /// # use google_cloud_build_v1::model::RepoSource;
799 /// let x = RepoSource::new().set_tag_name("example");
800 /// assert!(x.tag_name().is_some());
801 /// assert!(x.branch_name().is_none());
802 /// assert!(x.commit_sha().is_none());
803 /// ```
804 pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
805 self.revision =
806 std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
807 self
808 }
809
810 /// The value of [revision][crate::model::RepoSource::revision]
811 /// if it holds a `CommitSha`, `None` if the field is not set or
812 /// holds a different branch.
813 pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
814 #[allow(unreachable_patterns)]
815 self.revision.as_ref().and_then(|v| match v {
816 crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
817 _ => std::option::Option::None,
818 })
819 }
820
821 /// Sets the value of [revision][crate::model::RepoSource::revision]
822 /// to hold a `CommitSha`.
823 ///
824 /// Note that all the setters affecting `revision` are
825 /// mutually exclusive.
826 ///
827 /// # Example
828 /// ```ignore,no_run
829 /// # use google_cloud_build_v1::model::RepoSource;
830 /// let x = RepoSource::new().set_commit_sha("example");
831 /// assert!(x.commit_sha().is_some());
832 /// assert!(x.branch_name().is_none());
833 /// assert!(x.tag_name().is_none());
834 /// ```
835 pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
836 self.revision =
837 std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
838 self
839 }
840}
841
842impl wkt::message::Message for RepoSource {
843 fn typename() -> &'static str {
844 "type.googleapis.com/google.devtools.cloudbuild.v1.RepoSource"
845 }
846}
847
848/// Defines additional types related to [RepoSource].
849pub mod repo_source {
850 #[allow(unused_imports)]
851 use super::*;
852
853 /// A revision within the Cloud Source Repository must be specified in
854 /// one of these ways.
855 #[derive(Clone, Debug, PartialEq)]
856 #[non_exhaustive]
857 pub enum Revision {
858 /// Regex matching branches to build.
859 ///
860 /// The syntax of the regular expressions accepted is the syntax accepted by
861 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
862 BranchName(std::string::String),
863 /// Regex matching tags to build.
864 ///
865 /// The syntax of the regular expressions accepted is the syntax accepted by
866 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
867 TagName(std::string::String),
868 /// Explicit commit SHA to build.
869 CommitSha(std::string::String),
870 }
871}
872
873/// Location of the source manifest in Cloud Storage.
874/// This feature is in Preview; see description
875/// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
876#[derive(Clone, Default, PartialEq)]
877#[non_exhaustive]
878pub struct StorageSourceManifest {
879 /// Required. Cloud Storage bucket containing the source manifest (see [Bucket
880 /// Name
881 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
882 pub bucket: std::string::String,
883
884 /// Required. Cloud Storage object containing the source manifest.
885 ///
886 /// This object must be a JSON file.
887 pub object: std::string::String,
888
889 /// Cloud Storage generation for the object. If the generation is
890 /// omitted, the latest generation will be used.
891 pub generation: i64,
892
893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
894}
895
896impl StorageSourceManifest {
897 /// Creates a new default instance.
898 pub fn new() -> Self {
899 std::default::Default::default()
900 }
901
902 /// Sets the value of [bucket][crate::model::StorageSourceManifest::bucket].
903 ///
904 /// # Example
905 /// ```ignore,no_run
906 /// # use google_cloud_build_v1::model::StorageSourceManifest;
907 /// let x = StorageSourceManifest::new().set_bucket("example");
908 /// ```
909 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
910 self.bucket = v.into();
911 self
912 }
913
914 /// Sets the value of [object][crate::model::StorageSourceManifest::object].
915 ///
916 /// # Example
917 /// ```ignore,no_run
918 /// # use google_cloud_build_v1::model::StorageSourceManifest;
919 /// let x = StorageSourceManifest::new().set_object("example");
920 /// ```
921 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
922 self.object = v.into();
923 self
924 }
925
926 /// Sets the value of [generation][crate::model::StorageSourceManifest::generation].
927 ///
928 /// # Example
929 /// ```ignore,no_run
930 /// # use google_cloud_build_v1::model::StorageSourceManifest;
931 /// let x = StorageSourceManifest::new().set_generation(42);
932 /// ```
933 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
934 self.generation = v.into();
935 self
936 }
937}
938
939impl wkt::message::Message for StorageSourceManifest {
940 fn typename() -> &'static str {
941 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSourceManifest"
942 }
943}
944
945/// Location of the source in a 2nd-gen Google Cloud Build repository resource.
946#[derive(Clone, Default, PartialEq)]
947#[non_exhaustive]
948pub struct ConnectedRepository {
949 /// Required. Name of the Google Cloud Build repository, formatted as
950 /// `projects/*/locations/*/connections/*/repositories/*`.
951 pub repository: std::string::String,
952
953 /// Optional. Directory, relative to the source root, in which to run the
954 /// build.
955 pub dir: std::string::String,
956
957 /// Required. The revision to fetch from the Git repository such as a branch, a
958 /// tag, a commit SHA, or any Git ref.
959 pub revision: std::string::String,
960
961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
962}
963
964impl ConnectedRepository {
965 /// Creates a new default instance.
966 pub fn new() -> Self {
967 std::default::Default::default()
968 }
969
970 /// Sets the value of [repository][crate::model::ConnectedRepository::repository].
971 ///
972 /// # Example
973 /// ```ignore,no_run
974 /// # use google_cloud_build_v1::model::ConnectedRepository;
975 /// let x = ConnectedRepository::new().set_repository("example");
976 /// ```
977 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
978 self.repository = v.into();
979 self
980 }
981
982 /// Sets the value of [dir][crate::model::ConnectedRepository::dir].
983 ///
984 /// # Example
985 /// ```ignore,no_run
986 /// # use google_cloud_build_v1::model::ConnectedRepository;
987 /// let x = ConnectedRepository::new().set_dir("example");
988 /// ```
989 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
990 self.dir = v.into();
991 self
992 }
993
994 /// Sets the value of [revision][crate::model::ConnectedRepository::revision].
995 ///
996 /// # Example
997 /// ```ignore,no_run
998 /// # use google_cloud_build_v1::model::ConnectedRepository;
999 /// let x = ConnectedRepository::new().set_revision("example");
1000 /// ```
1001 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1002 self.revision = v.into();
1003 self
1004 }
1005}
1006
1007impl wkt::message::Message for ConnectedRepository {
1008 fn typename() -> &'static str {
1009 "type.googleapis.com/google.devtools.cloudbuild.v1.ConnectedRepository"
1010 }
1011}
1012
1013/// Location of the source in a supported storage service.
1014#[derive(Clone, Default, PartialEq)]
1015#[non_exhaustive]
1016pub struct Source {
1017 /// Location of source.
1018 pub source: std::option::Option<crate::model::source::Source>,
1019
1020 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1021}
1022
1023impl Source {
1024 /// Creates a new default instance.
1025 pub fn new() -> Self {
1026 std::default::Default::default()
1027 }
1028
1029 /// Sets the value of [source][crate::model::Source::source].
1030 ///
1031 /// Note that all the setters affecting `source` are mutually
1032 /// exclusive.
1033 ///
1034 /// # Example
1035 /// ```ignore,no_run
1036 /// # use google_cloud_build_v1::model::Source;
1037 /// use google_cloud_build_v1::model::StorageSource;
1038 /// let x = Source::new().set_source(Some(
1039 /// google_cloud_build_v1::model::source::Source::StorageSource(StorageSource::default().into())));
1040 /// ```
1041 pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
1042 mut self,
1043 v: T,
1044 ) -> Self {
1045 self.source = v.into();
1046 self
1047 }
1048
1049 /// The value of [source][crate::model::Source::source]
1050 /// if it holds a `StorageSource`, `None` if the field is not set or
1051 /// holds a different branch.
1052 pub fn storage_source(
1053 &self,
1054 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
1055 #[allow(unreachable_patterns)]
1056 self.source.as_ref().and_then(|v| match v {
1057 crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
1058 _ => std::option::Option::None,
1059 })
1060 }
1061
1062 /// Sets the value of [source][crate::model::Source::source]
1063 /// to hold a `StorageSource`.
1064 ///
1065 /// Note that all the setters affecting `source` are
1066 /// mutually exclusive.
1067 ///
1068 /// # Example
1069 /// ```ignore,no_run
1070 /// # use google_cloud_build_v1::model::Source;
1071 /// use google_cloud_build_v1::model::StorageSource;
1072 /// let x = Source::new().set_storage_source(StorageSource::default()/* use setters */);
1073 /// assert!(x.storage_source().is_some());
1074 /// assert!(x.repo_source().is_none());
1075 /// assert!(x.git_source().is_none());
1076 /// assert!(x.storage_source_manifest().is_none());
1077 /// assert!(x.connected_repository().is_none());
1078 /// ```
1079 pub fn set_storage_source<
1080 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
1081 >(
1082 mut self,
1083 v: T,
1084 ) -> Self {
1085 self.source =
1086 std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
1087 self
1088 }
1089
1090 /// The value of [source][crate::model::Source::source]
1091 /// if it holds a `RepoSource`, `None` if the field is not set or
1092 /// holds a different branch.
1093 pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
1094 #[allow(unreachable_patterns)]
1095 self.source.as_ref().and_then(|v| match v {
1096 crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
1097 _ => std::option::Option::None,
1098 })
1099 }
1100
1101 /// Sets the value of [source][crate::model::Source::source]
1102 /// to hold a `RepoSource`.
1103 ///
1104 /// Note that all the setters affecting `source` are
1105 /// mutually exclusive.
1106 ///
1107 /// # Example
1108 /// ```ignore,no_run
1109 /// # use google_cloud_build_v1::model::Source;
1110 /// use google_cloud_build_v1::model::RepoSource;
1111 /// let x = Source::new().set_repo_source(RepoSource::default()/* use setters */);
1112 /// assert!(x.repo_source().is_some());
1113 /// assert!(x.storage_source().is_none());
1114 /// assert!(x.git_source().is_none());
1115 /// assert!(x.storage_source_manifest().is_none());
1116 /// assert!(x.connected_repository().is_none());
1117 /// ```
1118 pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
1119 mut self,
1120 v: T,
1121 ) -> Self {
1122 self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
1123 self
1124 }
1125
1126 /// The value of [source][crate::model::Source::source]
1127 /// if it holds a `GitSource`, `None` if the field is not set or
1128 /// holds a different branch.
1129 pub fn git_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSource>> {
1130 #[allow(unreachable_patterns)]
1131 self.source.as_ref().and_then(|v| match v {
1132 crate::model::source::Source::GitSource(v) => std::option::Option::Some(v),
1133 _ => std::option::Option::None,
1134 })
1135 }
1136
1137 /// Sets the value of [source][crate::model::Source::source]
1138 /// to hold a `GitSource`.
1139 ///
1140 /// Note that all the setters affecting `source` are
1141 /// mutually exclusive.
1142 ///
1143 /// # Example
1144 /// ```ignore,no_run
1145 /// # use google_cloud_build_v1::model::Source;
1146 /// use google_cloud_build_v1::model::GitSource;
1147 /// let x = Source::new().set_git_source(GitSource::default()/* use setters */);
1148 /// assert!(x.git_source().is_some());
1149 /// assert!(x.storage_source().is_none());
1150 /// assert!(x.repo_source().is_none());
1151 /// assert!(x.storage_source_manifest().is_none());
1152 /// assert!(x.connected_repository().is_none());
1153 /// ```
1154 pub fn set_git_source<T: std::convert::Into<std::boxed::Box<crate::model::GitSource>>>(
1155 mut self,
1156 v: T,
1157 ) -> Self {
1158 self.source = std::option::Option::Some(crate::model::source::Source::GitSource(v.into()));
1159 self
1160 }
1161
1162 /// The value of [source][crate::model::Source::source]
1163 /// if it holds a `StorageSourceManifest`, `None` if the field is not set or
1164 /// holds a different branch.
1165 pub fn storage_source_manifest(
1166 &self,
1167 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSourceManifest>> {
1168 #[allow(unreachable_patterns)]
1169 self.source.as_ref().and_then(|v| match v {
1170 crate::model::source::Source::StorageSourceManifest(v) => std::option::Option::Some(v),
1171 _ => std::option::Option::None,
1172 })
1173 }
1174
1175 /// Sets the value of [source][crate::model::Source::source]
1176 /// to hold a `StorageSourceManifest`.
1177 ///
1178 /// Note that all the setters affecting `source` are
1179 /// mutually exclusive.
1180 ///
1181 /// # Example
1182 /// ```ignore,no_run
1183 /// # use google_cloud_build_v1::model::Source;
1184 /// use google_cloud_build_v1::model::StorageSourceManifest;
1185 /// let x = Source::new().set_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
1186 /// assert!(x.storage_source_manifest().is_some());
1187 /// assert!(x.storage_source().is_none());
1188 /// assert!(x.repo_source().is_none());
1189 /// assert!(x.git_source().is_none());
1190 /// assert!(x.connected_repository().is_none());
1191 /// ```
1192 pub fn set_storage_source_manifest<
1193 T: std::convert::Into<std::boxed::Box<crate::model::StorageSourceManifest>>,
1194 >(
1195 mut self,
1196 v: T,
1197 ) -> Self {
1198 self.source = std::option::Option::Some(
1199 crate::model::source::Source::StorageSourceManifest(v.into()),
1200 );
1201 self
1202 }
1203
1204 /// The value of [source][crate::model::Source::source]
1205 /// if it holds a `ConnectedRepository`, `None` if the field is not set or
1206 /// holds a different branch.
1207 pub fn connected_repository(
1208 &self,
1209 ) -> std::option::Option<&std::boxed::Box<crate::model::ConnectedRepository>> {
1210 #[allow(unreachable_patterns)]
1211 self.source.as_ref().and_then(|v| match v {
1212 crate::model::source::Source::ConnectedRepository(v) => std::option::Option::Some(v),
1213 _ => std::option::Option::None,
1214 })
1215 }
1216
1217 /// Sets the value of [source][crate::model::Source::source]
1218 /// to hold a `ConnectedRepository`.
1219 ///
1220 /// Note that all the setters affecting `source` are
1221 /// mutually exclusive.
1222 ///
1223 /// # Example
1224 /// ```ignore,no_run
1225 /// # use google_cloud_build_v1::model::Source;
1226 /// use google_cloud_build_v1::model::ConnectedRepository;
1227 /// let x = Source::new().set_connected_repository(ConnectedRepository::default()/* use setters */);
1228 /// assert!(x.connected_repository().is_some());
1229 /// assert!(x.storage_source().is_none());
1230 /// assert!(x.repo_source().is_none());
1231 /// assert!(x.git_source().is_none());
1232 /// assert!(x.storage_source_manifest().is_none());
1233 /// ```
1234 pub fn set_connected_repository<
1235 T: std::convert::Into<std::boxed::Box<crate::model::ConnectedRepository>>,
1236 >(
1237 mut self,
1238 v: T,
1239 ) -> Self {
1240 self.source =
1241 std::option::Option::Some(crate::model::source::Source::ConnectedRepository(v.into()));
1242 self
1243 }
1244}
1245
1246impl wkt::message::Message for Source {
1247 fn typename() -> &'static str {
1248 "type.googleapis.com/google.devtools.cloudbuild.v1.Source"
1249 }
1250}
1251
1252/// Defines additional types related to [Source].
1253pub mod source {
1254 #[allow(unused_imports)]
1255 use super::*;
1256
1257 /// Location of source.
1258 #[derive(Clone, Debug, PartialEq)]
1259 #[non_exhaustive]
1260 pub enum Source {
1261 /// If provided, get the source from this location in Cloud Storage.
1262 StorageSource(std::boxed::Box<crate::model::StorageSource>),
1263 /// If provided, get the source from this location in a Cloud Source
1264 /// Repository.
1265 RepoSource(std::boxed::Box<crate::model::RepoSource>),
1266 /// If provided, get the source from this Git repository.
1267 GitSource(std::boxed::Box<crate::model::GitSource>),
1268 /// If provided, get the source from this manifest in Cloud Storage.
1269 /// This feature is in Preview; see description
1270 /// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
1271 StorageSourceManifest(std::boxed::Box<crate::model::StorageSourceManifest>),
1272 /// Optional. If provided, get the source from this 2nd-gen Google Cloud
1273 /// Build repository resource.
1274 ConnectedRepository(std::boxed::Box<crate::model::ConnectedRepository>),
1275 }
1276}
1277
1278/// An image built by the pipeline.
1279#[derive(Clone, Default, PartialEq)]
1280#[non_exhaustive]
1281pub struct BuiltImage {
1282 /// Name used to push the container image to Google Container Registry, as
1283 /// presented to `docker push`.
1284 pub name: std::string::String,
1285
1286 /// Docker Registry 2.0 digest.
1287 pub digest: std::string::String,
1288
1289 /// Output only. Stores timing information for pushing the specified image.
1290 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1291
1292 /// Output only. Path to the artifact in Artifact Registry.
1293 pub artifact_registry_package: std::string::String,
1294
1295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1296}
1297
1298impl BuiltImage {
1299 /// Creates a new default instance.
1300 pub fn new() -> Self {
1301 std::default::Default::default()
1302 }
1303
1304 /// Sets the value of [name][crate::model::BuiltImage::name].
1305 ///
1306 /// # Example
1307 /// ```ignore,no_run
1308 /// # use google_cloud_build_v1::model::BuiltImage;
1309 /// let x = BuiltImage::new().set_name("example");
1310 /// ```
1311 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1312 self.name = v.into();
1313 self
1314 }
1315
1316 /// Sets the value of [digest][crate::model::BuiltImage::digest].
1317 ///
1318 /// # Example
1319 /// ```ignore,no_run
1320 /// # use google_cloud_build_v1::model::BuiltImage;
1321 /// let x = BuiltImage::new().set_digest("example");
1322 /// ```
1323 pub fn set_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1324 self.digest = v.into();
1325 self
1326 }
1327
1328 /// Sets the value of [push_timing][crate::model::BuiltImage::push_timing].
1329 ///
1330 /// # Example
1331 /// ```ignore,no_run
1332 /// # use google_cloud_build_v1::model::BuiltImage;
1333 /// use google_cloud_build_v1::model::TimeSpan;
1334 /// let x = BuiltImage::new().set_push_timing(TimeSpan::default()/* use setters */);
1335 /// ```
1336 pub fn set_push_timing<T>(mut self, v: T) -> Self
1337 where
1338 T: std::convert::Into<crate::model::TimeSpan>,
1339 {
1340 self.push_timing = std::option::Option::Some(v.into());
1341 self
1342 }
1343
1344 /// Sets or clears the value of [push_timing][crate::model::BuiltImage::push_timing].
1345 ///
1346 /// # Example
1347 /// ```ignore,no_run
1348 /// # use google_cloud_build_v1::model::BuiltImage;
1349 /// use google_cloud_build_v1::model::TimeSpan;
1350 /// let x = BuiltImage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1351 /// let x = BuiltImage::new().set_or_clear_push_timing(None::<TimeSpan>);
1352 /// ```
1353 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1354 where
1355 T: std::convert::Into<crate::model::TimeSpan>,
1356 {
1357 self.push_timing = v.map(|x| x.into());
1358 self
1359 }
1360
1361 /// Sets the value of [artifact_registry_package][crate::model::BuiltImage::artifact_registry_package].
1362 ///
1363 /// # Example
1364 /// ```ignore,no_run
1365 /// # use google_cloud_build_v1::model::BuiltImage;
1366 /// let x = BuiltImage::new().set_artifact_registry_package("example");
1367 /// ```
1368 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1369 mut self,
1370 v: T,
1371 ) -> Self {
1372 self.artifact_registry_package = v.into();
1373 self
1374 }
1375}
1376
1377impl wkt::message::Message for BuiltImage {
1378 fn typename() -> &'static str {
1379 "type.googleapis.com/google.devtools.cloudbuild.v1.BuiltImage"
1380 }
1381}
1382
1383/// Artifact uploaded using the PythonPackage directive.
1384#[derive(Clone, Default, PartialEq)]
1385#[non_exhaustive]
1386pub struct UploadedPythonPackage {
1387 /// URI of the uploaded artifact.
1388 pub uri: std::string::String,
1389
1390 /// Hash types and values of the Python Artifact.
1391 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1392
1393 /// Output only. Stores timing information for pushing the specified artifact.
1394 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1395
1396 /// Output only. Path to the artifact in Artifact Registry.
1397 pub artifact_registry_package: std::string::String,
1398
1399 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1400}
1401
1402impl UploadedPythonPackage {
1403 /// Creates a new default instance.
1404 pub fn new() -> Self {
1405 std::default::Default::default()
1406 }
1407
1408 /// Sets the value of [uri][crate::model::UploadedPythonPackage::uri].
1409 ///
1410 /// # Example
1411 /// ```ignore,no_run
1412 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1413 /// let x = UploadedPythonPackage::new().set_uri("example");
1414 /// ```
1415 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1416 self.uri = v.into();
1417 self
1418 }
1419
1420 /// Sets the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1421 ///
1422 /// # Example
1423 /// ```ignore,no_run
1424 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1425 /// use google_cloud_build_v1::model::FileHashes;
1426 /// let x = UploadedPythonPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1427 /// ```
1428 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1429 where
1430 T: std::convert::Into<crate::model::FileHashes>,
1431 {
1432 self.file_hashes = std::option::Option::Some(v.into());
1433 self
1434 }
1435
1436 /// Sets or clears the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1437 ///
1438 /// # Example
1439 /// ```ignore,no_run
1440 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1441 /// use google_cloud_build_v1::model::FileHashes;
1442 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1443 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1444 /// ```
1445 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1446 where
1447 T: std::convert::Into<crate::model::FileHashes>,
1448 {
1449 self.file_hashes = v.map(|x| x.into());
1450 self
1451 }
1452
1453 /// Sets the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1454 ///
1455 /// # Example
1456 /// ```ignore,no_run
1457 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1458 /// use google_cloud_build_v1::model::TimeSpan;
1459 /// let x = UploadedPythonPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1460 /// ```
1461 pub fn set_push_timing<T>(mut self, v: T) -> Self
1462 where
1463 T: std::convert::Into<crate::model::TimeSpan>,
1464 {
1465 self.push_timing = std::option::Option::Some(v.into());
1466 self
1467 }
1468
1469 /// Sets or clears the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1470 ///
1471 /// # Example
1472 /// ```ignore,no_run
1473 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1474 /// use google_cloud_build_v1::model::TimeSpan;
1475 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1476 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1477 /// ```
1478 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1479 where
1480 T: std::convert::Into<crate::model::TimeSpan>,
1481 {
1482 self.push_timing = v.map(|x| x.into());
1483 self
1484 }
1485
1486 /// Sets the value of [artifact_registry_package][crate::model::UploadedPythonPackage::artifact_registry_package].
1487 ///
1488 /// # Example
1489 /// ```ignore,no_run
1490 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1491 /// let x = UploadedPythonPackage::new().set_artifact_registry_package("example");
1492 /// ```
1493 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1494 mut self,
1495 v: T,
1496 ) -> Self {
1497 self.artifact_registry_package = v.into();
1498 self
1499 }
1500}
1501
1502impl wkt::message::Message for UploadedPythonPackage {
1503 fn typename() -> &'static str {
1504 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedPythonPackage"
1505 }
1506}
1507
1508/// A Maven artifact uploaded using the MavenArtifact directive.
1509#[derive(Clone, Default, PartialEq)]
1510#[non_exhaustive]
1511pub struct UploadedMavenArtifact {
1512 /// URI of the uploaded artifact.
1513 pub uri: std::string::String,
1514
1515 /// Hash types and values of the Maven Artifact.
1516 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1517
1518 /// Output only. Stores timing information for pushing the specified artifact.
1519 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1520
1521 /// Output only. Path to the artifact in Artifact Registry.
1522 pub artifact_registry_package: std::string::String,
1523
1524 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1525}
1526
1527impl UploadedMavenArtifact {
1528 /// Creates a new default instance.
1529 pub fn new() -> Self {
1530 std::default::Default::default()
1531 }
1532
1533 /// Sets the value of [uri][crate::model::UploadedMavenArtifact::uri].
1534 ///
1535 /// # Example
1536 /// ```ignore,no_run
1537 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1538 /// let x = UploadedMavenArtifact::new().set_uri("example");
1539 /// ```
1540 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1541 self.uri = v.into();
1542 self
1543 }
1544
1545 /// Sets the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1546 ///
1547 /// # Example
1548 /// ```ignore,no_run
1549 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1550 /// use google_cloud_build_v1::model::FileHashes;
1551 /// let x = UploadedMavenArtifact::new().set_file_hashes(FileHashes::default()/* use setters */);
1552 /// ```
1553 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1554 where
1555 T: std::convert::Into<crate::model::FileHashes>,
1556 {
1557 self.file_hashes = std::option::Option::Some(v.into());
1558 self
1559 }
1560
1561 /// Sets or clears the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1562 ///
1563 /// # Example
1564 /// ```ignore,no_run
1565 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1566 /// use google_cloud_build_v1::model::FileHashes;
1567 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1568 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(None::<FileHashes>);
1569 /// ```
1570 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1571 where
1572 T: std::convert::Into<crate::model::FileHashes>,
1573 {
1574 self.file_hashes = v.map(|x| x.into());
1575 self
1576 }
1577
1578 /// Sets the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1579 ///
1580 /// # Example
1581 /// ```ignore,no_run
1582 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1583 /// use google_cloud_build_v1::model::TimeSpan;
1584 /// let x = UploadedMavenArtifact::new().set_push_timing(TimeSpan::default()/* use setters */);
1585 /// ```
1586 pub fn set_push_timing<T>(mut self, v: T) -> Self
1587 where
1588 T: std::convert::Into<crate::model::TimeSpan>,
1589 {
1590 self.push_timing = std::option::Option::Some(v.into());
1591 self
1592 }
1593
1594 /// Sets or clears the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1595 ///
1596 /// # Example
1597 /// ```ignore,no_run
1598 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1599 /// use google_cloud_build_v1::model::TimeSpan;
1600 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1601 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(None::<TimeSpan>);
1602 /// ```
1603 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1604 where
1605 T: std::convert::Into<crate::model::TimeSpan>,
1606 {
1607 self.push_timing = v.map(|x| x.into());
1608 self
1609 }
1610
1611 /// Sets the value of [artifact_registry_package][crate::model::UploadedMavenArtifact::artifact_registry_package].
1612 ///
1613 /// # Example
1614 /// ```ignore,no_run
1615 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1616 /// let x = UploadedMavenArtifact::new().set_artifact_registry_package("example");
1617 /// ```
1618 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1619 mut self,
1620 v: T,
1621 ) -> Self {
1622 self.artifact_registry_package = v.into();
1623 self
1624 }
1625}
1626
1627impl wkt::message::Message for UploadedMavenArtifact {
1628 fn typename() -> &'static str {
1629 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedMavenArtifact"
1630 }
1631}
1632
1633/// A Go module artifact uploaded to Artifact Registry using the GoModule
1634/// directive.
1635#[derive(Clone, Default, PartialEq)]
1636#[non_exhaustive]
1637pub struct UploadedGoModule {
1638 /// URI of the uploaded artifact.
1639 pub uri: std::string::String,
1640
1641 /// Hash types and values of the Go Module Artifact.
1642 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1643
1644 /// Output only. Stores timing information for pushing the specified artifact.
1645 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1646
1647 /// Output only. Path to the artifact in Artifact Registry.
1648 pub artifact_registry_package: std::string::String,
1649
1650 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1651}
1652
1653impl UploadedGoModule {
1654 /// Creates a new default instance.
1655 pub fn new() -> Self {
1656 std::default::Default::default()
1657 }
1658
1659 /// Sets the value of [uri][crate::model::UploadedGoModule::uri].
1660 ///
1661 /// # Example
1662 /// ```ignore,no_run
1663 /// # use google_cloud_build_v1::model::UploadedGoModule;
1664 /// let x = UploadedGoModule::new().set_uri("example");
1665 /// ```
1666 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1667 self.uri = v.into();
1668 self
1669 }
1670
1671 /// Sets the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1672 ///
1673 /// # Example
1674 /// ```ignore,no_run
1675 /// # use google_cloud_build_v1::model::UploadedGoModule;
1676 /// use google_cloud_build_v1::model::FileHashes;
1677 /// let x = UploadedGoModule::new().set_file_hashes(FileHashes::default()/* use setters */);
1678 /// ```
1679 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1680 where
1681 T: std::convert::Into<crate::model::FileHashes>,
1682 {
1683 self.file_hashes = std::option::Option::Some(v.into());
1684 self
1685 }
1686
1687 /// Sets or clears the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1688 ///
1689 /// # Example
1690 /// ```ignore,no_run
1691 /// # use google_cloud_build_v1::model::UploadedGoModule;
1692 /// use google_cloud_build_v1::model::FileHashes;
1693 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1694 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(None::<FileHashes>);
1695 /// ```
1696 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1697 where
1698 T: std::convert::Into<crate::model::FileHashes>,
1699 {
1700 self.file_hashes = v.map(|x| x.into());
1701 self
1702 }
1703
1704 /// Sets the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1705 ///
1706 /// # Example
1707 /// ```ignore,no_run
1708 /// # use google_cloud_build_v1::model::UploadedGoModule;
1709 /// use google_cloud_build_v1::model::TimeSpan;
1710 /// let x = UploadedGoModule::new().set_push_timing(TimeSpan::default()/* use setters */);
1711 /// ```
1712 pub fn set_push_timing<T>(mut self, v: T) -> Self
1713 where
1714 T: std::convert::Into<crate::model::TimeSpan>,
1715 {
1716 self.push_timing = std::option::Option::Some(v.into());
1717 self
1718 }
1719
1720 /// Sets or clears the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1721 ///
1722 /// # Example
1723 /// ```ignore,no_run
1724 /// # use google_cloud_build_v1::model::UploadedGoModule;
1725 /// use google_cloud_build_v1::model::TimeSpan;
1726 /// let x = UploadedGoModule::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1727 /// let x = UploadedGoModule::new().set_or_clear_push_timing(None::<TimeSpan>);
1728 /// ```
1729 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1730 where
1731 T: std::convert::Into<crate::model::TimeSpan>,
1732 {
1733 self.push_timing = v.map(|x| x.into());
1734 self
1735 }
1736
1737 /// Sets the value of [artifact_registry_package][crate::model::UploadedGoModule::artifact_registry_package].
1738 ///
1739 /// # Example
1740 /// ```ignore,no_run
1741 /// # use google_cloud_build_v1::model::UploadedGoModule;
1742 /// let x = UploadedGoModule::new().set_artifact_registry_package("example");
1743 /// ```
1744 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1745 mut self,
1746 v: T,
1747 ) -> Self {
1748 self.artifact_registry_package = v.into();
1749 self
1750 }
1751}
1752
1753impl wkt::message::Message for UploadedGoModule {
1754 fn typename() -> &'static str {
1755 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedGoModule"
1756 }
1757}
1758
1759/// An npm package uploaded to Artifact Registry using the NpmPackage
1760/// directive.
1761#[derive(Clone, Default, PartialEq)]
1762#[non_exhaustive]
1763pub struct UploadedNpmPackage {
1764 /// URI of the uploaded npm package.
1765 pub uri: std::string::String,
1766
1767 /// Hash types and values of the npm package.
1768 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1769
1770 /// Output only. Stores timing information for pushing the specified artifact.
1771 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1772
1773 /// Output only. Path to the artifact in Artifact Registry.
1774 pub artifact_registry_package: std::string::String,
1775
1776 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1777}
1778
1779impl UploadedNpmPackage {
1780 /// Creates a new default instance.
1781 pub fn new() -> Self {
1782 std::default::Default::default()
1783 }
1784
1785 /// Sets the value of [uri][crate::model::UploadedNpmPackage::uri].
1786 ///
1787 /// # Example
1788 /// ```ignore,no_run
1789 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1790 /// let x = UploadedNpmPackage::new().set_uri("example");
1791 /// ```
1792 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1793 self.uri = v.into();
1794 self
1795 }
1796
1797 /// Sets the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1798 ///
1799 /// # Example
1800 /// ```ignore,no_run
1801 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1802 /// use google_cloud_build_v1::model::FileHashes;
1803 /// let x = UploadedNpmPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1804 /// ```
1805 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1806 where
1807 T: std::convert::Into<crate::model::FileHashes>,
1808 {
1809 self.file_hashes = std::option::Option::Some(v.into());
1810 self
1811 }
1812
1813 /// Sets or clears the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1814 ///
1815 /// # Example
1816 /// ```ignore,no_run
1817 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1818 /// use google_cloud_build_v1::model::FileHashes;
1819 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1820 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1821 /// ```
1822 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1823 where
1824 T: std::convert::Into<crate::model::FileHashes>,
1825 {
1826 self.file_hashes = v.map(|x| x.into());
1827 self
1828 }
1829
1830 /// Sets the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1831 ///
1832 /// # Example
1833 /// ```ignore,no_run
1834 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1835 /// use google_cloud_build_v1::model::TimeSpan;
1836 /// let x = UploadedNpmPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1837 /// ```
1838 pub fn set_push_timing<T>(mut self, v: T) -> Self
1839 where
1840 T: std::convert::Into<crate::model::TimeSpan>,
1841 {
1842 self.push_timing = std::option::Option::Some(v.into());
1843 self
1844 }
1845
1846 /// Sets or clears the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1847 ///
1848 /// # Example
1849 /// ```ignore,no_run
1850 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1851 /// use google_cloud_build_v1::model::TimeSpan;
1852 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1853 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1854 /// ```
1855 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1856 where
1857 T: std::convert::Into<crate::model::TimeSpan>,
1858 {
1859 self.push_timing = v.map(|x| x.into());
1860 self
1861 }
1862
1863 /// Sets the value of [artifact_registry_package][crate::model::UploadedNpmPackage::artifact_registry_package].
1864 ///
1865 /// # Example
1866 /// ```ignore,no_run
1867 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1868 /// let x = UploadedNpmPackage::new().set_artifact_registry_package("example");
1869 /// ```
1870 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1871 mut self,
1872 v: T,
1873 ) -> Self {
1874 self.artifact_registry_package = v.into();
1875 self
1876 }
1877}
1878
1879impl wkt::message::Message for UploadedNpmPackage {
1880 fn typename() -> &'static str {
1881 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedNpmPackage"
1882 }
1883}
1884
1885/// A step in the build pipeline.
1886#[derive(Clone, Default, PartialEq)]
1887#[non_exhaustive]
1888pub struct BuildStep {
1889 /// Required. The name of the container image that will run this particular
1890 /// build step.
1891 ///
1892 /// If the image is available in the host's Docker daemon's cache, it
1893 /// will be run directly. If not, the host will attempt to pull the image
1894 /// first, using the builder service account's credentials if necessary.
1895 ///
1896 /// The Docker daemon's cache will already have the latest versions of all of
1897 /// the officially supported build steps
1898 /// ([<https://github.com/GoogleCloudPlatform/cloud-builders>](https://github.com/GoogleCloudPlatform/cloud-builders)).
1899 /// The Docker daemon will also have cached many of the layers for some popular
1900 /// images, like "ubuntu", "debian", but they will be refreshed at the time you
1901 /// attempt to use them.
1902 ///
1903 /// If you built an image in a previous build step, it will be stored in the
1904 /// host's Docker daemon's cache and is available to use as the name for a
1905 /// later build step.
1906 pub name: std::string::String,
1907
1908 /// A list of environment variable definitions to be used when running a step.
1909 ///
1910 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
1911 /// being given the value "VALUE".
1912 pub env: std::vec::Vec<std::string::String>,
1913
1914 /// A list of arguments that will be presented to the step when it is started.
1915 ///
1916 /// If the image used to run the step's container has an entrypoint, the `args`
1917 /// are used as arguments to that entrypoint. If the image does not define
1918 /// an entrypoint, the first element in args is used as the entrypoint,
1919 /// and the remainder will be used as arguments.
1920 pub args: std::vec::Vec<std::string::String>,
1921
1922 /// Working directory to use when running this step's container.
1923 ///
1924 /// If this value is a relative path, it is relative to the build's working
1925 /// directory. If this value is absolute, it may be outside the build's working
1926 /// directory, in which case the contents of the path may not be persisted
1927 /// across build step executions, unless a `volume` for that path is specified.
1928 ///
1929 /// If the build specifies a `RepoSource` with `dir` and a step with a `dir`,
1930 /// which specifies an absolute path, the `RepoSource` `dir` is ignored for
1931 /// the step's execution.
1932 pub dir: std::string::String,
1933
1934 /// Unique identifier for this build step, used in `wait_for` to
1935 /// reference this build step as a dependency.
1936 pub id: std::string::String,
1937
1938 /// The ID(s) of the step(s) that this build step depends on.
1939 /// This build step will not start until all the build steps in `wait_for`
1940 /// have completed successfully. If `wait_for` is empty, this build step will
1941 /// start when all previous build steps in the `Build.Steps` list have
1942 /// completed successfully.
1943 pub wait_for: std::vec::Vec<std::string::String>,
1944
1945 /// Entrypoint to be used instead of the build step image's default entrypoint.
1946 /// If unset, the image's default entrypoint is used.
1947 pub entrypoint: std::string::String,
1948
1949 /// A list of environment variables which are encrypted using a Cloud Key
1950 /// Management Service crypto key. These values must be specified in the
1951 /// build's `Secret`.
1952 pub secret_env: std::vec::Vec<std::string::String>,
1953
1954 /// List of volumes to mount into the build step.
1955 ///
1956 /// Each volume is created as an empty volume prior to execution of the
1957 /// build step. Upon completion of the build, volumes and their contents are
1958 /// discarded.
1959 ///
1960 /// Using a named volume in only one step is not valid as it is indicative
1961 /// of a build request with an incorrect configuration.
1962 pub volumes: std::vec::Vec<crate::model::Volume>,
1963
1964 /// Output only. Stores timing information for executing this build step.
1965 pub timing: std::option::Option<crate::model::TimeSpan>,
1966
1967 /// Output only. Stores timing information for pulling this build step's
1968 /// builder image only.
1969 pub pull_timing: std::option::Option<crate::model::TimeSpan>,
1970
1971 /// Time limit for executing this build step. If not defined, the step has no
1972 /// time limit and will be allowed to continue to run until either it completes
1973 /// or the build itself times out.
1974 pub timeout: std::option::Option<wkt::Duration>,
1975
1976 /// Output only. Status of the build step. At this time, build step status is
1977 /// only updated on build completion; step status is not updated in real-time
1978 /// as the build progresses.
1979 pub status: crate::model::build::Status,
1980
1981 /// Allow this build step to fail without failing the entire build.
1982 ///
1983 /// If false, the entire build will fail if this step fails. Otherwise, the
1984 /// build will succeed, but this step will still have a failure status.
1985 /// Error information will be reported in the failure_detail field.
1986 pub allow_failure: bool,
1987
1988 /// Output only. Return code from running the step.
1989 pub exit_code: i32,
1990
1991 /// Allow this build step to fail without failing the entire build if and
1992 /// only if the exit code is one of the specified codes. If allow_failure
1993 /// is also specified, this field will take precedence.
1994 pub allow_exit_codes: std::vec::Vec<i32>,
1995
1996 /// A shell script to be executed in the step.
1997 ///
1998 /// When script is provided, the user cannot specify the entrypoint or args.
1999 pub script: std::string::String,
2000
2001 /// Option to include built-in and custom substitutions as env variables
2002 /// for this build step. This option will override the global option
2003 /// in BuildOption.
2004 pub automap_substitutions: std::option::Option<bool>,
2005
2006 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2007}
2008
2009impl BuildStep {
2010 /// Creates a new default instance.
2011 pub fn new() -> Self {
2012 std::default::Default::default()
2013 }
2014
2015 /// Sets the value of [name][crate::model::BuildStep::name].
2016 ///
2017 /// # Example
2018 /// ```ignore,no_run
2019 /// # use google_cloud_build_v1::model::BuildStep;
2020 /// let x = BuildStep::new().set_name("example");
2021 /// ```
2022 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2023 self.name = v.into();
2024 self
2025 }
2026
2027 /// Sets the value of [env][crate::model::BuildStep::env].
2028 ///
2029 /// # Example
2030 /// ```ignore,no_run
2031 /// # use google_cloud_build_v1::model::BuildStep;
2032 /// let x = BuildStep::new().set_env(["a", "b", "c"]);
2033 /// ```
2034 pub fn set_env<T, V>(mut self, v: T) -> Self
2035 where
2036 T: std::iter::IntoIterator<Item = V>,
2037 V: std::convert::Into<std::string::String>,
2038 {
2039 use std::iter::Iterator;
2040 self.env = v.into_iter().map(|i| i.into()).collect();
2041 self
2042 }
2043
2044 /// Sets the value of [args][crate::model::BuildStep::args].
2045 ///
2046 /// # Example
2047 /// ```ignore,no_run
2048 /// # use google_cloud_build_v1::model::BuildStep;
2049 /// let x = BuildStep::new().set_args(["a", "b", "c"]);
2050 /// ```
2051 pub fn set_args<T, V>(mut self, v: T) -> Self
2052 where
2053 T: std::iter::IntoIterator<Item = V>,
2054 V: std::convert::Into<std::string::String>,
2055 {
2056 use std::iter::Iterator;
2057 self.args = v.into_iter().map(|i| i.into()).collect();
2058 self
2059 }
2060
2061 /// Sets the value of [dir][crate::model::BuildStep::dir].
2062 ///
2063 /// # Example
2064 /// ```ignore,no_run
2065 /// # use google_cloud_build_v1::model::BuildStep;
2066 /// let x = BuildStep::new().set_dir("example");
2067 /// ```
2068 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2069 self.dir = v.into();
2070 self
2071 }
2072
2073 /// Sets the value of [id][crate::model::BuildStep::id].
2074 ///
2075 /// # Example
2076 /// ```ignore,no_run
2077 /// # use google_cloud_build_v1::model::BuildStep;
2078 /// let x = BuildStep::new().set_id("example");
2079 /// ```
2080 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2081 self.id = v.into();
2082 self
2083 }
2084
2085 /// Sets the value of [wait_for][crate::model::BuildStep::wait_for].
2086 ///
2087 /// # Example
2088 /// ```ignore,no_run
2089 /// # use google_cloud_build_v1::model::BuildStep;
2090 /// let x = BuildStep::new().set_wait_for(["a", "b", "c"]);
2091 /// ```
2092 pub fn set_wait_for<T, V>(mut self, v: T) -> Self
2093 where
2094 T: std::iter::IntoIterator<Item = V>,
2095 V: std::convert::Into<std::string::String>,
2096 {
2097 use std::iter::Iterator;
2098 self.wait_for = v.into_iter().map(|i| i.into()).collect();
2099 self
2100 }
2101
2102 /// Sets the value of [entrypoint][crate::model::BuildStep::entrypoint].
2103 ///
2104 /// # Example
2105 /// ```ignore,no_run
2106 /// # use google_cloud_build_v1::model::BuildStep;
2107 /// let x = BuildStep::new().set_entrypoint("example");
2108 /// ```
2109 pub fn set_entrypoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2110 self.entrypoint = v.into();
2111 self
2112 }
2113
2114 /// Sets the value of [secret_env][crate::model::BuildStep::secret_env].
2115 ///
2116 /// # Example
2117 /// ```ignore,no_run
2118 /// # use google_cloud_build_v1::model::BuildStep;
2119 /// let x = BuildStep::new().set_secret_env(["a", "b", "c"]);
2120 /// ```
2121 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
2122 where
2123 T: std::iter::IntoIterator<Item = V>,
2124 V: std::convert::Into<std::string::String>,
2125 {
2126 use std::iter::Iterator;
2127 self.secret_env = v.into_iter().map(|i| i.into()).collect();
2128 self
2129 }
2130
2131 /// Sets the value of [volumes][crate::model::BuildStep::volumes].
2132 ///
2133 /// # Example
2134 /// ```ignore,no_run
2135 /// # use google_cloud_build_v1::model::BuildStep;
2136 /// use google_cloud_build_v1::model::Volume;
2137 /// let x = BuildStep::new()
2138 /// .set_volumes([
2139 /// Volume::default()/* use setters */,
2140 /// Volume::default()/* use (different) setters */,
2141 /// ]);
2142 /// ```
2143 pub fn set_volumes<T, V>(mut self, v: T) -> Self
2144 where
2145 T: std::iter::IntoIterator<Item = V>,
2146 V: std::convert::Into<crate::model::Volume>,
2147 {
2148 use std::iter::Iterator;
2149 self.volumes = v.into_iter().map(|i| i.into()).collect();
2150 self
2151 }
2152
2153 /// Sets 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_timing(TimeSpan::default()/* use setters */);
2160 /// ```
2161 pub fn set_timing<T>(mut self, v: T) -> Self
2162 where
2163 T: std::convert::Into<crate::model::TimeSpan>,
2164 {
2165 self.timing = std::option::Option::Some(v.into());
2166 self
2167 }
2168
2169 /// Sets or clears the value of [timing][crate::model::BuildStep::timing].
2170 ///
2171 /// # Example
2172 /// ```ignore,no_run
2173 /// # use google_cloud_build_v1::model::BuildStep;
2174 /// use google_cloud_build_v1::model::TimeSpan;
2175 /// let x = BuildStep::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
2176 /// let x = BuildStep::new().set_or_clear_timing(None::<TimeSpan>);
2177 /// ```
2178 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
2179 where
2180 T: std::convert::Into<crate::model::TimeSpan>,
2181 {
2182 self.timing = v.map(|x| x.into());
2183 self
2184 }
2185
2186 /// Sets 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_pull_timing(TimeSpan::default()/* use setters */);
2193 /// ```
2194 pub fn set_pull_timing<T>(mut self, v: T) -> Self
2195 where
2196 T: std::convert::Into<crate::model::TimeSpan>,
2197 {
2198 self.pull_timing = std::option::Option::Some(v.into());
2199 self
2200 }
2201
2202 /// Sets or clears the value of [pull_timing][crate::model::BuildStep::pull_timing].
2203 ///
2204 /// # Example
2205 /// ```ignore,no_run
2206 /// # use google_cloud_build_v1::model::BuildStep;
2207 /// use google_cloud_build_v1::model::TimeSpan;
2208 /// let x = BuildStep::new().set_or_clear_pull_timing(Some(TimeSpan::default()/* use setters */));
2209 /// let x = BuildStep::new().set_or_clear_pull_timing(None::<TimeSpan>);
2210 /// ```
2211 pub fn set_or_clear_pull_timing<T>(mut self, v: std::option::Option<T>) -> Self
2212 where
2213 T: std::convert::Into<crate::model::TimeSpan>,
2214 {
2215 self.pull_timing = v.map(|x| x.into());
2216 self
2217 }
2218
2219 /// Sets 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_timeout(Duration::default()/* use setters */);
2226 /// ```
2227 pub fn set_timeout<T>(mut self, v: T) -> Self
2228 where
2229 T: std::convert::Into<wkt::Duration>,
2230 {
2231 self.timeout = std::option::Option::Some(v.into());
2232 self
2233 }
2234
2235 /// Sets or clears the value of [timeout][crate::model::BuildStep::timeout].
2236 ///
2237 /// # Example
2238 /// ```ignore,no_run
2239 /// # use google_cloud_build_v1::model::BuildStep;
2240 /// use wkt::Duration;
2241 /// let x = BuildStep::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
2242 /// let x = BuildStep::new().set_or_clear_timeout(None::<Duration>);
2243 /// ```
2244 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2245 where
2246 T: std::convert::Into<wkt::Duration>,
2247 {
2248 self.timeout = v.map(|x| x.into());
2249 self
2250 }
2251
2252 /// Sets the value of [status][crate::model::BuildStep::status].
2253 ///
2254 /// # Example
2255 /// ```ignore,no_run
2256 /// # use google_cloud_build_v1::model::BuildStep;
2257 /// use google_cloud_build_v1::model::build::Status;
2258 /// let x0 = BuildStep::new().set_status(Status::Pending);
2259 /// let x1 = BuildStep::new().set_status(Status::Queued);
2260 /// let x2 = BuildStep::new().set_status(Status::Working);
2261 /// ```
2262 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2263 self.status = v.into();
2264 self
2265 }
2266
2267 /// Sets the value of [allow_failure][crate::model::BuildStep::allow_failure].
2268 ///
2269 /// # Example
2270 /// ```ignore,no_run
2271 /// # use google_cloud_build_v1::model::BuildStep;
2272 /// let x = BuildStep::new().set_allow_failure(true);
2273 /// ```
2274 pub fn set_allow_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2275 self.allow_failure = v.into();
2276 self
2277 }
2278
2279 /// Sets the value of [exit_code][crate::model::BuildStep::exit_code].
2280 ///
2281 /// # Example
2282 /// ```ignore,no_run
2283 /// # use google_cloud_build_v1::model::BuildStep;
2284 /// let x = BuildStep::new().set_exit_code(42);
2285 /// ```
2286 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2287 self.exit_code = v.into();
2288 self
2289 }
2290
2291 /// Sets the value of [allow_exit_codes][crate::model::BuildStep::allow_exit_codes].
2292 ///
2293 /// # Example
2294 /// ```ignore,no_run
2295 /// # use google_cloud_build_v1::model::BuildStep;
2296 /// let x = BuildStep::new().set_allow_exit_codes([1, 2, 3]);
2297 /// ```
2298 pub fn set_allow_exit_codes<T, V>(mut self, v: T) -> Self
2299 where
2300 T: std::iter::IntoIterator<Item = V>,
2301 V: std::convert::Into<i32>,
2302 {
2303 use std::iter::Iterator;
2304 self.allow_exit_codes = v.into_iter().map(|i| i.into()).collect();
2305 self
2306 }
2307
2308 /// Sets the value of [script][crate::model::BuildStep::script].
2309 ///
2310 /// # Example
2311 /// ```ignore,no_run
2312 /// # use google_cloud_build_v1::model::BuildStep;
2313 /// let x = BuildStep::new().set_script("example");
2314 /// ```
2315 pub fn set_script<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2316 self.script = v.into();
2317 self
2318 }
2319
2320 /// Sets the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2321 ///
2322 /// # Example
2323 /// ```ignore,no_run
2324 /// # use google_cloud_build_v1::model::BuildStep;
2325 /// let x = BuildStep::new().set_automap_substitutions(true);
2326 /// ```
2327 pub fn set_automap_substitutions<T>(mut self, v: T) -> Self
2328 where
2329 T: std::convert::Into<bool>,
2330 {
2331 self.automap_substitutions = std::option::Option::Some(v.into());
2332 self
2333 }
2334
2335 /// Sets or clears the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2336 ///
2337 /// # Example
2338 /// ```ignore,no_run
2339 /// # use google_cloud_build_v1::model::BuildStep;
2340 /// let x = BuildStep::new().set_or_clear_automap_substitutions(Some(false));
2341 /// let x = BuildStep::new().set_or_clear_automap_substitutions(None::<bool>);
2342 /// ```
2343 pub fn set_or_clear_automap_substitutions<T>(mut self, v: std::option::Option<T>) -> Self
2344 where
2345 T: std::convert::Into<bool>,
2346 {
2347 self.automap_substitutions = v.map(|x| x.into());
2348 self
2349 }
2350}
2351
2352impl wkt::message::Message for BuildStep {
2353 fn typename() -> &'static str {
2354 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildStep"
2355 }
2356}
2357
2358/// Volume describes a Docker container volume which is mounted into build steps
2359/// in order to persist files across build step execution.
2360#[derive(Clone, Default, PartialEq)]
2361#[non_exhaustive]
2362pub struct Volume {
2363 /// Name of the volume to mount.
2364 ///
2365 /// Volume names must be unique per build step and must be valid names for
2366 /// Docker volumes. Each named volume must be used by at least two build steps.
2367 pub name: std::string::String,
2368
2369 /// Path at which to mount the volume.
2370 ///
2371 /// Paths must be absolute and cannot conflict with other volume paths on the
2372 /// same build step or with certain reserved volume paths.
2373 pub path: std::string::String,
2374
2375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2376}
2377
2378impl Volume {
2379 /// Creates a new default instance.
2380 pub fn new() -> Self {
2381 std::default::Default::default()
2382 }
2383
2384 /// Sets the value of [name][crate::model::Volume::name].
2385 ///
2386 /// # Example
2387 /// ```ignore,no_run
2388 /// # use google_cloud_build_v1::model::Volume;
2389 /// let x = Volume::new().set_name("example");
2390 /// ```
2391 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2392 self.name = v.into();
2393 self
2394 }
2395
2396 /// Sets the value of [path][crate::model::Volume::path].
2397 ///
2398 /// # Example
2399 /// ```ignore,no_run
2400 /// # use google_cloud_build_v1::model::Volume;
2401 /// let x = Volume::new().set_path("example");
2402 /// ```
2403 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2404 self.path = v.into();
2405 self
2406 }
2407}
2408
2409impl wkt::message::Message for Volume {
2410 fn typename() -> &'static str {
2411 "type.googleapis.com/google.devtools.cloudbuild.v1.Volume"
2412 }
2413}
2414
2415/// Artifacts created by the build pipeline.
2416#[derive(Clone, Default, PartialEq)]
2417#[non_exhaustive]
2418pub struct Results {
2419 /// Container images that were built as a part of the build.
2420 pub images: std::vec::Vec<crate::model::BuiltImage>,
2421
2422 /// List of build step digests, in the order corresponding to build step
2423 /// indices.
2424 pub build_step_images: std::vec::Vec<std::string::String>,
2425
2426 /// Path to the artifact manifest for non-container artifacts uploaded to Cloud
2427 /// Storage. Only populated when artifacts are uploaded to Cloud Storage.
2428 pub artifact_manifest: std::string::String,
2429
2430 /// Number of non-container artifacts uploaded to Cloud Storage. Only populated
2431 /// when artifacts are uploaded to Cloud Storage.
2432 pub num_artifacts: i64,
2433
2434 /// List of build step outputs, produced by builder images, in the order
2435 /// corresponding to build step indices.
2436 ///
2437 /// [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders)
2438 /// can produce this output by writing to `$BUILDER_OUTPUT/output`. Only the
2439 /// first 50KB of data is stored. Note that the `$BUILDER_OUTPUT` variable is
2440 /// read-only and can't be substituted.
2441 pub build_step_outputs: std::vec::Vec<::bytes::Bytes>,
2442
2443 /// Time to push all non-container artifacts to Cloud Storage.
2444 pub artifact_timing: std::option::Option<crate::model::TimeSpan>,
2445
2446 /// Python artifacts uploaded to Artifact Registry at the end of the build.
2447 pub python_packages: std::vec::Vec<crate::model::UploadedPythonPackage>,
2448
2449 /// Maven artifacts uploaded to Artifact Registry at the end of the build.
2450 pub maven_artifacts: std::vec::Vec<crate::model::UploadedMavenArtifact>,
2451
2452 /// Optional. Go module artifacts uploaded to Artifact Registry at the end of
2453 /// the build.
2454 pub go_modules: std::vec::Vec<crate::model::UploadedGoModule>,
2455
2456 /// Npm packages uploaded to Artifact Registry at the end of the build.
2457 pub npm_packages: std::vec::Vec<crate::model::UploadedNpmPackage>,
2458
2459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2460}
2461
2462impl Results {
2463 /// Creates a new default instance.
2464 pub fn new() -> Self {
2465 std::default::Default::default()
2466 }
2467
2468 /// Sets the value of [images][crate::model::Results::images].
2469 ///
2470 /// # Example
2471 /// ```ignore,no_run
2472 /// # use google_cloud_build_v1::model::Results;
2473 /// use google_cloud_build_v1::model::BuiltImage;
2474 /// let x = Results::new()
2475 /// .set_images([
2476 /// BuiltImage::default()/* use setters */,
2477 /// BuiltImage::default()/* use (different) setters */,
2478 /// ]);
2479 /// ```
2480 pub fn set_images<T, V>(mut self, v: T) -> Self
2481 where
2482 T: std::iter::IntoIterator<Item = V>,
2483 V: std::convert::Into<crate::model::BuiltImage>,
2484 {
2485 use std::iter::Iterator;
2486 self.images = v.into_iter().map(|i| i.into()).collect();
2487 self
2488 }
2489
2490 /// Sets the value of [build_step_images][crate::model::Results::build_step_images].
2491 ///
2492 /// # Example
2493 /// ```ignore,no_run
2494 /// # use google_cloud_build_v1::model::Results;
2495 /// let x = Results::new().set_build_step_images(["a", "b", "c"]);
2496 /// ```
2497 pub fn set_build_step_images<T, V>(mut self, v: T) -> Self
2498 where
2499 T: std::iter::IntoIterator<Item = V>,
2500 V: std::convert::Into<std::string::String>,
2501 {
2502 use std::iter::Iterator;
2503 self.build_step_images = v.into_iter().map(|i| i.into()).collect();
2504 self
2505 }
2506
2507 /// Sets the value of [artifact_manifest][crate::model::Results::artifact_manifest].
2508 ///
2509 /// # Example
2510 /// ```ignore,no_run
2511 /// # use google_cloud_build_v1::model::Results;
2512 /// let x = Results::new().set_artifact_manifest("example");
2513 /// ```
2514 pub fn set_artifact_manifest<T: std::convert::Into<std::string::String>>(
2515 mut self,
2516 v: T,
2517 ) -> Self {
2518 self.artifact_manifest = v.into();
2519 self
2520 }
2521
2522 /// Sets the value of [num_artifacts][crate::model::Results::num_artifacts].
2523 ///
2524 /// # Example
2525 /// ```ignore,no_run
2526 /// # use google_cloud_build_v1::model::Results;
2527 /// let x = Results::new().set_num_artifacts(42);
2528 /// ```
2529 pub fn set_num_artifacts<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2530 self.num_artifacts = v.into();
2531 self
2532 }
2533
2534 /// Sets the value of [build_step_outputs][crate::model::Results::build_step_outputs].
2535 ///
2536 /// # Example
2537 /// ```ignore,no_run
2538 /// # use google_cloud_build_v1::model::Results;
2539 /// let b1 = bytes::Bytes::from_static(b"abc");
2540 /// let b2 = bytes::Bytes::from_static(b"xyz");
2541 /// let x = Results::new().set_build_step_outputs([b1, b2]);
2542 /// ```
2543 pub fn set_build_step_outputs<T, V>(mut self, v: T) -> Self
2544 where
2545 T: std::iter::IntoIterator<Item = V>,
2546 V: std::convert::Into<::bytes::Bytes>,
2547 {
2548 use std::iter::Iterator;
2549 self.build_step_outputs = v.into_iter().map(|i| i.into()).collect();
2550 self
2551 }
2552
2553 /// Sets the value of [artifact_timing][crate::model::Results::artifact_timing].
2554 ///
2555 /// # Example
2556 /// ```ignore,no_run
2557 /// # use google_cloud_build_v1::model::Results;
2558 /// use google_cloud_build_v1::model::TimeSpan;
2559 /// let x = Results::new().set_artifact_timing(TimeSpan::default()/* use setters */);
2560 /// ```
2561 pub fn set_artifact_timing<T>(mut self, v: T) -> Self
2562 where
2563 T: std::convert::Into<crate::model::TimeSpan>,
2564 {
2565 self.artifact_timing = std::option::Option::Some(v.into());
2566 self
2567 }
2568
2569 /// Sets or clears the value of [artifact_timing][crate::model::Results::artifact_timing].
2570 ///
2571 /// # Example
2572 /// ```ignore,no_run
2573 /// # use google_cloud_build_v1::model::Results;
2574 /// use google_cloud_build_v1::model::TimeSpan;
2575 /// let x = Results::new().set_or_clear_artifact_timing(Some(TimeSpan::default()/* use setters */));
2576 /// let x = Results::new().set_or_clear_artifact_timing(None::<TimeSpan>);
2577 /// ```
2578 pub fn set_or_clear_artifact_timing<T>(mut self, v: std::option::Option<T>) -> Self
2579 where
2580 T: std::convert::Into<crate::model::TimeSpan>,
2581 {
2582 self.artifact_timing = v.map(|x| x.into());
2583 self
2584 }
2585
2586 /// Sets the value of [python_packages][crate::model::Results::python_packages].
2587 ///
2588 /// # Example
2589 /// ```ignore,no_run
2590 /// # use google_cloud_build_v1::model::Results;
2591 /// use google_cloud_build_v1::model::UploadedPythonPackage;
2592 /// let x = Results::new()
2593 /// .set_python_packages([
2594 /// UploadedPythonPackage::default()/* use setters */,
2595 /// UploadedPythonPackage::default()/* use (different) setters */,
2596 /// ]);
2597 /// ```
2598 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
2599 where
2600 T: std::iter::IntoIterator<Item = V>,
2601 V: std::convert::Into<crate::model::UploadedPythonPackage>,
2602 {
2603 use std::iter::Iterator;
2604 self.python_packages = v.into_iter().map(|i| i.into()).collect();
2605 self
2606 }
2607
2608 /// Sets the value of [maven_artifacts][crate::model::Results::maven_artifacts].
2609 ///
2610 /// # Example
2611 /// ```ignore,no_run
2612 /// # use google_cloud_build_v1::model::Results;
2613 /// use google_cloud_build_v1::model::UploadedMavenArtifact;
2614 /// let x = Results::new()
2615 /// .set_maven_artifacts([
2616 /// UploadedMavenArtifact::default()/* use setters */,
2617 /// UploadedMavenArtifact::default()/* use (different) setters */,
2618 /// ]);
2619 /// ```
2620 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
2621 where
2622 T: std::iter::IntoIterator<Item = V>,
2623 V: std::convert::Into<crate::model::UploadedMavenArtifact>,
2624 {
2625 use std::iter::Iterator;
2626 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
2627 self
2628 }
2629
2630 /// Sets the value of [go_modules][crate::model::Results::go_modules].
2631 ///
2632 /// # Example
2633 /// ```ignore,no_run
2634 /// # use google_cloud_build_v1::model::Results;
2635 /// use google_cloud_build_v1::model::UploadedGoModule;
2636 /// let x = Results::new()
2637 /// .set_go_modules([
2638 /// UploadedGoModule::default()/* use setters */,
2639 /// UploadedGoModule::default()/* use (different) setters */,
2640 /// ]);
2641 /// ```
2642 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
2643 where
2644 T: std::iter::IntoIterator<Item = V>,
2645 V: std::convert::Into<crate::model::UploadedGoModule>,
2646 {
2647 use std::iter::Iterator;
2648 self.go_modules = v.into_iter().map(|i| i.into()).collect();
2649 self
2650 }
2651
2652 /// Sets the value of [npm_packages][crate::model::Results::npm_packages].
2653 ///
2654 /// # Example
2655 /// ```ignore,no_run
2656 /// # use google_cloud_build_v1::model::Results;
2657 /// use google_cloud_build_v1::model::UploadedNpmPackage;
2658 /// let x = Results::new()
2659 /// .set_npm_packages([
2660 /// UploadedNpmPackage::default()/* use setters */,
2661 /// UploadedNpmPackage::default()/* use (different) setters */,
2662 /// ]);
2663 /// ```
2664 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
2665 where
2666 T: std::iter::IntoIterator<Item = V>,
2667 V: std::convert::Into<crate::model::UploadedNpmPackage>,
2668 {
2669 use std::iter::Iterator;
2670 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
2671 self
2672 }
2673}
2674
2675impl wkt::message::Message for Results {
2676 fn typename() -> &'static str {
2677 "type.googleapis.com/google.devtools.cloudbuild.v1.Results"
2678 }
2679}
2680
2681/// An artifact that was uploaded during a build. This
2682/// is a single record in the artifact manifest JSON file.
2683#[derive(Clone, Default, PartialEq)]
2684#[non_exhaustive]
2685pub struct ArtifactResult {
2686 /// The path of an artifact in a Cloud Storage bucket, with the
2687 /// generation number. For example,
2688 /// `gs://mybucket/path/to/output.jar#generation`.
2689 pub location: std::string::String,
2690
2691 /// The file hash of the artifact.
2692 pub file_hash: std::vec::Vec<crate::model::FileHashes>,
2693
2694 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2695}
2696
2697impl ArtifactResult {
2698 /// Creates a new default instance.
2699 pub fn new() -> Self {
2700 std::default::Default::default()
2701 }
2702
2703 /// Sets the value of [location][crate::model::ArtifactResult::location].
2704 ///
2705 /// # Example
2706 /// ```ignore,no_run
2707 /// # use google_cloud_build_v1::model::ArtifactResult;
2708 /// let x = ArtifactResult::new().set_location("example");
2709 /// ```
2710 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2711 self.location = v.into();
2712 self
2713 }
2714
2715 /// Sets the value of [file_hash][crate::model::ArtifactResult::file_hash].
2716 ///
2717 /// # Example
2718 /// ```ignore,no_run
2719 /// # use google_cloud_build_v1::model::ArtifactResult;
2720 /// use google_cloud_build_v1::model::FileHashes;
2721 /// let x = ArtifactResult::new()
2722 /// .set_file_hash([
2723 /// FileHashes::default()/* use setters */,
2724 /// FileHashes::default()/* use (different) setters */,
2725 /// ]);
2726 /// ```
2727 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
2728 where
2729 T: std::iter::IntoIterator<Item = V>,
2730 V: std::convert::Into<crate::model::FileHashes>,
2731 {
2732 use std::iter::Iterator;
2733 self.file_hash = v.into_iter().map(|i| i.into()).collect();
2734 self
2735 }
2736}
2737
2738impl wkt::message::Message for ArtifactResult {
2739 fn typename() -> &'static str {
2740 "type.googleapis.com/google.devtools.cloudbuild.v1.ArtifactResult"
2741 }
2742}
2743
2744/// A build resource in the Cloud Build API.
2745///
2746/// At a high level, a `Build` describes where to find source code, how to build
2747/// it (for example, the builder image to run on the source), and where to store
2748/// the built artifacts.
2749///
2750/// Fields can include the following variables, which will be expanded when the
2751/// build is created:
2752///
2753/// - $PROJECT_ID: the project ID of the build.
2754/// - $PROJECT_NUMBER: the project number of the build.
2755/// - $LOCATION: the location/region of the build.
2756/// - $BUILD_ID: the autogenerated ID of the build.
2757/// - $REPO_NAME: the source repository name specified by RepoSource.
2758/// - $BRANCH_NAME: the branch name specified by RepoSource.
2759/// - $TAG_NAME: the tag name specified by RepoSource.
2760/// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or
2761/// resolved from the specified branch or tag.
2762/// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA.
2763#[derive(Clone, Default, PartialEq)]
2764#[non_exhaustive]
2765pub struct Build {
2766 /// Output only. The 'Build' name with format:
2767 /// `projects/{project}/locations/{location}/builds/{build}`, where {build}
2768 /// is a unique identifier generated by the service.
2769 pub name: std::string::String,
2770
2771 /// Output only. Unique identifier of the build.
2772 pub id: std::string::String,
2773
2774 /// Output only. ID of the project.
2775 pub project_id: std::string::String,
2776
2777 /// Output only. Status of the build.
2778 pub status: crate::model::build::Status,
2779
2780 /// Output only. Customer-readable message about the current status.
2781 pub status_detail: std::string::String,
2782
2783 /// Optional. The location of the source files to build.
2784 pub source: std::option::Option<crate::model::Source>,
2785
2786 /// Required. The operations to be performed on the workspace.
2787 pub steps: std::vec::Vec<crate::model::BuildStep>,
2788
2789 /// Output only. Results of the build.
2790 pub results: std::option::Option<crate::model::Results>,
2791
2792 /// Output only. Time at which the request to create the build was received.
2793 pub create_time: std::option::Option<wkt::Timestamp>,
2794
2795 /// Output only. Time at which execution of the build was started.
2796 pub start_time: std::option::Option<wkt::Timestamp>,
2797
2798 /// Output only. Time at which execution of the build was finished.
2799 ///
2800 /// The difference between finish_time and start_time is the duration of the
2801 /// build's execution.
2802 pub finish_time: std::option::Option<wkt::Timestamp>,
2803
2804 /// Amount of time that this build should be allowed to run, to second
2805 /// granularity. If this amount of time elapses, work on the build will cease
2806 /// and the build status will be `TIMEOUT`.
2807 ///
2808 /// `timeout` starts ticking from `startTime`.
2809 ///
2810 /// Default time is 60 minutes.
2811 pub timeout: std::option::Option<wkt::Duration>,
2812
2813 /// A list of images to be pushed upon the successful completion of all build
2814 /// steps.
2815 ///
2816 /// The images are pushed using the builder service account's credentials.
2817 ///
2818 /// The digests of the pushed images will be stored in the `Build` resource's
2819 /// results field.
2820 ///
2821 /// If any of the images fail to be pushed, the build status is marked
2822 /// `FAILURE`.
2823 pub images: std::vec::Vec<std::string::String>,
2824
2825 /// TTL in queue for this build. If provided and the build is enqueued longer
2826 /// than this value, the build will expire and the build status will be
2827 /// `EXPIRED`.
2828 ///
2829 /// The TTL starts ticking from create_time.
2830 pub queue_ttl: std::option::Option<wkt::Duration>,
2831
2832 /// Artifacts produced by the build that should be uploaded upon
2833 /// successful completion of all build steps.
2834 pub artifacts: std::option::Option<crate::model::Artifacts>,
2835
2836 /// Cloud Storage bucket where logs should be written (see
2837 /// [Bucket Name
2838 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
2839 /// Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`.
2840 pub logs_bucket: std::string::String,
2841
2842 /// Output only. A permanent fixed identifier for source.
2843 pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
2844
2845 /// Output only. The ID of the `BuildTrigger` that triggered this build, if it
2846 /// was triggered automatically.
2847 pub build_trigger_id: std::string::String,
2848
2849 /// Special options for this build.
2850 pub options: std::option::Option<crate::model::BuildOptions>,
2851
2852 /// Output only. URL to logs for this build in Google Cloud Console.
2853 pub log_url: std::string::String,
2854
2855 /// Substitutions data for `Build` resource.
2856 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
2857
2858 /// Tags for annotation of a `Build`. These are not docker tags.
2859 pub tags: std::vec::Vec<std::string::String>,
2860
2861 /// Secrets to decrypt using Cloud Key Management Service.
2862 /// Note: Secret Manager is the recommended technique
2863 /// for managing sensitive data with Cloud Build. Use `available_secrets` to
2864 /// configure builds to access secrets from Secret Manager. For instructions,
2865 /// see: <https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets>
2866 pub secrets: std::vec::Vec<crate::model::Secret>,
2867
2868 /// Output only. Stores timing information for phases of the build. Valid keys
2869 /// are:
2870 ///
2871 /// * BUILD: time to execute all build steps.
2872 /// * PUSH: time to push all artifacts including docker images and non docker
2873 /// artifacts.
2874 /// * FETCHSOURCE: time to fetch source.
2875 /// * SETUPBUILD: time to set up build.
2876 ///
2877 /// If the build does not specify source or images,
2878 /// these keys will not be included.
2879 pub timing: std::collections::HashMap<std::string::String, crate::model::TimeSpan>,
2880
2881 /// Output only. Describes this build's approval configuration, status,
2882 /// and result.
2883 pub approval: std::option::Option<crate::model::BuildApproval>,
2884
2885 /// IAM service account whose credentials will be used at build runtime.
2886 /// Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
2887 /// ACCOUNT can be email address or uniqueId of the service account.
2888 pub service_account: std::string::String,
2889
2890 /// Secrets and secret environment variables.
2891 pub available_secrets: std::option::Option<crate::model::Secrets>,
2892
2893 /// Output only. Non-fatal problems encountered during the execution of the
2894 /// build.
2895 pub warnings: std::vec::Vec<crate::model::build::Warning>,
2896
2897 /// Optional. Configuration for git operations.
2898 pub git_config: std::option::Option<crate::model::GitConfig>,
2899
2900 /// Output only. Contains information about the build when status=FAILURE.
2901 pub failure_info: std::option::Option<crate::model::build::FailureInfo>,
2902
2903 /// Optional. Dependencies that the Cloud Build worker will fetch before
2904 /// executing user steps.
2905 pub dependencies: std::vec::Vec<crate::model::Dependency>,
2906
2907 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2908}
2909
2910impl Build {
2911 /// Creates a new default instance.
2912 pub fn new() -> Self {
2913 std::default::Default::default()
2914 }
2915
2916 /// Sets the value of [name][crate::model::Build::name].
2917 ///
2918 /// # Example
2919 /// ```ignore,no_run
2920 /// # use google_cloud_build_v1::model::Build;
2921 /// let x = Build::new().set_name("example");
2922 /// ```
2923 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2924 self.name = v.into();
2925 self
2926 }
2927
2928 /// Sets the value of [id][crate::model::Build::id].
2929 ///
2930 /// # Example
2931 /// ```ignore,no_run
2932 /// # use google_cloud_build_v1::model::Build;
2933 /// let x = Build::new().set_id("example");
2934 /// ```
2935 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2936 self.id = v.into();
2937 self
2938 }
2939
2940 /// Sets the value of [project_id][crate::model::Build::project_id].
2941 ///
2942 /// # Example
2943 /// ```ignore,no_run
2944 /// # use google_cloud_build_v1::model::Build;
2945 /// let x = Build::new().set_project_id("example");
2946 /// ```
2947 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2948 self.project_id = v.into();
2949 self
2950 }
2951
2952 /// Sets the value of [status][crate::model::Build::status].
2953 ///
2954 /// # Example
2955 /// ```ignore,no_run
2956 /// # use google_cloud_build_v1::model::Build;
2957 /// use google_cloud_build_v1::model::build::Status;
2958 /// let x0 = Build::new().set_status(Status::Pending);
2959 /// let x1 = Build::new().set_status(Status::Queued);
2960 /// let x2 = Build::new().set_status(Status::Working);
2961 /// ```
2962 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2963 self.status = v.into();
2964 self
2965 }
2966
2967 /// Sets the value of [status_detail][crate::model::Build::status_detail].
2968 ///
2969 /// # Example
2970 /// ```ignore,no_run
2971 /// # use google_cloud_build_v1::model::Build;
2972 /// let x = Build::new().set_status_detail("example");
2973 /// ```
2974 pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2975 self.status_detail = v.into();
2976 self
2977 }
2978
2979 /// Sets the value of [source][crate::model::Build::source].
2980 ///
2981 /// # Example
2982 /// ```ignore,no_run
2983 /// # use google_cloud_build_v1::model::Build;
2984 /// use google_cloud_build_v1::model::Source;
2985 /// let x = Build::new().set_source(Source::default()/* use setters */);
2986 /// ```
2987 pub fn set_source<T>(mut self, v: T) -> Self
2988 where
2989 T: std::convert::Into<crate::model::Source>,
2990 {
2991 self.source = std::option::Option::Some(v.into());
2992 self
2993 }
2994
2995 /// Sets or clears the value of [source][crate::model::Build::source].
2996 ///
2997 /// # Example
2998 /// ```ignore,no_run
2999 /// # use google_cloud_build_v1::model::Build;
3000 /// use google_cloud_build_v1::model::Source;
3001 /// let x = Build::new().set_or_clear_source(Some(Source::default()/* use setters */));
3002 /// let x = Build::new().set_or_clear_source(None::<Source>);
3003 /// ```
3004 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
3005 where
3006 T: std::convert::Into<crate::model::Source>,
3007 {
3008 self.source = v.map(|x| x.into());
3009 self
3010 }
3011
3012 /// Sets the value of [steps][crate::model::Build::steps].
3013 ///
3014 /// # Example
3015 /// ```ignore,no_run
3016 /// # use google_cloud_build_v1::model::Build;
3017 /// use google_cloud_build_v1::model::BuildStep;
3018 /// let x = Build::new()
3019 /// .set_steps([
3020 /// BuildStep::default()/* use setters */,
3021 /// BuildStep::default()/* use (different) setters */,
3022 /// ]);
3023 /// ```
3024 pub fn set_steps<T, V>(mut self, v: T) -> Self
3025 where
3026 T: std::iter::IntoIterator<Item = V>,
3027 V: std::convert::Into<crate::model::BuildStep>,
3028 {
3029 use std::iter::Iterator;
3030 self.steps = v.into_iter().map(|i| i.into()).collect();
3031 self
3032 }
3033
3034 /// Sets the value of [results][crate::model::Build::results].
3035 ///
3036 /// # Example
3037 /// ```ignore,no_run
3038 /// # use google_cloud_build_v1::model::Build;
3039 /// use google_cloud_build_v1::model::Results;
3040 /// let x = Build::new().set_results(Results::default()/* use setters */);
3041 /// ```
3042 pub fn set_results<T>(mut self, v: T) -> Self
3043 where
3044 T: std::convert::Into<crate::model::Results>,
3045 {
3046 self.results = std::option::Option::Some(v.into());
3047 self
3048 }
3049
3050 /// Sets or clears the value of [results][crate::model::Build::results].
3051 ///
3052 /// # Example
3053 /// ```ignore,no_run
3054 /// # use google_cloud_build_v1::model::Build;
3055 /// use google_cloud_build_v1::model::Results;
3056 /// let x = Build::new().set_or_clear_results(Some(Results::default()/* use setters */));
3057 /// let x = Build::new().set_or_clear_results(None::<Results>);
3058 /// ```
3059 pub fn set_or_clear_results<T>(mut self, v: std::option::Option<T>) -> Self
3060 where
3061 T: std::convert::Into<crate::model::Results>,
3062 {
3063 self.results = v.map(|x| x.into());
3064 self
3065 }
3066
3067 /// Sets the value of [create_time][crate::model::Build::create_time].
3068 ///
3069 /// # Example
3070 /// ```ignore,no_run
3071 /// # use google_cloud_build_v1::model::Build;
3072 /// use wkt::Timestamp;
3073 /// let x = Build::new().set_create_time(Timestamp::default()/* use setters */);
3074 /// ```
3075 pub fn set_create_time<T>(mut self, v: T) -> Self
3076 where
3077 T: std::convert::Into<wkt::Timestamp>,
3078 {
3079 self.create_time = std::option::Option::Some(v.into());
3080 self
3081 }
3082
3083 /// Sets or clears the value of [create_time][crate::model::Build::create_time].
3084 ///
3085 /// # Example
3086 /// ```ignore,no_run
3087 /// # use google_cloud_build_v1::model::Build;
3088 /// use wkt::Timestamp;
3089 /// let x = Build::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3090 /// let x = Build::new().set_or_clear_create_time(None::<Timestamp>);
3091 /// ```
3092 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3093 where
3094 T: std::convert::Into<wkt::Timestamp>,
3095 {
3096 self.create_time = v.map(|x| x.into());
3097 self
3098 }
3099
3100 /// Sets the value of [start_time][crate::model::Build::start_time].
3101 ///
3102 /// # Example
3103 /// ```ignore,no_run
3104 /// # use google_cloud_build_v1::model::Build;
3105 /// use wkt::Timestamp;
3106 /// let x = Build::new().set_start_time(Timestamp::default()/* use setters */);
3107 /// ```
3108 pub fn set_start_time<T>(mut self, v: T) -> Self
3109 where
3110 T: std::convert::Into<wkt::Timestamp>,
3111 {
3112 self.start_time = std::option::Option::Some(v.into());
3113 self
3114 }
3115
3116 /// Sets or clears the value of [start_time][crate::model::Build::start_time].
3117 ///
3118 /// # Example
3119 /// ```ignore,no_run
3120 /// # use google_cloud_build_v1::model::Build;
3121 /// use wkt::Timestamp;
3122 /// let x = Build::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3123 /// let x = Build::new().set_or_clear_start_time(None::<Timestamp>);
3124 /// ```
3125 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3126 where
3127 T: std::convert::Into<wkt::Timestamp>,
3128 {
3129 self.start_time = v.map(|x| x.into());
3130 self
3131 }
3132
3133 /// Sets the value of [finish_time][crate::model::Build::finish_time].
3134 ///
3135 /// # Example
3136 /// ```ignore,no_run
3137 /// # use google_cloud_build_v1::model::Build;
3138 /// use wkt::Timestamp;
3139 /// let x = Build::new().set_finish_time(Timestamp::default()/* use setters */);
3140 /// ```
3141 pub fn set_finish_time<T>(mut self, v: T) -> Self
3142 where
3143 T: std::convert::Into<wkt::Timestamp>,
3144 {
3145 self.finish_time = std::option::Option::Some(v.into());
3146 self
3147 }
3148
3149 /// Sets or clears the value of [finish_time][crate::model::Build::finish_time].
3150 ///
3151 /// # Example
3152 /// ```ignore,no_run
3153 /// # use google_cloud_build_v1::model::Build;
3154 /// use wkt::Timestamp;
3155 /// let x = Build::new().set_or_clear_finish_time(Some(Timestamp::default()/* use setters */));
3156 /// let x = Build::new().set_or_clear_finish_time(None::<Timestamp>);
3157 /// ```
3158 pub fn set_or_clear_finish_time<T>(mut self, v: std::option::Option<T>) -> Self
3159 where
3160 T: std::convert::Into<wkt::Timestamp>,
3161 {
3162 self.finish_time = v.map(|x| x.into());
3163 self
3164 }
3165
3166 /// Sets the value of [timeout][crate::model::Build::timeout].
3167 ///
3168 /// # Example
3169 /// ```ignore,no_run
3170 /// # use google_cloud_build_v1::model::Build;
3171 /// use wkt::Duration;
3172 /// let x = Build::new().set_timeout(Duration::default()/* use setters */);
3173 /// ```
3174 pub fn set_timeout<T>(mut self, v: T) -> Self
3175 where
3176 T: std::convert::Into<wkt::Duration>,
3177 {
3178 self.timeout = std::option::Option::Some(v.into());
3179 self
3180 }
3181
3182 /// Sets or clears the value of [timeout][crate::model::Build::timeout].
3183 ///
3184 /// # Example
3185 /// ```ignore,no_run
3186 /// # use google_cloud_build_v1::model::Build;
3187 /// use wkt::Duration;
3188 /// let x = Build::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
3189 /// let x = Build::new().set_or_clear_timeout(None::<Duration>);
3190 /// ```
3191 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3192 where
3193 T: std::convert::Into<wkt::Duration>,
3194 {
3195 self.timeout = v.map(|x| x.into());
3196 self
3197 }
3198
3199 /// Sets the value of [images][crate::model::Build::images].
3200 ///
3201 /// # Example
3202 /// ```ignore,no_run
3203 /// # use google_cloud_build_v1::model::Build;
3204 /// let x = Build::new().set_images(["a", "b", "c"]);
3205 /// ```
3206 pub fn set_images<T, V>(mut self, v: T) -> Self
3207 where
3208 T: std::iter::IntoIterator<Item = V>,
3209 V: std::convert::Into<std::string::String>,
3210 {
3211 use std::iter::Iterator;
3212 self.images = v.into_iter().map(|i| i.into()).collect();
3213 self
3214 }
3215
3216 /// Sets the value of [queue_ttl][crate::model::Build::queue_ttl].
3217 ///
3218 /// # Example
3219 /// ```ignore,no_run
3220 /// # use google_cloud_build_v1::model::Build;
3221 /// use wkt::Duration;
3222 /// let x = Build::new().set_queue_ttl(Duration::default()/* use setters */);
3223 /// ```
3224 pub fn set_queue_ttl<T>(mut self, v: T) -> Self
3225 where
3226 T: std::convert::Into<wkt::Duration>,
3227 {
3228 self.queue_ttl = std::option::Option::Some(v.into());
3229 self
3230 }
3231
3232 /// Sets or clears the value of [queue_ttl][crate::model::Build::queue_ttl].
3233 ///
3234 /// # Example
3235 /// ```ignore,no_run
3236 /// # use google_cloud_build_v1::model::Build;
3237 /// use wkt::Duration;
3238 /// let x = Build::new().set_or_clear_queue_ttl(Some(Duration::default()/* use setters */));
3239 /// let x = Build::new().set_or_clear_queue_ttl(None::<Duration>);
3240 /// ```
3241 pub fn set_or_clear_queue_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3242 where
3243 T: std::convert::Into<wkt::Duration>,
3244 {
3245 self.queue_ttl = v.map(|x| x.into());
3246 self
3247 }
3248
3249 /// Sets the value of [artifacts][crate::model::Build::artifacts].
3250 ///
3251 /// # Example
3252 /// ```ignore,no_run
3253 /// # use google_cloud_build_v1::model::Build;
3254 /// use google_cloud_build_v1::model::Artifacts;
3255 /// let x = Build::new().set_artifacts(Artifacts::default()/* use setters */);
3256 /// ```
3257 pub fn set_artifacts<T>(mut self, v: T) -> Self
3258 where
3259 T: std::convert::Into<crate::model::Artifacts>,
3260 {
3261 self.artifacts = std::option::Option::Some(v.into());
3262 self
3263 }
3264
3265 /// Sets or clears the value of [artifacts][crate::model::Build::artifacts].
3266 ///
3267 /// # Example
3268 /// ```ignore,no_run
3269 /// # use google_cloud_build_v1::model::Build;
3270 /// use google_cloud_build_v1::model::Artifacts;
3271 /// let x = Build::new().set_or_clear_artifacts(Some(Artifacts::default()/* use setters */));
3272 /// let x = Build::new().set_or_clear_artifacts(None::<Artifacts>);
3273 /// ```
3274 pub fn set_or_clear_artifacts<T>(mut self, v: std::option::Option<T>) -> Self
3275 where
3276 T: std::convert::Into<crate::model::Artifacts>,
3277 {
3278 self.artifacts = v.map(|x| x.into());
3279 self
3280 }
3281
3282 /// Sets the value of [logs_bucket][crate::model::Build::logs_bucket].
3283 ///
3284 /// # Example
3285 /// ```ignore,no_run
3286 /// # use google_cloud_build_v1::model::Build;
3287 /// let x = Build::new().set_logs_bucket("example");
3288 /// ```
3289 pub fn set_logs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3290 self.logs_bucket = v.into();
3291 self
3292 }
3293
3294 /// Sets the value of [source_provenance][crate::model::Build::source_provenance].
3295 ///
3296 /// # Example
3297 /// ```ignore,no_run
3298 /// # use google_cloud_build_v1::model::Build;
3299 /// use google_cloud_build_v1::model::SourceProvenance;
3300 /// let x = Build::new().set_source_provenance(SourceProvenance::default()/* use setters */);
3301 /// ```
3302 pub fn set_source_provenance<T>(mut self, v: T) -> Self
3303 where
3304 T: std::convert::Into<crate::model::SourceProvenance>,
3305 {
3306 self.source_provenance = std::option::Option::Some(v.into());
3307 self
3308 }
3309
3310 /// Sets or clears the value of [source_provenance][crate::model::Build::source_provenance].
3311 ///
3312 /// # Example
3313 /// ```ignore,no_run
3314 /// # use google_cloud_build_v1::model::Build;
3315 /// use google_cloud_build_v1::model::SourceProvenance;
3316 /// let x = Build::new().set_or_clear_source_provenance(Some(SourceProvenance::default()/* use setters */));
3317 /// let x = Build::new().set_or_clear_source_provenance(None::<SourceProvenance>);
3318 /// ```
3319 pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3320 where
3321 T: std::convert::Into<crate::model::SourceProvenance>,
3322 {
3323 self.source_provenance = v.map(|x| x.into());
3324 self
3325 }
3326
3327 /// Sets the value of [build_trigger_id][crate::model::Build::build_trigger_id].
3328 ///
3329 /// # Example
3330 /// ```ignore,no_run
3331 /// # use google_cloud_build_v1::model::Build;
3332 /// let x = Build::new().set_build_trigger_id("example");
3333 /// ```
3334 pub fn set_build_trigger_id<T: std::convert::Into<std::string::String>>(
3335 mut self,
3336 v: T,
3337 ) -> Self {
3338 self.build_trigger_id = v.into();
3339 self
3340 }
3341
3342 /// Sets the value of [options][crate::model::Build::options].
3343 ///
3344 /// # Example
3345 /// ```ignore,no_run
3346 /// # use google_cloud_build_v1::model::Build;
3347 /// use google_cloud_build_v1::model::BuildOptions;
3348 /// let x = Build::new().set_options(BuildOptions::default()/* use setters */);
3349 /// ```
3350 pub fn set_options<T>(mut self, v: T) -> Self
3351 where
3352 T: std::convert::Into<crate::model::BuildOptions>,
3353 {
3354 self.options = std::option::Option::Some(v.into());
3355 self
3356 }
3357
3358 /// Sets or clears the value of [options][crate::model::Build::options].
3359 ///
3360 /// # Example
3361 /// ```ignore,no_run
3362 /// # use google_cloud_build_v1::model::Build;
3363 /// use google_cloud_build_v1::model::BuildOptions;
3364 /// let x = Build::new().set_or_clear_options(Some(BuildOptions::default()/* use setters */));
3365 /// let x = Build::new().set_or_clear_options(None::<BuildOptions>);
3366 /// ```
3367 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3368 where
3369 T: std::convert::Into<crate::model::BuildOptions>,
3370 {
3371 self.options = v.map(|x| x.into());
3372 self
3373 }
3374
3375 /// Sets the value of [log_url][crate::model::Build::log_url].
3376 ///
3377 /// # Example
3378 /// ```ignore,no_run
3379 /// # use google_cloud_build_v1::model::Build;
3380 /// let x = Build::new().set_log_url("example");
3381 /// ```
3382 pub fn set_log_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3383 self.log_url = v.into();
3384 self
3385 }
3386
3387 /// Sets the value of [substitutions][crate::model::Build::substitutions].
3388 ///
3389 /// # Example
3390 /// ```ignore,no_run
3391 /// # use google_cloud_build_v1::model::Build;
3392 /// let x = Build::new().set_substitutions([
3393 /// ("key0", "abc"),
3394 /// ("key1", "xyz"),
3395 /// ]);
3396 /// ```
3397 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
3398 where
3399 T: std::iter::IntoIterator<Item = (K, V)>,
3400 K: std::convert::Into<std::string::String>,
3401 V: std::convert::Into<std::string::String>,
3402 {
3403 use std::iter::Iterator;
3404 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3405 self
3406 }
3407
3408 /// Sets the value of [tags][crate::model::Build::tags].
3409 ///
3410 /// # Example
3411 /// ```ignore,no_run
3412 /// # use google_cloud_build_v1::model::Build;
3413 /// let x = Build::new().set_tags(["a", "b", "c"]);
3414 /// ```
3415 pub fn set_tags<T, V>(mut self, v: T) -> Self
3416 where
3417 T: std::iter::IntoIterator<Item = V>,
3418 V: std::convert::Into<std::string::String>,
3419 {
3420 use std::iter::Iterator;
3421 self.tags = v.into_iter().map(|i| i.into()).collect();
3422 self
3423 }
3424
3425 /// Sets the value of [secrets][crate::model::Build::secrets].
3426 ///
3427 /// # Example
3428 /// ```ignore,no_run
3429 /// # use google_cloud_build_v1::model::Build;
3430 /// use google_cloud_build_v1::model::Secret;
3431 /// let x = Build::new()
3432 /// .set_secrets([
3433 /// Secret::default()/* use setters */,
3434 /// Secret::default()/* use (different) setters */,
3435 /// ]);
3436 /// ```
3437 pub fn set_secrets<T, V>(mut self, v: T) -> Self
3438 where
3439 T: std::iter::IntoIterator<Item = V>,
3440 V: std::convert::Into<crate::model::Secret>,
3441 {
3442 use std::iter::Iterator;
3443 self.secrets = v.into_iter().map(|i| i.into()).collect();
3444 self
3445 }
3446
3447 /// Sets the value of [timing][crate::model::Build::timing].
3448 ///
3449 /// # Example
3450 /// ```ignore,no_run
3451 /// # use google_cloud_build_v1::model::Build;
3452 /// use google_cloud_build_v1::model::TimeSpan;
3453 /// let x = Build::new().set_timing([
3454 /// ("key0", TimeSpan::default()/* use setters */),
3455 /// ("key1", TimeSpan::default()/* use (different) setters */),
3456 /// ]);
3457 /// ```
3458 pub fn set_timing<T, K, V>(mut self, v: T) -> Self
3459 where
3460 T: std::iter::IntoIterator<Item = (K, V)>,
3461 K: std::convert::Into<std::string::String>,
3462 V: std::convert::Into<crate::model::TimeSpan>,
3463 {
3464 use std::iter::Iterator;
3465 self.timing = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3466 self
3467 }
3468
3469 /// Sets the value of [approval][crate::model::Build::approval].
3470 ///
3471 /// # Example
3472 /// ```ignore,no_run
3473 /// # use google_cloud_build_v1::model::Build;
3474 /// use google_cloud_build_v1::model::BuildApproval;
3475 /// let x = Build::new().set_approval(BuildApproval::default()/* use setters */);
3476 /// ```
3477 pub fn set_approval<T>(mut self, v: T) -> Self
3478 where
3479 T: std::convert::Into<crate::model::BuildApproval>,
3480 {
3481 self.approval = std::option::Option::Some(v.into());
3482 self
3483 }
3484
3485 /// Sets or clears the value of [approval][crate::model::Build::approval].
3486 ///
3487 /// # Example
3488 /// ```ignore,no_run
3489 /// # use google_cloud_build_v1::model::Build;
3490 /// use google_cloud_build_v1::model::BuildApproval;
3491 /// let x = Build::new().set_or_clear_approval(Some(BuildApproval::default()/* use setters */));
3492 /// let x = Build::new().set_or_clear_approval(None::<BuildApproval>);
3493 /// ```
3494 pub fn set_or_clear_approval<T>(mut self, v: std::option::Option<T>) -> Self
3495 where
3496 T: std::convert::Into<crate::model::BuildApproval>,
3497 {
3498 self.approval = v.map(|x| x.into());
3499 self
3500 }
3501
3502 /// Sets the value of [service_account][crate::model::Build::service_account].
3503 ///
3504 /// # Example
3505 /// ```ignore,no_run
3506 /// # use google_cloud_build_v1::model::Build;
3507 /// let x = Build::new().set_service_account("example");
3508 /// ```
3509 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3510 self.service_account = v.into();
3511 self
3512 }
3513
3514 /// Sets the value of [available_secrets][crate::model::Build::available_secrets].
3515 ///
3516 /// # Example
3517 /// ```ignore,no_run
3518 /// # use google_cloud_build_v1::model::Build;
3519 /// use google_cloud_build_v1::model::Secrets;
3520 /// let x = Build::new().set_available_secrets(Secrets::default()/* use setters */);
3521 /// ```
3522 pub fn set_available_secrets<T>(mut self, v: T) -> Self
3523 where
3524 T: std::convert::Into<crate::model::Secrets>,
3525 {
3526 self.available_secrets = std::option::Option::Some(v.into());
3527 self
3528 }
3529
3530 /// Sets or clears the value of [available_secrets][crate::model::Build::available_secrets].
3531 ///
3532 /// # Example
3533 /// ```ignore,no_run
3534 /// # use google_cloud_build_v1::model::Build;
3535 /// use google_cloud_build_v1::model::Secrets;
3536 /// let x = Build::new().set_or_clear_available_secrets(Some(Secrets::default()/* use setters */));
3537 /// let x = Build::new().set_or_clear_available_secrets(None::<Secrets>);
3538 /// ```
3539 pub fn set_or_clear_available_secrets<T>(mut self, v: std::option::Option<T>) -> Self
3540 where
3541 T: std::convert::Into<crate::model::Secrets>,
3542 {
3543 self.available_secrets = v.map(|x| x.into());
3544 self
3545 }
3546
3547 /// Sets the value of [warnings][crate::model::Build::warnings].
3548 ///
3549 /// # Example
3550 /// ```ignore,no_run
3551 /// # use google_cloud_build_v1::model::Build;
3552 /// use google_cloud_build_v1::model::build::Warning;
3553 /// let x = Build::new()
3554 /// .set_warnings([
3555 /// Warning::default()/* use setters */,
3556 /// Warning::default()/* use (different) setters */,
3557 /// ]);
3558 /// ```
3559 pub fn set_warnings<T, V>(mut self, v: T) -> Self
3560 where
3561 T: std::iter::IntoIterator<Item = V>,
3562 V: std::convert::Into<crate::model::build::Warning>,
3563 {
3564 use std::iter::Iterator;
3565 self.warnings = v.into_iter().map(|i| i.into()).collect();
3566 self
3567 }
3568
3569 /// Sets the value of [git_config][crate::model::Build::git_config].
3570 ///
3571 /// # Example
3572 /// ```ignore,no_run
3573 /// # use google_cloud_build_v1::model::Build;
3574 /// use google_cloud_build_v1::model::GitConfig;
3575 /// let x = Build::new().set_git_config(GitConfig::default()/* use setters */);
3576 /// ```
3577 pub fn set_git_config<T>(mut self, v: T) -> Self
3578 where
3579 T: std::convert::Into<crate::model::GitConfig>,
3580 {
3581 self.git_config = std::option::Option::Some(v.into());
3582 self
3583 }
3584
3585 /// Sets or clears the value of [git_config][crate::model::Build::git_config].
3586 ///
3587 /// # Example
3588 /// ```ignore,no_run
3589 /// # use google_cloud_build_v1::model::Build;
3590 /// use google_cloud_build_v1::model::GitConfig;
3591 /// let x = Build::new().set_or_clear_git_config(Some(GitConfig::default()/* use setters */));
3592 /// let x = Build::new().set_or_clear_git_config(None::<GitConfig>);
3593 /// ```
3594 pub fn set_or_clear_git_config<T>(mut self, v: std::option::Option<T>) -> Self
3595 where
3596 T: std::convert::Into<crate::model::GitConfig>,
3597 {
3598 self.git_config = v.map(|x| x.into());
3599 self
3600 }
3601
3602 /// Sets the value of [failure_info][crate::model::Build::failure_info].
3603 ///
3604 /// # Example
3605 /// ```ignore,no_run
3606 /// # use google_cloud_build_v1::model::Build;
3607 /// use google_cloud_build_v1::model::build::FailureInfo;
3608 /// let x = Build::new().set_failure_info(FailureInfo::default()/* use setters */);
3609 /// ```
3610 pub fn set_failure_info<T>(mut self, v: T) -> Self
3611 where
3612 T: std::convert::Into<crate::model::build::FailureInfo>,
3613 {
3614 self.failure_info = std::option::Option::Some(v.into());
3615 self
3616 }
3617
3618 /// Sets or clears the value of [failure_info][crate::model::Build::failure_info].
3619 ///
3620 /// # Example
3621 /// ```ignore,no_run
3622 /// # use google_cloud_build_v1::model::Build;
3623 /// use google_cloud_build_v1::model::build::FailureInfo;
3624 /// let x = Build::new().set_or_clear_failure_info(Some(FailureInfo::default()/* use setters */));
3625 /// let x = Build::new().set_or_clear_failure_info(None::<FailureInfo>);
3626 /// ```
3627 pub fn set_or_clear_failure_info<T>(mut self, v: std::option::Option<T>) -> Self
3628 where
3629 T: std::convert::Into<crate::model::build::FailureInfo>,
3630 {
3631 self.failure_info = v.map(|x| x.into());
3632 self
3633 }
3634
3635 /// Sets the value of [dependencies][crate::model::Build::dependencies].
3636 ///
3637 /// # Example
3638 /// ```ignore,no_run
3639 /// # use google_cloud_build_v1::model::Build;
3640 /// use google_cloud_build_v1::model::Dependency;
3641 /// let x = Build::new()
3642 /// .set_dependencies([
3643 /// Dependency::default()/* use setters */,
3644 /// Dependency::default()/* use (different) setters */,
3645 /// ]);
3646 /// ```
3647 pub fn set_dependencies<T, V>(mut self, v: T) -> Self
3648 where
3649 T: std::iter::IntoIterator<Item = V>,
3650 V: std::convert::Into<crate::model::Dependency>,
3651 {
3652 use std::iter::Iterator;
3653 self.dependencies = v.into_iter().map(|i| i.into()).collect();
3654 self
3655 }
3656}
3657
3658impl wkt::message::Message for Build {
3659 fn typename() -> &'static str {
3660 "type.googleapis.com/google.devtools.cloudbuild.v1.Build"
3661 }
3662}
3663
3664/// Defines additional types related to [Build].
3665pub mod build {
3666 #[allow(unused_imports)]
3667 use super::*;
3668
3669 /// A non-fatal problem encountered during the execution of the build.
3670 #[derive(Clone, Default, PartialEq)]
3671 #[non_exhaustive]
3672 pub struct Warning {
3673 /// Explanation of the warning generated.
3674 pub text: std::string::String,
3675
3676 /// The priority for this warning.
3677 pub priority: crate::model::build::warning::Priority,
3678
3679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3680 }
3681
3682 impl Warning {
3683 /// Creates a new default instance.
3684 pub fn new() -> Self {
3685 std::default::Default::default()
3686 }
3687
3688 /// Sets the value of [text][crate::model::build::Warning::text].
3689 ///
3690 /// # Example
3691 /// ```ignore,no_run
3692 /// # use google_cloud_build_v1::model::build::Warning;
3693 /// let x = Warning::new().set_text("example");
3694 /// ```
3695 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3696 self.text = v.into();
3697 self
3698 }
3699
3700 /// Sets the value of [priority][crate::model::build::Warning::priority].
3701 ///
3702 /// # Example
3703 /// ```ignore,no_run
3704 /// # use google_cloud_build_v1::model::build::Warning;
3705 /// use google_cloud_build_v1::model::build::warning::Priority;
3706 /// let x0 = Warning::new().set_priority(Priority::Info);
3707 /// let x1 = Warning::new().set_priority(Priority::Warning);
3708 /// let x2 = Warning::new().set_priority(Priority::Alert);
3709 /// ```
3710 pub fn set_priority<T: std::convert::Into<crate::model::build::warning::Priority>>(
3711 mut self,
3712 v: T,
3713 ) -> Self {
3714 self.priority = v.into();
3715 self
3716 }
3717 }
3718
3719 impl wkt::message::Message for Warning {
3720 fn typename() -> &'static str {
3721 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.Warning"
3722 }
3723 }
3724
3725 /// Defines additional types related to [Warning].
3726 pub mod warning {
3727 #[allow(unused_imports)]
3728 use super::*;
3729
3730 /// The relative importance of this warning.
3731 ///
3732 /// # Working with unknown values
3733 ///
3734 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3735 /// additional enum variants at any time. Adding new variants is not considered
3736 /// a breaking change. Applications should write their code in anticipation of:
3737 ///
3738 /// - New values appearing in future releases of the client library, **and**
3739 /// - New values received dynamically, without application changes.
3740 ///
3741 /// Please consult the [Working with enums] section in the user guide for some
3742 /// guidelines.
3743 ///
3744 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3745 #[derive(Clone, Debug, PartialEq)]
3746 #[non_exhaustive]
3747 pub enum Priority {
3748 /// Should not be used.
3749 Unspecified,
3750 /// e.g. deprecation warnings and alternative feature highlights.
3751 Info,
3752 /// e.g. automated detection of possible issues with the build.
3753 Warning,
3754 /// e.g. alerts that a feature used in the build is pending removal
3755 Alert,
3756 /// If set, the enum was initialized with an unknown value.
3757 ///
3758 /// Applications can examine the value using [Priority::value] or
3759 /// [Priority::name].
3760 UnknownValue(priority::UnknownValue),
3761 }
3762
3763 #[doc(hidden)]
3764 pub mod priority {
3765 #[allow(unused_imports)]
3766 use super::*;
3767 #[derive(Clone, Debug, PartialEq)]
3768 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3769 }
3770
3771 impl Priority {
3772 /// Gets the enum value.
3773 ///
3774 /// Returns `None` if the enum contains an unknown value deserialized from
3775 /// the string representation of enums.
3776 pub fn value(&self) -> std::option::Option<i32> {
3777 match self {
3778 Self::Unspecified => std::option::Option::Some(0),
3779 Self::Info => std::option::Option::Some(1),
3780 Self::Warning => std::option::Option::Some(2),
3781 Self::Alert => std::option::Option::Some(3),
3782 Self::UnknownValue(u) => u.0.value(),
3783 }
3784 }
3785
3786 /// Gets the enum value as a string.
3787 ///
3788 /// Returns `None` if the enum contains an unknown value deserialized from
3789 /// the integer representation of enums.
3790 pub fn name(&self) -> std::option::Option<&str> {
3791 match self {
3792 Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
3793 Self::Info => std::option::Option::Some("INFO"),
3794 Self::Warning => std::option::Option::Some("WARNING"),
3795 Self::Alert => std::option::Option::Some("ALERT"),
3796 Self::UnknownValue(u) => u.0.name(),
3797 }
3798 }
3799 }
3800
3801 impl std::default::Default for Priority {
3802 fn default() -> Self {
3803 use std::convert::From;
3804 Self::from(0)
3805 }
3806 }
3807
3808 impl std::fmt::Display for Priority {
3809 fn fmt(
3810 &self,
3811 f: &mut std::fmt::Formatter<'_>,
3812 ) -> std::result::Result<(), std::fmt::Error> {
3813 wkt::internal::display_enum(f, self.name(), self.value())
3814 }
3815 }
3816
3817 impl std::convert::From<i32> for Priority {
3818 fn from(value: i32) -> Self {
3819 match value {
3820 0 => Self::Unspecified,
3821 1 => Self::Info,
3822 2 => Self::Warning,
3823 3 => Self::Alert,
3824 _ => Self::UnknownValue(priority::UnknownValue(
3825 wkt::internal::UnknownEnumValue::Integer(value),
3826 )),
3827 }
3828 }
3829 }
3830
3831 impl std::convert::From<&str> for Priority {
3832 fn from(value: &str) -> Self {
3833 use std::string::ToString;
3834 match value {
3835 "PRIORITY_UNSPECIFIED" => Self::Unspecified,
3836 "INFO" => Self::Info,
3837 "WARNING" => Self::Warning,
3838 "ALERT" => Self::Alert,
3839 _ => Self::UnknownValue(priority::UnknownValue(
3840 wkt::internal::UnknownEnumValue::String(value.to_string()),
3841 )),
3842 }
3843 }
3844 }
3845
3846 impl serde::ser::Serialize for Priority {
3847 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3848 where
3849 S: serde::Serializer,
3850 {
3851 match self {
3852 Self::Unspecified => serializer.serialize_i32(0),
3853 Self::Info => serializer.serialize_i32(1),
3854 Self::Warning => serializer.serialize_i32(2),
3855 Self::Alert => serializer.serialize_i32(3),
3856 Self::UnknownValue(u) => u.0.serialize(serializer),
3857 }
3858 }
3859 }
3860
3861 impl<'de> serde::de::Deserialize<'de> for Priority {
3862 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3863 where
3864 D: serde::Deserializer<'de>,
3865 {
3866 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
3867 ".google.devtools.cloudbuild.v1.Build.Warning.Priority",
3868 ))
3869 }
3870 }
3871 }
3872
3873 /// A fatal problem encountered during the execution of the build.
3874 #[derive(Clone, Default, PartialEq)]
3875 #[non_exhaustive]
3876 pub struct FailureInfo {
3877 /// The name of the failure.
3878 pub r#type: crate::model::build::failure_info::FailureType,
3879
3880 /// Explains the failure issue in more detail using hard-coded text.
3881 pub detail: std::string::String,
3882
3883 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3884 }
3885
3886 impl FailureInfo {
3887 /// Creates a new default instance.
3888 pub fn new() -> Self {
3889 std::default::Default::default()
3890 }
3891
3892 /// Sets the value of [r#type][crate::model::build::FailureInfo::type].
3893 ///
3894 /// # Example
3895 /// ```ignore,no_run
3896 /// # use google_cloud_build_v1::model::build::FailureInfo;
3897 /// use google_cloud_build_v1::model::build::failure_info::FailureType;
3898 /// let x0 = FailureInfo::new().set_type(FailureType::PushFailed);
3899 /// let x1 = FailureInfo::new().set_type(FailureType::PushImageNotFound);
3900 /// let x2 = FailureInfo::new().set_type(FailureType::PushNotAuthorized);
3901 /// ```
3902 pub fn set_type<T: std::convert::Into<crate::model::build::failure_info::FailureType>>(
3903 mut self,
3904 v: T,
3905 ) -> Self {
3906 self.r#type = v.into();
3907 self
3908 }
3909
3910 /// Sets the value of [detail][crate::model::build::FailureInfo::detail].
3911 ///
3912 /// # Example
3913 /// ```ignore,no_run
3914 /// # use google_cloud_build_v1::model::build::FailureInfo;
3915 /// let x = FailureInfo::new().set_detail("example");
3916 /// ```
3917 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3918 self.detail = v.into();
3919 self
3920 }
3921 }
3922
3923 impl wkt::message::Message for FailureInfo {
3924 fn typename() -> &'static str {
3925 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.FailureInfo"
3926 }
3927 }
3928
3929 /// Defines additional types related to [FailureInfo].
3930 pub mod failure_info {
3931 #[allow(unused_imports)]
3932 use super::*;
3933
3934 /// The name of a fatal problem encountered during the execution of the
3935 /// build.
3936 ///
3937 /// # Working with unknown values
3938 ///
3939 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3940 /// additional enum variants at any time. Adding new variants is not considered
3941 /// a breaking change. Applications should write their code in anticipation of:
3942 ///
3943 /// - New values appearing in future releases of the client library, **and**
3944 /// - New values received dynamically, without application changes.
3945 ///
3946 /// Please consult the [Working with enums] section in the user guide for some
3947 /// guidelines.
3948 ///
3949 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3950 #[derive(Clone, Debug, PartialEq)]
3951 #[non_exhaustive]
3952 pub enum FailureType {
3953 /// Type unspecified
3954 Unspecified,
3955 /// Unable to push the image to the repository.
3956 PushFailed,
3957 /// Final image not found.
3958 PushImageNotFound,
3959 /// Unauthorized push of the final image.
3960 PushNotAuthorized,
3961 /// Backend logging failures. Should retry.
3962 LoggingFailure,
3963 /// A build step has failed.
3964 UserBuildStep,
3965 /// The source fetching has failed.
3966 FetchSourceFailed,
3967 /// If set, the enum was initialized with an unknown value.
3968 ///
3969 /// Applications can examine the value using [FailureType::value] or
3970 /// [FailureType::name].
3971 UnknownValue(failure_type::UnknownValue),
3972 }
3973
3974 #[doc(hidden)]
3975 pub mod failure_type {
3976 #[allow(unused_imports)]
3977 use super::*;
3978 #[derive(Clone, Debug, PartialEq)]
3979 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3980 }
3981
3982 impl FailureType {
3983 /// Gets the enum value.
3984 ///
3985 /// Returns `None` if the enum contains an unknown value deserialized from
3986 /// the string representation of enums.
3987 pub fn value(&self) -> std::option::Option<i32> {
3988 match self {
3989 Self::Unspecified => std::option::Option::Some(0),
3990 Self::PushFailed => std::option::Option::Some(1),
3991 Self::PushImageNotFound => std::option::Option::Some(2),
3992 Self::PushNotAuthorized => std::option::Option::Some(3),
3993 Self::LoggingFailure => std::option::Option::Some(4),
3994 Self::UserBuildStep => std::option::Option::Some(5),
3995 Self::FetchSourceFailed => std::option::Option::Some(6),
3996 Self::UnknownValue(u) => u.0.value(),
3997 }
3998 }
3999
4000 /// Gets the enum value as a string.
4001 ///
4002 /// Returns `None` if the enum contains an unknown value deserialized from
4003 /// the integer representation of enums.
4004 pub fn name(&self) -> std::option::Option<&str> {
4005 match self {
4006 Self::Unspecified => std::option::Option::Some("FAILURE_TYPE_UNSPECIFIED"),
4007 Self::PushFailed => std::option::Option::Some("PUSH_FAILED"),
4008 Self::PushImageNotFound => std::option::Option::Some("PUSH_IMAGE_NOT_FOUND"),
4009 Self::PushNotAuthorized => std::option::Option::Some("PUSH_NOT_AUTHORIZED"),
4010 Self::LoggingFailure => std::option::Option::Some("LOGGING_FAILURE"),
4011 Self::UserBuildStep => std::option::Option::Some("USER_BUILD_STEP"),
4012 Self::FetchSourceFailed => std::option::Option::Some("FETCH_SOURCE_FAILED"),
4013 Self::UnknownValue(u) => u.0.name(),
4014 }
4015 }
4016 }
4017
4018 impl std::default::Default for FailureType {
4019 fn default() -> Self {
4020 use std::convert::From;
4021 Self::from(0)
4022 }
4023 }
4024
4025 impl std::fmt::Display for FailureType {
4026 fn fmt(
4027 &self,
4028 f: &mut std::fmt::Formatter<'_>,
4029 ) -> std::result::Result<(), std::fmt::Error> {
4030 wkt::internal::display_enum(f, self.name(), self.value())
4031 }
4032 }
4033
4034 impl std::convert::From<i32> for FailureType {
4035 fn from(value: i32) -> Self {
4036 match value {
4037 0 => Self::Unspecified,
4038 1 => Self::PushFailed,
4039 2 => Self::PushImageNotFound,
4040 3 => Self::PushNotAuthorized,
4041 4 => Self::LoggingFailure,
4042 5 => Self::UserBuildStep,
4043 6 => Self::FetchSourceFailed,
4044 _ => Self::UnknownValue(failure_type::UnknownValue(
4045 wkt::internal::UnknownEnumValue::Integer(value),
4046 )),
4047 }
4048 }
4049 }
4050
4051 impl std::convert::From<&str> for FailureType {
4052 fn from(value: &str) -> Self {
4053 use std::string::ToString;
4054 match value {
4055 "FAILURE_TYPE_UNSPECIFIED" => Self::Unspecified,
4056 "PUSH_FAILED" => Self::PushFailed,
4057 "PUSH_IMAGE_NOT_FOUND" => Self::PushImageNotFound,
4058 "PUSH_NOT_AUTHORIZED" => Self::PushNotAuthorized,
4059 "LOGGING_FAILURE" => Self::LoggingFailure,
4060 "USER_BUILD_STEP" => Self::UserBuildStep,
4061 "FETCH_SOURCE_FAILED" => Self::FetchSourceFailed,
4062 _ => Self::UnknownValue(failure_type::UnknownValue(
4063 wkt::internal::UnknownEnumValue::String(value.to_string()),
4064 )),
4065 }
4066 }
4067 }
4068
4069 impl serde::ser::Serialize for FailureType {
4070 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4071 where
4072 S: serde::Serializer,
4073 {
4074 match self {
4075 Self::Unspecified => serializer.serialize_i32(0),
4076 Self::PushFailed => serializer.serialize_i32(1),
4077 Self::PushImageNotFound => serializer.serialize_i32(2),
4078 Self::PushNotAuthorized => serializer.serialize_i32(3),
4079 Self::LoggingFailure => serializer.serialize_i32(4),
4080 Self::UserBuildStep => serializer.serialize_i32(5),
4081 Self::FetchSourceFailed => serializer.serialize_i32(6),
4082 Self::UnknownValue(u) => u.0.serialize(serializer),
4083 }
4084 }
4085 }
4086
4087 impl<'de> serde::de::Deserialize<'de> for FailureType {
4088 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4089 where
4090 D: serde::Deserializer<'de>,
4091 {
4092 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureType>::new(
4093 ".google.devtools.cloudbuild.v1.Build.FailureInfo.FailureType",
4094 ))
4095 }
4096 }
4097 }
4098
4099 /// Possible status of a build or build step.
4100 ///
4101 /// # Working with unknown values
4102 ///
4103 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4104 /// additional enum variants at any time. Adding new variants is not considered
4105 /// a breaking change. Applications should write their code in anticipation of:
4106 ///
4107 /// - New values appearing in future releases of the client library, **and**
4108 /// - New values received dynamically, without application changes.
4109 ///
4110 /// Please consult the [Working with enums] section in the user guide for some
4111 /// guidelines.
4112 ///
4113 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4114 #[derive(Clone, Debug, PartialEq)]
4115 #[non_exhaustive]
4116 pub enum Status {
4117 /// Status of the build is unknown.
4118 Unknown,
4119 /// Build has been created and is pending execution and queuing. It has not
4120 /// been queued.
4121 Pending,
4122 /// Build or step is queued; work has not yet begun.
4123 Queued,
4124 /// Build or step is being executed.
4125 Working,
4126 /// Build or step finished successfully.
4127 Success,
4128 /// Build or step failed to complete successfully.
4129 Failure,
4130 /// Build or step failed due to an internal cause.
4131 InternalError,
4132 /// Build or step took longer than was allowed.
4133 Timeout,
4134 /// Build or step was canceled by a user.
4135 Cancelled,
4136 /// Build was enqueued for longer than the value of `queue_ttl`.
4137 Expired,
4138 /// If set, the enum was initialized with an unknown value.
4139 ///
4140 /// Applications can examine the value using [Status::value] or
4141 /// [Status::name].
4142 UnknownValue(status::UnknownValue),
4143 }
4144
4145 #[doc(hidden)]
4146 pub mod status {
4147 #[allow(unused_imports)]
4148 use super::*;
4149 #[derive(Clone, Debug, PartialEq)]
4150 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4151 }
4152
4153 impl Status {
4154 /// Gets the enum value.
4155 ///
4156 /// Returns `None` if the enum contains an unknown value deserialized from
4157 /// the string representation of enums.
4158 pub fn value(&self) -> std::option::Option<i32> {
4159 match self {
4160 Self::Unknown => std::option::Option::Some(0),
4161 Self::Pending => std::option::Option::Some(10),
4162 Self::Queued => std::option::Option::Some(1),
4163 Self::Working => std::option::Option::Some(2),
4164 Self::Success => std::option::Option::Some(3),
4165 Self::Failure => std::option::Option::Some(4),
4166 Self::InternalError => std::option::Option::Some(5),
4167 Self::Timeout => std::option::Option::Some(6),
4168 Self::Cancelled => std::option::Option::Some(7),
4169 Self::Expired => std::option::Option::Some(9),
4170 Self::UnknownValue(u) => u.0.value(),
4171 }
4172 }
4173
4174 /// Gets the enum value as a string.
4175 ///
4176 /// Returns `None` if the enum contains an unknown value deserialized from
4177 /// the integer representation of enums.
4178 pub fn name(&self) -> std::option::Option<&str> {
4179 match self {
4180 Self::Unknown => std::option::Option::Some("STATUS_UNKNOWN"),
4181 Self::Pending => std::option::Option::Some("PENDING"),
4182 Self::Queued => std::option::Option::Some("QUEUED"),
4183 Self::Working => std::option::Option::Some("WORKING"),
4184 Self::Success => std::option::Option::Some("SUCCESS"),
4185 Self::Failure => std::option::Option::Some("FAILURE"),
4186 Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
4187 Self::Timeout => std::option::Option::Some("TIMEOUT"),
4188 Self::Cancelled => std::option::Option::Some("CANCELLED"),
4189 Self::Expired => std::option::Option::Some("EXPIRED"),
4190 Self::UnknownValue(u) => u.0.name(),
4191 }
4192 }
4193 }
4194
4195 impl std::default::Default for Status {
4196 fn default() -> Self {
4197 use std::convert::From;
4198 Self::from(0)
4199 }
4200 }
4201
4202 impl std::fmt::Display for Status {
4203 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4204 wkt::internal::display_enum(f, self.name(), self.value())
4205 }
4206 }
4207
4208 impl std::convert::From<i32> for Status {
4209 fn from(value: i32) -> Self {
4210 match value {
4211 0 => Self::Unknown,
4212 1 => Self::Queued,
4213 2 => Self::Working,
4214 3 => Self::Success,
4215 4 => Self::Failure,
4216 5 => Self::InternalError,
4217 6 => Self::Timeout,
4218 7 => Self::Cancelled,
4219 9 => Self::Expired,
4220 10 => Self::Pending,
4221 _ => Self::UnknownValue(status::UnknownValue(
4222 wkt::internal::UnknownEnumValue::Integer(value),
4223 )),
4224 }
4225 }
4226 }
4227
4228 impl std::convert::From<&str> for Status {
4229 fn from(value: &str) -> Self {
4230 use std::string::ToString;
4231 match value {
4232 "STATUS_UNKNOWN" => Self::Unknown,
4233 "PENDING" => Self::Pending,
4234 "QUEUED" => Self::Queued,
4235 "WORKING" => Self::Working,
4236 "SUCCESS" => Self::Success,
4237 "FAILURE" => Self::Failure,
4238 "INTERNAL_ERROR" => Self::InternalError,
4239 "TIMEOUT" => Self::Timeout,
4240 "CANCELLED" => Self::Cancelled,
4241 "EXPIRED" => Self::Expired,
4242 _ => Self::UnknownValue(status::UnknownValue(
4243 wkt::internal::UnknownEnumValue::String(value.to_string()),
4244 )),
4245 }
4246 }
4247 }
4248
4249 impl serde::ser::Serialize for Status {
4250 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4251 where
4252 S: serde::Serializer,
4253 {
4254 match self {
4255 Self::Unknown => serializer.serialize_i32(0),
4256 Self::Pending => serializer.serialize_i32(10),
4257 Self::Queued => serializer.serialize_i32(1),
4258 Self::Working => serializer.serialize_i32(2),
4259 Self::Success => serializer.serialize_i32(3),
4260 Self::Failure => serializer.serialize_i32(4),
4261 Self::InternalError => serializer.serialize_i32(5),
4262 Self::Timeout => serializer.serialize_i32(6),
4263 Self::Cancelled => serializer.serialize_i32(7),
4264 Self::Expired => serializer.serialize_i32(9),
4265 Self::UnknownValue(u) => u.0.serialize(serializer),
4266 }
4267 }
4268 }
4269
4270 impl<'de> serde::de::Deserialize<'de> for Status {
4271 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4272 where
4273 D: serde::Deserializer<'de>,
4274 {
4275 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
4276 ".google.devtools.cloudbuild.v1.Build.Status",
4277 ))
4278 }
4279 }
4280}
4281
4282/// A dependency that the Cloud Build worker will fetch before executing user
4283/// steps.
4284#[derive(Clone, Default, PartialEq)]
4285#[non_exhaustive]
4286pub struct Dependency {
4287 /// The type of dependency to fetch.
4288 pub dep: std::option::Option<crate::model::dependency::Dep>,
4289
4290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4291}
4292
4293impl Dependency {
4294 /// Creates a new default instance.
4295 pub fn new() -> Self {
4296 std::default::Default::default()
4297 }
4298
4299 /// Sets the value of [dep][crate::model::Dependency::dep].
4300 ///
4301 /// Note that all the setters affecting `dep` are mutually
4302 /// exclusive.
4303 ///
4304 /// # Example
4305 /// ```ignore,no_run
4306 /// # use google_cloud_build_v1::model::Dependency;
4307 /// use google_cloud_build_v1::model::dependency::Dep;
4308 /// let x = Dependency::new().set_dep(Some(Dep::Empty(true)));
4309 /// ```
4310 pub fn set_dep<T: std::convert::Into<std::option::Option<crate::model::dependency::Dep>>>(
4311 mut self,
4312 v: T,
4313 ) -> Self {
4314 self.dep = v.into();
4315 self
4316 }
4317
4318 /// The value of [dep][crate::model::Dependency::dep]
4319 /// if it holds a `Empty`, `None` if the field is not set or
4320 /// holds a different branch.
4321 pub fn empty(&self) -> std::option::Option<&bool> {
4322 #[allow(unreachable_patterns)]
4323 self.dep.as_ref().and_then(|v| match v {
4324 crate::model::dependency::Dep::Empty(v) => std::option::Option::Some(v),
4325 _ => std::option::Option::None,
4326 })
4327 }
4328
4329 /// Sets the value of [dep][crate::model::Dependency::dep]
4330 /// to hold a `Empty`.
4331 ///
4332 /// Note that all the setters affecting `dep` are
4333 /// mutually exclusive.
4334 ///
4335 /// # Example
4336 /// ```ignore,no_run
4337 /// # use google_cloud_build_v1::model::Dependency;
4338 /// let x = Dependency::new().set_empty(true);
4339 /// assert!(x.empty().is_some());
4340 /// assert!(x.git_source().is_none());
4341 /// ```
4342 pub fn set_empty<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4343 self.dep = std::option::Option::Some(crate::model::dependency::Dep::Empty(v.into()));
4344 self
4345 }
4346
4347 /// The value of [dep][crate::model::Dependency::dep]
4348 /// if it holds a `GitSource`, `None` if the field is not set or
4349 /// holds a different branch.
4350 pub fn git_source(
4351 &self,
4352 ) -> std::option::Option<&std::boxed::Box<crate::model::dependency::GitSourceDependency>> {
4353 #[allow(unreachable_patterns)]
4354 self.dep.as_ref().and_then(|v| match v {
4355 crate::model::dependency::Dep::GitSource(v) => std::option::Option::Some(v),
4356 _ => std::option::Option::None,
4357 })
4358 }
4359
4360 /// Sets the value of [dep][crate::model::Dependency::dep]
4361 /// to hold a `GitSource`.
4362 ///
4363 /// Note that all the setters affecting `dep` are
4364 /// mutually exclusive.
4365 ///
4366 /// # Example
4367 /// ```ignore,no_run
4368 /// # use google_cloud_build_v1::model::Dependency;
4369 /// use google_cloud_build_v1::model::dependency::GitSourceDependency;
4370 /// let x = Dependency::new().set_git_source(GitSourceDependency::default()/* use setters */);
4371 /// assert!(x.git_source().is_some());
4372 /// assert!(x.empty().is_none());
4373 /// ```
4374 pub fn set_git_source<
4375 T: std::convert::Into<std::boxed::Box<crate::model::dependency::GitSourceDependency>>,
4376 >(
4377 mut self,
4378 v: T,
4379 ) -> Self {
4380 self.dep = std::option::Option::Some(crate::model::dependency::Dep::GitSource(v.into()));
4381 self
4382 }
4383}
4384
4385impl wkt::message::Message for Dependency {
4386 fn typename() -> &'static str {
4387 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency"
4388 }
4389}
4390
4391/// Defines additional types related to [Dependency].
4392pub mod dependency {
4393 #[allow(unused_imports)]
4394 use super::*;
4395
4396 /// Represents a git repository as a build dependency.
4397 #[derive(Clone, Default, PartialEq)]
4398 #[non_exhaustive]
4399 pub struct GitSourceDependency {
4400 /// Required. The kind of repo (url or dev connect).
4401 pub repository: std::option::Option<crate::model::dependency::GitSourceRepository>,
4402
4403 /// Required. The revision that we will fetch the repo at.
4404 pub revision: std::string::String,
4405
4406 /// Optional. True if submodules should be fetched too (default false).
4407 pub recurse_submodules: bool,
4408
4409 /// Optional. How much history should be fetched for the build (default 1, -1
4410 /// for all history).
4411 pub depth: i64,
4412
4413 /// Required. Where should the files be placed on the worker.
4414 pub dest_path: std::string::String,
4415
4416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4417 }
4418
4419 impl GitSourceDependency {
4420 /// Creates a new default instance.
4421 pub fn new() -> Self {
4422 std::default::Default::default()
4423 }
4424
4425 /// Sets the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4426 ///
4427 /// # Example
4428 /// ```ignore,no_run
4429 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4430 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4431 /// let x = GitSourceDependency::new().set_repository(GitSourceRepository::default()/* use setters */);
4432 /// ```
4433 pub fn set_repository<T>(mut self, v: T) -> Self
4434 where
4435 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4436 {
4437 self.repository = std::option::Option::Some(v.into());
4438 self
4439 }
4440
4441 /// Sets or clears the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4442 ///
4443 /// # Example
4444 /// ```ignore,no_run
4445 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4446 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4447 /// let x = GitSourceDependency::new().set_or_clear_repository(Some(GitSourceRepository::default()/* use setters */));
4448 /// let x = GitSourceDependency::new().set_or_clear_repository(None::<GitSourceRepository>);
4449 /// ```
4450 pub fn set_or_clear_repository<T>(mut self, v: std::option::Option<T>) -> Self
4451 where
4452 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4453 {
4454 self.repository = v.map(|x| x.into());
4455 self
4456 }
4457
4458 /// Sets the value of [revision][crate::model::dependency::GitSourceDependency::revision].
4459 ///
4460 /// # Example
4461 /// ```ignore,no_run
4462 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4463 /// let x = GitSourceDependency::new().set_revision("example");
4464 /// ```
4465 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4466 self.revision = v.into();
4467 self
4468 }
4469
4470 /// Sets the value of [recurse_submodules][crate::model::dependency::GitSourceDependency::recurse_submodules].
4471 ///
4472 /// # Example
4473 /// ```ignore,no_run
4474 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4475 /// let x = GitSourceDependency::new().set_recurse_submodules(true);
4476 /// ```
4477 pub fn set_recurse_submodules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4478 self.recurse_submodules = v.into();
4479 self
4480 }
4481
4482 /// Sets the value of [depth][crate::model::dependency::GitSourceDependency::depth].
4483 ///
4484 /// # Example
4485 /// ```ignore,no_run
4486 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4487 /// let x = GitSourceDependency::new().set_depth(42);
4488 /// ```
4489 pub fn set_depth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4490 self.depth = v.into();
4491 self
4492 }
4493
4494 /// Sets the value of [dest_path][crate::model::dependency::GitSourceDependency::dest_path].
4495 ///
4496 /// # Example
4497 /// ```ignore,no_run
4498 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4499 /// let x = GitSourceDependency::new().set_dest_path("example");
4500 /// ```
4501 pub fn set_dest_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4502 self.dest_path = v.into();
4503 self
4504 }
4505 }
4506
4507 impl wkt::message::Message for GitSourceDependency {
4508 fn typename() -> &'static str {
4509 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceDependency"
4510 }
4511 }
4512
4513 /// A repository for a git source.
4514 #[derive(Clone, Default, PartialEq)]
4515 #[non_exhaustive]
4516 pub struct GitSourceRepository {
4517 /// The type of git source repo (url or dev connect).
4518 pub repotype:
4519 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4520
4521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4522 }
4523
4524 impl GitSourceRepository {
4525 /// Creates a new default instance.
4526 pub fn new() -> Self {
4527 std::default::Default::default()
4528 }
4529
4530 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype].
4531 ///
4532 /// Note that all the setters affecting `repotype` are mutually
4533 /// exclusive.
4534 ///
4535 /// # Example
4536 /// ```ignore,no_run
4537 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4538 /// use google_cloud_build_v1::model::dependency::git_source_repository::Repotype;
4539 /// let x = GitSourceRepository::new().set_repotype(Some(Repotype::Url("example".to_string())));
4540 /// ```
4541 pub fn set_repotype<
4542 T: std::convert::Into<
4543 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4544 >,
4545 >(
4546 mut self,
4547 v: T,
4548 ) -> Self {
4549 self.repotype = v.into();
4550 self
4551 }
4552
4553 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4554 /// if it holds a `Url`, `None` if the field is not set or
4555 /// holds a different branch.
4556 pub fn url(&self) -> std::option::Option<&std::string::String> {
4557 #[allow(unreachable_patterns)]
4558 self.repotype.as_ref().and_then(|v| match v {
4559 crate::model::dependency::git_source_repository::Repotype::Url(v) => {
4560 std::option::Option::Some(v)
4561 }
4562 _ => std::option::Option::None,
4563 })
4564 }
4565
4566 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4567 /// to hold a `Url`.
4568 ///
4569 /// Note that all the setters affecting `repotype` are
4570 /// mutually exclusive.
4571 ///
4572 /// # Example
4573 /// ```ignore,no_run
4574 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4575 /// let x = GitSourceRepository::new().set_url("example");
4576 /// assert!(x.url().is_some());
4577 /// assert!(x.developer_connect().is_none());
4578 /// ```
4579 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4580 self.repotype = std::option::Option::Some(
4581 crate::model::dependency::git_source_repository::Repotype::Url(v.into()),
4582 );
4583 self
4584 }
4585
4586 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4587 /// if it holds a `DeveloperConnect`, `None` if the field is not set or
4588 /// holds a different branch.
4589 pub fn developer_connect(&self) -> std::option::Option<&std::string::String> {
4590 #[allow(unreachable_patterns)]
4591 self.repotype.as_ref().and_then(|v| match v {
4592 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(v) => {
4593 std::option::Option::Some(v)
4594 }
4595 _ => std::option::Option::None,
4596 })
4597 }
4598
4599 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4600 /// to hold a `DeveloperConnect`.
4601 ///
4602 /// Note that all the setters affecting `repotype` are
4603 /// mutually exclusive.
4604 ///
4605 /// # Example
4606 /// ```ignore,no_run
4607 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4608 /// let x = GitSourceRepository::new().set_developer_connect("example");
4609 /// assert!(x.developer_connect().is_some());
4610 /// assert!(x.url().is_none());
4611 /// ```
4612 pub fn set_developer_connect<T: std::convert::Into<std::string::String>>(
4613 mut self,
4614 v: T,
4615 ) -> Self {
4616 self.repotype = std::option::Option::Some(
4617 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(
4618 v.into(),
4619 ),
4620 );
4621 self
4622 }
4623 }
4624
4625 impl wkt::message::Message for GitSourceRepository {
4626 fn typename() -> &'static str {
4627 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceRepository"
4628 }
4629 }
4630
4631 /// Defines additional types related to [GitSourceRepository].
4632 pub mod git_source_repository {
4633 #[allow(unused_imports)]
4634 use super::*;
4635
4636 /// The type of git source repo (url or dev connect).
4637 #[derive(Clone, Debug, PartialEq)]
4638 #[non_exhaustive]
4639 pub enum Repotype {
4640 /// Location of the Git repository.
4641 Url(std::string::String),
4642 /// The Developer Connect Git repository link formatted as
4643 /// `projects/*/locations/*/connections/*/gitRepositoryLink/*`
4644 DeveloperConnect(std::string::String),
4645 }
4646 }
4647
4648 /// The type of dependency to fetch.
4649 #[derive(Clone, Debug, PartialEq)]
4650 #[non_exhaustive]
4651 pub enum Dep {
4652 /// If set to true disable all dependency fetching (ignoring the default
4653 /// source as well).
4654 Empty(bool),
4655 /// Represents a git repository as a build dependency.
4656 GitSource(std::boxed::Box<crate::model::dependency::GitSourceDependency>),
4657 }
4658}
4659
4660/// GitConfig is a configuration for git operations.
4661#[derive(Clone, Default, PartialEq)]
4662#[non_exhaustive]
4663pub struct GitConfig {
4664 /// Configuration for HTTP related git operations.
4665 pub http: std::option::Option<crate::model::git_config::HttpConfig>,
4666
4667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4668}
4669
4670impl GitConfig {
4671 /// Creates a new default instance.
4672 pub fn new() -> Self {
4673 std::default::Default::default()
4674 }
4675
4676 /// Sets the value of [http][crate::model::GitConfig::http].
4677 ///
4678 /// # Example
4679 /// ```ignore,no_run
4680 /// # use google_cloud_build_v1::model::GitConfig;
4681 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4682 /// let x = GitConfig::new().set_http(HttpConfig::default()/* use setters */);
4683 /// ```
4684 pub fn set_http<T>(mut self, v: T) -> Self
4685 where
4686 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4687 {
4688 self.http = std::option::Option::Some(v.into());
4689 self
4690 }
4691
4692 /// Sets or clears the value of [http][crate::model::GitConfig::http].
4693 ///
4694 /// # Example
4695 /// ```ignore,no_run
4696 /// # use google_cloud_build_v1::model::GitConfig;
4697 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4698 /// let x = GitConfig::new().set_or_clear_http(Some(HttpConfig::default()/* use setters */));
4699 /// let x = GitConfig::new().set_or_clear_http(None::<HttpConfig>);
4700 /// ```
4701 pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
4702 where
4703 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4704 {
4705 self.http = v.map(|x| x.into());
4706 self
4707 }
4708}
4709
4710impl wkt::message::Message for GitConfig {
4711 fn typename() -> &'static str {
4712 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig"
4713 }
4714}
4715
4716/// Defines additional types related to [GitConfig].
4717pub mod git_config {
4718 #[allow(unused_imports)]
4719 use super::*;
4720
4721 /// HttpConfig is a configuration for HTTP related git operations.
4722 #[derive(Clone, Default, PartialEq)]
4723 #[non_exhaustive]
4724 pub struct HttpConfig {
4725 /// SecretVersion resource of the HTTP proxy URL. The Service Account used in
4726 /// the build (either the default Service Account or
4727 /// user-specified Service Account) should have
4728 /// `secretmanager.versions.access` permissions on this secret. The proxy URL
4729 /// should be in format `[protocol://][user[:password]@]proxyhost[:port]`.
4730 pub proxy_secret_version_name: std::string::String,
4731
4732 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4733 }
4734
4735 impl HttpConfig {
4736 /// Creates a new default instance.
4737 pub fn new() -> Self {
4738 std::default::Default::default()
4739 }
4740
4741 /// Sets the value of [proxy_secret_version_name][crate::model::git_config::HttpConfig::proxy_secret_version_name].
4742 ///
4743 /// # Example
4744 /// ```ignore,no_run
4745 /// # use google_cloud_build_v1::model::git_config::HttpConfig;
4746 /// let x = HttpConfig::new().set_proxy_secret_version_name("example");
4747 /// ```
4748 pub fn set_proxy_secret_version_name<T: std::convert::Into<std::string::String>>(
4749 mut self,
4750 v: T,
4751 ) -> Self {
4752 self.proxy_secret_version_name = v.into();
4753 self
4754 }
4755 }
4756
4757 impl wkt::message::Message for HttpConfig {
4758 fn typename() -> &'static str {
4759 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig.HttpConfig"
4760 }
4761 }
4762}
4763
4764/// Artifacts produced by a build that should be uploaded upon
4765/// successful completion of all build steps.
4766#[derive(Clone, Default, PartialEq)]
4767#[non_exhaustive]
4768pub struct Artifacts {
4769 /// A list of images to be pushed upon the successful completion of all build
4770 /// steps.
4771 ///
4772 /// The images will be pushed using the builder service account's credentials.
4773 ///
4774 /// The digests of the pushed images will be stored in the Build resource's
4775 /// results field.
4776 ///
4777 /// If any of the images fail to be pushed, the build is marked FAILURE.
4778 pub images: std::vec::Vec<std::string::String>,
4779
4780 /// A list of objects to be uploaded to Cloud Storage upon successful
4781 /// completion of all build steps.
4782 ///
4783 /// Files in the workspace matching specified paths globs will be uploaded to
4784 /// the specified Cloud Storage location using the builder service account's
4785 /// credentials.
4786 ///
4787 /// The location and generation of the uploaded objects will be stored in the
4788 /// Build resource's results field.
4789 ///
4790 /// If any objects fail to be pushed, the build is marked FAILURE.
4791 pub objects: std::option::Option<crate::model::artifacts::ArtifactObjects>,
4792
4793 /// A list of Maven artifacts to be uploaded to Artifact Registry upon
4794 /// successful completion of all build steps.
4795 ///
4796 /// Artifacts in the workspace matching specified paths globs will be uploaded
4797 /// to the specified Artifact Registry repository using the builder service
4798 /// account's credentials.
4799 ///
4800 /// If any artifacts fail to be pushed, the build is marked FAILURE.
4801 pub maven_artifacts: std::vec::Vec<crate::model::artifacts::MavenArtifact>,
4802
4803 /// Optional. A list of Go modules to be uploaded to Artifact Registry upon
4804 /// successful completion of all build steps.
4805 ///
4806 /// If any objects fail to be pushed, the build is marked FAILURE.
4807 pub go_modules: std::vec::Vec<crate::model::artifacts::GoModule>,
4808
4809 /// A list of Python packages to be uploaded to Artifact Registry upon
4810 /// successful completion of all build steps.
4811 ///
4812 /// The build service account credentials will be used to perform the upload.
4813 ///
4814 /// If any objects fail to be pushed, the build is marked FAILURE.
4815 pub python_packages: std::vec::Vec<crate::model::artifacts::PythonPackage>,
4816
4817 /// A list of npm packages to be uploaded to Artifact Registry upon
4818 /// successful completion of all build steps.
4819 ///
4820 /// Npm packages in the specified paths will be uploaded
4821 /// to the specified Artifact Registry repository using the builder service
4822 /// account's credentials.
4823 ///
4824 /// If any packages fail to be pushed, the build is marked FAILURE.
4825 pub npm_packages: std::vec::Vec<crate::model::artifacts::NpmPackage>,
4826
4827 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4828}
4829
4830impl Artifacts {
4831 /// Creates a new default instance.
4832 pub fn new() -> Self {
4833 std::default::Default::default()
4834 }
4835
4836 /// Sets the value of [images][crate::model::Artifacts::images].
4837 ///
4838 /// # Example
4839 /// ```ignore,no_run
4840 /// # use google_cloud_build_v1::model::Artifacts;
4841 /// let x = Artifacts::new().set_images(["a", "b", "c"]);
4842 /// ```
4843 pub fn set_images<T, V>(mut self, v: T) -> Self
4844 where
4845 T: std::iter::IntoIterator<Item = V>,
4846 V: std::convert::Into<std::string::String>,
4847 {
4848 use std::iter::Iterator;
4849 self.images = v.into_iter().map(|i| i.into()).collect();
4850 self
4851 }
4852
4853 /// Sets the value of [objects][crate::model::Artifacts::objects].
4854 ///
4855 /// # Example
4856 /// ```ignore,no_run
4857 /// # use google_cloud_build_v1::model::Artifacts;
4858 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4859 /// let x = Artifacts::new().set_objects(ArtifactObjects::default()/* use setters */);
4860 /// ```
4861 pub fn set_objects<T>(mut self, v: T) -> Self
4862 where
4863 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4864 {
4865 self.objects = std::option::Option::Some(v.into());
4866 self
4867 }
4868
4869 /// Sets or clears the value of [objects][crate::model::Artifacts::objects].
4870 ///
4871 /// # Example
4872 /// ```ignore,no_run
4873 /// # use google_cloud_build_v1::model::Artifacts;
4874 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4875 /// let x = Artifacts::new().set_or_clear_objects(Some(ArtifactObjects::default()/* use setters */));
4876 /// let x = Artifacts::new().set_or_clear_objects(None::<ArtifactObjects>);
4877 /// ```
4878 pub fn set_or_clear_objects<T>(mut self, v: std::option::Option<T>) -> Self
4879 where
4880 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4881 {
4882 self.objects = v.map(|x| x.into());
4883 self
4884 }
4885
4886 /// Sets the value of [maven_artifacts][crate::model::Artifacts::maven_artifacts].
4887 ///
4888 /// # Example
4889 /// ```ignore,no_run
4890 /// # use google_cloud_build_v1::model::Artifacts;
4891 /// use google_cloud_build_v1::model::artifacts::MavenArtifact;
4892 /// let x = Artifacts::new()
4893 /// .set_maven_artifacts([
4894 /// MavenArtifact::default()/* use setters */,
4895 /// MavenArtifact::default()/* use (different) setters */,
4896 /// ]);
4897 /// ```
4898 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
4899 where
4900 T: std::iter::IntoIterator<Item = V>,
4901 V: std::convert::Into<crate::model::artifacts::MavenArtifact>,
4902 {
4903 use std::iter::Iterator;
4904 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
4905 self
4906 }
4907
4908 /// Sets the value of [go_modules][crate::model::Artifacts::go_modules].
4909 ///
4910 /// # Example
4911 /// ```ignore,no_run
4912 /// # use google_cloud_build_v1::model::Artifacts;
4913 /// use google_cloud_build_v1::model::artifacts::GoModule;
4914 /// let x = Artifacts::new()
4915 /// .set_go_modules([
4916 /// GoModule::default()/* use setters */,
4917 /// GoModule::default()/* use (different) setters */,
4918 /// ]);
4919 /// ```
4920 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
4921 where
4922 T: std::iter::IntoIterator<Item = V>,
4923 V: std::convert::Into<crate::model::artifacts::GoModule>,
4924 {
4925 use std::iter::Iterator;
4926 self.go_modules = v.into_iter().map(|i| i.into()).collect();
4927 self
4928 }
4929
4930 /// Sets the value of [python_packages][crate::model::Artifacts::python_packages].
4931 ///
4932 /// # Example
4933 /// ```ignore,no_run
4934 /// # use google_cloud_build_v1::model::Artifacts;
4935 /// use google_cloud_build_v1::model::artifacts::PythonPackage;
4936 /// let x = Artifacts::new()
4937 /// .set_python_packages([
4938 /// PythonPackage::default()/* use setters */,
4939 /// PythonPackage::default()/* use (different) setters */,
4940 /// ]);
4941 /// ```
4942 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
4943 where
4944 T: std::iter::IntoIterator<Item = V>,
4945 V: std::convert::Into<crate::model::artifacts::PythonPackage>,
4946 {
4947 use std::iter::Iterator;
4948 self.python_packages = v.into_iter().map(|i| i.into()).collect();
4949 self
4950 }
4951
4952 /// Sets the value of [npm_packages][crate::model::Artifacts::npm_packages].
4953 ///
4954 /// # Example
4955 /// ```ignore,no_run
4956 /// # use google_cloud_build_v1::model::Artifacts;
4957 /// use google_cloud_build_v1::model::artifacts::NpmPackage;
4958 /// let x = Artifacts::new()
4959 /// .set_npm_packages([
4960 /// NpmPackage::default()/* use setters */,
4961 /// NpmPackage::default()/* use (different) setters */,
4962 /// ]);
4963 /// ```
4964 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
4965 where
4966 T: std::iter::IntoIterator<Item = V>,
4967 V: std::convert::Into<crate::model::artifacts::NpmPackage>,
4968 {
4969 use std::iter::Iterator;
4970 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
4971 self
4972 }
4973}
4974
4975impl wkt::message::Message for Artifacts {
4976 fn typename() -> &'static str {
4977 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts"
4978 }
4979}
4980
4981/// Defines additional types related to [Artifacts].
4982pub mod artifacts {
4983 #[allow(unused_imports)]
4984 use super::*;
4985
4986 /// Files in the workspace to upload to Cloud Storage upon successful
4987 /// completion of all build steps.
4988 #[derive(Clone, Default, PartialEq)]
4989 #[non_exhaustive]
4990 pub struct ArtifactObjects {
4991 /// Cloud Storage bucket and optional object path, in the form
4992 /// "gs://bucket/path/to/somewhere/". (see [Bucket Name
4993 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
4994 ///
4995 /// Files in the workspace matching any path pattern will be uploaded to
4996 /// Cloud Storage with this location as a prefix.
4997 pub location: std::string::String,
4998
4999 /// Path globs used to match files in the build's workspace.
5000 pub paths: std::vec::Vec<std::string::String>,
5001
5002 /// Output only. Stores timing information for pushing all artifact objects.
5003 pub timing: std::option::Option<crate::model::TimeSpan>,
5004
5005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5006 }
5007
5008 impl ArtifactObjects {
5009 /// Creates a new default instance.
5010 pub fn new() -> Self {
5011 std::default::Default::default()
5012 }
5013
5014 /// Sets the value of [location][crate::model::artifacts::ArtifactObjects::location].
5015 ///
5016 /// # Example
5017 /// ```ignore,no_run
5018 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5019 /// let x = ArtifactObjects::new().set_location("example");
5020 /// ```
5021 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5022 self.location = v.into();
5023 self
5024 }
5025
5026 /// Sets the value of [paths][crate::model::artifacts::ArtifactObjects::paths].
5027 ///
5028 /// # Example
5029 /// ```ignore,no_run
5030 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5031 /// let x = ArtifactObjects::new().set_paths(["a", "b", "c"]);
5032 /// ```
5033 pub fn set_paths<T, V>(mut self, v: T) -> Self
5034 where
5035 T: std::iter::IntoIterator<Item = V>,
5036 V: std::convert::Into<std::string::String>,
5037 {
5038 use std::iter::Iterator;
5039 self.paths = v.into_iter().map(|i| i.into()).collect();
5040 self
5041 }
5042
5043 /// Sets the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5044 ///
5045 /// # Example
5046 /// ```ignore,no_run
5047 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5048 /// use google_cloud_build_v1::model::TimeSpan;
5049 /// let x = ArtifactObjects::new().set_timing(TimeSpan::default()/* use setters */);
5050 /// ```
5051 pub fn set_timing<T>(mut self, v: T) -> Self
5052 where
5053 T: std::convert::Into<crate::model::TimeSpan>,
5054 {
5055 self.timing = std::option::Option::Some(v.into());
5056 self
5057 }
5058
5059 /// Sets or clears the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5060 ///
5061 /// # Example
5062 /// ```ignore,no_run
5063 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5064 /// use google_cloud_build_v1::model::TimeSpan;
5065 /// let x = ArtifactObjects::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
5066 /// let x = ArtifactObjects::new().set_or_clear_timing(None::<TimeSpan>);
5067 /// ```
5068 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
5069 where
5070 T: std::convert::Into<crate::model::TimeSpan>,
5071 {
5072 self.timing = v.map(|x| x.into());
5073 self
5074 }
5075 }
5076
5077 impl wkt::message::Message for ArtifactObjects {
5078 fn typename() -> &'static str {
5079 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects"
5080 }
5081 }
5082
5083 /// A Maven artifact to upload to Artifact Registry upon successful completion
5084 /// of all build steps.
5085 #[derive(Clone, Default, PartialEq)]
5086 #[non_exhaustive]
5087 pub struct MavenArtifact {
5088 /// Artifact Registry repository, in the form
5089 /// "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY"
5090 ///
5091 /// Artifact in the workspace specified by path will be uploaded to
5092 /// Artifact Registry with this location as a prefix.
5093 pub repository: std::string::String,
5094
5095 /// Optional. Path to an artifact in the build's workspace to be uploaded to
5096 /// Artifact Registry.
5097 /// This can be either an absolute path,
5098 /// e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar
5099 /// or a relative path from /workspace,
5100 /// e.g. my-app/target/my-app-1.0.SNAPSHOT.jar.
5101 pub path: std::string::String,
5102
5103 /// Maven `artifactId` value used when uploading the artifact to Artifact
5104 /// Registry.
5105 pub artifact_id: std::string::String,
5106
5107 /// Maven `groupId` value used when uploading the artifact to Artifact
5108 /// Registry.
5109 pub group_id: std::string::String,
5110
5111 /// Maven `version` value used when uploading the artifact to Artifact
5112 /// Registry.
5113 pub version: std::string::String,
5114
5115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5116 }
5117
5118 impl MavenArtifact {
5119 /// Creates a new default instance.
5120 pub fn new() -> Self {
5121 std::default::Default::default()
5122 }
5123
5124 /// Sets the value of [repository][crate::model::artifacts::MavenArtifact::repository].
5125 ///
5126 /// # Example
5127 /// ```ignore,no_run
5128 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5129 /// let x = MavenArtifact::new().set_repository("example");
5130 /// ```
5131 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5132 self.repository = v.into();
5133 self
5134 }
5135
5136 /// Sets the value of [path][crate::model::artifacts::MavenArtifact::path].
5137 ///
5138 /// # Example
5139 /// ```ignore,no_run
5140 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5141 /// let x = MavenArtifact::new().set_path("example");
5142 /// ```
5143 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5144 self.path = v.into();
5145 self
5146 }
5147
5148 /// Sets the value of [artifact_id][crate::model::artifacts::MavenArtifact::artifact_id].
5149 ///
5150 /// # Example
5151 /// ```ignore,no_run
5152 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5153 /// let x = MavenArtifact::new().set_artifact_id("example");
5154 /// ```
5155 pub fn set_artifact_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5156 self.artifact_id = v.into();
5157 self
5158 }
5159
5160 /// Sets the value of [group_id][crate::model::artifacts::MavenArtifact::group_id].
5161 ///
5162 /// # Example
5163 /// ```ignore,no_run
5164 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5165 /// let x = MavenArtifact::new().set_group_id("example");
5166 /// ```
5167 pub fn set_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5168 self.group_id = v.into();
5169 self
5170 }
5171
5172 /// Sets the value of [version][crate::model::artifacts::MavenArtifact::version].
5173 ///
5174 /// # Example
5175 /// ```ignore,no_run
5176 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5177 /// let x = MavenArtifact::new().set_version("example");
5178 /// ```
5179 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5180 self.version = v.into();
5181 self
5182 }
5183 }
5184
5185 impl wkt::message::Message for MavenArtifact {
5186 fn typename() -> &'static str {
5187 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.MavenArtifact"
5188 }
5189 }
5190
5191 /// Go module to upload to Artifact Registry upon successful completion of all
5192 /// build steps. A module refers to all dependencies in a go.mod file.
5193 #[derive(Clone, Default, PartialEq)]
5194 #[non_exhaustive]
5195 pub struct GoModule {
5196 /// Optional. Artifact Registry repository name.
5197 ///
5198 /// Specified Go modules will be zipped and uploaded to Artifact Registry
5199 /// with this location as a prefix.
5200 /// e.g. my-go-repo
5201 pub repository_name: std::string::String,
5202
5203 /// Optional. Location of the Artifact Registry repository. i.e. us-east1
5204 /// Defaults to the build’s location.
5205 pub repository_location: std::string::String,
5206
5207 /// Optional. Project ID of the Artifact Registry repository.
5208 /// Defaults to the build project.
5209 pub repository_project_id: std::string::String,
5210
5211 /// Optional. Source path of the go.mod file in the build's workspace. If not
5212 /// specified, this will default to the current directory.
5213 /// e.g. ~/code/go/mypackage
5214 pub source_path: std::string::String,
5215
5216 /// Optional. The Go module's "module path".
5217 /// e.g. example.com/foo/v2
5218 pub module_path: std::string::String,
5219
5220 /// Optional. The Go module's semantic version in the form vX.Y.Z. e.g.
5221 /// v0.1.1 Pre-release identifiers can also be added by appending a dash and
5222 /// dot separated ASCII alphanumeric characters and hyphens.
5223 /// e.g. v0.2.3-alpha.x.12m.5
5224 pub module_version: std::string::String,
5225
5226 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5227 }
5228
5229 impl GoModule {
5230 /// Creates a new default instance.
5231 pub fn new() -> Self {
5232 std::default::Default::default()
5233 }
5234
5235 /// Sets the value of [repository_name][crate::model::artifacts::GoModule::repository_name].
5236 ///
5237 /// # Example
5238 /// ```ignore,no_run
5239 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5240 /// let x = GoModule::new().set_repository_name("example");
5241 /// ```
5242 pub fn set_repository_name<T: std::convert::Into<std::string::String>>(
5243 mut self,
5244 v: T,
5245 ) -> Self {
5246 self.repository_name = v.into();
5247 self
5248 }
5249
5250 /// Sets the value of [repository_location][crate::model::artifacts::GoModule::repository_location].
5251 ///
5252 /// # Example
5253 /// ```ignore,no_run
5254 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5255 /// let x = GoModule::new().set_repository_location("example");
5256 /// ```
5257 pub fn set_repository_location<T: std::convert::Into<std::string::String>>(
5258 mut self,
5259 v: T,
5260 ) -> Self {
5261 self.repository_location = v.into();
5262 self
5263 }
5264
5265 /// Sets the value of [repository_project_id][crate::model::artifacts::GoModule::repository_project_id].
5266 ///
5267 /// # Example
5268 /// ```ignore,no_run
5269 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5270 /// let x = GoModule::new().set_repository_project_id("example");
5271 /// ```
5272 pub fn set_repository_project_id<T: std::convert::Into<std::string::String>>(
5273 mut self,
5274 v: T,
5275 ) -> Self {
5276 self.repository_project_id = v.into();
5277 self
5278 }
5279
5280 /// Sets the value of [source_path][crate::model::artifacts::GoModule::source_path].
5281 ///
5282 /// # Example
5283 /// ```ignore,no_run
5284 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5285 /// let x = GoModule::new().set_source_path("example");
5286 /// ```
5287 pub fn set_source_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5288 self.source_path = v.into();
5289 self
5290 }
5291
5292 /// Sets the value of [module_path][crate::model::artifacts::GoModule::module_path].
5293 ///
5294 /// # Example
5295 /// ```ignore,no_run
5296 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5297 /// let x = GoModule::new().set_module_path("example");
5298 /// ```
5299 pub fn set_module_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5300 self.module_path = v.into();
5301 self
5302 }
5303
5304 /// Sets the value of [module_version][crate::model::artifacts::GoModule::module_version].
5305 ///
5306 /// # Example
5307 /// ```ignore,no_run
5308 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5309 /// let x = GoModule::new().set_module_version("example");
5310 /// ```
5311 pub fn set_module_version<T: std::convert::Into<std::string::String>>(
5312 mut self,
5313 v: T,
5314 ) -> Self {
5315 self.module_version = v.into();
5316 self
5317 }
5318 }
5319
5320 impl wkt::message::Message for GoModule {
5321 fn typename() -> &'static str {
5322 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.GoModule"
5323 }
5324 }
5325
5326 /// Python package to upload to Artifact Registry upon successful completion
5327 /// of all build steps. A package can encapsulate multiple objects to be
5328 /// uploaded to a single repository.
5329 #[derive(Clone, Default, PartialEq)]
5330 #[non_exhaustive]
5331 pub struct PythonPackage {
5332 /// Artifact Registry repository, in the form
5333 /// "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY"
5334 ///
5335 /// Files in the workspace matching any path pattern will be uploaded to
5336 /// Artifact Registry with this location as a prefix.
5337 pub repository: std::string::String,
5338
5339 /// Path globs used to match files in the build's workspace. For Python/
5340 /// Twine, this is usually `dist/*`, and sometimes additionally an `.asc`
5341 /// file.
5342 pub paths: std::vec::Vec<std::string::String>,
5343
5344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5345 }
5346
5347 impl PythonPackage {
5348 /// Creates a new default instance.
5349 pub fn new() -> Self {
5350 std::default::Default::default()
5351 }
5352
5353 /// Sets the value of [repository][crate::model::artifacts::PythonPackage::repository].
5354 ///
5355 /// # Example
5356 /// ```ignore,no_run
5357 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5358 /// let x = PythonPackage::new().set_repository("example");
5359 /// ```
5360 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5361 self.repository = v.into();
5362 self
5363 }
5364
5365 /// Sets the value of [paths][crate::model::artifacts::PythonPackage::paths].
5366 ///
5367 /// # Example
5368 /// ```ignore,no_run
5369 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5370 /// let x = PythonPackage::new().set_paths(["a", "b", "c"]);
5371 /// ```
5372 pub fn set_paths<T, V>(mut self, v: T) -> Self
5373 where
5374 T: std::iter::IntoIterator<Item = V>,
5375 V: std::convert::Into<std::string::String>,
5376 {
5377 use std::iter::Iterator;
5378 self.paths = v.into_iter().map(|i| i.into()).collect();
5379 self
5380 }
5381 }
5382
5383 impl wkt::message::Message for PythonPackage {
5384 fn typename() -> &'static str {
5385 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.PythonPackage"
5386 }
5387 }
5388
5389 /// Npm package to upload to Artifact Registry upon successful completion
5390 /// of all build steps.
5391 #[derive(Clone, Default, PartialEq)]
5392 #[non_exhaustive]
5393 pub struct NpmPackage {
5394 /// Artifact Registry repository, in the form
5395 /// "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY"
5396 ///
5397 /// Npm package in the workspace specified by path will be zipped and
5398 /// uploaded to Artifact Registry with this location as a prefix.
5399 pub repository: std::string::String,
5400
5401 /// Optional. Path to the package.json.
5402 /// e.g. workspace/path/to/package
5403 ///
5404 /// Only one of `archive` or `package_path` can be specified.
5405 pub package_path: std::string::String,
5406
5407 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5408 }
5409
5410 impl NpmPackage {
5411 /// Creates a new default instance.
5412 pub fn new() -> Self {
5413 std::default::Default::default()
5414 }
5415
5416 /// Sets the value of [repository][crate::model::artifacts::NpmPackage::repository].
5417 ///
5418 /// # Example
5419 /// ```ignore,no_run
5420 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5421 /// let x = NpmPackage::new().set_repository("example");
5422 /// ```
5423 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5424 self.repository = v.into();
5425 self
5426 }
5427
5428 /// Sets the value of [package_path][crate::model::artifacts::NpmPackage::package_path].
5429 ///
5430 /// # Example
5431 /// ```ignore,no_run
5432 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5433 /// let x = NpmPackage::new().set_package_path("example");
5434 /// ```
5435 pub fn set_package_path<T: std::convert::Into<std::string::String>>(
5436 mut self,
5437 v: T,
5438 ) -> Self {
5439 self.package_path = v.into();
5440 self
5441 }
5442 }
5443
5444 impl wkt::message::Message for NpmPackage {
5445 fn typename() -> &'static str {
5446 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.NpmPackage"
5447 }
5448 }
5449}
5450
5451/// Start and end times for a build execution phase.
5452#[derive(Clone, Default, PartialEq)]
5453#[non_exhaustive]
5454pub struct TimeSpan {
5455 /// Start of time span.
5456 pub start_time: std::option::Option<wkt::Timestamp>,
5457
5458 /// End of time span.
5459 pub end_time: std::option::Option<wkt::Timestamp>,
5460
5461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5462}
5463
5464impl TimeSpan {
5465 /// Creates a new default instance.
5466 pub fn new() -> Self {
5467 std::default::Default::default()
5468 }
5469
5470 /// Sets the value of [start_time][crate::model::TimeSpan::start_time].
5471 ///
5472 /// # Example
5473 /// ```ignore,no_run
5474 /// # use google_cloud_build_v1::model::TimeSpan;
5475 /// use wkt::Timestamp;
5476 /// let x = TimeSpan::new().set_start_time(Timestamp::default()/* use setters */);
5477 /// ```
5478 pub fn set_start_time<T>(mut self, v: T) -> Self
5479 where
5480 T: std::convert::Into<wkt::Timestamp>,
5481 {
5482 self.start_time = std::option::Option::Some(v.into());
5483 self
5484 }
5485
5486 /// Sets or clears the value of [start_time][crate::model::TimeSpan::start_time].
5487 ///
5488 /// # Example
5489 /// ```ignore,no_run
5490 /// # use google_cloud_build_v1::model::TimeSpan;
5491 /// use wkt::Timestamp;
5492 /// let x = TimeSpan::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
5493 /// let x = TimeSpan::new().set_or_clear_start_time(None::<Timestamp>);
5494 /// ```
5495 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5496 where
5497 T: std::convert::Into<wkt::Timestamp>,
5498 {
5499 self.start_time = v.map(|x| x.into());
5500 self
5501 }
5502
5503 /// Sets the value of [end_time][crate::model::TimeSpan::end_time].
5504 ///
5505 /// # Example
5506 /// ```ignore,no_run
5507 /// # use google_cloud_build_v1::model::TimeSpan;
5508 /// use wkt::Timestamp;
5509 /// let x = TimeSpan::new().set_end_time(Timestamp::default()/* use setters */);
5510 /// ```
5511 pub fn set_end_time<T>(mut self, v: T) -> Self
5512 where
5513 T: std::convert::Into<wkt::Timestamp>,
5514 {
5515 self.end_time = std::option::Option::Some(v.into());
5516 self
5517 }
5518
5519 /// Sets or clears the value of [end_time][crate::model::TimeSpan::end_time].
5520 ///
5521 /// # Example
5522 /// ```ignore,no_run
5523 /// # use google_cloud_build_v1::model::TimeSpan;
5524 /// use wkt::Timestamp;
5525 /// let x = TimeSpan::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5526 /// let x = TimeSpan::new().set_or_clear_end_time(None::<Timestamp>);
5527 /// ```
5528 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5529 where
5530 T: std::convert::Into<wkt::Timestamp>,
5531 {
5532 self.end_time = v.map(|x| x.into());
5533 self
5534 }
5535}
5536
5537impl wkt::message::Message for TimeSpan {
5538 fn typename() -> &'static str {
5539 "type.googleapis.com/google.devtools.cloudbuild.v1.TimeSpan"
5540 }
5541}
5542
5543/// Metadata for build operations.
5544#[derive(Clone, Default, PartialEq)]
5545#[non_exhaustive]
5546pub struct BuildOperationMetadata {
5547 /// The build that the operation is tracking.
5548 pub build: std::option::Option<crate::model::Build>,
5549
5550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5551}
5552
5553impl BuildOperationMetadata {
5554 /// Creates a new default instance.
5555 pub fn new() -> Self {
5556 std::default::Default::default()
5557 }
5558
5559 /// Sets the value of [build][crate::model::BuildOperationMetadata::build].
5560 ///
5561 /// # Example
5562 /// ```ignore,no_run
5563 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5564 /// use google_cloud_build_v1::model::Build;
5565 /// let x = BuildOperationMetadata::new().set_build(Build::default()/* use setters */);
5566 /// ```
5567 pub fn set_build<T>(mut self, v: T) -> Self
5568 where
5569 T: std::convert::Into<crate::model::Build>,
5570 {
5571 self.build = std::option::Option::Some(v.into());
5572 self
5573 }
5574
5575 /// Sets or clears the value of [build][crate::model::BuildOperationMetadata::build].
5576 ///
5577 /// # Example
5578 /// ```ignore,no_run
5579 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5580 /// use google_cloud_build_v1::model::Build;
5581 /// let x = BuildOperationMetadata::new().set_or_clear_build(Some(Build::default()/* use setters */));
5582 /// let x = BuildOperationMetadata::new().set_or_clear_build(None::<Build>);
5583 /// ```
5584 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
5585 where
5586 T: std::convert::Into<crate::model::Build>,
5587 {
5588 self.build = v.map(|x| x.into());
5589 self
5590 }
5591}
5592
5593impl wkt::message::Message for BuildOperationMetadata {
5594 fn typename() -> &'static str {
5595 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata"
5596 }
5597}
5598
5599/// Provenance of the source. Ways to find the original source, or verify that
5600/// some source was used for this build.
5601#[derive(Clone, Default, PartialEq)]
5602#[non_exhaustive]
5603pub struct SourceProvenance {
5604 /// A copy of the build's `source.storage_source`, if exists, with any
5605 /// generations resolved.
5606 pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
5607
5608 /// A copy of the build's `source.repo_source`, if exists, with any
5609 /// revisions resolved.
5610 pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
5611
5612 /// A copy of the build's `source.storage_source_manifest`, if exists, with any
5613 /// revisions resolved.
5614 /// This feature is in Preview.
5615 pub resolved_storage_source_manifest: std::option::Option<crate::model::StorageSourceManifest>,
5616
5617 /// Output only. A copy of the build's `source.connected_repository`, if
5618 /// exists, with any revisions resolved.
5619 pub resolved_connected_repository: std::option::Option<crate::model::ConnectedRepository>,
5620
5621 /// Output only. A copy of the build's `source.git_source`, if exists, with any
5622 /// revisions resolved.
5623 pub resolved_git_source: std::option::Option<crate::model::GitSource>,
5624
5625 /// Output only. Hash(es) of the build source, which can be used to verify that
5626 /// the original source integrity was maintained in the build. Note that
5627 /// `FileHashes` will only be populated if `BuildOptions` has requested a
5628 /// `SourceProvenanceHash`.
5629 ///
5630 /// The keys to this map are file paths used as build source and the values
5631 /// contain the hash values for those files.
5632 ///
5633 /// If the build source came in a single package such as a gzipped tarfile
5634 /// (`.tar.gz`), the `FileHash` will be for the single path to that file.
5635 pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
5636
5637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5638}
5639
5640impl SourceProvenance {
5641 /// Creates a new default instance.
5642 pub fn new() -> Self {
5643 std::default::Default::default()
5644 }
5645
5646 /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5647 ///
5648 /// # Example
5649 /// ```ignore,no_run
5650 /// # use google_cloud_build_v1::model::SourceProvenance;
5651 /// use google_cloud_build_v1::model::StorageSource;
5652 /// let x = SourceProvenance::new().set_resolved_storage_source(StorageSource::default()/* use setters */);
5653 /// ```
5654 pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
5655 where
5656 T: std::convert::Into<crate::model::StorageSource>,
5657 {
5658 self.resolved_storage_source = std::option::Option::Some(v.into());
5659 self
5660 }
5661
5662 /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5663 ///
5664 /// # Example
5665 /// ```ignore,no_run
5666 /// # use google_cloud_build_v1::model::SourceProvenance;
5667 /// use google_cloud_build_v1::model::StorageSource;
5668 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(Some(StorageSource::default()/* use setters */));
5669 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(None::<StorageSource>);
5670 /// ```
5671 pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
5672 where
5673 T: std::convert::Into<crate::model::StorageSource>,
5674 {
5675 self.resolved_storage_source = v.map(|x| x.into());
5676 self
5677 }
5678
5679 /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5680 ///
5681 /// # Example
5682 /// ```ignore,no_run
5683 /// # use google_cloud_build_v1::model::SourceProvenance;
5684 /// use google_cloud_build_v1::model::RepoSource;
5685 /// let x = SourceProvenance::new().set_resolved_repo_source(RepoSource::default()/* use setters */);
5686 /// ```
5687 pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
5688 where
5689 T: std::convert::Into<crate::model::RepoSource>,
5690 {
5691 self.resolved_repo_source = std::option::Option::Some(v.into());
5692 self
5693 }
5694
5695 /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5696 ///
5697 /// # Example
5698 /// ```ignore,no_run
5699 /// # use google_cloud_build_v1::model::SourceProvenance;
5700 /// use google_cloud_build_v1::model::RepoSource;
5701 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(Some(RepoSource::default()/* use setters */));
5702 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(None::<RepoSource>);
5703 /// ```
5704 pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
5705 where
5706 T: std::convert::Into<crate::model::RepoSource>,
5707 {
5708 self.resolved_repo_source = v.map(|x| x.into());
5709 self
5710 }
5711
5712 /// Sets the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5713 ///
5714 /// # Example
5715 /// ```ignore,no_run
5716 /// # use google_cloud_build_v1::model::SourceProvenance;
5717 /// use google_cloud_build_v1::model::StorageSourceManifest;
5718 /// let x = SourceProvenance::new().set_resolved_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
5719 /// ```
5720 pub fn set_resolved_storage_source_manifest<T>(mut self, v: T) -> Self
5721 where
5722 T: std::convert::Into<crate::model::StorageSourceManifest>,
5723 {
5724 self.resolved_storage_source_manifest = std::option::Option::Some(v.into());
5725 self
5726 }
5727
5728 /// Sets or clears the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5729 ///
5730 /// # Example
5731 /// ```ignore,no_run
5732 /// # use google_cloud_build_v1::model::SourceProvenance;
5733 /// use google_cloud_build_v1::model::StorageSourceManifest;
5734 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(Some(StorageSourceManifest::default()/* use setters */));
5735 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(None::<StorageSourceManifest>);
5736 /// ```
5737 pub fn set_or_clear_resolved_storage_source_manifest<T>(
5738 mut self,
5739 v: std::option::Option<T>,
5740 ) -> Self
5741 where
5742 T: std::convert::Into<crate::model::StorageSourceManifest>,
5743 {
5744 self.resolved_storage_source_manifest = v.map(|x| x.into());
5745 self
5746 }
5747
5748 /// Sets the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5749 ///
5750 /// # Example
5751 /// ```ignore,no_run
5752 /// # use google_cloud_build_v1::model::SourceProvenance;
5753 /// use google_cloud_build_v1::model::ConnectedRepository;
5754 /// let x = SourceProvenance::new().set_resolved_connected_repository(ConnectedRepository::default()/* use setters */);
5755 /// ```
5756 pub fn set_resolved_connected_repository<T>(mut self, v: T) -> Self
5757 where
5758 T: std::convert::Into<crate::model::ConnectedRepository>,
5759 {
5760 self.resolved_connected_repository = std::option::Option::Some(v.into());
5761 self
5762 }
5763
5764 /// Sets or clears the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5765 ///
5766 /// # Example
5767 /// ```ignore,no_run
5768 /// # use google_cloud_build_v1::model::SourceProvenance;
5769 /// use google_cloud_build_v1::model::ConnectedRepository;
5770 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(Some(ConnectedRepository::default()/* use setters */));
5771 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(None::<ConnectedRepository>);
5772 /// ```
5773 pub fn set_or_clear_resolved_connected_repository<T>(
5774 mut self,
5775 v: std::option::Option<T>,
5776 ) -> Self
5777 where
5778 T: std::convert::Into<crate::model::ConnectedRepository>,
5779 {
5780 self.resolved_connected_repository = v.map(|x| x.into());
5781 self
5782 }
5783
5784 /// Sets the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5785 ///
5786 /// # Example
5787 /// ```ignore,no_run
5788 /// # use google_cloud_build_v1::model::SourceProvenance;
5789 /// use google_cloud_build_v1::model::GitSource;
5790 /// let x = SourceProvenance::new().set_resolved_git_source(GitSource::default()/* use setters */);
5791 /// ```
5792 pub fn set_resolved_git_source<T>(mut self, v: T) -> Self
5793 where
5794 T: std::convert::Into<crate::model::GitSource>,
5795 {
5796 self.resolved_git_source = std::option::Option::Some(v.into());
5797 self
5798 }
5799
5800 /// Sets or clears the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5801 ///
5802 /// # Example
5803 /// ```ignore,no_run
5804 /// # use google_cloud_build_v1::model::SourceProvenance;
5805 /// use google_cloud_build_v1::model::GitSource;
5806 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(Some(GitSource::default()/* use setters */));
5807 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(None::<GitSource>);
5808 /// ```
5809 pub fn set_or_clear_resolved_git_source<T>(mut self, v: std::option::Option<T>) -> Self
5810 where
5811 T: std::convert::Into<crate::model::GitSource>,
5812 {
5813 self.resolved_git_source = v.map(|x| x.into());
5814 self
5815 }
5816
5817 /// Sets the value of [file_hashes][crate::model::SourceProvenance::file_hashes].
5818 ///
5819 /// # Example
5820 /// ```ignore,no_run
5821 /// # use google_cloud_build_v1::model::SourceProvenance;
5822 /// use google_cloud_build_v1::model::FileHashes;
5823 /// let x = SourceProvenance::new().set_file_hashes([
5824 /// ("key0", FileHashes::default()/* use setters */),
5825 /// ("key1", FileHashes::default()/* use (different) setters */),
5826 /// ]);
5827 /// ```
5828 pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
5829 where
5830 T: std::iter::IntoIterator<Item = (K, V)>,
5831 K: std::convert::Into<std::string::String>,
5832 V: std::convert::Into<crate::model::FileHashes>,
5833 {
5834 use std::iter::Iterator;
5835 self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5836 self
5837 }
5838}
5839
5840impl wkt::message::Message for SourceProvenance {
5841 fn typename() -> &'static str {
5842 "type.googleapis.com/google.devtools.cloudbuild.v1.SourceProvenance"
5843 }
5844}
5845
5846/// Container message for hashes of byte content of files, used in
5847/// SourceProvenance messages to verify integrity of source input to the build.
5848#[derive(Clone, Default, PartialEq)]
5849#[non_exhaustive]
5850pub struct FileHashes {
5851 /// Collection of file hashes.
5852 pub file_hash: std::vec::Vec<crate::model::Hash>,
5853
5854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5855}
5856
5857impl FileHashes {
5858 /// Creates a new default instance.
5859 pub fn new() -> Self {
5860 std::default::Default::default()
5861 }
5862
5863 /// Sets the value of [file_hash][crate::model::FileHashes::file_hash].
5864 ///
5865 /// # Example
5866 /// ```ignore,no_run
5867 /// # use google_cloud_build_v1::model::FileHashes;
5868 /// use google_cloud_build_v1::model::Hash;
5869 /// let x = FileHashes::new()
5870 /// .set_file_hash([
5871 /// Hash::default()/* use setters */,
5872 /// Hash::default()/* use (different) setters */,
5873 /// ]);
5874 /// ```
5875 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
5876 where
5877 T: std::iter::IntoIterator<Item = V>,
5878 V: std::convert::Into<crate::model::Hash>,
5879 {
5880 use std::iter::Iterator;
5881 self.file_hash = v.into_iter().map(|i| i.into()).collect();
5882 self
5883 }
5884}
5885
5886impl wkt::message::Message for FileHashes {
5887 fn typename() -> &'static str {
5888 "type.googleapis.com/google.devtools.cloudbuild.v1.FileHashes"
5889 }
5890}
5891
5892/// Container message for hash values.
5893#[derive(Clone, Default, PartialEq)]
5894#[non_exhaustive]
5895pub struct Hash {
5896 /// The type of hash that was performed.
5897 pub r#type: crate::model::hash::HashType,
5898
5899 /// The hash value.
5900 pub value: ::bytes::Bytes,
5901
5902 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5903}
5904
5905impl Hash {
5906 /// Creates a new default instance.
5907 pub fn new() -> Self {
5908 std::default::Default::default()
5909 }
5910
5911 /// Sets the value of [r#type][crate::model::Hash::type].
5912 ///
5913 /// # Example
5914 /// ```ignore,no_run
5915 /// # use google_cloud_build_v1::model::Hash;
5916 /// use google_cloud_build_v1::model::hash::HashType;
5917 /// let x0 = Hash::new().set_type(HashType::Sha256);
5918 /// let x1 = Hash::new().set_type(HashType::Md5);
5919 /// let x2 = Hash::new().set_type(HashType::GoModuleH1);
5920 /// ```
5921 pub fn set_type<T: std::convert::Into<crate::model::hash::HashType>>(mut self, v: T) -> Self {
5922 self.r#type = v.into();
5923 self
5924 }
5925
5926 /// Sets the value of [value][crate::model::Hash::value].
5927 ///
5928 /// # Example
5929 /// ```ignore,no_run
5930 /// # use google_cloud_build_v1::model::Hash;
5931 /// let x = Hash::new().set_value(bytes::Bytes::from_static(b"example"));
5932 /// ```
5933 pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5934 self.value = v.into();
5935 self
5936 }
5937}
5938
5939impl wkt::message::Message for Hash {
5940 fn typename() -> &'static str {
5941 "type.googleapis.com/google.devtools.cloudbuild.v1.Hash"
5942 }
5943}
5944
5945/// Defines additional types related to [Hash].
5946pub mod hash {
5947 #[allow(unused_imports)]
5948 use super::*;
5949
5950 /// Specifies the hash algorithm, if any.
5951 ///
5952 /// # Working with unknown values
5953 ///
5954 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5955 /// additional enum variants at any time. Adding new variants is not considered
5956 /// a breaking change. Applications should write their code in anticipation of:
5957 ///
5958 /// - New values appearing in future releases of the client library, **and**
5959 /// - New values received dynamically, without application changes.
5960 ///
5961 /// Please consult the [Working with enums] section in the user guide for some
5962 /// guidelines.
5963 ///
5964 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5965 #[derive(Clone, Debug, PartialEq)]
5966 #[non_exhaustive]
5967 pub enum HashType {
5968 /// No hash requested.
5969 None,
5970 /// Use a sha256 hash.
5971 Sha256,
5972 /// Use a md5 hash.
5973 Md5,
5974 /// Dirhash of a Go module's source code which is then hex-encoded.
5975 GoModuleH1,
5976 /// Use a sha512 hash.
5977 Sha512,
5978 /// If set, the enum was initialized with an unknown value.
5979 ///
5980 /// Applications can examine the value using [HashType::value] or
5981 /// [HashType::name].
5982 UnknownValue(hash_type::UnknownValue),
5983 }
5984
5985 #[doc(hidden)]
5986 pub mod hash_type {
5987 #[allow(unused_imports)]
5988 use super::*;
5989 #[derive(Clone, Debug, PartialEq)]
5990 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5991 }
5992
5993 impl HashType {
5994 /// Gets the enum value.
5995 ///
5996 /// Returns `None` if the enum contains an unknown value deserialized from
5997 /// the string representation of enums.
5998 pub fn value(&self) -> std::option::Option<i32> {
5999 match self {
6000 Self::None => std::option::Option::Some(0),
6001 Self::Sha256 => std::option::Option::Some(1),
6002 Self::Md5 => std::option::Option::Some(2),
6003 Self::GoModuleH1 => std::option::Option::Some(3),
6004 Self::Sha512 => std::option::Option::Some(4),
6005 Self::UnknownValue(u) => u.0.value(),
6006 }
6007 }
6008
6009 /// Gets the enum value as a string.
6010 ///
6011 /// Returns `None` if the enum contains an unknown value deserialized from
6012 /// the integer representation of enums.
6013 pub fn name(&self) -> std::option::Option<&str> {
6014 match self {
6015 Self::None => std::option::Option::Some("NONE"),
6016 Self::Sha256 => std::option::Option::Some("SHA256"),
6017 Self::Md5 => std::option::Option::Some("MD5"),
6018 Self::GoModuleH1 => std::option::Option::Some("GO_MODULE_H1"),
6019 Self::Sha512 => std::option::Option::Some("SHA512"),
6020 Self::UnknownValue(u) => u.0.name(),
6021 }
6022 }
6023 }
6024
6025 impl std::default::Default for HashType {
6026 fn default() -> Self {
6027 use std::convert::From;
6028 Self::from(0)
6029 }
6030 }
6031
6032 impl std::fmt::Display for HashType {
6033 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6034 wkt::internal::display_enum(f, self.name(), self.value())
6035 }
6036 }
6037
6038 impl std::convert::From<i32> for HashType {
6039 fn from(value: i32) -> Self {
6040 match value {
6041 0 => Self::None,
6042 1 => Self::Sha256,
6043 2 => Self::Md5,
6044 3 => Self::GoModuleH1,
6045 4 => Self::Sha512,
6046 _ => Self::UnknownValue(hash_type::UnknownValue(
6047 wkt::internal::UnknownEnumValue::Integer(value),
6048 )),
6049 }
6050 }
6051 }
6052
6053 impl std::convert::From<&str> for HashType {
6054 fn from(value: &str) -> Self {
6055 use std::string::ToString;
6056 match value {
6057 "NONE" => Self::None,
6058 "SHA256" => Self::Sha256,
6059 "MD5" => Self::Md5,
6060 "GO_MODULE_H1" => Self::GoModuleH1,
6061 "SHA512" => Self::Sha512,
6062 _ => Self::UnknownValue(hash_type::UnknownValue(
6063 wkt::internal::UnknownEnumValue::String(value.to_string()),
6064 )),
6065 }
6066 }
6067 }
6068
6069 impl serde::ser::Serialize for HashType {
6070 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6071 where
6072 S: serde::Serializer,
6073 {
6074 match self {
6075 Self::None => serializer.serialize_i32(0),
6076 Self::Sha256 => serializer.serialize_i32(1),
6077 Self::Md5 => serializer.serialize_i32(2),
6078 Self::GoModuleH1 => serializer.serialize_i32(3),
6079 Self::Sha512 => serializer.serialize_i32(4),
6080 Self::UnknownValue(u) => u.0.serialize(serializer),
6081 }
6082 }
6083 }
6084
6085 impl<'de> serde::de::Deserialize<'de> for HashType {
6086 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6087 where
6088 D: serde::Deserializer<'de>,
6089 {
6090 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HashType>::new(
6091 ".google.devtools.cloudbuild.v1.Hash.HashType",
6092 ))
6093 }
6094 }
6095}
6096
6097/// Secrets and secret environment variables.
6098#[derive(Clone, Default, PartialEq)]
6099#[non_exhaustive]
6100pub struct Secrets {
6101 /// Secrets in Secret Manager and associated secret environment variable.
6102 pub secret_manager: std::vec::Vec<crate::model::SecretManagerSecret>,
6103
6104 /// Secrets encrypted with KMS key and the associated secret environment
6105 /// variable.
6106 pub inline: std::vec::Vec<crate::model::InlineSecret>,
6107
6108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6109}
6110
6111impl Secrets {
6112 /// Creates a new default instance.
6113 pub fn new() -> Self {
6114 std::default::Default::default()
6115 }
6116
6117 /// Sets the value of [secret_manager][crate::model::Secrets::secret_manager].
6118 ///
6119 /// # Example
6120 /// ```ignore,no_run
6121 /// # use google_cloud_build_v1::model::Secrets;
6122 /// use google_cloud_build_v1::model::SecretManagerSecret;
6123 /// let x = Secrets::new()
6124 /// .set_secret_manager([
6125 /// SecretManagerSecret::default()/* use setters */,
6126 /// SecretManagerSecret::default()/* use (different) setters */,
6127 /// ]);
6128 /// ```
6129 pub fn set_secret_manager<T, V>(mut self, v: T) -> Self
6130 where
6131 T: std::iter::IntoIterator<Item = V>,
6132 V: std::convert::Into<crate::model::SecretManagerSecret>,
6133 {
6134 use std::iter::Iterator;
6135 self.secret_manager = v.into_iter().map(|i| i.into()).collect();
6136 self
6137 }
6138
6139 /// Sets the value of [inline][crate::model::Secrets::inline].
6140 ///
6141 /// # Example
6142 /// ```ignore,no_run
6143 /// # use google_cloud_build_v1::model::Secrets;
6144 /// use google_cloud_build_v1::model::InlineSecret;
6145 /// let x = Secrets::new()
6146 /// .set_inline([
6147 /// InlineSecret::default()/* use setters */,
6148 /// InlineSecret::default()/* use (different) setters */,
6149 /// ]);
6150 /// ```
6151 pub fn set_inline<T, V>(mut self, v: T) -> Self
6152 where
6153 T: std::iter::IntoIterator<Item = V>,
6154 V: std::convert::Into<crate::model::InlineSecret>,
6155 {
6156 use std::iter::Iterator;
6157 self.inline = v.into_iter().map(|i| i.into()).collect();
6158 self
6159 }
6160}
6161
6162impl wkt::message::Message for Secrets {
6163 fn typename() -> &'static str {
6164 "type.googleapis.com/google.devtools.cloudbuild.v1.Secrets"
6165 }
6166}
6167
6168/// Pairs a set of secret environment variables mapped to encrypted
6169/// values with the Cloud KMS key to use to decrypt the value.
6170#[derive(Clone, Default, PartialEq)]
6171#[non_exhaustive]
6172pub struct InlineSecret {
6173 /// Resource name of Cloud KMS crypto key to decrypt the encrypted value.
6174 /// In format: projects/*/locations/*/keyRings/*/cryptoKeys/*
6175 pub kms_key_name: std::string::String,
6176
6177 /// Map of environment variable name to its encrypted value.
6178 ///
6179 /// Secret environment variables must be unique across all of a build's
6180 /// secrets, and must be used by at least one build step. Values can be at most
6181 /// 64 KB in size. There can be at most 100 secret values across all of a
6182 /// build's secrets.
6183 pub env_map: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6184
6185 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6186}
6187
6188impl InlineSecret {
6189 /// Creates a new default instance.
6190 pub fn new() -> Self {
6191 std::default::Default::default()
6192 }
6193
6194 /// Sets the value of [kms_key_name][crate::model::InlineSecret::kms_key_name].
6195 ///
6196 /// # Example
6197 /// ```ignore,no_run
6198 /// # use google_cloud_build_v1::model::InlineSecret;
6199 /// let x = InlineSecret::new().set_kms_key_name("example");
6200 /// ```
6201 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6202 self.kms_key_name = v.into();
6203 self
6204 }
6205
6206 /// Sets the value of [env_map][crate::model::InlineSecret::env_map].
6207 ///
6208 /// # Example
6209 /// ```ignore,no_run
6210 /// # use google_cloud_build_v1::model::InlineSecret;
6211 /// let x = InlineSecret::new().set_env_map([
6212 /// ("key0", bytes::Bytes::from_static(b"abc")),
6213 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6214 /// ]);
6215 /// ```
6216 pub fn set_env_map<T, K, V>(mut self, v: T) -> Self
6217 where
6218 T: std::iter::IntoIterator<Item = (K, V)>,
6219 K: std::convert::Into<std::string::String>,
6220 V: std::convert::Into<::bytes::Bytes>,
6221 {
6222 use std::iter::Iterator;
6223 self.env_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6224 self
6225 }
6226}
6227
6228impl wkt::message::Message for InlineSecret {
6229 fn typename() -> &'static str {
6230 "type.googleapis.com/google.devtools.cloudbuild.v1.InlineSecret"
6231 }
6232}
6233
6234/// Pairs a secret environment variable with a SecretVersion in Secret Manager.
6235#[derive(Clone, Default, PartialEq)]
6236#[non_exhaustive]
6237pub struct SecretManagerSecret {
6238 /// Resource name of the SecretVersion. In format:
6239 /// projects/*/secrets/*/versions/*
6240 pub version_name: std::string::String,
6241
6242 /// Environment variable name to associate with the secret.
6243 /// Secret environment variables must be unique across all of a build's
6244 /// secrets, and must be used by at least one build step.
6245 pub env: std::string::String,
6246
6247 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6248}
6249
6250impl SecretManagerSecret {
6251 /// Creates a new default instance.
6252 pub fn new() -> Self {
6253 std::default::Default::default()
6254 }
6255
6256 /// Sets the value of [version_name][crate::model::SecretManagerSecret::version_name].
6257 ///
6258 /// # Example
6259 /// ```ignore,no_run
6260 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6261 /// let x = SecretManagerSecret::new().set_version_name("example");
6262 /// ```
6263 pub fn set_version_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6264 self.version_name = v.into();
6265 self
6266 }
6267
6268 /// Sets the value of [env][crate::model::SecretManagerSecret::env].
6269 ///
6270 /// # Example
6271 /// ```ignore,no_run
6272 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6273 /// let x = SecretManagerSecret::new().set_env("example");
6274 /// ```
6275 pub fn set_env<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6276 self.env = v.into();
6277 self
6278 }
6279}
6280
6281impl wkt::message::Message for SecretManagerSecret {
6282 fn typename() -> &'static str {
6283 "type.googleapis.com/google.devtools.cloudbuild.v1.SecretManagerSecret"
6284 }
6285}
6286
6287/// Pairs a set of secret environment variables containing encrypted
6288/// values with the Cloud KMS key to use to decrypt the value.
6289/// Note: Use `kmsKeyName` with `available_secrets` instead of using
6290/// `kmsKeyName` with `secret`. For instructions see:
6291/// <https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials>.
6292#[derive(Clone, Default, PartialEq)]
6293#[non_exhaustive]
6294pub struct Secret {
6295 /// Cloud KMS key name to use to decrypt these envs.
6296 pub kms_key_name: std::string::String,
6297
6298 /// Map of environment variable name to its encrypted value.
6299 ///
6300 /// Secret environment variables must be unique across all of a build's
6301 /// secrets, and must be used by at least one build step. Values can be at most
6302 /// 64 KB in size. There can be at most 100 secret values across all of a
6303 /// build's secrets.
6304 pub secret_env: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6305
6306 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6307}
6308
6309impl Secret {
6310 /// Creates a new default instance.
6311 pub fn new() -> Self {
6312 std::default::Default::default()
6313 }
6314
6315 /// Sets the value of [kms_key_name][crate::model::Secret::kms_key_name].
6316 ///
6317 /// # Example
6318 /// ```ignore,no_run
6319 /// # use google_cloud_build_v1::model::Secret;
6320 /// let x = Secret::new().set_kms_key_name("example");
6321 /// ```
6322 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6323 self.kms_key_name = v.into();
6324 self
6325 }
6326
6327 /// Sets the value of [secret_env][crate::model::Secret::secret_env].
6328 ///
6329 /// # Example
6330 /// ```ignore,no_run
6331 /// # use google_cloud_build_v1::model::Secret;
6332 /// let x = Secret::new().set_secret_env([
6333 /// ("key0", bytes::Bytes::from_static(b"abc")),
6334 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6335 /// ]);
6336 /// ```
6337 pub fn set_secret_env<T, K, V>(mut self, v: T) -> Self
6338 where
6339 T: std::iter::IntoIterator<Item = (K, V)>,
6340 K: std::convert::Into<std::string::String>,
6341 V: std::convert::Into<::bytes::Bytes>,
6342 {
6343 use std::iter::Iterator;
6344 self.secret_env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6345 self
6346 }
6347}
6348
6349impl wkt::message::Message for Secret {
6350 fn typename() -> &'static str {
6351 "type.googleapis.com/google.devtools.cloudbuild.v1.Secret"
6352 }
6353}
6354
6355/// Request to create a new build.
6356#[derive(Clone, Default, PartialEq)]
6357#[non_exhaustive]
6358pub struct CreateBuildRequest {
6359 /// The parent resource where this build will be created.
6360 /// Format: `projects/{project}/locations/{location}`
6361 pub parent: std::string::String,
6362
6363 /// Required. ID of the project.
6364 pub project_id: std::string::String,
6365
6366 /// Required. Build resource to create.
6367 pub build: std::option::Option<crate::model::Build>,
6368
6369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6370}
6371
6372impl CreateBuildRequest {
6373 /// Creates a new default instance.
6374 pub fn new() -> Self {
6375 std::default::Default::default()
6376 }
6377
6378 /// Sets the value of [parent][crate::model::CreateBuildRequest::parent].
6379 ///
6380 /// # Example
6381 /// ```ignore,no_run
6382 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6383 /// let x = CreateBuildRequest::new().set_parent("example");
6384 /// ```
6385 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6386 self.parent = v.into();
6387 self
6388 }
6389
6390 /// Sets the value of [project_id][crate::model::CreateBuildRequest::project_id].
6391 ///
6392 /// # Example
6393 /// ```ignore,no_run
6394 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6395 /// let x = CreateBuildRequest::new().set_project_id("example");
6396 /// ```
6397 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6398 self.project_id = v.into();
6399 self
6400 }
6401
6402 /// Sets the value of [build][crate::model::CreateBuildRequest::build].
6403 ///
6404 /// # Example
6405 /// ```ignore,no_run
6406 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6407 /// use google_cloud_build_v1::model::Build;
6408 /// let x = CreateBuildRequest::new().set_build(Build::default()/* use setters */);
6409 /// ```
6410 pub fn set_build<T>(mut self, v: T) -> Self
6411 where
6412 T: std::convert::Into<crate::model::Build>,
6413 {
6414 self.build = std::option::Option::Some(v.into());
6415 self
6416 }
6417
6418 /// Sets or clears the value of [build][crate::model::CreateBuildRequest::build].
6419 ///
6420 /// # Example
6421 /// ```ignore,no_run
6422 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6423 /// use google_cloud_build_v1::model::Build;
6424 /// let x = CreateBuildRequest::new().set_or_clear_build(Some(Build::default()/* use setters */));
6425 /// let x = CreateBuildRequest::new().set_or_clear_build(None::<Build>);
6426 /// ```
6427 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
6428 where
6429 T: std::convert::Into<crate::model::Build>,
6430 {
6431 self.build = v.map(|x| x.into());
6432 self
6433 }
6434}
6435
6436impl wkt::message::Message for CreateBuildRequest {
6437 fn typename() -> &'static str {
6438 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildRequest"
6439 }
6440}
6441
6442/// Request to get a build.
6443#[derive(Clone, Default, PartialEq)]
6444#[non_exhaustive]
6445pub struct GetBuildRequest {
6446 /// The name of the `Build` to retrieve.
6447 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6448 pub name: std::string::String,
6449
6450 /// Required. ID of the project.
6451 pub project_id: std::string::String,
6452
6453 /// Required. ID of the build.
6454 pub id: std::string::String,
6455
6456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6457}
6458
6459impl GetBuildRequest {
6460 /// Creates a new default instance.
6461 pub fn new() -> Self {
6462 std::default::Default::default()
6463 }
6464
6465 /// Sets the value of [name][crate::model::GetBuildRequest::name].
6466 ///
6467 /// # Example
6468 /// ```ignore,no_run
6469 /// # use google_cloud_build_v1::model::GetBuildRequest;
6470 /// let x = GetBuildRequest::new().set_name("example");
6471 /// ```
6472 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6473 self.name = v.into();
6474 self
6475 }
6476
6477 /// Sets the value of [project_id][crate::model::GetBuildRequest::project_id].
6478 ///
6479 /// # Example
6480 /// ```ignore,no_run
6481 /// # use google_cloud_build_v1::model::GetBuildRequest;
6482 /// let x = GetBuildRequest::new().set_project_id("example");
6483 /// ```
6484 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6485 self.project_id = v.into();
6486 self
6487 }
6488
6489 /// Sets the value of [id][crate::model::GetBuildRequest::id].
6490 ///
6491 /// # Example
6492 /// ```ignore,no_run
6493 /// # use google_cloud_build_v1::model::GetBuildRequest;
6494 /// let x = GetBuildRequest::new().set_id("example");
6495 /// ```
6496 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6497 self.id = v.into();
6498 self
6499 }
6500}
6501
6502impl wkt::message::Message for GetBuildRequest {
6503 fn typename() -> &'static str {
6504 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildRequest"
6505 }
6506}
6507
6508/// Request to list builds.
6509#[derive(Clone, Default, PartialEq)]
6510#[non_exhaustive]
6511pub struct ListBuildsRequest {
6512 /// The parent of the collection of `Builds`.
6513 /// Format: `projects/{project}/locations/{location}`
6514 pub parent: std::string::String,
6515
6516 /// Required. ID of the project.
6517 pub project_id: std::string::String,
6518
6519 /// Number of results to return in the list.
6520 pub page_size: i32,
6521
6522 /// The page token for the next page of Builds.
6523 ///
6524 /// If unspecified, the first page of results is returned.
6525 ///
6526 /// If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
6527 /// In this case, the token should be discarded, and pagination should be
6528 /// restarted from the first page of results.
6529 ///
6530 /// See <https://google.aip.dev/158> for more.
6531 pub page_token: std::string::String,
6532
6533 /// The raw filter text to constrain the results.
6534 pub filter: std::string::String,
6535
6536 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6537}
6538
6539impl ListBuildsRequest {
6540 /// Creates a new default instance.
6541 pub fn new() -> Self {
6542 std::default::Default::default()
6543 }
6544
6545 /// Sets the value of [parent][crate::model::ListBuildsRequest::parent].
6546 ///
6547 /// # Example
6548 /// ```ignore,no_run
6549 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6550 /// let x = ListBuildsRequest::new().set_parent("example");
6551 /// ```
6552 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6553 self.parent = v.into();
6554 self
6555 }
6556
6557 /// Sets the value of [project_id][crate::model::ListBuildsRequest::project_id].
6558 ///
6559 /// # Example
6560 /// ```ignore,no_run
6561 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6562 /// let x = ListBuildsRequest::new().set_project_id("example");
6563 /// ```
6564 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6565 self.project_id = v.into();
6566 self
6567 }
6568
6569 /// Sets the value of [page_size][crate::model::ListBuildsRequest::page_size].
6570 ///
6571 /// # Example
6572 /// ```ignore,no_run
6573 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6574 /// let x = ListBuildsRequest::new().set_page_size(42);
6575 /// ```
6576 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6577 self.page_size = v.into();
6578 self
6579 }
6580
6581 /// Sets the value of [page_token][crate::model::ListBuildsRequest::page_token].
6582 ///
6583 /// # Example
6584 /// ```ignore,no_run
6585 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6586 /// let x = ListBuildsRequest::new().set_page_token("example");
6587 /// ```
6588 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6589 self.page_token = v.into();
6590 self
6591 }
6592
6593 /// Sets the value of [filter][crate::model::ListBuildsRequest::filter].
6594 ///
6595 /// # Example
6596 /// ```ignore,no_run
6597 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6598 /// let x = ListBuildsRequest::new().set_filter("example");
6599 /// ```
6600 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6601 self.filter = v.into();
6602 self
6603 }
6604}
6605
6606impl wkt::message::Message for ListBuildsRequest {
6607 fn typename() -> &'static str {
6608 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsRequest"
6609 }
6610}
6611
6612/// Response including listed builds.
6613#[derive(Clone, Default, PartialEq)]
6614#[non_exhaustive]
6615pub struct ListBuildsResponse {
6616 /// Builds will be sorted by `create_time`, descending.
6617 pub builds: std::vec::Vec<crate::model::Build>,
6618
6619 /// Token to receive the next page of results.
6620 /// This will be absent if the end of the response list has been reached.
6621 pub next_page_token: std::string::String,
6622
6623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6624}
6625
6626impl ListBuildsResponse {
6627 /// Creates a new default instance.
6628 pub fn new() -> Self {
6629 std::default::Default::default()
6630 }
6631
6632 /// Sets the value of [builds][crate::model::ListBuildsResponse::builds].
6633 ///
6634 /// # Example
6635 /// ```ignore,no_run
6636 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6637 /// use google_cloud_build_v1::model::Build;
6638 /// let x = ListBuildsResponse::new()
6639 /// .set_builds([
6640 /// Build::default()/* use setters */,
6641 /// Build::default()/* use (different) setters */,
6642 /// ]);
6643 /// ```
6644 pub fn set_builds<T, V>(mut self, v: T) -> Self
6645 where
6646 T: std::iter::IntoIterator<Item = V>,
6647 V: std::convert::Into<crate::model::Build>,
6648 {
6649 use std::iter::Iterator;
6650 self.builds = v.into_iter().map(|i| i.into()).collect();
6651 self
6652 }
6653
6654 /// Sets the value of [next_page_token][crate::model::ListBuildsResponse::next_page_token].
6655 ///
6656 /// # Example
6657 /// ```ignore,no_run
6658 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6659 /// let x = ListBuildsResponse::new().set_next_page_token("example");
6660 /// ```
6661 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6662 self.next_page_token = v.into();
6663 self
6664 }
6665}
6666
6667impl wkt::message::Message for ListBuildsResponse {
6668 fn typename() -> &'static str {
6669 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsResponse"
6670 }
6671}
6672
6673#[doc(hidden)]
6674impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildsResponse {
6675 type PageItem = crate::model::Build;
6676
6677 fn items(self) -> std::vec::Vec<Self::PageItem> {
6678 self.builds
6679 }
6680
6681 fn next_page_token(&self) -> std::string::String {
6682 use std::clone::Clone;
6683 self.next_page_token.clone()
6684 }
6685}
6686
6687/// Request to cancel an ongoing build.
6688#[derive(Clone, Default, PartialEq)]
6689#[non_exhaustive]
6690pub struct CancelBuildRequest {
6691 /// The name of the `Build` to cancel.
6692 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6693 pub name: std::string::String,
6694
6695 /// Required. ID of the project.
6696 pub project_id: std::string::String,
6697
6698 /// Required. ID of the build.
6699 pub id: std::string::String,
6700
6701 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6702}
6703
6704impl CancelBuildRequest {
6705 /// Creates a new default instance.
6706 pub fn new() -> Self {
6707 std::default::Default::default()
6708 }
6709
6710 /// Sets the value of [name][crate::model::CancelBuildRequest::name].
6711 ///
6712 /// # Example
6713 /// ```ignore,no_run
6714 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6715 /// let x = CancelBuildRequest::new().set_name("example");
6716 /// ```
6717 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6718 self.name = v.into();
6719 self
6720 }
6721
6722 /// Sets the value of [project_id][crate::model::CancelBuildRequest::project_id].
6723 ///
6724 /// # Example
6725 /// ```ignore,no_run
6726 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6727 /// let x = CancelBuildRequest::new().set_project_id("example");
6728 /// ```
6729 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6730 self.project_id = v.into();
6731 self
6732 }
6733
6734 /// Sets the value of [id][crate::model::CancelBuildRequest::id].
6735 ///
6736 /// # Example
6737 /// ```ignore,no_run
6738 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6739 /// let x = CancelBuildRequest::new().set_id("example");
6740 /// ```
6741 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6742 self.id = v.into();
6743 self
6744 }
6745}
6746
6747impl wkt::message::Message for CancelBuildRequest {
6748 fn typename() -> &'static str {
6749 "type.googleapis.com/google.devtools.cloudbuild.v1.CancelBuildRequest"
6750 }
6751}
6752
6753/// Request to approve or reject a pending build.
6754#[derive(Clone, Default, PartialEq)]
6755#[non_exhaustive]
6756pub struct ApproveBuildRequest {
6757 /// Required. Name of the target build.
6758 /// For example: "projects/{$project_id}/builds/{$build_id}"
6759 pub name: std::string::String,
6760
6761 /// Approval decision and metadata.
6762 pub approval_result: std::option::Option<crate::model::ApprovalResult>,
6763
6764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6765}
6766
6767impl ApproveBuildRequest {
6768 /// Creates a new default instance.
6769 pub fn new() -> Self {
6770 std::default::Default::default()
6771 }
6772
6773 /// Sets the value of [name][crate::model::ApproveBuildRequest::name].
6774 ///
6775 /// # Example
6776 /// ```ignore,no_run
6777 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6778 /// let x = ApproveBuildRequest::new().set_name("example");
6779 /// ```
6780 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6781 self.name = v.into();
6782 self
6783 }
6784
6785 /// Sets the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6786 ///
6787 /// # Example
6788 /// ```ignore,no_run
6789 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6790 /// use google_cloud_build_v1::model::ApprovalResult;
6791 /// let x = ApproveBuildRequest::new().set_approval_result(ApprovalResult::default()/* use setters */);
6792 /// ```
6793 pub fn set_approval_result<T>(mut self, v: T) -> Self
6794 where
6795 T: std::convert::Into<crate::model::ApprovalResult>,
6796 {
6797 self.approval_result = std::option::Option::Some(v.into());
6798 self
6799 }
6800
6801 /// Sets or clears the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6802 ///
6803 /// # Example
6804 /// ```ignore,no_run
6805 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6806 /// use google_cloud_build_v1::model::ApprovalResult;
6807 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(Some(ApprovalResult::default()/* use setters */));
6808 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(None::<ApprovalResult>);
6809 /// ```
6810 pub fn set_or_clear_approval_result<T>(mut self, v: std::option::Option<T>) -> Self
6811 where
6812 T: std::convert::Into<crate::model::ApprovalResult>,
6813 {
6814 self.approval_result = v.map(|x| x.into());
6815 self
6816 }
6817}
6818
6819impl wkt::message::Message for ApproveBuildRequest {
6820 fn typename() -> &'static str {
6821 "type.googleapis.com/google.devtools.cloudbuild.v1.ApproveBuildRequest"
6822 }
6823}
6824
6825/// BuildApproval describes a build's approval configuration, state, and
6826/// result.
6827#[derive(Clone, Default, PartialEq)]
6828#[non_exhaustive]
6829pub struct BuildApproval {
6830 /// Output only. The state of this build's approval.
6831 pub state: crate::model::build_approval::State,
6832
6833 /// Output only. Configuration for manual approval of this build.
6834 pub config: std::option::Option<crate::model::ApprovalConfig>,
6835
6836 /// Output only. Result of manual approval for this Build.
6837 pub result: std::option::Option<crate::model::ApprovalResult>,
6838
6839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6840}
6841
6842impl BuildApproval {
6843 /// Creates a new default instance.
6844 pub fn new() -> Self {
6845 std::default::Default::default()
6846 }
6847
6848 /// Sets the value of [state][crate::model::BuildApproval::state].
6849 ///
6850 /// # Example
6851 /// ```ignore,no_run
6852 /// # use google_cloud_build_v1::model::BuildApproval;
6853 /// use google_cloud_build_v1::model::build_approval::State;
6854 /// let x0 = BuildApproval::new().set_state(State::Pending);
6855 /// let x1 = BuildApproval::new().set_state(State::Approved);
6856 /// let x2 = BuildApproval::new().set_state(State::Rejected);
6857 /// ```
6858 pub fn set_state<T: std::convert::Into<crate::model::build_approval::State>>(
6859 mut self,
6860 v: T,
6861 ) -> Self {
6862 self.state = v.into();
6863 self
6864 }
6865
6866 /// Sets the value of [config][crate::model::BuildApproval::config].
6867 ///
6868 /// # Example
6869 /// ```ignore,no_run
6870 /// # use google_cloud_build_v1::model::BuildApproval;
6871 /// use google_cloud_build_v1::model::ApprovalConfig;
6872 /// let x = BuildApproval::new().set_config(ApprovalConfig::default()/* use setters */);
6873 /// ```
6874 pub fn set_config<T>(mut self, v: T) -> Self
6875 where
6876 T: std::convert::Into<crate::model::ApprovalConfig>,
6877 {
6878 self.config = std::option::Option::Some(v.into());
6879 self
6880 }
6881
6882 /// Sets or clears the value of [config][crate::model::BuildApproval::config].
6883 ///
6884 /// # Example
6885 /// ```ignore,no_run
6886 /// # use google_cloud_build_v1::model::BuildApproval;
6887 /// use google_cloud_build_v1::model::ApprovalConfig;
6888 /// let x = BuildApproval::new().set_or_clear_config(Some(ApprovalConfig::default()/* use setters */));
6889 /// let x = BuildApproval::new().set_or_clear_config(None::<ApprovalConfig>);
6890 /// ```
6891 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
6892 where
6893 T: std::convert::Into<crate::model::ApprovalConfig>,
6894 {
6895 self.config = v.map(|x| x.into());
6896 self
6897 }
6898
6899 /// Sets the value of [result][crate::model::BuildApproval::result].
6900 ///
6901 /// # Example
6902 /// ```ignore,no_run
6903 /// # use google_cloud_build_v1::model::BuildApproval;
6904 /// use google_cloud_build_v1::model::ApprovalResult;
6905 /// let x = BuildApproval::new().set_result(ApprovalResult::default()/* use setters */);
6906 /// ```
6907 pub fn set_result<T>(mut self, v: T) -> Self
6908 where
6909 T: std::convert::Into<crate::model::ApprovalResult>,
6910 {
6911 self.result = std::option::Option::Some(v.into());
6912 self
6913 }
6914
6915 /// Sets or clears the value of [result][crate::model::BuildApproval::result].
6916 ///
6917 /// # Example
6918 /// ```ignore,no_run
6919 /// # use google_cloud_build_v1::model::BuildApproval;
6920 /// use google_cloud_build_v1::model::ApprovalResult;
6921 /// let x = BuildApproval::new().set_or_clear_result(Some(ApprovalResult::default()/* use setters */));
6922 /// let x = BuildApproval::new().set_or_clear_result(None::<ApprovalResult>);
6923 /// ```
6924 pub fn set_or_clear_result<T>(mut self, v: std::option::Option<T>) -> Self
6925 where
6926 T: std::convert::Into<crate::model::ApprovalResult>,
6927 {
6928 self.result = v.map(|x| x.into());
6929 self
6930 }
6931}
6932
6933impl wkt::message::Message for BuildApproval {
6934 fn typename() -> &'static str {
6935 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildApproval"
6936 }
6937}
6938
6939/// Defines additional types related to [BuildApproval].
6940pub mod build_approval {
6941 #[allow(unused_imports)]
6942 use super::*;
6943
6944 /// Specifies the current state of a build's approval.
6945 ///
6946 /// # Working with unknown values
6947 ///
6948 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6949 /// additional enum variants at any time. Adding new variants is not considered
6950 /// a breaking change. Applications should write their code in anticipation of:
6951 ///
6952 /// - New values appearing in future releases of the client library, **and**
6953 /// - New values received dynamically, without application changes.
6954 ///
6955 /// Please consult the [Working with enums] section in the user guide for some
6956 /// guidelines.
6957 ///
6958 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6959 #[derive(Clone, Debug, PartialEq)]
6960 #[non_exhaustive]
6961 pub enum State {
6962 /// Default enum type. This should not be used.
6963 Unspecified,
6964 /// Build approval is pending.
6965 Pending,
6966 /// Build approval has been approved.
6967 Approved,
6968 /// Build approval has been rejected.
6969 Rejected,
6970 /// Build was cancelled while it was still pending approval.
6971 Cancelled,
6972 /// If set, the enum was initialized with an unknown value.
6973 ///
6974 /// Applications can examine the value using [State::value] or
6975 /// [State::name].
6976 UnknownValue(state::UnknownValue),
6977 }
6978
6979 #[doc(hidden)]
6980 pub mod state {
6981 #[allow(unused_imports)]
6982 use super::*;
6983 #[derive(Clone, Debug, PartialEq)]
6984 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6985 }
6986
6987 impl State {
6988 /// Gets the enum value.
6989 ///
6990 /// Returns `None` if the enum contains an unknown value deserialized from
6991 /// the string representation of enums.
6992 pub fn value(&self) -> std::option::Option<i32> {
6993 match self {
6994 Self::Unspecified => std::option::Option::Some(0),
6995 Self::Pending => std::option::Option::Some(1),
6996 Self::Approved => std::option::Option::Some(2),
6997 Self::Rejected => std::option::Option::Some(3),
6998 Self::Cancelled => std::option::Option::Some(5),
6999 Self::UnknownValue(u) => u.0.value(),
7000 }
7001 }
7002
7003 /// Gets the enum value as a string.
7004 ///
7005 /// Returns `None` if the enum contains an unknown value deserialized from
7006 /// the integer representation of enums.
7007 pub fn name(&self) -> std::option::Option<&str> {
7008 match self {
7009 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7010 Self::Pending => std::option::Option::Some("PENDING"),
7011 Self::Approved => std::option::Option::Some("APPROVED"),
7012 Self::Rejected => std::option::Option::Some("REJECTED"),
7013 Self::Cancelled => std::option::Option::Some("CANCELLED"),
7014 Self::UnknownValue(u) => u.0.name(),
7015 }
7016 }
7017 }
7018
7019 impl std::default::Default for State {
7020 fn default() -> Self {
7021 use std::convert::From;
7022 Self::from(0)
7023 }
7024 }
7025
7026 impl std::fmt::Display for State {
7027 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7028 wkt::internal::display_enum(f, self.name(), self.value())
7029 }
7030 }
7031
7032 impl std::convert::From<i32> for State {
7033 fn from(value: i32) -> Self {
7034 match value {
7035 0 => Self::Unspecified,
7036 1 => Self::Pending,
7037 2 => Self::Approved,
7038 3 => Self::Rejected,
7039 5 => Self::Cancelled,
7040 _ => Self::UnknownValue(state::UnknownValue(
7041 wkt::internal::UnknownEnumValue::Integer(value),
7042 )),
7043 }
7044 }
7045 }
7046
7047 impl std::convert::From<&str> for State {
7048 fn from(value: &str) -> Self {
7049 use std::string::ToString;
7050 match value {
7051 "STATE_UNSPECIFIED" => Self::Unspecified,
7052 "PENDING" => Self::Pending,
7053 "APPROVED" => Self::Approved,
7054 "REJECTED" => Self::Rejected,
7055 "CANCELLED" => Self::Cancelled,
7056 _ => Self::UnknownValue(state::UnknownValue(
7057 wkt::internal::UnknownEnumValue::String(value.to_string()),
7058 )),
7059 }
7060 }
7061 }
7062
7063 impl serde::ser::Serialize for State {
7064 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7065 where
7066 S: serde::Serializer,
7067 {
7068 match self {
7069 Self::Unspecified => serializer.serialize_i32(0),
7070 Self::Pending => serializer.serialize_i32(1),
7071 Self::Approved => serializer.serialize_i32(2),
7072 Self::Rejected => serializer.serialize_i32(3),
7073 Self::Cancelled => serializer.serialize_i32(5),
7074 Self::UnknownValue(u) => u.0.serialize(serializer),
7075 }
7076 }
7077 }
7078
7079 impl<'de> serde::de::Deserialize<'de> for State {
7080 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7081 where
7082 D: serde::Deserializer<'de>,
7083 {
7084 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7085 ".google.devtools.cloudbuild.v1.BuildApproval.State",
7086 ))
7087 }
7088 }
7089}
7090
7091/// ApprovalConfig describes configuration for manual approval of a build.
7092#[derive(Clone, Default, PartialEq)]
7093#[non_exhaustive]
7094pub struct ApprovalConfig {
7095 /// Whether or not approval is needed. If this is set on a build, it will
7096 /// become pending when created, and will need to be explicitly approved
7097 /// to start.
7098 pub approval_required: bool,
7099
7100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7101}
7102
7103impl ApprovalConfig {
7104 /// Creates a new default instance.
7105 pub fn new() -> Self {
7106 std::default::Default::default()
7107 }
7108
7109 /// Sets the value of [approval_required][crate::model::ApprovalConfig::approval_required].
7110 ///
7111 /// # Example
7112 /// ```ignore,no_run
7113 /// # use google_cloud_build_v1::model::ApprovalConfig;
7114 /// let x = ApprovalConfig::new().set_approval_required(true);
7115 /// ```
7116 pub fn set_approval_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7117 self.approval_required = v.into();
7118 self
7119 }
7120}
7121
7122impl wkt::message::Message for ApprovalConfig {
7123 fn typename() -> &'static str {
7124 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalConfig"
7125 }
7126}
7127
7128/// ApprovalResult describes the decision and associated metadata of a manual
7129/// approval of a build.
7130#[derive(Clone, Default, PartialEq)]
7131#[non_exhaustive]
7132pub struct ApprovalResult {
7133 /// Output only. Email of the user that called the ApproveBuild API to
7134 /// approve or reject a build at the time that the API was called.
7135 pub approver_account: std::string::String,
7136
7137 /// Output only. The time when the approval decision was made.
7138 pub approval_time: std::option::Option<wkt::Timestamp>,
7139
7140 /// Required. The decision of this manual approval.
7141 pub decision: crate::model::approval_result::Decision,
7142
7143 /// Optional. An optional comment for this manual approval result.
7144 pub comment: std::string::String,
7145
7146 /// Optional. An optional URL tied to this manual approval result. This field
7147 /// is essentially the same as comment, except that it will be rendered by the
7148 /// UI differently. An example use case is a link to an external job that
7149 /// approved this Build.
7150 pub url: std::string::String,
7151
7152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7153}
7154
7155impl ApprovalResult {
7156 /// Creates a new default instance.
7157 pub fn new() -> Self {
7158 std::default::Default::default()
7159 }
7160
7161 /// Sets the value of [approver_account][crate::model::ApprovalResult::approver_account].
7162 ///
7163 /// # Example
7164 /// ```ignore,no_run
7165 /// # use google_cloud_build_v1::model::ApprovalResult;
7166 /// let x = ApprovalResult::new().set_approver_account("example");
7167 /// ```
7168 pub fn set_approver_account<T: std::convert::Into<std::string::String>>(
7169 mut self,
7170 v: T,
7171 ) -> Self {
7172 self.approver_account = v.into();
7173 self
7174 }
7175
7176 /// Sets the value of [approval_time][crate::model::ApprovalResult::approval_time].
7177 ///
7178 /// # Example
7179 /// ```ignore,no_run
7180 /// # use google_cloud_build_v1::model::ApprovalResult;
7181 /// use wkt::Timestamp;
7182 /// let x = ApprovalResult::new().set_approval_time(Timestamp::default()/* use setters */);
7183 /// ```
7184 pub fn set_approval_time<T>(mut self, v: T) -> Self
7185 where
7186 T: std::convert::Into<wkt::Timestamp>,
7187 {
7188 self.approval_time = std::option::Option::Some(v.into());
7189 self
7190 }
7191
7192 /// Sets or clears the value of [approval_time][crate::model::ApprovalResult::approval_time].
7193 ///
7194 /// # Example
7195 /// ```ignore,no_run
7196 /// # use google_cloud_build_v1::model::ApprovalResult;
7197 /// use wkt::Timestamp;
7198 /// let x = ApprovalResult::new().set_or_clear_approval_time(Some(Timestamp::default()/* use setters */));
7199 /// let x = ApprovalResult::new().set_or_clear_approval_time(None::<Timestamp>);
7200 /// ```
7201 pub fn set_or_clear_approval_time<T>(mut self, v: std::option::Option<T>) -> Self
7202 where
7203 T: std::convert::Into<wkt::Timestamp>,
7204 {
7205 self.approval_time = v.map(|x| x.into());
7206 self
7207 }
7208
7209 /// Sets the value of [decision][crate::model::ApprovalResult::decision].
7210 ///
7211 /// # Example
7212 /// ```ignore,no_run
7213 /// # use google_cloud_build_v1::model::ApprovalResult;
7214 /// use google_cloud_build_v1::model::approval_result::Decision;
7215 /// let x0 = ApprovalResult::new().set_decision(Decision::Approved);
7216 /// let x1 = ApprovalResult::new().set_decision(Decision::Rejected);
7217 /// ```
7218 pub fn set_decision<T: std::convert::Into<crate::model::approval_result::Decision>>(
7219 mut self,
7220 v: T,
7221 ) -> Self {
7222 self.decision = v.into();
7223 self
7224 }
7225
7226 /// Sets the value of [comment][crate::model::ApprovalResult::comment].
7227 ///
7228 /// # Example
7229 /// ```ignore,no_run
7230 /// # use google_cloud_build_v1::model::ApprovalResult;
7231 /// let x = ApprovalResult::new().set_comment("example");
7232 /// ```
7233 pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7234 self.comment = v.into();
7235 self
7236 }
7237
7238 /// Sets the value of [url][crate::model::ApprovalResult::url].
7239 ///
7240 /// # Example
7241 /// ```ignore,no_run
7242 /// # use google_cloud_build_v1::model::ApprovalResult;
7243 /// let x = ApprovalResult::new().set_url("example");
7244 /// ```
7245 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7246 self.url = v.into();
7247 self
7248 }
7249}
7250
7251impl wkt::message::Message for ApprovalResult {
7252 fn typename() -> &'static str {
7253 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalResult"
7254 }
7255}
7256
7257/// Defines additional types related to [ApprovalResult].
7258pub mod approval_result {
7259 #[allow(unused_imports)]
7260 use super::*;
7261
7262 /// Specifies whether or not this manual approval result is to approve
7263 /// or reject a build.
7264 ///
7265 /// # Working with unknown values
7266 ///
7267 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7268 /// additional enum variants at any time. Adding new variants is not considered
7269 /// a breaking change. Applications should write their code in anticipation of:
7270 ///
7271 /// - New values appearing in future releases of the client library, **and**
7272 /// - New values received dynamically, without application changes.
7273 ///
7274 /// Please consult the [Working with enums] section in the user guide for some
7275 /// guidelines.
7276 ///
7277 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7278 #[derive(Clone, Debug, PartialEq)]
7279 #[non_exhaustive]
7280 pub enum Decision {
7281 /// Default enum type. This should not be used.
7282 Unspecified,
7283 /// Build is approved.
7284 Approved,
7285 /// Build is rejected.
7286 Rejected,
7287 /// If set, the enum was initialized with an unknown value.
7288 ///
7289 /// Applications can examine the value using [Decision::value] or
7290 /// [Decision::name].
7291 UnknownValue(decision::UnknownValue),
7292 }
7293
7294 #[doc(hidden)]
7295 pub mod decision {
7296 #[allow(unused_imports)]
7297 use super::*;
7298 #[derive(Clone, Debug, PartialEq)]
7299 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7300 }
7301
7302 impl Decision {
7303 /// Gets the enum value.
7304 ///
7305 /// Returns `None` if the enum contains an unknown value deserialized from
7306 /// the string representation of enums.
7307 pub fn value(&self) -> std::option::Option<i32> {
7308 match self {
7309 Self::Unspecified => std::option::Option::Some(0),
7310 Self::Approved => std::option::Option::Some(1),
7311 Self::Rejected => std::option::Option::Some(2),
7312 Self::UnknownValue(u) => u.0.value(),
7313 }
7314 }
7315
7316 /// Gets the enum value as a string.
7317 ///
7318 /// Returns `None` if the enum contains an unknown value deserialized from
7319 /// the integer representation of enums.
7320 pub fn name(&self) -> std::option::Option<&str> {
7321 match self {
7322 Self::Unspecified => std::option::Option::Some("DECISION_UNSPECIFIED"),
7323 Self::Approved => std::option::Option::Some("APPROVED"),
7324 Self::Rejected => std::option::Option::Some("REJECTED"),
7325 Self::UnknownValue(u) => u.0.name(),
7326 }
7327 }
7328 }
7329
7330 impl std::default::Default for Decision {
7331 fn default() -> Self {
7332 use std::convert::From;
7333 Self::from(0)
7334 }
7335 }
7336
7337 impl std::fmt::Display for Decision {
7338 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7339 wkt::internal::display_enum(f, self.name(), self.value())
7340 }
7341 }
7342
7343 impl std::convert::From<i32> for Decision {
7344 fn from(value: i32) -> Self {
7345 match value {
7346 0 => Self::Unspecified,
7347 1 => Self::Approved,
7348 2 => Self::Rejected,
7349 _ => Self::UnknownValue(decision::UnknownValue(
7350 wkt::internal::UnknownEnumValue::Integer(value),
7351 )),
7352 }
7353 }
7354 }
7355
7356 impl std::convert::From<&str> for Decision {
7357 fn from(value: &str) -> Self {
7358 use std::string::ToString;
7359 match value {
7360 "DECISION_UNSPECIFIED" => Self::Unspecified,
7361 "APPROVED" => Self::Approved,
7362 "REJECTED" => Self::Rejected,
7363 _ => Self::UnknownValue(decision::UnknownValue(
7364 wkt::internal::UnknownEnumValue::String(value.to_string()),
7365 )),
7366 }
7367 }
7368 }
7369
7370 impl serde::ser::Serialize for Decision {
7371 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7372 where
7373 S: serde::Serializer,
7374 {
7375 match self {
7376 Self::Unspecified => serializer.serialize_i32(0),
7377 Self::Approved => serializer.serialize_i32(1),
7378 Self::Rejected => serializer.serialize_i32(2),
7379 Self::UnknownValue(u) => u.0.serialize(serializer),
7380 }
7381 }
7382 }
7383
7384 impl<'de> serde::de::Deserialize<'de> for Decision {
7385 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7386 where
7387 D: serde::Deserializer<'de>,
7388 {
7389 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Decision>::new(
7390 ".google.devtools.cloudbuild.v1.ApprovalResult.Decision",
7391 ))
7392 }
7393 }
7394}
7395
7396/// GitRepoSource describes a repo and ref of a code repository.
7397#[derive(Clone, Default, PartialEq)]
7398#[non_exhaustive]
7399pub struct GitRepoSource {
7400 /// The URI of the repo (e.g. <https://github.com/user/repo.git>).
7401 /// Either `uri` or `repository` can be specified and is required.
7402 pub uri: std::string::String,
7403
7404 /// The branch or tag to use. Must start with "refs/" (required).
7405 pub r#ref: std::string::String,
7406
7407 /// See RepoType below.
7408 pub repo_type: crate::model::git_file_source::RepoType,
7409
7410 /// The source of the SCM repo.
7411 pub source: std::option::Option<crate::model::git_repo_source::Source>,
7412
7413 /// The resource name of the enterprise config that should be applied
7414 /// to this source.
7415 pub enterprise_config: std::option::Option<crate::model::git_repo_source::EnterpriseConfig>,
7416
7417 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7418}
7419
7420impl GitRepoSource {
7421 /// Creates a new default instance.
7422 pub fn new() -> Self {
7423 std::default::Default::default()
7424 }
7425
7426 /// Sets the value of [uri][crate::model::GitRepoSource::uri].
7427 ///
7428 /// # Example
7429 /// ```ignore,no_run
7430 /// # use google_cloud_build_v1::model::GitRepoSource;
7431 /// let x = GitRepoSource::new().set_uri("example");
7432 /// ```
7433 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7434 self.uri = v.into();
7435 self
7436 }
7437
7438 /// Sets the value of [r#ref][crate::model::GitRepoSource::ref].
7439 ///
7440 /// # Example
7441 /// ```ignore,no_run
7442 /// # use google_cloud_build_v1::model::GitRepoSource;
7443 /// let x = GitRepoSource::new().set_ref("example");
7444 /// ```
7445 pub fn set_ref<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7446 self.r#ref = v.into();
7447 self
7448 }
7449
7450 /// Sets the value of [repo_type][crate::model::GitRepoSource::repo_type].
7451 ///
7452 /// # Example
7453 /// ```ignore,no_run
7454 /// # use google_cloud_build_v1::model::GitRepoSource;
7455 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7456 /// let x0 = GitRepoSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7457 /// let x1 = GitRepoSource::new().set_repo_type(RepoType::Github);
7458 /// let x2 = GitRepoSource::new().set_repo_type(RepoType::BitbucketServer);
7459 /// ```
7460 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7461 mut self,
7462 v: T,
7463 ) -> Self {
7464 self.repo_type = v.into();
7465 self
7466 }
7467
7468 /// Sets the value of [source][crate::model::GitRepoSource::source].
7469 ///
7470 /// Note that all the setters affecting `source` are mutually
7471 /// exclusive.
7472 ///
7473 /// # Example
7474 /// ```ignore,no_run
7475 /// # use google_cloud_build_v1::model::GitRepoSource;
7476 /// use google_cloud_build_v1::model::git_repo_source::Source;
7477 /// let x = GitRepoSource::new().set_source(Some(Source::Repository("example".to_string())));
7478 /// ```
7479 pub fn set_source<
7480 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::Source>>,
7481 >(
7482 mut self,
7483 v: T,
7484 ) -> Self {
7485 self.source = v.into();
7486 self
7487 }
7488
7489 /// The value of [source][crate::model::GitRepoSource::source]
7490 /// if it holds a `Repository`, `None` if the field is not set or
7491 /// holds a different branch.
7492 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7493 #[allow(unreachable_patterns)]
7494 self.source.as_ref().and_then(|v| match v {
7495 crate::model::git_repo_source::Source::Repository(v) => std::option::Option::Some(v),
7496 _ => std::option::Option::None,
7497 })
7498 }
7499
7500 /// Sets the value of [source][crate::model::GitRepoSource::source]
7501 /// to hold a `Repository`.
7502 ///
7503 /// Note that all the setters affecting `source` 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_repository("example");
7510 /// assert!(x.repository().is_some());
7511 /// ```
7512 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7513 self.source =
7514 std::option::Option::Some(crate::model::git_repo_source::Source::Repository(v.into()));
7515 self
7516 }
7517
7518 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config].
7519 ///
7520 /// Note that all the setters affecting `enterprise_config` are mutually
7521 /// exclusive.
7522 ///
7523 /// # Example
7524 /// ```ignore,no_run
7525 /// # use google_cloud_build_v1::model::GitRepoSource;
7526 /// use google_cloud_build_v1::model::git_repo_source::EnterpriseConfig;
7527 /// let x = GitRepoSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7528 /// ```
7529 pub fn set_enterprise_config<
7530 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::EnterpriseConfig>>,
7531 >(
7532 mut self,
7533 v: T,
7534 ) -> Self {
7535 self.enterprise_config = v.into();
7536 self
7537 }
7538
7539 /// The value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7540 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7541 /// holds a different branch.
7542 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7543 #[allow(unreachable_patterns)]
7544 self.enterprise_config.as_ref().and_then(|v| match v {
7545 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7546 std::option::Option::Some(v)
7547 }
7548 _ => std::option::Option::None,
7549 })
7550 }
7551
7552 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7553 /// to hold a `GithubEnterpriseConfig`.
7554 ///
7555 /// Note that all the setters affecting `enterprise_config` are
7556 /// mutually exclusive.
7557 ///
7558 /// # Example
7559 /// ```ignore,no_run
7560 /// # use google_cloud_build_v1::model::GitRepoSource;
7561 /// let x = GitRepoSource::new().set_github_enterprise_config("example");
7562 /// assert!(x.github_enterprise_config().is_some());
7563 /// ```
7564 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7565 mut self,
7566 v: T,
7567 ) -> Self {
7568 self.enterprise_config = std::option::Option::Some(
7569 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7570 );
7571 self
7572 }
7573}
7574
7575impl wkt::message::Message for GitRepoSource {
7576 fn typename() -> &'static str {
7577 "type.googleapis.com/google.devtools.cloudbuild.v1.GitRepoSource"
7578 }
7579}
7580
7581/// Defines additional types related to [GitRepoSource].
7582pub mod git_repo_source {
7583 #[allow(unused_imports)]
7584 use super::*;
7585
7586 /// The source of the SCM repo.
7587 #[derive(Clone, Debug, PartialEq)]
7588 #[non_exhaustive]
7589 pub enum Source {
7590 /// The connected repository resource name, in the format
7591 /// `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or
7592 /// `repository` can be specified and is required.
7593 Repository(std::string::String),
7594 }
7595
7596 /// The resource name of the enterprise config that should be applied
7597 /// to this source.
7598 #[derive(Clone, Debug, PartialEq)]
7599 #[non_exhaustive]
7600 pub enum EnterpriseConfig {
7601 /// The full resource name of the github enterprise config.
7602 /// Format:
7603 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7604 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7605 GithubEnterpriseConfig(std::string::String),
7606 }
7607}
7608
7609/// GitFileSource describes a file within a (possibly remote) code repository.
7610#[derive(Clone, Default, PartialEq)]
7611#[non_exhaustive]
7612pub struct GitFileSource {
7613 /// The path of the file, with the repo root as the root of the path.
7614 pub path: std::string::String,
7615
7616 /// The URI of the repo.
7617 /// Either uri or repository can be specified.
7618 /// If unspecified, the repo from which the trigger invocation originated is
7619 /// assumed to be the repo from which to read the specified path.
7620 pub uri: std::string::String,
7621
7622 /// See RepoType above.
7623 pub repo_type: crate::model::git_file_source::RepoType,
7624
7625 /// The branch, tag, arbitrary ref, or SHA version of the repo to use when
7626 /// resolving the filename (optional).
7627 /// This field respects the same syntax/resolution as described here:
7628 /// <https://git-scm.com/docs/gitrevisions>
7629 /// If unspecified, the revision from which the trigger invocation originated
7630 /// is assumed to be the revision from which to read the specified path.
7631 pub revision: std::string::String,
7632
7633 /// The source of the SCM repo.
7634 pub source: std::option::Option<crate::model::git_file_source::Source>,
7635
7636 /// The resource name of the enterprise config that should be applied
7637 /// to this source.
7638 pub enterprise_config: std::option::Option<crate::model::git_file_source::EnterpriseConfig>,
7639
7640 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7641}
7642
7643impl GitFileSource {
7644 /// Creates a new default instance.
7645 pub fn new() -> Self {
7646 std::default::Default::default()
7647 }
7648
7649 /// Sets the value of [path][crate::model::GitFileSource::path].
7650 ///
7651 /// # Example
7652 /// ```ignore,no_run
7653 /// # use google_cloud_build_v1::model::GitFileSource;
7654 /// let x = GitFileSource::new().set_path("example");
7655 /// ```
7656 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7657 self.path = v.into();
7658 self
7659 }
7660
7661 /// Sets the value of [uri][crate::model::GitFileSource::uri].
7662 ///
7663 /// # Example
7664 /// ```ignore,no_run
7665 /// # use google_cloud_build_v1::model::GitFileSource;
7666 /// let x = GitFileSource::new().set_uri("example");
7667 /// ```
7668 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7669 self.uri = v.into();
7670 self
7671 }
7672
7673 /// Sets the value of [repo_type][crate::model::GitFileSource::repo_type].
7674 ///
7675 /// # Example
7676 /// ```ignore,no_run
7677 /// # use google_cloud_build_v1::model::GitFileSource;
7678 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7679 /// let x0 = GitFileSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7680 /// let x1 = GitFileSource::new().set_repo_type(RepoType::Github);
7681 /// let x2 = GitFileSource::new().set_repo_type(RepoType::BitbucketServer);
7682 /// ```
7683 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7684 mut self,
7685 v: T,
7686 ) -> Self {
7687 self.repo_type = v.into();
7688 self
7689 }
7690
7691 /// Sets the value of [revision][crate::model::GitFileSource::revision].
7692 ///
7693 /// # Example
7694 /// ```ignore,no_run
7695 /// # use google_cloud_build_v1::model::GitFileSource;
7696 /// let x = GitFileSource::new().set_revision("example");
7697 /// ```
7698 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7699 self.revision = v.into();
7700 self
7701 }
7702
7703 /// Sets the value of [source][crate::model::GitFileSource::source].
7704 ///
7705 /// Note that all the setters affecting `source` are mutually
7706 /// exclusive.
7707 ///
7708 /// # Example
7709 /// ```ignore,no_run
7710 /// # use google_cloud_build_v1::model::GitFileSource;
7711 /// use google_cloud_build_v1::model::git_file_source::Source;
7712 /// let x = GitFileSource::new().set_source(Some(Source::Repository("example".to_string())));
7713 /// ```
7714 pub fn set_source<
7715 T: std::convert::Into<std::option::Option<crate::model::git_file_source::Source>>,
7716 >(
7717 mut self,
7718 v: T,
7719 ) -> Self {
7720 self.source = v.into();
7721 self
7722 }
7723
7724 /// The value of [source][crate::model::GitFileSource::source]
7725 /// if it holds a `Repository`, `None` if the field is not set or
7726 /// holds a different branch.
7727 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7728 #[allow(unreachable_patterns)]
7729 self.source.as_ref().and_then(|v| match v {
7730 crate::model::git_file_source::Source::Repository(v) => std::option::Option::Some(v),
7731 _ => std::option::Option::None,
7732 })
7733 }
7734
7735 /// Sets the value of [source][crate::model::GitFileSource::source]
7736 /// to hold a `Repository`.
7737 ///
7738 /// Note that all the setters affecting `source` are
7739 /// mutually exclusive.
7740 ///
7741 /// # Example
7742 /// ```ignore,no_run
7743 /// # use google_cloud_build_v1::model::GitFileSource;
7744 /// let x = GitFileSource::new().set_repository("example");
7745 /// assert!(x.repository().is_some());
7746 /// ```
7747 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7748 self.source =
7749 std::option::Option::Some(crate::model::git_file_source::Source::Repository(v.into()));
7750 self
7751 }
7752
7753 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config].
7754 ///
7755 /// Note that all the setters affecting `enterprise_config` are mutually
7756 /// exclusive.
7757 ///
7758 /// # Example
7759 /// ```ignore,no_run
7760 /// # use google_cloud_build_v1::model::GitFileSource;
7761 /// use google_cloud_build_v1::model::git_file_source::EnterpriseConfig;
7762 /// let x = GitFileSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7763 /// ```
7764 pub fn set_enterprise_config<
7765 T: std::convert::Into<std::option::Option<crate::model::git_file_source::EnterpriseConfig>>,
7766 >(
7767 mut self,
7768 v: T,
7769 ) -> Self {
7770 self.enterprise_config = v.into();
7771 self
7772 }
7773
7774 /// The value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7775 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7776 /// holds a different branch.
7777 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7778 #[allow(unreachable_patterns)]
7779 self.enterprise_config.as_ref().and_then(|v| match v {
7780 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7781 std::option::Option::Some(v)
7782 }
7783 _ => std::option::Option::None,
7784 })
7785 }
7786
7787 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7788 /// to hold a `GithubEnterpriseConfig`.
7789 ///
7790 /// Note that all the setters affecting `enterprise_config` are
7791 /// mutually exclusive.
7792 ///
7793 /// # Example
7794 /// ```ignore,no_run
7795 /// # use google_cloud_build_v1::model::GitFileSource;
7796 /// let x = GitFileSource::new().set_github_enterprise_config("example");
7797 /// assert!(x.github_enterprise_config().is_some());
7798 /// ```
7799 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7800 mut self,
7801 v: T,
7802 ) -> Self {
7803 self.enterprise_config = std::option::Option::Some(
7804 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7805 );
7806 self
7807 }
7808}
7809
7810impl wkt::message::Message for GitFileSource {
7811 fn typename() -> &'static str {
7812 "type.googleapis.com/google.devtools.cloudbuild.v1.GitFileSource"
7813 }
7814}
7815
7816/// Defines additional types related to [GitFileSource].
7817pub mod git_file_source {
7818 #[allow(unused_imports)]
7819 use super::*;
7820
7821 /// The type of the repo, since it may not be explicit from the `repo` field
7822 /// (e.g from a URL).
7823 ///
7824 /// # Working with unknown values
7825 ///
7826 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7827 /// additional enum variants at any time. Adding new variants is not considered
7828 /// a breaking change. Applications should write their code in anticipation of:
7829 ///
7830 /// - New values appearing in future releases of the client library, **and**
7831 /// - New values received dynamically, without application changes.
7832 ///
7833 /// Please consult the [Working with enums] section in the user guide for some
7834 /// guidelines.
7835 ///
7836 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7837 #[derive(Clone, Debug, PartialEq)]
7838 #[non_exhaustive]
7839 pub enum RepoType {
7840 /// The default, unknown repo type. Don't use it, instead use one of
7841 /// the other repo types.
7842 Unknown,
7843 /// A Google Cloud Source Repositories-hosted repo.
7844 CloudSourceRepositories,
7845 /// A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub
7846 /// Enterprise).
7847 Github,
7848 /// A Bitbucket Server-hosted repo.
7849 BitbucketServer,
7850 /// A GitLab-hosted repo.
7851 Gitlab,
7852 /// If set, the enum was initialized with an unknown value.
7853 ///
7854 /// Applications can examine the value using [RepoType::value] or
7855 /// [RepoType::name].
7856 UnknownValue(repo_type::UnknownValue),
7857 }
7858
7859 #[doc(hidden)]
7860 pub mod repo_type {
7861 #[allow(unused_imports)]
7862 use super::*;
7863 #[derive(Clone, Debug, PartialEq)]
7864 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7865 }
7866
7867 impl RepoType {
7868 /// Gets the enum value.
7869 ///
7870 /// Returns `None` if the enum contains an unknown value deserialized from
7871 /// the string representation of enums.
7872 pub fn value(&self) -> std::option::Option<i32> {
7873 match self {
7874 Self::Unknown => std::option::Option::Some(0),
7875 Self::CloudSourceRepositories => std::option::Option::Some(1),
7876 Self::Github => std::option::Option::Some(2),
7877 Self::BitbucketServer => std::option::Option::Some(3),
7878 Self::Gitlab => std::option::Option::Some(4),
7879 Self::UnknownValue(u) => u.0.value(),
7880 }
7881 }
7882
7883 /// Gets the enum value as a string.
7884 ///
7885 /// Returns `None` if the enum contains an unknown value deserialized from
7886 /// the integer representation of enums.
7887 pub fn name(&self) -> std::option::Option<&str> {
7888 match self {
7889 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7890 Self::CloudSourceRepositories => {
7891 std::option::Option::Some("CLOUD_SOURCE_REPOSITORIES")
7892 }
7893 Self::Github => std::option::Option::Some("GITHUB"),
7894 Self::BitbucketServer => std::option::Option::Some("BITBUCKET_SERVER"),
7895 Self::Gitlab => std::option::Option::Some("GITLAB"),
7896 Self::UnknownValue(u) => u.0.name(),
7897 }
7898 }
7899 }
7900
7901 impl std::default::Default for RepoType {
7902 fn default() -> Self {
7903 use std::convert::From;
7904 Self::from(0)
7905 }
7906 }
7907
7908 impl std::fmt::Display for RepoType {
7909 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7910 wkt::internal::display_enum(f, self.name(), self.value())
7911 }
7912 }
7913
7914 impl std::convert::From<i32> for RepoType {
7915 fn from(value: i32) -> Self {
7916 match value {
7917 0 => Self::Unknown,
7918 1 => Self::CloudSourceRepositories,
7919 2 => Self::Github,
7920 3 => Self::BitbucketServer,
7921 4 => Self::Gitlab,
7922 _ => Self::UnknownValue(repo_type::UnknownValue(
7923 wkt::internal::UnknownEnumValue::Integer(value),
7924 )),
7925 }
7926 }
7927 }
7928
7929 impl std::convert::From<&str> for RepoType {
7930 fn from(value: &str) -> Self {
7931 use std::string::ToString;
7932 match value {
7933 "UNKNOWN" => Self::Unknown,
7934 "CLOUD_SOURCE_REPOSITORIES" => Self::CloudSourceRepositories,
7935 "GITHUB" => Self::Github,
7936 "BITBUCKET_SERVER" => Self::BitbucketServer,
7937 "GITLAB" => Self::Gitlab,
7938 _ => Self::UnknownValue(repo_type::UnknownValue(
7939 wkt::internal::UnknownEnumValue::String(value.to_string()),
7940 )),
7941 }
7942 }
7943 }
7944
7945 impl serde::ser::Serialize for RepoType {
7946 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7947 where
7948 S: serde::Serializer,
7949 {
7950 match self {
7951 Self::Unknown => serializer.serialize_i32(0),
7952 Self::CloudSourceRepositories => serializer.serialize_i32(1),
7953 Self::Github => serializer.serialize_i32(2),
7954 Self::BitbucketServer => serializer.serialize_i32(3),
7955 Self::Gitlab => serializer.serialize_i32(4),
7956 Self::UnknownValue(u) => u.0.serialize(serializer),
7957 }
7958 }
7959 }
7960
7961 impl<'de> serde::de::Deserialize<'de> for RepoType {
7962 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7963 where
7964 D: serde::Deserializer<'de>,
7965 {
7966 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepoType>::new(
7967 ".google.devtools.cloudbuild.v1.GitFileSource.RepoType",
7968 ))
7969 }
7970 }
7971
7972 /// The source of the SCM repo.
7973 #[derive(Clone, Debug, PartialEq)]
7974 #[non_exhaustive]
7975 pub enum Source {
7976 /// The fully qualified resource name of the Repos API repository.
7977 /// Either URI or repository can be specified.
7978 /// If unspecified, the repo from which the trigger invocation originated is
7979 /// assumed to be the repo from which to read the specified path.
7980 Repository(std::string::String),
7981 }
7982
7983 /// The resource name of the enterprise config that should be applied
7984 /// to this source.
7985 #[derive(Clone, Debug, PartialEq)]
7986 #[non_exhaustive]
7987 pub enum EnterpriseConfig {
7988 /// The full resource name of the github enterprise config.
7989 /// Format:
7990 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7991 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7992 GithubEnterpriseConfig(std::string::String),
7993 }
7994}
7995
7996/// Configuration for an automated build in response to source repository
7997/// changes.
7998#[derive(Clone, Default, PartialEq)]
7999#[non_exhaustive]
8000pub struct BuildTrigger {
8001 /// The `Trigger` name with format:
8002 /// `projects/{project}/locations/{location}/triggers/{trigger}`, where
8003 /// {trigger} is a unique identifier generated by the service.
8004 pub resource_name: std::string::String,
8005
8006 /// Output only. Unique identifier of the trigger.
8007 pub id: std::string::String,
8008
8009 /// Human-readable description of this trigger.
8010 pub description: std::string::String,
8011
8012 /// User-assigned name of the trigger. Must be unique within the project.
8013 /// Trigger names must meet the following requirements:
8014 ///
8015 /// + They must contain only alphanumeric characters and dashes.
8016 /// + They can be 1-64 characters long.
8017 /// + They must begin and end with an alphanumeric character.
8018 pub name: std::string::String,
8019
8020 /// Tags for annotation of a `BuildTrigger`
8021 pub tags: std::vec::Vec<std::string::String>,
8022
8023 /// Template describing the types of source changes to trigger a build.
8024 ///
8025 /// Branch and tag names in trigger templates are interpreted as regular
8026 /// expressions. Any branch or tag change that matches that regular expression
8027 /// will trigger a build.
8028 ///
8029 /// Mutually exclusive with `github`.
8030 pub trigger_template: std::option::Option<crate::model::RepoSource>,
8031
8032 /// GitHubEventsConfig describes the configuration of a trigger that creates
8033 /// a build whenever a GitHub event is received.
8034 ///
8035 /// Mutually exclusive with `trigger_template`.
8036 pub github: std::option::Option<crate::model::GitHubEventsConfig>,
8037
8038 /// PubsubConfig describes the configuration of a trigger that
8039 /// creates a build whenever a Pub/Sub message is published.
8040 pub pubsub_config: std::option::Option<crate::model::PubsubConfig>,
8041
8042 /// WebhookConfig describes the configuration of a trigger that
8043 /// creates a build whenever a webhook is sent to a trigger's webhook URL.
8044 pub webhook_config: std::option::Option<crate::model::WebhookConfig>,
8045
8046 /// Output only. Time when the trigger was created.
8047 pub create_time: std::option::Option<wkt::Timestamp>,
8048
8049 /// If true, the trigger will never automatically execute a build.
8050 pub disabled: bool,
8051
8052 /// Substitutions for Build resource. The keys must match the following
8053 /// regular expression: `^_[A-Z0-9_]+$`.
8054 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
8055
8056 /// ignored_files and included_files are file glob matches using
8057 /// <https://golang.org/pkg/path/filepath/#Match> extended with support for "**".
8058 ///
8059 /// If ignored_files and changed files are both empty, then they are
8060 /// not used to determine whether or not to trigger a build.
8061 ///
8062 /// If ignored_files is not empty, then we ignore any files that match
8063 /// any of the ignored_file globs. If the change has no files that are
8064 /// outside of the ignored_files globs, then we do not trigger a build.
8065 pub ignored_files: std::vec::Vec<std::string::String>,
8066
8067 /// If any of the files altered in the commit pass the ignored_files
8068 /// filter and included_files is empty, then as far as this filter is
8069 /// concerned, we should trigger the build.
8070 ///
8071 /// If any of the files altered in the commit pass the ignored_files
8072 /// filter and included_files is not empty, then we make sure that at
8073 /// least one of those files matches a included_files glob. If not,
8074 /// then we do not trigger a build.
8075 pub included_files: std::vec::Vec<std::string::String>,
8076
8077 /// Optional. A Common Expression Language string.
8078 pub filter: std::string::String,
8079
8080 /// The repo and ref of the repository from which to build. This field
8081 /// is used only for those triggers that do not respond to SCM events.
8082 /// Triggers that respond to such events build source at whatever commit
8083 /// caused the event.
8084 /// This field is currently only used by Webhook, Pub/Sub, Manual, and Cron
8085 /// triggers.
8086 pub source_to_build: std::option::Option<crate::model::GitRepoSource>,
8087
8088 /// The service account used for all user-controlled operations including
8089 /// UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
8090 /// If no service account is set and the legacy Cloud Build service account
8091 /// (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the
8092 /// project then it will be used instead.
8093 /// Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
8094 pub service_account: std::string::String,
8095
8096 /// The configuration of a trigger that creates a build whenever an event from
8097 /// Repo API is received.
8098 pub repository_event_config: std::option::Option<crate::model::RepositoryEventConfig>,
8099
8100 /// Template describing the Build request to make when the trigger is matched.
8101 /// At least one of the template fields must be provided.
8102 pub build_template: std::option::Option<crate::model::build_trigger::BuildTemplate>,
8103
8104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8105}
8106
8107impl BuildTrigger {
8108 /// Creates a new default instance.
8109 pub fn new() -> Self {
8110 std::default::Default::default()
8111 }
8112
8113 /// Sets the value of [resource_name][crate::model::BuildTrigger::resource_name].
8114 ///
8115 /// # Example
8116 /// ```ignore,no_run
8117 /// # use google_cloud_build_v1::model::BuildTrigger;
8118 /// let x = BuildTrigger::new().set_resource_name("example");
8119 /// ```
8120 pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8121 self.resource_name = v.into();
8122 self
8123 }
8124
8125 /// Sets the value of [id][crate::model::BuildTrigger::id].
8126 ///
8127 /// # Example
8128 /// ```ignore,no_run
8129 /// # use google_cloud_build_v1::model::BuildTrigger;
8130 /// let x = BuildTrigger::new().set_id("example");
8131 /// ```
8132 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8133 self.id = v.into();
8134 self
8135 }
8136
8137 /// Sets the value of [description][crate::model::BuildTrigger::description].
8138 ///
8139 /// # Example
8140 /// ```ignore,no_run
8141 /// # use google_cloud_build_v1::model::BuildTrigger;
8142 /// let x = BuildTrigger::new().set_description("example");
8143 /// ```
8144 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8145 self.description = v.into();
8146 self
8147 }
8148
8149 /// Sets the value of [name][crate::model::BuildTrigger::name].
8150 ///
8151 /// # Example
8152 /// ```ignore,no_run
8153 /// # use google_cloud_build_v1::model::BuildTrigger;
8154 /// let x = BuildTrigger::new().set_name("example");
8155 /// ```
8156 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8157 self.name = v.into();
8158 self
8159 }
8160
8161 /// Sets the value of [tags][crate::model::BuildTrigger::tags].
8162 ///
8163 /// # Example
8164 /// ```ignore,no_run
8165 /// # use google_cloud_build_v1::model::BuildTrigger;
8166 /// let x = BuildTrigger::new().set_tags(["a", "b", "c"]);
8167 /// ```
8168 pub fn set_tags<T, V>(mut self, v: T) -> Self
8169 where
8170 T: std::iter::IntoIterator<Item = V>,
8171 V: std::convert::Into<std::string::String>,
8172 {
8173 use std::iter::Iterator;
8174 self.tags = v.into_iter().map(|i| i.into()).collect();
8175 self
8176 }
8177
8178 /// Sets the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8179 ///
8180 /// # Example
8181 /// ```ignore,no_run
8182 /// # use google_cloud_build_v1::model::BuildTrigger;
8183 /// use google_cloud_build_v1::model::RepoSource;
8184 /// let x = BuildTrigger::new().set_trigger_template(RepoSource::default()/* use setters */);
8185 /// ```
8186 pub fn set_trigger_template<T>(mut self, v: T) -> Self
8187 where
8188 T: std::convert::Into<crate::model::RepoSource>,
8189 {
8190 self.trigger_template = std::option::Option::Some(v.into());
8191 self
8192 }
8193
8194 /// Sets or clears the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8195 ///
8196 /// # Example
8197 /// ```ignore,no_run
8198 /// # use google_cloud_build_v1::model::BuildTrigger;
8199 /// use google_cloud_build_v1::model::RepoSource;
8200 /// let x = BuildTrigger::new().set_or_clear_trigger_template(Some(RepoSource::default()/* use setters */));
8201 /// let x = BuildTrigger::new().set_or_clear_trigger_template(None::<RepoSource>);
8202 /// ```
8203 pub fn set_or_clear_trigger_template<T>(mut self, v: std::option::Option<T>) -> Self
8204 where
8205 T: std::convert::Into<crate::model::RepoSource>,
8206 {
8207 self.trigger_template = v.map(|x| x.into());
8208 self
8209 }
8210
8211 /// Sets the value of [github][crate::model::BuildTrigger::github].
8212 ///
8213 /// # Example
8214 /// ```ignore,no_run
8215 /// # use google_cloud_build_v1::model::BuildTrigger;
8216 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8217 /// let x = BuildTrigger::new().set_github(GitHubEventsConfig::default()/* use setters */);
8218 /// ```
8219 pub fn set_github<T>(mut self, v: T) -> Self
8220 where
8221 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8222 {
8223 self.github = std::option::Option::Some(v.into());
8224 self
8225 }
8226
8227 /// Sets or clears the value of [github][crate::model::BuildTrigger::github].
8228 ///
8229 /// # Example
8230 /// ```ignore,no_run
8231 /// # use google_cloud_build_v1::model::BuildTrigger;
8232 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8233 /// let x = BuildTrigger::new().set_or_clear_github(Some(GitHubEventsConfig::default()/* use setters */));
8234 /// let x = BuildTrigger::new().set_or_clear_github(None::<GitHubEventsConfig>);
8235 /// ```
8236 pub fn set_or_clear_github<T>(mut self, v: std::option::Option<T>) -> Self
8237 where
8238 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8239 {
8240 self.github = v.map(|x| x.into());
8241 self
8242 }
8243
8244 /// Sets the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8245 ///
8246 /// # Example
8247 /// ```ignore,no_run
8248 /// # use google_cloud_build_v1::model::BuildTrigger;
8249 /// use google_cloud_build_v1::model::PubsubConfig;
8250 /// let x = BuildTrigger::new().set_pubsub_config(PubsubConfig::default()/* use setters */);
8251 /// ```
8252 pub fn set_pubsub_config<T>(mut self, v: T) -> Self
8253 where
8254 T: std::convert::Into<crate::model::PubsubConfig>,
8255 {
8256 self.pubsub_config = std::option::Option::Some(v.into());
8257 self
8258 }
8259
8260 /// Sets or clears the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8261 ///
8262 /// # Example
8263 /// ```ignore,no_run
8264 /// # use google_cloud_build_v1::model::BuildTrigger;
8265 /// use google_cloud_build_v1::model::PubsubConfig;
8266 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(Some(PubsubConfig::default()/* use setters */));
8267 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(None::<PubsubConfig>);
8268 /// ```
8269 pub fn set_or_clear_pubsub_config<T>(mut self, v: std::option::Option<T>) -> Self
8270 where
8271 T: std::convert::Into<crate::model::PubsubConfig>,
8272 {
8273 self.pubsub_config = v.map(|x| x.into());
8274 self
8275 }
8276
8277 /// Sets the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8278 ///
8279 /// # Example
8280 /// ```ignore,no_run
8281 /// # use google_cloud_build_v1::model::BuildTrigger;
8282 /// use google_cloud_build_v1::model::WebhookConfig;
8283 /// let x = BuildTrigger::new().set_webhook_config(WebhookConfig::default()/* use setters */);
8284 /// ```
8285 pub fn set_webhook_config<T>(mut self, v: T) -> Self
8286 where
8287 T: std::convert::Into<crate::model::WebhookConfig>,
8288 {
8289 self.webhook_config = std::option::Option::Some(v.into());
8290 self
8291 }
8292
8293 /// Sets or clears the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8294 ///
8295 /// # Example
8296 /// ```ignore,no_run
8297 /// # use google_cloud_build_v1::model::BuildTrigger;
8298 /// use google_cloud_build_v1::model::WebhookConfig;
8299 /// let x = BuildTrigger::new().set_or_clear_webhook_config(Some(WebhookConfig::default()/* use setters */));
8300 /// let x = BuildTrigger::new().set_or_clear_webhook_config(None::<WebhookConfig>);
8301 /// ```
8302 pub fn set_or_clear_webhook_config<T>(mut self, v: std::option::Option<T>) -> Self
8303 where
8304 T: std::convert::Into<crate::model::WebhookConfig>,
8305 {
8306 self.webhook_config = v.map(|x| x.into());
8307 self
8308 }
8309
8310 /// Sets the value of [create_time][crate::model::BuildTrigger::create_time].
8311 ///
8312 /// # Example
8313 /// ```ignore,no_run
8314 /// # use google_cloud_build_v1::model::BuildTrigger;
8315 /// use wkt::Timestamp;
8316 /// let x = BuildTrigger::new().set_create_time(Timestamp::default()/* use setters */);
8317 /// ```
8318 pub fn set_create_time<T>(mut self, v: T) -> Self
8319 where
8320 T: std::convert::Into<wkt::Timestamp>,
8321 {
8322 self.create_time = std::option::Option::Some(v.into());
8323 self
8324 }
8325
8326 /// Sets or clears the value of [create_time][crate::model::BuildTrigger::create_time].
8327 ///
8328 /// # Example
8329 /// ```ignore,no_run
8330 /// # use google_cloud_build_v1::model::BuildTrigger;
8331 /// use wkt::Timestamp;
8332 /// let x = BuildTrigger::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8333 /// let x = BuildTrigger::new().set_or_clear_create_time(None::<Timestamp>);
8334 /// ```
8335 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8336 where
8337 T: std::convert::Into<wkt::Timestamp>,
8338 {
8339 self.create_time = v.map(|x| x.into());
8340 self
8341 }
8342
8343 /// Sets the value of [disabled][crate::model::BuildTrigger::disabled].
8344 ///
8345 /// # Example
8346 /// ```ignore,no_run
8347 /// # use google_cloud_build_v1::model::BuildTrigger;
8348 /// let x = BuildTrigger::new().set_disabled(true);
8349 /// ```
8350 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8351 self.disabled = v.into();
8352 self
8353 }
8354
8355 /// Sets the value of [substitutions][crate::model::BuildTrigger::substitutions].
8356 ///
8357 /// # Example
8358 /// ```ignore,no_run
8359 /// # use google_cloud_build_v1::model::BuildTrigger;
8360 /// let x = BuildTrigger::new().set_substitutions([
8361 /// ("key0", "abc"),
8362 /// ("key1", "xyz"),
8363 /// ]);
8364 /// ```
8365 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
8366 where
8367 T: std::iter::IntoIterator<Item = (K, V)>,
8368 K: std::convert::Into<std::string::String>,
8369 V: std::convert::Into<std::string::String>,
8370 {
8371 use std::iter::Iterator;
8372 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8373 self
8374 }
8375
8376 /// Sets the value of [ignored_files][crate::model::BuildTrigger::ignored_files].
8377 ///
8378 /// # Example
8379 /// ```ignore,no_run
8380 /// # use google_cloud_build_v1::model::BuildTrigger;
8381 /// let x = BuildTrigger::new().set_ignored_files(["a", "b", "c"]);
8382 /// ```
8383 pub fn set_ignored_files<T, V>(mut self, v: T) -> Self
8384 where
8385 T: std::iter::IntoIterator<Item = V>,
8386 V: std::convert::Into<std::string::String>,
8387 {
8388 use std::iter::Iterator;
8389 self.ignored_files = v.into_iter().map(|i| i.into()).collect();
8390 self
8391 }
8392
8393 /// Sets the value of [included_files][crate::model::BuildTrigger::included_files].
8394 ///
8395 /// # Example
8396 /// ```ignore,no_run
8397 /// # use google_cloud_build_v1::model::BuildTrigger;
8398 /// let x = BuildTrigger::new().set_included_files(["a", "b", "c"]);
8399 /// ```
8400 pub fn set_included_files<T, V>(mut self, v: T) -> Self
8401 where
8402 T: std::iter::IntoIterator<Item = V>,
8403 V: std::convert::Into<std::string::String>,
8404 {
8405 use std::iter::Iterator;
8406 self.included_files = v.into_iter().map(|i| i.into()).collect();
8407 self
8408 }
8409
8410 /// Sets the value of [filter][crate::model::BuildTrigger::filter].
8411 ///
8412 /// # Example
8413 /// ```ignore,no_run
8414 /// # use google_cloud_build_v1::model::BuildTrigger;
8415 /// let x = BuildTrigger::new().set_filter("example");
8416 /// ```
8417 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8418 self.filter = v.into();
8419 self
8420 }
8421
8422 /// Sets the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8423 ///
8424 /// # Example
8425 /// ```ignore,no_run
8426 /// # use google_cloud_build_v1::model::BuildTrigger;
8427 /// use google_cloud_build_v1::model::GitRepoSource;
8428 /// let x = BuildTrigger::new().set_source_to_build(GitRepoSource::default()/* use setters */);
8429 /// ```
8430 pub fn set_source_to_build<T>(mut self, v: T) -> Self
8431 where
8432 T: std::convert::Into<crate::model::GitRepoSource>,
8433 {
8434 self.source_to_build = std::option::Option::Some(v.into());
8435 self
8436 }
8437
8438 /// Sets or clears the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8439 ///
8440 /// # Example
8441 /// ```ignore,no_run
8442 /// # use google_cloud_build_v1::model::BuildTrigger;
8443 /// use google_cloud_build_v1::model::GitRepoSource;
8444 /// let x = BuildTrigger::new().set_or_clear_source_to_build(Some(GitRepoSource::default()/* use setters */));
8445 /// let x = BuildTrigger::new().set_or_clear_source_to_build(None::<GitRepoSource>);
8446 /// ```
8447 pub fn set_or_clear_source_to_build<T>(mut self, v: std::option::Option<T>) -> Self
8448 where
8449 T: std::convert::Into<crate::model::GitRepoSource>,
8450 {
8451 self.source_to_build = v.map(|x| x.into());
8452 self
8453 }
8454
8455 /// Sets the value of [service_account][crate::model::BuildTrigger::service_account].
8456 ///
8457 /// # Example
8458 /// ```ignore,no_run
8459 /// # use google_cloud_build_v1::model::BuildTrigger;
8460 /// let x = BuildTrigger::new().set_service_account("example");
8461 /// ```
8462 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8463 self.service_account = v.into();
8464 self
8465 }
8466
8467 /// Sets the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8468 ///
8469 /// # Example
8470 /// ```ignore,no_run
8471 /// # use google_cloud_build_v1::model::BuildTrigger;
8472 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8473 /// let x = BuildTrigger::new().set_repository_event_config(RepositoryEventConfig::default()/* use setters */);
8474 /// ```
8475 pub fn set_repository_event_config<T>(mut self, v: T) -> Self
8476 where
8477 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8478 {
8479 self.repository_event_config = std::option::Option::Some(v.into());
8480 self
8481 }
8482
8483 /// Sets or clears the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8484 ///
8485 /// # Example
8486 /// ```ignore,no_run
8487 /// # use google_cloud_build_v1::model::BuildTrigger;
8488 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8489 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(Some(RepositoryEventConfig::default()/* use setters */));
8490 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(None::<RepositoryEventConfig>);
8491 /// ```
8492 pub fn set_or_clear_repository_event_config<T>(mut self, v: std::option::Option<T>) -> Self
8493 where
8494 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8495 {
8496 self.repository_event_config = v.map(|x| x.into());
8497 self
8498 }
8499
8500 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template].
8501 ///
8502 /// Note that all the setters affecting `build_template` are mutually
8503 /// exclusive.
8504 ///
8505 /// # Example
8506 /// ```ignore,no_run
8507 /// # use google_cloud_build_v1::model::BuildTrigger;
8508 /// use google_cloud_build_v1::model::build_trigger::BuildTemplate;
8509 /// let x = BuildTrigger::new().set_build_template(Some(BuildTemplate::Autodetect(true)));
8510 /// ```
8511 pub fn set_build_template<
8512 T: std::convert::Into<std::option::Option<crate::model::build_trigger::BuildTemplate>>,
8513 >(
8514 mut self,
8515 v: T,
8516 ) -> Self {
8517 self.build_template = v.into();
8518 self
8519 }
8520
8521 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8522 /// if it holds a `Autodetect`, `None` if the field is not set or
8523 /// holds a different branch.
8524 pub fn autodetect(&self) -> std::option::Option<&bool> {
8525 #[allow(unreachable_patterns)]
8526 self.build_template.as_ref().and_then(|v| match v {
8527 crate::model::build_trigger::BuildTemplate::Autodetect(v) => {
8528 std::option::Option::Some(v)
8529 }
8530 _ => std::option::Option::None,
8531 })
8532 }
8533
8534 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8535 /// to hold a `Autodetect`.
8536 ///
8537 /// Note that all the setters affecting `build_template` are
8538 /// mutually exclusive.
8539 ///
8540 /// # Example
8541 /// ```ignore,no_run
8542 /// # use google_cloud_build_v1::model::BuildTrigger;
8543 /// let x = BuildTrigger::new().set_autodetect(true);
8544 /// assert!(x.autodetect().is_some());
8545 /// assert!(x.build().is_none());
8546 /// assert!(x.filename().is_none());
8547 /// assert!(x.git_file_source().is_none());
8548 /// ```
8549 pub fn set_autodetect<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8550 self.build_template = std::option::Option::Some(
8551 crate::model::build_trigger::BuildTemplate::Autodetect(v.into()),
8552 );
8553 self
8554 }
8555
8556 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8557 /// if it holds a `Build`, `None` if the field is not set or
8558 /// holds a different branch.
8559 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::Build>> {
8560 #[allow(unreachable_patterns)]
8561 self.build_template.as_ref().and_then(|v| match v {
8562 crate::model::build_trigger::BuildTemplate::Build(v) => std::option::Option::Some(v),
8563 _ => std::option::Option::None,
8564 })
8565 }
8566
8567 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8568 /// to hold a `Build`.
8569 ///
8570 /// Note that all the setters affecting `build_template` are
8571 /// mutually exclusive.
8572 ///
8573 /// # Example
8574 /// ```ignore,no_run
8575 /// # use google_cloud_build_v1::model::BuildTrigger;
8576 /// use google_cloud_build_v1::model::Build;
8577 /// let x = BuildTrigger::new().set_build(Build::default()/* use setters */);
8578 /// assert!(x.build().is_some());
8579 /// assert!(x.autodetect().is_none());
8580 /// assert!(x.filename().is_none());
8581 /// assert!(x.git_file_source().is_none());
8582 /// ```
8583 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::Build>>>(
8584 mut self,
8585 v: T,
8586 ) -> Self {
8587 self.build_template =
8588 std::option::Option::Some(crate::model::build_trigger::BuildTemplate::Build(v.into()));
8589 self
8590 }
8591
8592 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8593 /// if it holds a `Filename`, `None` if the field is not set or
8594 /// holds a different branch.
8595 pub fn filename(&self) -> std::option::Option<&std::string::String> {
8596 #[allow(unreachable_patterns)]
8597 self.build_template.as_ref().and_then(|v| match v {
8598 crate::model::build_trigger::BuildTemplate::Filename(v) => std::option::Option::Some(v),
8599 _ => std::option::Option::None,
8600 })
8601 }
8602
8603 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8604 /// to hold a `Filename`.
8605 ///
8606 /// Note that all the setters affecting `build_template` are
8607 /// mutually exclusive.
8608 ///
8609 /// # Example
8610 /// ```ignore,no_run
8611 /// # use google_cloud_build_v1::model::BuildTrigger;
8612 /// let x = BuildTrigger::new().set_filename("example");
8613 /// assert!(x.filename().is_some());
8614 /// assert!(x.autodetect().is_none());
8615 /// assert!(x.build().is_none());
8616 /// assert!(x.git_file_source().is_none());
8617 /// ```
8618 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8619 self.build_template = std::option::Option::Some(
8620 crate::model::build_trigger::BuildTemplate::Filename(v.into()),
8621 );
8622 self
8623 }
8624
8625 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8626 /// if it holds a `GitFileSource`, `None` if the field is not set or
8627 /// holds a different branch.
8628 pub fn git_file_source(
8629 &self,
8630 ) -> std::option::Option<&std::boxed::Box<crate::model::GitFileSource>> {
8631 #[allow(unreachable_patterns)]
8632 self.build_template.as_ref().and_then(|v| match v {
8633 crate::model::build_trigger::BuildTemplate::GitFileSource(v) => {
8634 std::option::Option::Some(v)
8635 }
8636 _ => std::option::Option::None,
8637 })
8638 }
8639
8640 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8641 /// to hold a `GitFileSource`.
8642 ///
8643 /// Note that all the setters affecting `build_template` are
8644 /// mutually exclusive.
8645 ///
8646 /// # Example
8647 /// ```ignore,no_run
8648 /// # use google_cloud_build_v1::model::BuildTrigger;
8649 /// use google_cloud_build_v1::model::GitFileSource;
8650 /// let x = BuildTrigger::new().set_git_file_source(GitFileSource::default()/* use setters */);
8651 /// assert!(x.git_file_source().is_some());
8652 /// assert!(x.autodetect().is_none());
8653 /// assert!(x.build().is_none());
8654 /// assert!(x.filename().is_none());
8655 /// ```
8656 pub fn set_git_file_source<
8657 T: std::convert::Into<std::boxed::Box<crate::model::GitFileSource>>,
8658 >(
8659 mut self,
8660 v: T,
8661 ) -> Self {
8662 self.build_template = std::option::Option::Some(
8663 crate::model::build_trigger::BuildTemplate::GitFileSource(v.into()),
8664 );
8665 self
8666 }
8667}
8668
8669impl wkt::message::Message for BuildTrigger {
8670 fn typename() -> &'static str {
8671 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildTrigger"
8672 }
8673}
8674
8675/// Defines additional types related to [BuildTrigger].
8676pub mod build_trigger {
8677 #[allow(unused_imports)]
8678 use super::*;
8679
8680 /// Template describing the Build request to make when the trigger is matched.
8681 /// At least one of the template fields must be provided.
8682 #[derive(Clone, Debug, PartialEq)]
8683 #[non_exhaustive]
8684 pub enum BuildTemplate {
8685 /// Autodetect build configuration. The following precedence is used (case
8686 /// insensitive):
8687 ///
8688 /// 1. cloudbuild.yaml
8689 /// 1. cloudbuild.yml
8690 /// 1. cloudbuild.json
8691 /// 1. Dockerfile
8692 ///
8693 /// Currently only available for GitHub App Triggers.
8694 Autodetect(bool),
8695 /// Contents of the build template.
8696 Build(std::boxed::Box<crate::model::Build>),
8697 /// Path, from the source root, to the build configuration file
8698 /// (i.e. cloudbuild.yaml).
8699 Filename(std::string::String),
8700 /// The file source describing the local or remote Build template.
8701 GitFileSource(std::boxed::Box<crate::model::GitFileSource>),
8702 }
8703}
8704
8705/// The configuration of a trigger that creates a build whenever an event from
8706/// Repo API is received.
8707#[derive(Clone, Default, PartialEq)]
8708#[non_exhaustive]
8709pub struct RepositoryEventConfig {
8710 /// The resource name of the Repo API resource.
8711 pub repository: std::string::String,
8712
8713 /// Output only. The type of the SCM vendor the repository points to.
8714 pub repository_type: crate::model::repository_event_config::RepositoryType,
8715
8716 /// The types of filter to trigger a build.
8717 pub filter: std::option::Option<crate::model::repository_event_config::Filter>,
8718
8719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8720}
8721
8722impl RepositoryEventConfig {
8723 /// Creates a new default instance.
8724 pub fn new() -> Self {
8725 std::default::Default::default()
8726 }
8727
8728 /// Sets the value of [repository][crate::model::RepositoryEventConfig::repository].
8729 ///
8730 /// # Example
8731 /// ```ignore,no_run
8732 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8733 /// let x = RepositoryEventConfig::new().set_repository("example");
8734 /// ```
8735 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8736 self.repository = v.into();
8737 self
8738 }
8739
8740 /// Sets the value of [repository_type][crate::model::RepositoryEventConfig::repository_type].
8741 ///
8742 /// # Example
8743 /// ```ignore,no_run
8744 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8745 /// use google_cloud_build_v1::model::repository_event_config::RepositoryType;
8746 /// let x0 = RepositoryEventConfig::new().set_repository_type(RepositoryType::Github);
8747 /// let x1 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GithubEnterprise);
8748 /// let x2 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GitlabEnterprise);
8749 /// ```
8750 pub fn set_repository_type<
8751 T: std::convert::Into<crate::model::repository_event_config::RepositoryType>,
8752 >(
8753 mut self,
8754 v: T,
8755 ) -> Self {
8756 self.repository_type = v.into();
8757 self
8758 }
8759
8760 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter].
8761 ///
8762 /// Note that all the setters affecting `filter` are mutually
8763 /// exclusive.
8764 ///
8765 /// # Example
8766 /// ```ignore,no_run
8767 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8768 /// use google_cloud_build_v1::model::PullRequestFilter;
8769 /// let x = RepositoryEventConfig::new().set_filter(Some(
8770 /// google_cloud_build_v1::model::repository_event_config::Filter::PullRequest(PullRequestFilter::default().into())));
8771 /// ```
8772 pub fn set_filter<
8773 T: std::convert::Into<std::option::Option<crate::model::repository_event_config::Filter>>,
8774 >(
8775 mut self,
8776 v: T,
8777 ) -> Self {
8778 self.filter = v.into();
8779 self
8780 }
8781
8782 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8783 /// if it holds a `PullRequest`, `None` if the field is not set or
8784 /// holds a different branch.
8785 pub fn pull_request(
8786 &self,
8787 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
8788 #[allow(unreachable_patterns)]
8789 self.filter.as_ref().and_then(|v| match v {
8790 crate::model::repository_event_config::Filter::PullRequest(v) => {
8791 std::option::Option::Some(v)
8792 }
8793 _ => std::option::Option::None,
8794 })
8795 }
8796
8797 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8798 /// to hold a `PullRequest`.
8799 ///
8800 /// Note that all the setters affecting `filter` are
8801 /// mutually exclusive.
8802 ///
8803 /// # Example
8804 /// ```ignore,no_run
8805 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8806 /// use google_cloud_build_v1::model::PullRequestFilter;
8807 /// let x = RepositoryEventConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
8808 /// assert!(x.pull_request().is_some());
8809 /// assert!(x.push().is_none());
8810 /// ```
8811 pub fn set_pull_request<
8812 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
8813 >(
8814 mut self,
8815 v: T,
8816 ) -> Self {
8817 self.filter = std::option::Option::Some(
8818 crate::model::repository_event_config::Filter::PullRequest(v.into()),
8819 );
8820 self
8821 }
8822
8823 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8824 /// if it holds a `Push`, `None` if the field is not set or
8825 /// holds a different branch.
8826 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
8827 #[allow(unreachable_patterns)]
8828 self.filter.as_ref().and_then(|v| match v {
8829 crate::model::repository_event_config::Filter::Push(v) => std::option::Option::Some(v),
8830 _ => std::option::Option::None,
8831 })
8832 }
8833
8834 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8835 /// to hold a `Push`.
8836 ///
8837 /// Note that all the setters affecting `filter` are
8838 /// mutually exclusive.
8839 ///
8840 /// # Example
8841 /// ```ignore,no_run
8842 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8843 /// use google_cloud_build_v1::model::PushFilter;
8844 /// let x = RepositoryEventConfig::new().set_push(PushFilter::default()/* use setters */);
8845 /// assert!(x.push().is_some());
8846 /// assert!(x.pull_request().is_none());
8847 /// ```
8848 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
8849 mut self,
8850 v: T,
8851 ) -> Self {
8852 self.filter = std::option::Option::Some(
8853 crate::model::repository_event_config::Filter::Push(v.into()),
8854 );
8855 self
8856 }
8857}
8858
8859impl wkt::message::Message for RepositoryEventConfig {
8860 fn typename() -> &'static str {
8861 "type.googleapis.com/google.devtools.cloudbuild.v1.RepositoryEventConfig"
8862 }
8863}
8864
8865/// Defines additional types related to [RepositoryEventConfig].
8866pub mod repository_event_config {
8867 #[allow(unused_imports)]
8868 use super::*;
8869
8870 /// All possible SCM repo types from Repo API.
8871 ///
8872 /// # Working with unknown values
8873 ///
8874 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8875 /// additional enum variants at any time. Adding new variants is not considered
8876 /// a breaking change. Applications should write their code in anticipation of:
8877 ///
8878 /// - New values appearing in future releases of the client library, **and**
8879 /// - New values received dynamically, without application changes.
8880 ///
8881 /// Please consult the [Working with enums] section in the user guide for some
8882 /// guidelines.
8883 ///
8884 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8885 #[derive(Clone, Debug, PartialEq)]
8886 #[non_exhaustive]
8887 pub enum RepositoryType {
8888 /// If unspecified, RepositoryType defaults to GITHUB.
8889 Unspecified,
8890 /// The SCM repo is GITHUB.
8891 Github,
8892 /// The SCM repo is GITHUB Enterprise.
8893 GithubEnterprise,
8894 /// The SCM repo is GITLAB Enterprise.
8895 GitlabEnterprise,
8896 /// If set, the enum was initialized with an unknown value.
8897 ///
8898 /// Applications can examine the value using [RepositoryType::value] or
8899 /// [RepositoryType::name].
8900 UnknownValue(repository_type::UnknownValue),
8901 }
8902
8903 #[doc(hidden)]
8904 pub mod repository_type {
8905 #[allow(unused_imports)]
8906 use super::*;
8907 #[derive(Clone, Debug, PartialEq)]
8908 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8909 }
8910
8911 impl RepositoryType {
8912 /// Gets the enum value.
8913 ///
8914 /// Returns `None` if the enum contains an unknown value deserialized from
8915 /// the string representation of enums.
8916 pub fn value(&self) -> std::option::Option<i32> {
8917 match self {
8918 Self::Unspecified => std::option::Option::Some(0),
8919 Self::Github => std::option::Option::Some(1),
8920 Self::GithubEnterprise => std::option::Option::Some(2),
8921 Self::GitlabEnterprise => std::option::Option::Some(3),
8922 Self::UnknownValue(u) => u.0.value(),
8923 }
8924 }
8925
8926 /// Gets the enum value as a string.
8927 ///
8928 /// Returns `None` if the enum contains an unknown value deserialized from
8929 /// the integer representation of enums.
8930 pub fn name(&self) -> std::option::Option<&str> {
8931 match self {
8932 Self::Unspecified => std::option::Option::Some("REPOSITORY_TYPE_UNSPECIFIED"),
8933 Self::Github => std::option::Option::Some("GITHUB"),
8934 Self::GithubEnterprise => std::option::Option::Some("GITHUB_ENTERPRISE"),
8935 Self::GitlabEnterprise => std::option::Option::Some("GITLAB_ENTERPRISE"),
8936 Self::UnknownValue(u) => u.0.name(),
8937 }
8938 }
8939 }
8940
8941 impl std::default::Default for RepositoryType {
8942 fn default() -> Self {
8943 use std::convert::From;
8944 Self::from(0)
8945 }
8946 }
8947
8948 impl std::fmt::Display for RepositoryType {
8949 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8950 wkt::internal::display_enum(f, self.name(), self.value())
8951 }
8952 }
8953
8954 impl std::convert::From<i32> for RepositoryType {
8955 fn from(value: i32) -> Self {
8956 match value {
8957 0 => Self::Unspecified,
8958 1 => Self::Github,
8959 2 => Self::GithubEnterprise,
8960 3 => Self::GitlabEnterprise,
8961 _ => Self::UnknownValue(repository_type::UnknownValue(
8962 wkt::internal::UnknownEnumValue::Integer(value),
8963 )),
8964 }
8965 }
8966 }
8967
8968 impl std::convert::From<&str> for RepositoryType {
8969 fn from(value: &str) -> Self {
8970 use std::string::ToString;
8971 match value {
8972 "REPOSITORY_TYPE_UNSPECIFIED" => Self::Unspecified,
8973 "GITHUB" => Self::Github,
8974 "GITHUB_ENTERPRISE" => Self::GithubEnterprise,
8975 "GITLAB_ENTERPRISE" => Self::GitlabEnterprise,
8976 _ => Self::UnknownValue(repository_type::UnknownValue(
8977 wkt::internal::UnknownEnumValue::String(value.to_string()),
8978 )),
8979 }
8980 }
8981 }
8982
8983 impl serde::ser::Serialize for RepositoryType {
8984 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8985 where
8986 S: serde::Serializer,
8987 {
8988 match self {
8989 Self::Unspecified => serializer.serialize_i32(0),
8990 Self::Github => serializer.serialize_i32(1),
8991 Self::GithubEnterprise => serializer.serialize_i32(2),
8992 Self::GitlabEnterprise => serializer.serialize_i32(3),
8993 Self::UnknownValue(u) => u.0.serialize(serializer),
8994 }
8995 }
8996 }
8997
8998 impl<'de> serde::de::Deserialize<'de> for RepositoryType {
8999 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9000 where
9001 D: serde::Deserializer<'de>,
9002 {
9003 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepositoryType>::new(
9004 ".google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType",
9005 ))
9006 }
9007 }
9008
9009 /// The types of filter to trigger a build.
9010 #[derive(Clone, Debug, PartialEq)]
9011 #[non_exhaustive]
9012 pub enum Filter {
9013 /// Filter to match changes in pull requests.
9014 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9015 /// Filter to match changes in refs like branches, tags.
9016 Push(std::boxed::Box<crate::model::PushFilter>),
9017 }
9018}
9019
9020/// GitHubEventsConfig describes the configuration of a trigger that creates a
9021/// build whenever a GitHub event is received.
9022#[derive(Clone, Default, PartialEq)]
9023#[non_exhaustive]
9024pub struct GitHubEventsConfig {
9025 /// The installationID that emits the GitHub event.
9026 #[deprecated]
9027 pub installation_id: i64,
9028
9029 /// Owner of the repository. For example: The owner for
9030 /// <https://github.com/googlecloudplatform/cloud-builders> is
9031 /// "googlecloudplatform".
9032 pub owner: std::string::String,
9033
9034 /// Name of the repository. For example: The name for
9035 /// <https://github.com/googlecloudplatform/cloud-builders> is "cloud-builders".
9036 pub name: std::string::String,
9037
9038 /// Filter describing the types of events to trigger a build.
9039 /// Currently supported event types: push, pull_request.
9040 pub event: std::option::Option<crate::model::git_hub_events_config::Event>,
9041
9042 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9043}
9044
9045impl GitHubEventsConfig {
9046 /// Creates a new default instance.
9047 pub fn new() -> Self {
9048 std::default::Default::default()
9049 }
9050
9051 /// Sets the value of [installation_id][crate::model::GitHubEventsConfig::installation_id].
9052 ///
9053 /// # Example
9054 /// ```ignore,no_run
9055 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9056 /// let x = GitHubEventsConfig::new().set_installation_id(42);
9057 /// ```
9058 #[deprecated]
9059 pub fn set_installation_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9060 self.installation_id = v.into();
9061 self
9062 }
9063
9064 /// Sets the value of [owner][crate::model::GitHubEventsConfig::owner].
9065 ///
9066 /// # Example
9067 /// ```ignore,no_run
9068 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9069 /// let x = GitHubEventsConfig::new().set_owner("example");
9070 /// ```
9071 pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9072 self.owner = v.into();
9073 self
9074 }
9075
9076 /// Sets the value of [name][crate::model::GitHubEventsConfig::name].
9077 ///
9078 /// # Example
9079 /// ```ignore,no_run
9080 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9081 /// let x = GitHubEventsConfig::new().set_name("example");
9082 /// ```
9083 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9084 self.name = v.into();
9085 self
9086 }
9087
9088 /// Sets the value of [event][crate::model::GitHubEventsConfig::event].
9089 ///
9090 /// Note that all the setters affecting `event` are mutually
9091 /// exclusive.
9092 ///
9093 /// # Example
9094 /// ```ignore,no_run
9095 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9096 /// use google_cloud_build_v1::model::PullRequestFilter;
9097 /// let x = GitHubEventsConfig::new().set_event(Some(
9098 /// google_cloud_build_v1::model::git_hub_events_config::Event::PullRequest(PullRequestFilter::default().into())));
9099 /// ```
9100 pub fn set_event<
9101 T: std::convert::Into<std::option::Option<crate::model::git_hub_events_config::Event>>,
9102 >(
9103 mut self,
9104 v: T,
9105 ) -> Self {
9106 self.event = v.into();
9107 self
9108 }
9109
9110 /// The value of [event][crate::model::GitHubEventsConfig::event]
9111 /// if it holds a `PullRequest`, `None` if the field is not set or
9112 /// holds a different branch.
9113 pub fn pull_request(
9114 &self,
9115 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
9116 #[allow(unreachable_patterns)]
9117 self.event.as_ref().and_then(|v| match v {
9118 crate::model::git_hub_events_config::Event::PullRequest(v) => {
9119 std::option::Option::Some(v)
9120 }
9121 _ => std::option::Option::None,
9122 })
9123 }
9124
9125 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9126 /// to hold a `PullRequest`.
9127 ///
9128 /// Note that all the setters affecting `event` are
9129 /// mutually exclusive.
9130 ///
9131 /// # Example
9132 /// ```ignore,no_run
9133 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9134 /// use google_cloud_build_v1::model::PullRequestFilter;
9135 /// let x = GitHubEventsConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
9136 /// assert!(x.pull_request().is_some());
9137 /// assert!(x.push().is_none());
9138 /// ```
9139 pub fn set_pull_request<
9140 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
9141 >(
9142 mut self,
9143 v: T,
9144 ) -> Self {
9145 self.event = std::option::Option::Some(
9146 crate::model::git_hub_events_config::Event::PullRequest(v.into()),
9147 );
9148 self
9149 }
9150
9151 /// The value of [event][crate::model::GitHubEventsConfig::event]
9152 /// if it holds a `Push`, `None` if the field is not set or
9153 /// holds a different branch.
9154 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
9155 #[allow(unreachable_patterns)]
9156 self.event.as_ref().and_then(|v| match v {
9157 crate::model::git_hub_events_config::Event::Push(v) => std::option::Option::Some(v),
9158 _ => std::option::Option::None,
9159 })
9160 }
9161
9162 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9163 /// to hold a `Push`.
9164 ///
9165 /// Note that all the setters affecting `event` are
9166 /// mutually exclusive.
9167 ///
9168 /// # Example
9169 /// ```ignore,no_run
9170 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9171 /// use google_cloud_build_v1::model::PushFilter;
9172 /// let x = GitHubEventsConfig::new().set_push(PushFilter::default()/* use setters */);
9173 /// assert!(x.push().is_some());
9174 /// assert!(x.pull_request().is_none());
9175 /// ```
9176 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
9177 mut self,
9178 v: T,
9179 ) -> Self {
9180 self.event =
9181 std::option::Option::Some(crate::model::git_hub_events_config::Event::Push(v.into()));
9182 self
9183 }
9184}
9185
9186impl wkt::message::Message for GitHubEventsConfig {
9187 fn typename() -> &'static str {
9188 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEventsConfig"
9189 }
9190}
9191
9192/// Defines additional types related to [GitHubEventsConfig].
9193pub mod git_hub_events_config {
9194 #[allow(unused_imports)]
9195 use super::*;
9196
9197 /// Filter describing the types of events to trigger a build.
9198 /// Currently supported event types: push, pull_request.
9199 #[derive(Clone, Debug, PartialEq)]
9200 #[non_exhaustive]
9201 pub enum Event {
9202 /// filter to match changes in pull requests.
9203 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9204 /// filter to match changes in refs like branches, tags.
9205 Push(std::boxed::Box<crate::model::PushFilter>),
9206 }
9207}
9208
9209/// PubsubConfig describes the configuration of a trigger that
9210/// creates a build whenever a Pub/Sub message is published.
9211#[derive(Clone, Default, PartialEq)]
9212#[non_exhaustive]
9213pub struct PubsubConfig {
9214 /// Output only. Name of the subscription. Format is
9215 /// `projects/{project}/subscriptions/{subscription}`.
9216 pub subscription: std::string::String,
9217
9218 /// Optional. The name of the topic from which this subscription is receiving
9219 /// messages. Format is `projects/{project}/topics/{topic}`.
9220 pub topic: std::string::String,
9221
9222 /// Service account that will make the push request.
9223 pub service_account_email: std::string::String,
9224
9225 /// Potential issues with the underlying Pub/Sub subscription configuration.
9226 /// Only populated on get requests.
9227 pub state: crate::model::pubsub_config::State,
9228
9229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9230}
9231
9232impl PubsubConfig {
9233 /// Creates a new default instance.
9234 pub fn new() -> Self {
9235 std::default::Default::default()
9236 }
9237
9238 /// Sets the value of [subscription][crate::model::PubsubConfig::subscription].
9239 ///
9240 /// # Example
9241 /// ```ignore,no_run
9242 /// # use google_cloud_build_v1::model::PubsubConfig;
9243 /// let x = PubsubConfig::new().set_subscription("example");
9244 /// ```
9245 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9246 self.subscription = v.into();
9247 self
9248 }
9249
9250 /// Sets the value of [topic][crate::model::PubsubConfig::topic].
9251 ///
9252 /// # Example
9253 /// ```ignore,no_run
9254 /// # use google_cloud_build_v1::model::PubsubConfig;
9255 /// let x = PubsubConfig::new().set_topic("example");
9256 /// ```
9257 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9258 self.topic = v.into();
9259 self
9260 }
9261
9262 /// Sets the value of [service_account_email][crate::model::PubsubConfig::service_account_email].
9263 ///
9264 /// # Example
9265 /// ```ignore,no_run
9266 /// # use google_cloud_build_v1::model::PubsubConfig;
9267 /// let x = PubsubConfig::new().set_service_account_email("example");
9268 /// ```
9269 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
9270 mut self,
9271 v: T,
9272 ) -> Self {
9273 self.service_account_email = v.into();
9274 self
9275 }
9276
9277 /// Sets the value of [state][crate::model::PubsubConfig::state].
9278 ///
9279 /// # Example
9280 /// ```ignore,no_run
9281 /// # use google_cloud_build_v1::model::PubsubConfig;
9282 /// use google_cloud_build_v1::model::pubsub_config::State;
9283 /// let x0 = PubsubConfig::new().set_state(State::Ok);
9284 /// let x1 = PubsubConfig::new().set_state(State::SubscriptionDeleted);
9285 /// let x2 = PubsubConfig::new().set_state(State::TopicDeleted);
9286 /// ```
9287 pub fn set_state<T: std::convert::Into<crate::model::pubsub_config::State>>(
9288 mut self,
9289 v: T,
9290 ) -> Self {
9291 self.state = v.into();
9292 self
9293 }
9294}
9295
9296impl wkt::message::Message for PubsubConfig {
9297 fn typename() -> &'static str {
9298 "type.googleapis.com/google.devtools.cloudbuild.v1.PubsubConfig"
9299 }
9300}
9301
9302/// Defines additional types related to [PubsubConfig].
9303pub mod pubsub_config {
9304 #[allow(unused_imports)]
9305 use super::*;
9306
9307 /// Enumerates potential issues with the underlying Pub/Sub subscription
9308 /// configuration.
9309 ///
9310 /// # Working with unknown values
9311 ///
9312 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9313 /// additional enum variants at any time. Adding new variants is not considered
9314 /// a breaking change. Applications should write their code in anticipation of:
9315 ///
9316 /// - New values appearing in future releases of the client library, **and**
9317 /// - New values received dynamically, without application changes.
9318 ///
9319 /// Please consult the [Working with enums] section in the user guide for some
9320 /// guidelines.
9321 ///
9322 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9323 #[derive(Clone, Debug, PartialEq)]
9324 #[non_exhaustive]
9325 pub enum State {
9326 /// The subscription configuration has not been checked.
9327 Unspecified,
9328 /// The Pub/Sub subscription is properly configured.
9329 Ok,
9330 /// The subscription has been deleted.
9331 SubscriptionDeleted,
9332 /// The topic has been deleted.
9333 TopicDeleted,
9334 /// Some of the subscription's field are misconfigured.
9335 SubscriptionMisconfigured,
9336 /// If set, the enum was initialized with an unknown value.
9337 ///
9338 /// Applications can examine the value using [State::value] or
9339 /// [State::name].
9340 UnknownValue(state::UnknownValue),
9341 }
9342
9343 #[doc(hidden)]
9344 pub mod state {
9345 #[allow(unused_imports)]
9346 use super::*;
9347 #[derive(Clone, Debug, PartialEq)]
9348 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9349 }
9350
9351 impl State {
9352 /// Gets the enum value.
9353 ///
9354 /// Returns `None` if the enum contains an unknown value deserialized from
9355 /// the string representation of enums.
9356 pub fn value(&self) -> std::option::Option<i32> {
9357 match self {
9358 Self::Unspecified => std::option::Option::Some(0),
9359 Self::Ok => std::option::Option::Some(1),
9360 Self::SubscriptionDeleted => std::option::Option::Some(2),
9361 Self::TopicDeleted => std::option::Option::Some(3),
9362 Self::SubscriptionMisconfigured => std::option::Option::Some(4),
9363 Self::UnknownValue(u) => u.0.value(),
9364 }
9365 }
9366
9367 /// Gets the enum value as a string.
9368 ///
9369 /// Returns `None` if the enum contains an unknown value deserialized from
9370 /// the integer representation of enums.
9371 pub fn name(&self) -> std::option::Option<&str> {
9372 match self {
9373 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9374 Self::Ok => std::option::Option::Some("OK"),
9375 Self::SubscriptionDeleted => std::option::Option::Some("SUBSCRIPTION_DELETED"),
9376 Self::TopicDeleted => std::option::Option::Some("TOPIC_DELETED"),
9377 Self::SubscriptionMisconfigured => {
9378 std::option::Option::Some("SUBSCRIPTION_MISCONFIGURED")
9379 }
9380 Self::UnknownValue(u) => u.0.name(),
9381 }
9382 }
9383 }
9384
9385 impl std::default::Default for State {
9386 fn default() -> Self {
9387 use std::convert::From;
9388 Self::from(0)
9389 }
9390 }
9391
9392 impl std::fmt::Display for State {
9393 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9394 wkt::internal::display_enum(f, self.name(), self.value())
9395 }
9396 }
9397
9398 impl std::convert::From<i32> for State {
9399 fn from(value: i32) -> Self {
9400 match value {
9401 0 => Self::Unspecified,
9402 1 => Self::Ok,
9403 2 => Self::SubscriptionDeleted,
9404 3 => Self::TopicDeleted,
9405 4 => Self::SubscriptionMisconfigured,
9406 _ => Self::UnknownValue(state::UnknownValue(
9407 wkt::internal::UnknownEnumValue::Integer(value),
9408 )),
9409 }
9410 }
9411 }
9412
9413 impl std::convert::From<&str> for State {
9414 fn from(value: &str) -> Self {
9415 use std::string::ToString;
9416 match value {
9417 "STATE_UNSPECIFIED" => Self::Unspecified,
9418 "OK" => Self::Ok,
9419 "SUBSCRIPTION_DELETED" => Self::SubscriptionDeleted,
9420 "TOPIC_DELETED" => Self::TopicDeleted,
9421 "SUBSCRIPTION_MISCONFIGURED" => Self::SubscriptionMisconfigured,
9422 _ => Self::UnknownValue(state::UnknownValue(
9423 wkt::internal::UnknownEnumValue::String(value.to_string()),
9424 )),
9425 }
9426 }
9427 }
9428
9429 impl serde::ser::Serialize for State {
9430 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9431 where
9432 S: serde::Serializer,
9433 {
9434 match self {
9435 Self::Unspecified => serializer.serialize_i32(0),
9436 Self::Ok => serializer.serialize_i32(1),
9437 Self::SubscriptionDeleted => serializer.serialize_i32(2),
9438 Self::TopicDeleted => serializer.serialize_i32(3),
9439 Self::SubscriptionMisconfigured => serializer.serialize_i32(4),
9440 Self::UnknownValue(u) => u.0.serialize(serializer),
9441 }
9442 }
9443 }
9444
9445 impl<'de> serde::de::Deserialize<'de> for State {
9446 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9447 where
9448 D: serde::Deserializer<'de>,
9449 {
9450 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9451 ".google.devtools.cloudbuild.v1.PubsubConfig.State",
9452 ))
9453 }
9454 }
9455}
9456
9457/// WebhookConfig describes the configuration of a trigger that
9458/// creates a build whenever a webhook is sent to a trigger's webhook URL.
9459#[derive(Clone, Default, PartialEq)]
9460#[non_exhaustive]
9461pub struct WebhookConfig {
9462 /// Potential issues with the underlying Pub/Sub subscription configuration.
9463 /// Only populated on get requests.
9464 pub state: crate::model::webhook_config::State,
9465
9466 /// Auth method specifies how the webhook authenticates with GCP.
9467 pub auth_method: std::option::Option<crate::model::webhook_config::AuthMethod>,
9468
9469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9470}
9471
9472impl WebhookConfig {
9473 /// Creates a new default instance.
9474 pub fn new() -> Self {
9475 std::default::Default::default()
9476 }
9477
9478 /// Sets the value of [state][crate::model::WebhookConfig::state].
9479 ///
9480 /// # Example
9481 /// ```ignore,no_run
9482 /// # use google_cloud_build_v1::model::WebhookConfig;
9483 /// use google_cloud_build_v1::model::webhook_config::State;
9484 /// let x0 = WebhookConfig::new().set_state(State::Ok);
9485 /// let x1 = WebhookConfig::new().set_state(State::SecretDeleted);
9486 /// ```
9487 pub fn set_state<T: std::convert::Into<crate::model::webhook_config::State>>(
9488 mut self,
9489 v: T,
9490 ) -> Self {
9491 self.state = v.into();
9492 self
9493 }
9494
9495 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method].
9496 ///
9497 /// Note that all the setters affecting `auth_method` are mutually
9498 /// exclusive.
9499 ///
9500 /// # Example
9501 /// ```ignore,no_run
9502 /// # use google_cloud_build_v1::model::WebhookConfig;
9503 /// use google_cloud_build_v1::model::webhook_config::AuthMethod;
9504 /// let x = WebhookConfig::new().set_auth_method(Some(AuthMethod::Secret("example".to_string())));
9505 /// ```
9506 pub fn set_auth_method<
9507 T: std::convert::Into<std::option::Option<crate::model::webhook_config::AuthMethod>>,
9508 >(
9509 mut self,
9510 v: T,
9511 ) -> Self {
9512 self.auth_method = v.into();
9513 self
9514 }
9515
9516 /// The value of [auth_method][crate::model::WebhookConfig::auth_method]
9517 /// if it holds a `Secret`, `None` if the field is not set or
9518 /// holds a different branch.
9519 pub fn secret(&self) -> std::option::Option<&std::string::String> {
9520 #[allow(unreachable_patterns)]
9521 self.auth_method.as_ref().and_then(|v| match v {
9522 crate::model::webhook_config::AuthMethod::Secret(v) => std::option::Option::Some(v),
9523 _ => std::option::Option::None,
9524 })
9525 }
9526
9527 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method]
9528 /// to hold a `Secret`.
9529 ///
9530 /// Note that all the setters affecting `auth_method` are
9531 /// mutually exclusive.
9532 ///
9533 /// # Example
9534 /// ```ignore,no_run
9535 /// # use google_cloud_build_v1::model::WebhookConfig;
9536 /// let x = WebhookConfig::new().set_secret("example");
9537 /// assert!(x.secret().is_some());
9538 /// ```
9539 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9540 self.auth_method =
9541 std::option::Option::Some(crate::model::webhook_config::AuthMethod::Secret(v.into()));
9542 self
9543 }
9544}
9545
9546impl wkt::message::Message for WebhookConfig {
9547 fn typename() -> &'static str {
9548 "type.googleapis.com/google.devtools.cloudbuild.v1.WebhookConfig"
9549 }
9550}
9551
9552/// Defines additional types related to [WebhookConfig].
9553pub mod webhook_config {
9554 #[allow(unused_imports)]
9555 use super::*;
9556
9557 /// Enumerates potential issues with the Secret Manager secret provided by the
9558 /// user.
9559 ///
9560 /// # Working with unknown values
9561 ///
9562 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9563 /// additional enum variants at any time. Adding new variants is not considered
9564 /// a breaking change. Applications should write their code in anticipation of:
9565 ///
9566 /// - New values appearing in future releases of the client library, **and**
9567 /// - New values received dynamically, without application changes.
9568 ///
9569 /// Please consult the [Working with enums] section in the user guide for some
9570 /// guidelines.
9571 ///
9572 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9573 #[derive(Clone, Debug, PartialEq)]
9574 #[non_exhaustive]
9575 pub enum State {
9576 /// The webhook auth configuration not been checked.
9577 Unspecified,
9578 /// The auth configuration is properly setup.
9579 Ok,
9580 /// The secret provided in auth_method has been deleted.
9581 SecretDeleted,
9582 /// If set, the enum was initialized with an unknown value.
9583 ///
9584 /// Applications can examine the value using [State::value] or
9585 /// [State::name].
9586 UnknownValue(state::UnknownValue),
9587 }
9588
9589 #[doc(hidden)]
9590 pub mod state {
9591 #[allow(unused_imports)]
9592 use super::*;
9593 #[derive(Clone, Debug, PartialEq)]
9594 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9595 }
9596
9597 impl State {
9598 /// Gets the enum value.
9599 ///
9600 /// Returns `None` if the enum contains an unknown value deserialized from
9601 /// the string representation of enums.
9602 pub fn value(&self) -> std::option::Option<i32> {
9603 match self {
9604 Self::Unspecified => std::option::Option::Some(0),
9605 Self::Ok => std::option::Option::Some(1),
9606 Self::SecretDeleted => std::option::Option::Some(2),
9607 Self::UnknownValue(u) => u.0.value(),
9608 }
9609 }
9610
9611 /// Gets the enum value as a string.
9612 ///
9613 /// Returns `None` if the enum contains an unknown value deserialized from
9614 /// the integer representation of enums.
9615 pub fn name(&self) -> std::option::Option<&str> {
9616 match self {
9617 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9618 Self::Ok => std::option::Option::Some("OK"),
9619 Self::SecretDeleted => std::option::Option::Some("SECRET_DELETED"),
9620 Self::UnknownValue(u) => u.0.name(),
9621 }
9622 }
9623 }
9624
9625 impl std::default::Default for State {
9626 fn default() -> Self {
9627 use std::convert::From;
9628 Self::from(0)
9629 }
9630 }
9631
9632 impl std::fmt::Display for State {
9633 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9634 wkt::internal::display_enum(f, self.name(), self.value())
9635 }
9636 }
9637
9638 impl std::convert::From<i32> for State {
9639 fn from(value: i32) -> Self {
9640 match value {
9641 0 => Self::Unspecified,
9642 1 => Self::Ok,
9643 2 => Self::SecretDeleted,
9644 _ => Self::UnknownValue(state::UnknownValue(
9645 wkt::internal::UnknownEnumValue::Integer(value),
9646 )),
9647 }
9648 }
9649 }
9650
9651 impl std::convert::From<&str> for State {
9652 fn from(value: &str) -> Self {
9653 use std::string::ToString;
9654 match value {
9655 "STATE_UNSPECIFIED" => Self::Unspecified,
9656 "OK" => Self::Ok,
9657 "SECRET_DELETED" => Self::SecretDeleted,
9658 _ => Self::UnknownValue(state::UnknownValue(
9659 wkt::internal::UnknownEnumValue::String(value.to_string()),
9660 )),
9661 }
9662 }
9663 }
9664
9665 impl serde::ser::Serialize for State {
9666 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9667 where
9668 S: serde::Serializer,
9669 {
9670 match self {
9671 Self::Unspecified => serializer.serialize_i32(0),
9672 Self::Ok => serializer.serialize_i32(1),
9673 Self::SecretDeleted => serializer.serialize_i32(2),
9674 Self::UnknownValue(u) => u.0.serialize(serializer),
9675 }
9676 }
9677 }
9678
9679 impl<'de> serde::de::Deserialize<'de> for State {
9680 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9681 where
9682 D: serde::Deserializer<'de>,
9683 {
9684 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9685 ".google.devtools.cloudbuild.v1.WebhookConfig.State",
9686 ))
9687 }
9688 }
9689
9690 /// Auth method specifies how the webhook authenticates with GCP.
9691 #[derive(Clone, Debug, PartialEq)]
9692 #[non_exhaustive]
9693 pub enum AuthMethod {
9694 /// Required. Resource name for the secret required as a URL parameter.
9695 Secret(std::string::String),
9696 }
9697}
9698
9699/// PullRequestFilter contains filter properties for matching GitHub Pull
9700/// Requests.
9701#[derive(Clone, Default, PartialEq)]
9702#[non_exhaustive]
9703pub struct PullRequestFilter {
9704 /// If CommentControl is enabled, depending on the setting, builds may not
9705 /// fire until a repository writer comments `/gcbrun` on a pull
9706 /// request or `/gcbrun` is in the pull request description.
9707 /// Only PR comments that contain `/gcbrun` will trigger builds.
9708 ///
9709 /// If CommentControl is set to disabled, comments with `/gcbrun` from a user
9710 /// with repository write permission or above will
9711 /// still trigger builds to run.
9712 pub comment_control: crate::model::pull_request_filter::CommentControl,
9713
9714 /// If true, branches that do NOT match the git_ref will trigger a build.
9715 pub invert_regex: bool,
9716
9717 /// Target refs to match.
9718 /// A target ref is the git reference where the pull request will be applied.
9719 pub git_ref: std::option::Option<crate::model::pull_request_filter::GitRef>,
9720
9721 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9722}
9723
9724impl PullRequestFilter {
9725 /// Creates a new default instance.
9726 pub fn new() -> Self {
9727 std::default::Default::default()
9728 }
9729
9730 /// Sets the value of [comment_control][crate::model::PullRequestFilter::comment_control].
9731 ///
9732 /// # Example
9733 /// ```ignore,no_run
9734 /// # use google_cloud_build_v1::model::PullRequestFilter;
9735 /// use google_cloud_build_v1::model::pull_request_filter::CommentControl;
9736 /// let x0 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabled);
9737 /// let x1 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabledForExternalContributorsOnly);
9738 /// ```
9739 pub fn set_comment_control<
9740 T: std::convert::Into<crate::model::pull_request_filter::CommentControl>,
9741 >(
9742 mut self,
9743 v: T,
9744 ) -> Self {
9745 self.comment_control = v.into();
9746 self
9747 }
9748
9749 /// Sets the value of [invert_regex][crate::model::PullRequestFilter::invert_regex].
9750 ///
9751 /// # Example
9752 /// ```ignore,no_run
9753 /// # use google_cloud_build_v1::model::PullRequestFilter;
9754 /// let x = PullRequestFilter::new().set_invert_regex(true);
9755 /// ```
9756 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9757 self.invert_regex = v.into();
9758 self
9759 }
9760
9761 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref].
9762 ///
9763 /// Note that all the setters affecting `git_ref` are mutually
9764 /// exclusive.
9765 ///
9766 /// # Example
9767 /// ```ignore,no_run
9768 /// # use google_cloud_build_v1::model::PullRequestFilter;
9769 /// use google_cloud_build_v1::model::pull_request_filter::GitRef;
9770 /// let x = PullRequestFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9771 /// ```
9772 pub fn set_git_ref<
9773 T: std::convert::Into<std::option::Option<crate::model::pull_request_filter::GitRef>>,
9774 >(
9775 mut self,
9776 v: T,
9777 ) -> Self {
9778 self.git_ref = v.into();
9779 self
9780 }
9781
9782 /// The value of [git_ref][crate::model::PullRequestFilter::git_ref]
9783 /// if it holds a `Branch`, `None` if the field is not set or
9784 /// holds a different branch.
9785 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9786 #[allow(unreachable_patterns)]
9787 self.git_ref.as_ref().and_then(|v| match v {
9788 crate::model::pull_request_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9789 _ => std::option::Option::None,
9790 })
9791 }
9792
9793 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref]
9794 /// to hold a `Branch`.
9795 ///
9796 /// Note that all the setters affecting `git_ref` are
9797 /// mutually exclusive.
9798 ///
9799 /// # Example
9800 /// ```ignore,no_run
9801 /// # use google_cloud_build_v1::model::PullRequestFilter;
9802 /// let x = PullRequestFilter::new().set_branch("example");
9803 /// assert!(x.branch().is_some());
9804 /// ```
9805 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9806 self.git_ref =
9807 std::option::Option::Some(crate::model::pull_request_filter::GitRef::Branch(v.into()));
9808 self
9809 }
9810}
9811
9812impl wkt::message::Message for PullRequestFilter {
9813 fn typename() -> &'static str {
9814 "type.googleapis.com/google.devtools.cloudbuild.v1.PullRequestFilter"
9815 }
9816}
9817
9818/// Defines additional types related to [PullRequestFilter].
9819pub mod pull_request_filter {
9820 #[allow(unused_imports)]
9821 use super::*;
9822
9823 /// Controls whether or not a `/gcbrun` comment is required from a user with
9824 /// repository write permission or above in order to
9825 /// trigger Build runs for pull requests. Pull Request update events differ
9826 /// between repo types.
9827 /// Check repo specific guides
9828 /// ([GitHub](https://cloud.google.com/build/docs/automating-builds/github/build-repos-from-github-enterprise#creating_a_github_enterprise_trigger),
9829 /// [Bitbucket](https://cloud.google.com/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-server#creating_a_bitbucket_server_trigger),
9830 /// [GitLab](https://cloud.google.com/build/docs/automating-builds/gitlab/build-repos-from-gitlab#creating_a_gitlab_trigger)
9831 /// for details.
9832 ///
9833 /// # Working with unknown values
9834 ///
9835 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9836 /// additional enum variants at any time. Adding new variants is not considered
9837 /// a breaking change. Applications should write their code in anticipation of:
9838 ///
9839 /// - New values appearing in future releases of the client library, **and**
9840 /// - New values received dynamically, without application changes.
9841 ///
9842 /// Please consult the [Working with enums] section in the user guide for some
9843 /// guidelines.
9844 ///
9845 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9846 #[derive(Clone, Debug, PartialEq)]
9847 #[non_exhaustive]
9848 pub enum CommentControl {
9849 /// Do not require `/gcbrun` comments from a user with repository write
9850 /// permission or above on pull requests before builds are triggered.
9851 /// Comments that contain `/gcbrun` will still fire builds so this should
9852 /// be thought of as comments not required.
9853 CommentsDisabled,
9854 /// Builds will only fire in response to pull requests if:
9855 ///
9856 /// 1. The pull request author has repository write permission or above and
9857 /// `/gcbrun` is in the PR description.
9858 /// 1. A user with repository writer permissions or above comments `/gcbrun`
9859 /// on a pull request authored by any user.
9860 CommentsEnabled,
9861 /// Builds will only fire in response to pull requests if:
9862 ///
9863 /// 1. The pull request author is a repository writer or above.
9864 /// 1. If the author does not have write permissions, a user with write
9865 /// permissions or above must comment `/gcbrun` in order to fire a build.
9866 CommentsEnabledForExternalContributorsOnly,
9867 /// If set, the enum was initialized with an unknown value.
9868 ///
9869 /// Applications can examine the value using [CommentControl::value] or
9870 /// [CommentControl::name].
9871 UnknownValue(comment_control::UnknownValue),
9872 }
9873
9874 #[doc(hidden)]
9875 pub mod comment_control {
9876 #[allow(unused_imports)]
9877 use super::*;
9878 #[derive(Clone, Debug, PartialEq)]
9879 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9880 }
9881
9882 impl CommentControl {
9883 /// Gets the enum value.
9884 ///
9885 /// Returns `None` if the enum contains an unknown value deserialized from
9886 /// the string representation of enums.
9887 pub fn value(&self) -> std::option::Option<i32> {
9888 match self {
9889 Self::CommentsDisabled => std::option::Option::Some(0),
9890 Self::CommentsEnabled => std::option::Option::Some(1),
9891 Self::CommentsEnabledForExternalContributorsOnly => std::option::Option::Some(2),
9892 Self::UnknownValue(u) => u.0.value(),
9893 }
9894 }
9895
9896 /// Gets the enum value as a string.
9897 ///
9898 /// Returns `None` if the enum contains an unknown value deserialized from
9899 /// the integer representation of enums.
9900 pub fn name(&self) -> std::option::Option<&str> {
9901 match self {
9902 Self::CommentsDisabled => std::option::Option::Some("COMMENTS_DISABLED"),
9903 Self::CommentsEnabled => std::option::Option::Some("COMMENTS_ENABLED"),
9904 Self::CommentsEnabledForExternalContributorsOnly => {
9905 std::option::Option::Some("COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY")
9906 }
9907 Self::UnknownValue(u) => u.0.name(),
9908 }
9909 }
9910 }
9911
9912 impl std::default::Default for CommentControl {
9913 fn default() -> Self {
9914 use std::convert::From;
9915 Self::from(0)
9916 }
9917 }
9918
9919 impl std::fmt::Display for CommentControl {
9920 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9921 wkt::internal::display_enum(f, self.name(), self.value())
9922 }
9923 }
9924
9925 impl std::convert::From<i32> for CommentControl {
9926 fn from(value: i32) -> Self {
9927 match value {
9928 0 => Self::CommentsDisabled,
9929 1 => Self::CommentsEnabled,
9930 2 => Self::CommentsEnabledForExternalContributorsOnly,
9931 _ => Self::UnknownValue(comment_control::UnknownValue(
9932 wkt::internal::UnknownEnumValue::Integer(value),
9933 )),
9934 }
9935 }
9936 }
9937
9938 impl std::convert::From<&str> for CommentControl {
9939 fn from(value: &str) -> Self {
9940 use std::string::ToString;
9941 match value {
9942 "COMMENTS_DISABLED" => Self::CommentsDisabled,
9943 "COMMENTS_ENABLED" => Self::CommentsEnabled,
9944 "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" => {
9945 Self::CommentsEnabledForExternalContributorsOnly
9946 }
9947 _ => Self::UnknownValue(comment_control::UnknownValue(
9948 wkt::internal::UnknownEnumValue::String(value.to_string()),
9949 )),
9950 }
9951 }
9952 }
9953
9954 impl serde::ser::Serialize for CommentControl {
9955 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9956 where
9957 S: serde::Serializer,
9958 {
9959 match self {
9960 Self::CommentsDisabled => serializer.serialize_i32(0),
9961 Self::CommentsEnabled => serializer.serialize_i32(1),
9962 Self::CommentsEnabledForExternalContributorsOnly => serializer.serialize_i32(2),
9963 Self::UnknownValue(u) => u.0.serialize(serializer),
9964 }
9965 }
9966 }
9967
9968 impl<'de> serde::de::Deserialize<'de> for CommentControl {
9969 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9970 where
9971 D: serde::Deserializer<'de>,
9972 {
9973 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommentControl>::new(
9974 ".google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl",
9975 ))
9976 }
9977 }
9978
9979 /// Target refs to match.
9980 /// A target ref is the git reference where the pull request will be applied.
9981 #[derive(Clone, Debug, PartialEq)]
9982 #[non_exhaustive]
9983 pub enum GitRef {
9984 /// Regex of branches to match.
9985 ///
9986 /// The syntax of the regular expressions accepted is the syntax accepted by
9987 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
9988 Branch(std::string::String),
9989 }
9990}
9991
9992/// Push contains filter properties for matching GitHub git pushes.
9993#[derive(Clone, Default, PartialEq)]
9994#[non_exhaustive]
9995pub struct PushFilter {
9996 /// When true, only trigger a build if the revision regex does NOT match the
9997 /// git_ref regex.
9998 pub invert_regex: bool,
9999
10000 /// Modified refs to match.
10001 /// A modified refs are the refs modified by a git push operation.
10002 pub git_ref: std::option::Option<crate::model::push_filter::GitRef>,
10003
10004 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10005}
10006
10007impl PushFilter {
10008 /// Creates a new default instance.
10009 pub fn new() -> Self {
10010 std::default::Default::default()
10011 }
10012
10013 /// Sets the value of [invert_regex][crate::model::PushFilter::invert_regex].
10014 ///
10015 /// # Example
10016 /// ```ignore,no_run
10017 /// # use google_cloud_build_v1::model::PushFilter;
10018 /// let x = PushFilter::new().set_invert_regex(true);
10019 /// ```
10020 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10021 self.invert_regex = v.into();
10022 self
10023 }
10024
10025 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref].
10026 ///
10027 /// Note that all the setters affecting `git_ref` are mutually
10028 /// exclusive.
10029 ///
10030 /// # Example
10031 /// ```ignore,no_run
10032 /// # use google_cloud_build_v1::model::PushFilter;
10033 /// use google_cloud_build_v1::model::push_filter::GitRef;
10034 /// let x = PushFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
10035 /// ```
10036 pub fn set_git_ref<
10037 T: std::convert::Into<std::option::Option<crate::model::push_filter::GitRef>>,
10038 >(
10039 mut self,
10040 v: T,
10041 ) -> Self {
10042 self.git_ref = v.into();
10043 self
10044 }
10045
10046 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10047 /// if it holds a `Branch`, `None` if the field is not set or
10048 /// holds a different branch.
10049 pub fn branch(&self) -> std::option::Option<&std::string::String> {
10050 #[allow(unreachable_patterns)]
10051 self.git_ref.as_ref().and_then(|v| match v {
10052 crate::model::push_filter::GitRef::Branch(v) => std::option::Option::Some(v),
10053 _ => std::option::Option::None,
10054 })
10055 }
10056
10057 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10058 /// to hold a `Branch`.
10059 ///
10060 /// Note that all the setters affecting `git_ref` are
10061 /// mutually exclusive.
10062 ///
10063 /// # Example
10064 /// ```ignore,no_run
10065 /// # use google_cloud_build_v1::model::PushFilter;
10066 /// let x = PushFilter::new().set_branch("example");
10067 /// assert!(x.branch().is_some());
10068 /// assert!(x.tag().is_none());
10069 /// ```
10070 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10071 self.git_ref =
10072 std::option::Option::Some(crate::model::push_filter::GitRef::Branch(v.into()));
10073 self
10074 }
10075
10076 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10077 /// if it holds a `Tag`, `None` if the field is not set or
10078 /// holds a different branch.
10079 pub fn tag(&self) -> std::option::Option<&std::string::String> {
10080 #[allow(unreachable_patterns)]
10081 self.git_ref.as_ref().and_then(|v| match v {
10082 crate::model::push_filter::GitRef::Tag(v) => std::option::Option::Some(v),
10083 _ => std::option::Option::None,
10084 })
10085 }
10086
10087 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10088 /// to hold a `Tag`.
10089 ///
10090 /// Note that all the setters affecting `git_ref` are
10091 /// mutually exclusive.
10092 ///
10093 /// # Example
10094 /// ```ignore,no_run
10095 /// # use google_cloud_build_v1::model::PushFilter;
10096 /// let x = PushFilter::new().set_tag("example");
10097 /// assert!(x.tag().is_some());
10098 /// assert!(x.branch().is_none());
10099 /// ```
10100 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10101 self.git_ref = std::option::Option::Some(crate::model::push_filter::GitRef::Tag(v.into()));
10102 self
10103 }
10104}
10105
10106impl wkt::message::Message for PushFilter {
10107 fn typename() -> &'static str {
10108 "type.googleapis.com/google.devtools.cloudbuild.v1.PushFilter"
10109 }
10110}
10111
10112/// Defines additional types related to [PushFilter].
10113pub mod push_filter {
10114 #[allow(unused_imports)]
10115 use super::*;
10116
10117 /// Modified refs to match.
10118 /// A modified refs are the refs modified by a git push operation.
10119 #[derive(Clone, Debug, PartialEq)]
10120 #[non_exhaustive]
10121 pub enum GitRef {
10122 /// Regexes matching branches to build.
10123 ///
10124 /// The syntax of the regular expressions accepted is the syntax accepted by
10125 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10126 Branch(std::string::String),
10127 /// Regexes matching tags to build.
10128 ///
10129 /// The syntax of the regular expressions accepted is the syntax accepted by
10130 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10131 Tag(std::string::String),
10132 }
10133}
10134
10135/// Request to create a new `BuildTrigger`.
10136#[derive(Clone, Default, PartialEq)]
10137#[non_exhaustive]
10138pub struct CreateBuildTriggerRequest {
10139 /// The parent resource where this trigger will be created.
10140 /// Format: `projects/{project}/locations/{location}`
10141 pub parent: std::string::String,
10142
10143 /// Required. ID of the project for which to configure automatic builds.
10144 pub project_id: std::string::String,
10145
10146 /// Required. `BuildTrigger` to create.
10147 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10148
10149 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10150}
10151
10152impl CreateBuildTriggerRequest {
10153 /// Creates a new default instance.
10154 pub fn new() -> Self {
10155 std::default::Default::default()
10156 }
10157
10158 /// Sets the value of [parent][crate::model::CreateBuildTriggerRequest::parent].
10159 ///
10160 /// # Example
10161 /// ```ignore,no_run
10162 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10163 /// let x = CreateBuildTriggerRequest::new().set_parent("example");
10164 /// ```
10165 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10166 self.parent = v.into();
10167 self
10168 }
10169
10170 /// Sets the value of [project_id][crate::model::CreateBuildTriggerRequest::project_id].
10171 ///
10172 /// # Example
10173 /// ```ignore,no_run
10174 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10175 /// let x = CreateBuildTriggerRequest::new().set_project_id("example");
10176 /// ```
10177 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10178 self.project_id = v.into();
10179 self
10180 }
10181
10182 /// Sets the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10183 ///
10184 /// # Example
10185 /// ```ignore,no_run
10186 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10187 /// use google_cloud_build_v1::model::BuildTrigger;
10188 /// let x = CreateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10189 /// ```
10190 pub fn set_trigger<T>(mut self, v: T) -> Self
10191 where
10192 T: std::convert::Into<crate::model::BuildTrigger>,
10193 {
10194 self.trigger = std::option::Option::Some(v.into());
10195 self
10196 }
10197
10198 /// Sets or clears the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10199 ///
10200 /// # Example
10201 /// ```ignore,no_run
10202 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10203 /// use google_cloud_build_v1::model::BuildTrigger;
10204 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10205 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10206 /// ```
10207 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10208 where
10209 T: std::convert::Into<crate::model::BuildTrigger>,
10210 {
10211 self.trigger = v.map(|x| x.into());
10212 self
10213 }
10214}
10215
10216impl wkt::message::Message for CreateBuildTriggerRequest {
10217 fn typename() -> &'static str {
10218 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildTriggerRequest"
10219 }
10220}
10221
10222/// Returns the `BuildTrigger` with the specified ID.
10223#[derive(Clone, Default, PartialEq)]
10224#[non_exhaustive]
10225pub struct GetBuildTriggerRequest {
10226 /// The name of the `Trigger` to retrieve.
10227 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10228 pub name: std::string::String,
10229
10230 /// Required. ID of the project that owns the trigger.
10231 pub project_id: std::string::String,
10232
10233 /// Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
10234 pub trigger_id: std::string::String,
10235
10236 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10237}
10238
10239impl GetBuildTriggerRequest {
10240 /// Creates a new default instance.
10241 pub fn new() -> Self {
10242 std::default::Default::default()
10243 }
10244
10245 /// Sets the value of [name][crate::model::GetBuildTriggerRequest::name].
10246 ///
10247 /// # Example
10248 /// ```ignore,no_run
10249 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10250 /// let x = GetBuildTriggerRequest::new().set_name("example");
10251 /// ```
10252 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10253 self.name = v.into();
10254 self
10255 }
10256
10257 /// Sets the value of [project_id][crate::model::GetBuildTriggerRequest::project_id].
10258 ///
10259 /// # Example
10260 /// ```ignore,no_run
10261 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10262 /// let x = GetBuildTriggerRequest::new().set_project_id("example");
10263 /// ```
10264 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10265 self.project_id = v.into();
10266 self
10267 }
10268
10269 /// Sets the value of [trigger_id][crate::model::GetBuildTriggerRequest::trigger_id].
10270 ///
10271 /// # Example
10272 /// ```ignore,no_run
10273 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10274 /// let x = GetBuildTriggerRequest::new().set_trigger_id("example");
10275 /// ```
10276 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10277 self.trigger_id = v.into();
10278 self
10279 }
10280}
10281
10282impl wkt::message::Message for GetBuildTriggerRequest {
10283 fn typename() -> &'static str {
10284 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildTriggerRequest"
10285 }
10286}
10287
10288/// Request to list existing `BuildTriggers`.
10289#[derive(Clone, Default, PartialEq)]
10290#[non_exhaustive]
10291pub struct ListBuildTriggersRequest {
10292 /// The parent of the collection of `Triggers`.
10293 /// Format: `projects/{project}/locations/{location}`
10294 pub parent: std::string::String,
10295
10296 /// Required. ID of the project for which to list BuildTriggers.
10297 pub project_id: std::string::String,
10298
10299 /// Number of results to return in the list.
10300 pub page_size: i32,
10301
10302 /// Token to provide to skip to a particular spot in the list.
10303 pub page_token: std::string::String,
10304
10305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10306}
10307
10308impl ListBuildTriggersRequest {
10309 /// Creates a new default instance.
10310 pub fn new() -> Self {
10311 std::default::Default::default()
10312 }
10313
10314 /// Sets the value of [parent][crate::model::ListBuildTriggersRequest::parent].
10315 ///
10316 /// # Example
10317 /// ```ignore,no_run
10318 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10319 /// let x = ListBuildTriggersRequest::new().set_parent("example");
10320 /// ```
10321 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10322 self.parent = v.into();
10323 self
10324 }
10325
10326 /// Sets the value of [project_id][crate::model::ListBuildTriggersRequest::project_id].
10327 ///
10328 /// # Example
10329 /// ```ignore,no_run
10330 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10331 /// let x = ListBuildTriggersRequest::new().set_project_id("example");
10332 /// ```
10333 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10334 self.project_id = v.into();
10335 self
10336 }
10337
10338 /// Sets the value of [page_size][crate::model::ListBuildTriggersRequest::page_size].
10339 ///
10340 /// # Example
10341 /// ```ignore,no_run
10342 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10343 /// let x = ListBuildTriggersRequest::new().set_page_size(42);
10344 /// ```
10345 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10346 self.page_size = v.into();
10347 self
10348 }
10349
10350 /// Sets the value of [page_token][crate::model::ListBuildTriggersRequest::page_token].
10351 ///
10352 /// # Example
10353 /// ```ignore,no_run
10354 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10355 /// let x = ListBuildTriggersRequest::new().set_page_token("example");
10356 /// ```
10357 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10358 self.page_token = v.into();
10359 self
10360 }
10361}
10362
10363impl wkt::message::Message for ListBuildTriggersRequest {
10364 fn typename() -> &'static str {
10365 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersRequest"
10366 }
10367}
10368
10369/// Response containing existing `BuildTriggers`.
10370#[derive(Clone, Default, PartialEq)]
10371#[non_exhaustive]
10372pub struct ListBuildTriggersResponse {
10373 /// `BuildTriggers` for the project, sorted by `create_time` descending.
10374 pub triggers: std::vec::Vec<crate::model::BuildTrigger>,
10375
10376 /// Token to receive the next page of results.
10377 pub next_page_token: std::string::String,
10378
10379 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10380}
10381
10382impl ListBuildTriggersResponse {
10383 /// Creates a new default instance.
10384 pub fn new() -> Self {
10385 std::default::Default::default()
10386 }
10387
10388 /// Sets the value of [triggers][crate::model::ListBuildTriggersResponse::triggers].
10389 ///
10390 /// # Example
10391 /// ```ignore,no_run
10392 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10393 /// use google_cloud_build_v1::model::BuildTrigger;
10394 /// let x = ListBuildTriggersResponse::new()
10395 /// .set_triggers([
10396 /// BuildTrigger::default()/* use setters */,
10397 /// BuildTrigger::default()/* use (different) setters */,
10398 /// ]);
10399 /// ```
10400 pub fn set_triggers<T, V>(mut self, v: T) -> Self
10401 where
10402 T: std::iter::IntoIterator<Item = V>,
10403 V: std::convert::Into<crate::model::BuildTrigger>,
10404 {
10405 use std::iter::Iterator;
10406 self.triggers = v.into_iter().map(|i| i.into()).collect();
10407 self
10408 }
10409
10410 /// Sets the value of [next_page_token][crate::model::ListBuildTriggersResponse::next_page_token].
10411 ///
10412 /// # Example
10413 /// ```ignore,no_run
10414 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10415 /// let x = ListBuildTriggersResponse::new().set_next_page_token("example");
10416 /// ```
10417 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10418 self.next_page_token = v.into();
10419 self
10420 }
10421}
10422
10423impl wkt::message::Message for ListBuildTriggersResponse {
10424 fn typename() -> &'static str {
10425 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersResponse"
10426 }
10427}
10428
10429#[doc(hidden)]
10430impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildTriggersResponse {
10431 type PageItem = crate::model::BuildTrigger;
10432
10433 fn items(self) -> std::vec::Vec<Self::PageItem> {
10434 self.triggers
10435 }
10436
10437 fn next_page_token(&self) -> std::string::String {
10438 use std::clone::Clone;
10439 self.next_page_token.clone()
10440 }
10441}
10442
10443/// Request to delete a `BuildTrigger`.
10444#[derive(Clone, Default, PartialEq)]
10445#[non_exhaustive]
10446pub struct DeleteBuildTriggerRequest {
10447 /// The name of the `Trigger` to delete.
10448 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10449 pub name: std::string::String,
10450
10451 /// Required. ID of the project that owns the trigger.
10452 pub project_id: std::string::String,
10453
10454 /// Required. ID of the `BuildTrigger` to delete.
10455 pub trigger_id: std::string::String,
10456
10457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10458}
10459
10460impl DeleteBuildTriggerRequest {
10461 /// Creates a new default instance.
10462 pub fn new() -> Self {
10463 std::default::Default::default()
10464 }
10465
10466 /// Sets the value of [name][crate::model::DeleteBuildTriggerRequest::name].
10467 ///
10468 /// # Example
10469 /// ```ignore,no_run
10470 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10471 /// let x = DeleteBuildTriggerRequest::new().set_name("example");
10472 /// ```
10473 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10474 self.name = v.into();
10475 self
10476 }
10477
10478 /// Sets the value of [project_id][crate::model::DeleteBuildTriggerRequest::project_id].
10479 ///
10480 /// # Example
10481 /// ```ignore,no_run
10482 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10483 /// let x = DeleteBuildTriggerRequest::new().set_project_id("example");
10484 /// ```
10485 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10486 self.project_id = v.into();
10487 self
10488 }
10489
10490 /// Sets the value of [trigger_id][crate::model::DeleteBuildTriggerRequest::trigger_id].
10491 ///
10492 /// # Example
10493 /// ```ignore,no_run
10494 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10495 /// let x = DeleteBuildTriggerRequest::new().set_trigger_id("example");
10496 /// ```
10497 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10498 self.trigger_id = v.into();
10499 self
10500 }
10501}
10502
10503impl wkt::message::Message for DeleteBuildTriggerRequest {
10504 fn typename() -> &'static str {
10505 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest"
10506 }
10507}
10508
10509/// Request to update an existing `BuildTrigger`.
10510#[derive(Clone, Default, PartialEq)]
10511#[non_exhaustive]
10512pub struct UpdateBuildTriggerRequest {
10513 /// Required. ID of the project that owns the trigger.
10514 pub project_id: std::string::String,
10515
10516 /// Required. ID of the `BuildTrigger` to update.
10517 pub trigger_id: std::string::String,
10518
10519 /// Required. `BuildTrigger` to update.
10520 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10521
10522 /// Update mask for the resource. If this is set,
10523 /// the server will only update the fields specified in the field mask.
10524 /// Otherwise, a full update of the mutable resource fields will be performed.
10525 pub update_mask: std::option::Option<wkt::FieldMask>,
10526
10527 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10528}
10529
10530impl UpdateBuildTriggerRequest {
10531 /// Creates a new default instance.
10532 pub fn new() -> Self {
10533 std::default::Default::default()
10534 }
10535
10536 /// Sets the value of [project_id][crate::model::UpdateBuildTriggerRequest::project_id].
10537 ///
10538 /// # Example
10539 /// ```ignore,no_run
10540 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10541 /// let x = UpdateBuildTriggerRequest::new().set_project_id("example");
10542 /// ```
10543 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10544 self.project_id = v.into();
10545 self
10546 }
10547
10548 /// Sets the value of [trigger_id][crate::model::UpdateBuildTriggerRequest::trigger_id].
10549 ///
10550 /// # Example
10551 /// ```ignore,no_run
10552 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10553 /// let x = UpdateBuildTriggerRequest::new().set_trigger_id("example");
10554 /// ```
10555 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10556 self.trigger_id = v.into();
10557 self
10558 }
10559
10560 /// Sets the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10561 ///
10562 /// # Example
10563 /// ```ignore,no_run
10564 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10565 /// use google_cloud_build_v1::model::BuildTrigger;
10566 /// let x = UpdateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10567 /// ```
10568 pub fn set_trigger<T>(mut self, v: T) -> Self
10569 where
10570 T: std::convert::Into<crate::model::BuildTrigger>,
10571 {
10572 self.trigger = std::option::Option::Some(v.into());
10573 self
10574 }
10575
10576 /// Sets or clears the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10577 ///
10578 /// # Example
10579 /// ```ignore,no_run
10580 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10581 /// use google_cloud_build_v1::model::BuildTrigger;
10582 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10583 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10584 /// ```
10585 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10586 where
10587 T: std::convert::Into<crate::model::BuildTrigger>,
10588 {
10589 self.trigger = v.map(|x| x.into());
10590 self
10591 }
10592
10593 /// Sets the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10594 ///
10595 /// # Example
10596 /// ```ignore,no_run
10597 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10598 /// use wkt::FieldMask;
10599 /// let x = UpdateBuildTriggerRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10600 /// ```
10601 pub fn set_update_mask<T>(mut self, v: T) -> Self
10602 where
10603 T: std::convert::Into<wkt::FieldMask>,
10604 {
10605 self.update_mask = std::option::Option::Some(v.into());
10606 self
10607 }
10608
10609 /// Sets or clears the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10610 ///
10611 /// # Example
10612 /// ```ignore,no_run
10613 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10614 /// use wkt::FieldMask;
10615 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10616 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10617 /// ```
10618 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10619 where
10620 T: std::convert::Into<wkt::FieldMask>,
10621 {
10622 self.update_mask = v.map(|x| x.into());
10623 self
10624 }
10625}
10626
10627impl wkt::message::Message for UpdateBuildTriggerRequest {
10628 fn typename() -> &'static str {
10629 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest"
10630 }
10631}
10632
10633/// Optional arguments to enable specific features of builds.
10634#[derive(Clone, Default, PartialEq)]
10635#[non_exhaustive]
10636pub struct BuildOptions {
10637 /// Requested hash for SourceProvenance.
10638 pub source_provenance_hash: std::vec::Vec<crate::model::hash::HashType>,
10639
10640 /// Requested verifiability options.
10641 pub requested_verify_option: crate::model::build_options::VerifyOption,
10642
10643 /// Compute Engine machine type on which to run the build.
10644 pub machine_type: crate::model::build_options::MachineType,
10645
10646 /// Requested disk size for the VM that runs the build. Note that this is *NOT*
10647 /// "disk free"; some of the space will be used by the operating system and
10648 /// build utilities. Also note that this is the minimum disk size that will be
10649 /// allocated for the build -- the build may run with a larger disk than
10650 /// requested. At present, the maximum disk size is 4000GB; builds that request
10651 /// more than the maximum are rejected with an error.
10652 pub disk_size_gb: i64,
10653
10654 /// Option to specify behavior when there is an error in the substitution
10655 /// checks.
10656 ///
10657 /// NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot
10658 /// be overridden in the build configuration file.
10659 pub substitution_option: crate::model::build_options::SubstitutionOption,
10660
10661 /// Option to specify whether or not to apply bash style string
10662 /// operations to the substitutions.
10663 ///
10664 /// NOTE: this is always enabled for triggered builds and cannot be
10665 /// overridden in the build configuration file.
10666 pub dynamic_substitutions: bool,
10667
10668 /// Option to include built-in and custom substitutions as env variables
10669 /// for all build steps.
10670 pub automap_substitutions: bool,
10671
10672 /// Option to define build log streaming behavior to Cloud
10673 /// Storage.
10674 pub log_streaming_option: crate::model::build_options::LogStreamingOption,
10675
10676 /// This field deprecated; please use `pool.name` instead.
10677 #[deprecated]
10678 pub worker_pool: std::string::String,
10679
10680 /// Optional. Specification for execution on a `WorkerPool`.
10681 ///
10682 /// See [running builds in a private
10683 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10684 /// for more information.
10685 pub pool: std::option::Option<crate::model::build_options::PoolOption>,
10686
10687 /// Option to specify the logging mode, which determines if and where build
10688 /// logs are stored.
10689 pub logging: crate::model::build_options::LoggingMode,
10690
10691 /// A list of global environment variable definitions that will exist for all
10692 /// build steps in this build. If a variable is defined in both globally and in
10693 /// a build step, the variable will use the build step value.
10694 ///
10695 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
10696 /// being given the value "VALUE".
10697 pub env: std::vec::Vec<std::string::String>,
10698
10699 /// A list of global environment variables, which are encrypted using a Cloud
10700 /// Key Management Service crypto key. These values must be specified in the
10701 /// build's `Secret`. These variables will be available to all build steps
10702 /// in this build.
10703 pub secret_env: std::vec::Vec<std::string::String>,
10704
10705 /// Global list of volumes to mount for ALL build steps
10706 ///
10707 /// Each volume is created as an empty volume prior to starting the build
10708 /// process. Upon completion of the build, volumes and their contents are
10709 /// discarded. Global volume names and paths cannot conflict with the volumes
10710 /// defined a build step.
10711 ///
10712 /// Using a global volume in a build with only one step is not valid as
10713 /// it is indicative of a build request with an incorrect configuration.
10714 pub volumes: std::vec::Vec<crate::model::Volume>,
10715
10716 /// Optional. Option to specify how default logs buckets are setup.
10717 pub default_logs_bucket_behavior: crate::model::build_options::DefaultLogsBucketBehavior,
10718
10719 /// Optional. Option to specify whether structured logging is enabled.
10720 ///
10721 /// If true, JSON-formatted logs are parsed as structured logs.
10722 pub enable_structured_logging: bool,
10723
10724 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10725}
10726
10727impl BuildOptions {
10728 /// Creates a new default instance.
10729 pub fn new() -> Self {
10730 std::default::Default::default()
10731 }
10732
10733 /// Sets the value of [source_provenance_hash][crate::model::BuildOptions::source_provenance_hash].
10734 ///
10735 /// # Example
10736 /// ```ignore,no_run
10737 /// # use google_cloud_build_v1::model::BuildOptions;
10738 /// use google_cloud_build_v1::model::hash::HashType;
10739 /// let x = BuildOptions::new().set_source_provenance_hash([
10740 /// HashType::Sha256,
10741 /// HashType::Md5,
10742 /// HashType::GoModuleH1,
10743 /// ]);
10744 /// ```
10745 pub fn set_source_provenance_hash<T, V>(mut self, v: T) -> Self
10746 where
10747 T: std::iter::IntoIterator<Item = V>,
10748 V: std::convert::Into<crate::model::hash::HashType>,
10749 {
10750 use std::iter::Iterator;
10751 self.source_provenance_hash = v.into_iter().map(|i| i.into()).collect();
10752 self
10753 }
10754
10755 /// Sets the value of [requested_verify_option][crate::model::BuildOptions::requested_verify_option].
10756 ///
10757 /// # Example
10758 /// ```ignore,no_run
10759 /// # use google_cloud_build_v1::model::BuildOptions;
10760 /// use google_cloud_build_v1::model::build_options::VerifyOption;
10761 /// let x0 = BuildOptions::new().set_requested_verify_option(VerifyOption::Verified);
10762 /// ```
10763 pub fn set_requested_verify_option<
10764 T: std::convert::Into<crate::model::build_options::VerifyOption>,
10765 >(
10766 mut self,
10767 v: T,
10768 ) -> Self {
10769 self.requested_verify_option = v.into();
10770 self
10771 }
10772
10773 /// Sets the value of [machine_type][crate::model::BuildOptions::machine_type].
10774 ///
10775 /// # Example
10776 /// ```ignore,no_run
10777 /// # use google_cloud_build_v1::model::BuildOptions;
10778 /// use google_cloud_build_v1::model::build_options::MachineType;
10779 /// let x0 = BuildOptions::new().set_machine_type(MachineType::N1Highcpu8);
10780 /// let x1 = BuildOptions::new().set_machine_type(MachineType::N1Highcpu32);
10781 /// let x2 = BuildOptions::new().set_machine_type(MachineType::E2Highcpu8);
10782 /// ```
10783 pub fn set_machine_type<T: std::convert::Into<crate::model::build_options::MachineType>>(
10784 mut self,
10785 v: T,
10786 ) -> Self {
10787 self.machine_type = v.into();
10788 self
10789 }
10790
10791 /// Sets the value of [disk_size_gb][crate::model::BuildOptions::disk_size_gb].
10792 ///
10793 /// # Example
10794 /// ```ignore,no_run
10795 /// # use google_cloud_build_v1::model::BuildOptions;
10796 /// let x = BuildOptions::new().set_disk_size_gb(42);
10797 /// ```
10798 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10799 self.disk_size_gb = v.into();
10800 self
10801 }
10802
10803 /// Sets the value of [substitution_option][crate::model::BuildOptions::substitution_option].
10804 ///
10805 /// # Example
10806 /// ```ignore,no_run
10807 /// # use google_cloud_build_v1::model::BuildOptions;
10808 /// use google_cloud_build_v1::model::build_options::SubstitutionOption;
10809 /// let x0 = BuildOptions::new().set_substitution_option(SubstitutionOption::AllowLoose);
10810 /// ```
10811 pub fn set_substitution_option<
10812 T: std::convert::Into<crate::model::build_options::SubstitutionOption>,
10813 >(
10814 mut self,
10815 v: T,
10816 ) -> Self {
10817 self.substitution_option = v.into();
10818 self
10819 }
10820
10821 /// Sets the value of [dynamic_substitutions][crate::model::BuildOptions::dynamic_substitutions].
10822 ///
10823 /// # Example
10824 /// ```ignore,no_run
10825 /// # use google_cloud_build_v1::model::BuildOptions;
10826 /// let x = BuildOptions::new().set_dynamic_substitutions(true);
10827 /// ```
10828 pub fn set_dynamic_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10829 self.dynamic_substitutions = v.into();
10830 self
10831 }
10832
10833 /// Sets the value of [automap_substitutions][crate::model::BuildOptions::automap_substitutions].
10834 ///
10835 /// # Example
10836 /// ```ignore,no_run
10837 /// # use google_cloud_build_v1::model::BuildOptions;
10838 /// let x = BuildOptions::new().set_automap_substitutions(true);
10839 /// ```
10840 pub fn set_automap_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10841 self.automap_substitutions = v.into();
10842 self
10843 }
10844
10845 /// Sets the value of [log_streaming_option][crate::model::BuildOptions::log_streaming_option].
10846 ///
10847 /// # Example
10848 /// ```ignore,no_run
10849 /// # use google_cloud_build_v1::model::BuildOptions;
10850 /// use google_cloud_build_v1::model::build_options::LogStreamingOption;
10851 /// let x0 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOn);
10852 /// let x1 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOff);
10853 /// ```
10854 pub fn set_log_streaming_option<
10855 T: std::convert::Into<crate::model::build_options::LogStreamingOption>,
10856 >(
10857 mut self,
10858 v: T,
10859 ) -> Self {
10860 self.log_streaming_option = v.into();
10861 self
10862 }
10863
10864 /// Sets the value of [worker_pool][crate::model::BuildOptions::worker_pool].
10865 ///
10866 /// # Example
10867 /// ```ignore,no_run
10868 /// # use google_cloud_build_v1::model::BuildOptions;
10869 /// let x = BuildOptions::new().set_worker_pool("example");
10870 /// ```
10871 #[deprecated]
10872 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10873 self.worker_pool = v.into();
10874 self
10875 }
10876
10877 /// Sets the value of [pool][crate::model::BuildOptions::pool].
10878 ///
10879 /// # Example
10880 /// ```ignore,no_run
10881 /// # use google_cloud_build_v1::model::BuildOptions;
10882 /// use google_cloud_build_v1::model::build_options::PoolOption;
10883 /// let x = BuildOptions::new().set_pool(PoolOption::default()/* use setters */);
10884 /// ```
10885 pub fn set_pool<T>(mut self, v: T) -> Self
10886 where
10887 T: std::convert::Into<crate::model::build_options::PoolOption>,
10888 {
10889 self.pool = std::option::Option::Some(v.into());
10890 self
10891 }
10892
10893 /// Sets or clears the value of [pool][crate::model::BuildOptions::pool].
10894 ///
10895 /// # Example
10896 /// ```ignore,no_run
10897 /// # use google_cloud_build_v1::model::BuildOptions;
10898 /// use google_cloud_build_v1::model::build_options::PoolOption;
10899 /// let x = BuildOptions::new().set_or_clear_pool(Some(PoolOption::default()/* use setters */));
10900 /// let x = BuildOptions::new().set_or_clear_pool(None::<PoolOption>);
10901 /// ```
10902 pub fn set_or_clear_pool<T>(mut self, v: std::option::Option<T>) -> Self
10903 where
10904 T: std::convert::Into<crate::model::build_options::PoolOption>,
10905 {
10906 self.pool = v.map(|x| x.into());
10907 self
10908 }
10909
10910 /// Sets the value of [logging][crate::model::BuildOptions::logging].
10911 ///
10912 /// # Example
10913 /// ```ignore,no_run
10914 /// # use google_cloud_build_v1::model::BuildOptions;
10915 /// use google_cloud_build_v1::model::build_options::LoggingMode;
10916 /// let x0 = BuildOptions::new().set_logging(LoggingMode::Legacy);
10917 /// let x1 = BuildOptions::new().set_logging(LoggingMode::GcsOnly);
10918 /// let x2 = BuildOptions::new().set_logging(LoggingMode::CloudLoggingOnly);
10919 /// ```
10920 pub fn set_logging<T: std::convert::Into<crate::model::build_options::LoggingMode>>(
10921 mut self,
10922 v: T,
10923 ) -> Self {
10924 self.logging = v.into();
10925 self
10926 }
10927
10928 /// Sets the value of [env][crate::model::BuildOptions::env].
10929 ///
10930 /// # Example
10931 /// ```ignore,no_run
10932 /// # use google_cloud_build_v1::model::BuildOptions;
10933 /// let x = BuildOptions::new().set_env(["a", "b", "c"]);
10934 /// ```
10935 pub fn set_env<T, V>(mut self, v: T) -> Self
10936 where
10937 T: std::iter::IntoIterator<Item = V>,
10938 V: std::convert::Into<std::string::String>,
10939 {
10940 use std::iter::Iterator;
10941 self.env = v.into_iter().map(|i| i.into()).collect();
10942 self
10943 }
10944
10945 /// Sets the value of [secret_env][crate::model::BuildOptions::secret_env].
10946 ///
10947 /// # Example
10948 /// ```ignore,no_run
10949 /// # use google_cloud_build_v1::model::BuildOptions;
10950 /// let x = BuildOptions::new().set_secret_env(["a", "b", "c"]);
10951 /// ```
10952 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
10953 where
10954 T: std::iter::IntoIterator<Item = V>,
10955 V: std::convert::Into<std::string::String>,
10956 {
10957 use std::iter::Iterator;
10958 self.secret_env = v.into_iter().map(|i| i.into()).collect();
10959 self
10960 }
10961
10962 /// Sets the value of [volumes][crate::model::BuildOptions::volumes].
10963 ///
10964 /// # Example
10965 /// ```ignore,no_run
10966 /// # use google_cloud_build_v1::model::BuildOptions;
10967 /// use google_cloud_build_v1::model::Volume;
10968 /// let x = BuildOptions::new()
10969 /// .set_volumes([
10970 /// Volume::default()/* use setters */,
10971 /// Volume::default()/* use (different) setters */,
10972 /// ]);
10973 /// ```
10974 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10975 where
10976 T: std::iter::IntoIterator<Item = V>,
10977 V: std::convert::Into<crate::model::Volume>,
10978 {
10979 use std::iter::Iterator;
10980 self.volumes = v.into_iter().map(|i| i.into()).collect();
10981 self
10982 }
10983
10984 /// Sets the value of [default_logs_bucket_behavior][crate::model::BuildOptions::default_logs_bucket_behavior].
10985 ///
10986 /// # Example
10987 /// ```ignore,no_run
10988 /// # use google_cloud_build_v1::model::BuildOptions;
10989 /// use google_cloud_build_v1::model::build_options::DefaultLogsBucketBehavior;
10990 /// let x0 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::RegionalUserOwnedBucket);
10991 /// let x1 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::LegacyBucket);
10992 /// ```
10993 pub fn set_default_logs_bucket_behavior<
10994 T: std::convert::Into<crate::model::build_options::DefaultLogsBucketBehavior>,
10995 >(
10996 mut self,
10997 v: T,
10998 ) -> Self {
10999 self.default_logs_bucket_behavior = v.into();
11000 self
11001 }
11002
11003 /// Sets the value of [enable_structured_logging][crate::model::BuildOptions::enable_structured_logging].
11004 ///
11005 /// # Example
11006 /// ```ignore,no_run
11007 /// # use google_cloud_build_v1::model::BuildOptions;
11008 /// let x = BuildOptions::new().set_enable_structured_logging(true);
11009 /// ```
11010 pub fn set_enable_structured_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11011 self.enable_structured_logging = v.into();
11012 self
11013 }
11014}
11015
11016impl wkt::message::Message for BuildOptions {
11017 fn typename() -> &'static str {
11018 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions"
11019 }
11020}
11021
11022/// Defines additional types related to [BuildOptions].
11023pub mod build_options {
11024 #[allow(unused_imports)]
11025 use super::*;
11026
11027 /// Details about how a build should be executed on a `WorkerPool`.
11028 ///
11029 /// See [running builds in a private
11030 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
11031 /// for more information.
11032 #[derive(Clone, Default, PartialEq)]
11033 #[non_exhaustive]
11034 pub struct PoolOption {
11035 /// The `WorkerPool` resource to execute the build on.
11036 /// You must have `cloudbuild.workerpools.use` on the project hosting the
11037 /// WorkerPool.
11038 ///
11039 /// Format projects/{project}/locations/{location}/workerPools/{workerPoolId}
11040 pub name: std::string::String,
11041
11042 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11043 }
11044
11045 impl PoolOption {
11046 /// Creates a new default instance.
11047 pub fn new() -> Self {
11048 std::default::Default::default()
11049 }
11050
11051 /// Sets the value of [name][crate::model::build_options::PoolOption::name].
11052 ///
11053 /// # Example
11054 /// ```ignore,no_run
11055 /// # use google_cloud_build_v1::model::build_options::PoolOption;
11056 /// let x = PoolOption::new().set_name("example");
11057 /// ```
11058 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11059 self.name = v.into();
11060 self
11061 }
11062 }
11063
11064 impl wkt::message::Message for PoolOption {
11065 fn typename() -> &'static str {
11066 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions.PoolOption"
11067 }
11068 }
11069
11070 /// Specifies the manner in which the build should be verified, if at all.
11071 ///
11072 /// If a verified build is requested, and any part of the process to generate
11073 /// and upload provenance fails, the build will also fail.
11074 ///
11075 /// If the build does not request verification then that process may occur, but
11076 /// is not guaranteed to. If it does occur and fails, the build will not fail.
11077 ///
11078 /// For more information, see [Viewing Build
11079 /// Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance).
11080 ///
11081 /// # Working with unknown values
11082 ///
11083 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11084 /// additional enum variants at any time. Adding new variants is not considered
11085 /// a breaking change. Applications should write their code in anticipation of:
11086 ///
11087 /// - New values appearing in future releases of the client library, **and**
11088 /// - New values received dynamically, without application changes.
11089 ///
11090 /// Please consult the [Working with enums] section in the user guide for some
11091 /// guidelines.
11092 ///
11093 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11094 #[derive(Clone, Debug, PartialEq)]
11095 #[non_exhaustive]
11096 pub enum VerifyOption {
11097 /// Not a verifiable build (the default).
11098 NotVerified,
11099 /// Build must be verified.
11100 Verified,
11101 /// If set, the enum was initialized with an unknown value.
11102 ///
11103 /// Applications can examine the value using [VerifyOption::value] or
11104 /// [VerifyOption::name].
11105 UnknownValue(verify_option::UnknownValue),
11106 }
11107
11108 #[doc(hidden)]
11109 pub mod verify_option {
11110 #[allow(unused_imports)]
11111 use super::*;
11112 #[derive(Clone, Debug, PartialEq)]
11113 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11114 }
11115
11116 impl VerifyOption {
11117 /// Gets the enum value.
11118 ///
11119 /// Returns `None` if the enum contains an unknown value deserialized from
11120 /// the string representation of enums.
11121 pub fn value(&self) -> std::option::Option<i32> {
11122 match self {
11123 Self::NotVerified => std::option::Option::Some(0),
11124 Self::Verified => std::option::Option::Some(1),
11125 Self::UnknownValue(u) => u.0.value(),
11126 }
11127 }
11128
11129 /// Gets the enum value as a string.
11130 ///
11131 /// Returns `None` if the enum contains an unknown value deserialized from
11132 /// the integer representation of enums.
11133 pub fn name(&self) -> std::option::Option<&str> {
11134 match self {
11135 Self::NotVerified => std::option::Option::Some("NOT_VERIFIED"),
11136 Self::Verified => std::option::Option::Some("VERIFIED"),
11137 Self::UnknownValue(u) => u.0.name(),
11138 }
11139 }
11140 }
11141
11142 impl std::default::Default for VerifyOption {
11143 fn default() -> Self {
11144 use std::convert::From;
11145 Self::from(0)
11146 }
11147 }
11148
11149 impl std::fmt::Display for VerifyOption {
11150 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11151 wkt::internal::display_enum(f, self.name(), self.value())
11152 }
11153 }
11154
11155 impl std::convert::From<i32> for VerifyOption {
11156 fn from(value: i32) -> Self {
11157 match value {
11158 0 => Self::NotVerified,
11159 1 => Self::Verified,
11160 _ => Self::UnknownValue(verify_option::UnknownValue(
11161 wkt::internal::UnknownEnumValue::Integer(value),
11162 )),
11163 }
11164 }
11165 }
11166
11167 impl std::convert::From<&str> for VerifyOption {
11168 fn from(value: &str) -> Self {
11169 use std::string::ToString;
11170 match value {
11171 "NOT_VERIFIED" => Self::NotVerified,
11172 "VERIFIED" => Self::Verified,
11173 _ => Self::UnknownValue(verify_option::UnknownValue(
11174 wkt::internal::UnknownEnumValue::String(value.to_string()),
11175 )),
11176 }
11177 }
11178 }
11179
11180 impl serde::ser::Serialize for VerifyOption {
11181 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11182 where
11183 S: serde::Serializer,
11184 {
11185 match self {
11186 Self::NotVerified => serializer.serialize_i32(0),
11187 Self::Verified => serializer.serialize_i32(1),
11188 Self::UnknownValue(u) => u.0.serialize(serializer),
11189 }
11190 }
11191 }
11192
11193 impl<'de> serde::de::Deserialize<'de> for VerifyOption {
11194 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11195 where
11196 D: serde::Deserializer<'de>,
11197 {
11198 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerifyOption>::new(
11199 ".google.devtools.cloudbuild.v1.BuildOptions.VerifyOption",
11200 ))
11201 }
11202 }
11203
11204 /// Supported Compute Engine machine types.
11205 /// For more information, see [Machine
11206 /// types](https://cloud.google.com/compute/docs/machine-types).
11207 ///
11208 /// # Working with unknown values
11209 ///
11210 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11211 /// additional enum variants at any time. Adding new variants is not considered
11212 /// a breaking change. Applications should write their code in anticipation of:
11213 ///
11214 /// - New values appearing in future releases of the client library, **and**
11215 /// - New values received dynamically, without application changes.
11216 ///
11217 /// Please consult the [Working with enums] section in the user guide for some
11218 /// guidelines.
11219 ///
11220 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11221 #[derive(Clone, Debug, PartialEq)]
11222 #[non_exhaustive]
11223 pub enum MachineType {
11224 /// Standard machine type.
11225 Unspecified,
11226 /// Highcpu machine with 8 CPUs.
11227 N1Highcpu8,
11228 /// Highcpu machine with 32 CPUs.
11229 N1Highcpu32,
11230 /// Highcpu e2 machine with 8 CPUs.
11231 E2Highcpu8,
11232 /// Highcpu e2 machine with 32 CPUs.
11233 E2Highcpu32,
11234 /// E2 machine with 1 CPU.
11235 E2Medium,
11236 /// If set, the enum was initialized with an unknown value.
11237 ///
11238 /// Applications can examine the value using [MachineType::value] or
11239 /// [MachineType::name].
11240 UnknownValue(machine_type::UnknownValue),
11241 }
11242
11243 #[doc(hidden)]
11244 pub mod machine_type {
11245 #[allow(unused_imports)]
11246 use super::*;
11247 #[derive(Clone, Debug, PartialEq)]
11248 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11249 }
11250
11251 impl MachineType {
11252 /// Gets the enum value.
11253 ///
11254 /// Returns `None` if the enum contains an unknown value deserialized from
11255 /// the string representation of enums.
11256 pub fn value(&self) -> std::option::Option<i32> {
11257 match self {
11258 Self::Unspecified => std::option::Option::Some(0),
11259 Self::N1Highcpu8 => std::option::Option::Some(1),
11260 Self::N1Highcpu32 => std::option::Option::Some(2),
11261 Self::E2Highcpu8 => std::option::Option::Some(5),
11262 Self::E2Highcpu32 => std::option::Option::Some(6),
11263 Self::E2Medium => std::option::Option::Some(7),
11264 Self::UnknownValue(u) => u.0.value(),
11265 }
11266 }
11267
11268 /// Gets the enum value as a string.
11269 ///
11270 /// Returns `None` if the enum contains an unknown value deserialized from
11271 /// the integer representation of enums.
11272 pub fn name(&self) -> std::option::Option<&str> {
11273 match self {
11274 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
11275 Self::N1Highcpu8 => std::option::Option::Some("N1_HIGHCPU_8"),
11276 Self::N1Highcpu32 => std::option::Option::Some("N1_HIGHCPU_32"),
11277 Self::E2Highcpu8 => std::option::Option::Some("E2_HIGHCPU_8"),
11278 Self::E2Highcpu32 => std::option::Option::Some("E2_HIGHCPU_32"),
11279 Self::E2Medium => std::option::Option::Some("E2_MEDIUM"),
11280 Self::UnknownValue(u) => u.0.name(),
11281 }
11282 }
11283 }
11284
11285 impl std::default::Default for MachineType {
11286 fn default() -> Self {
11287 use std::convert::From;
11288 Self::from(0)
11289 }
11290 }
11291
11292 impl std::fmt::Display for MachineType {
11293 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11294 wkt::internal::display_enum(f, self.name(), self.value())
11295 }
11296 }
11297
11298 impl std::convert::From<i32> for MachineType {
11299 fn from(value: i32) -> Self {
11300 match value {
11301 0 => Self::Unspecified,
11302 1 => Self::N1Highcpu8,
11303 2 => Self::N1Highcpu32,
11304 5 => Self::E2Highcpu8,
11305 6 => Self::E2Highcpu32,
11306 7 => Self::E2Medium,
11307 _ => Self::UnknownValue(machine_type::UnknownValue(
11308 wkt::internal::UnknownEnumValue::Integer(value),
11309 )),
11310 }
11311 }
11312 }
11313
11314 impl std::convert::From<&str> for MachineType {
11315 fn from(value: &str) -> Self {
11316 use std::string::ToString;
11317 match value {
11318 "UNSPECIFIED" => Self::Unspecified,
11319 "N1_HIGHCPU_8" => Self::N1Highcpu8,
11320 "N1_HIGHCPU_32" => Self::N1Highcpu32,
11321 "E2_HIGHCPU_8" => Self::E2Highcpu8,
11322 "E2_HIGHCPU_32" => Self::E2Highcpu32,
11323 "E2_MEDIUM" => Self::E2Medium,
11324 _ => Self::UnknownValue(machine_type::UnknownValue(
11325 wkt::internal::UnknownEnumValue::String(value.to_string()),
11326 )),
11327 }
11328 }
11329 }
11330
11331 impl serde::ser::Serialize for MachineType {
11332 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11333 where
11334 S: serde::Serializer,
11335 {
11336 match self {
11337 Self::Unspecified => serializer.serialize_i32(0),
11338 Self::N1Highcpu8 => serializer.serialize_i32(1),
11339 Self::N1Highcpu32 => serializer.serialize_i32(2),
11340 Self::E2Highcpu8 => serializer.serialize_i32(5),
11341 Self::E2Highcpu32 => serializer.serialize_i32(6),
11342 Self::E2Medium => serializer.serialize_i32(7),
11343 Self::UnknownValue(u) => u.0.serialize(serializer),
11344 }
11345 }
11346 }
11347
11348 impl<'de> serde::de::Deserialize<'de> for MachineType {
11349 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11350 where
11351 D: serde::Deserializer<'de>,
11352 {
11353 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MachineType>::new(
11354 ".google.devtools.cloudbuild.v1.BuildOptions.MachineType",
11355 ))
11356 }
11357 }
11358
11359 /// Specifies the behavior when there is an error in the substitution checks.
11360 ///
11361 /// # Working with unknown values
11362 ///
11363 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11364 /// additional enum variants at any time. Adding new variants is not considered
11365 /// a breaking change. Applications should write their code in anticipation of:
11366 ///
11367 /// - New values appearing in future releases of the client library, **and**
11368 /// - New values received dynamically, without application changes.
11369 ///
11370 /// Please consult the [Working with enums] section in the user guide for some
11371 /// guidelines.
11372 ///
11373 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11374 #[derive(Clone, Debug, PartialEq)]
11375 #[non_exhaustive]
11376 pub enum SubstitutionOption {
11377 /// Fails the build if error in substitutions checks, like missing
11378 /// a substitution in the template or in the map.
11379 MustMatch,
11380 /// Do not fail the build if error in substitutions checks.
11381 AllowLoose,
11382 /// If set, the enum was initialized with an unknown value.
11383 ///
11384 /// Applications can examine the value using [SubstitutionOption::value] or
11385 /// [SubstitutionOption::name].
11386 UnknownValue(substitution_option::UnknownValue),
11387 }
11388
11389 #[doc(hidden)]
11390 pub mod substitution_option {
11391 #[allow(unused_imports)]
11392 use super::*;
11393 #[derive(Clone, Debug, PartialEq)]
11394 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11395 }
11396
11397 impl SubstitutionOption {
11398 /// Gets the enum value.
11399 ///
11400 /// Returns `None` if the enum contains an unknown value deserialized from
11401 /// the string representation of enums.
11402 pub fn value(&self) -> std::option::Option<i32> {
11403 match self {
11404 Self::MustMatch => std::option::Option::Some(0),
11405 Self::AllowLoose => std::option::Option::Some(1),
11406 Self::UnknownValue(u) => u.0.value(),
11407 }
11408 }
11409
11410 /// Gets the enum value as a string.
11411 ///
11412 /// Returns `None` if the enum contains an unknown value deserialized from
11413 /// the integer representation of enums.
11414 pub fn name(&self) -> std::option::Option<&str> {
11415 match self {
11416 Self::MustMatch => std::option::Option::Some("MUST_MATCH"),
11417 Self::AllowLoose => std::option::Option::Some("ALLOW_LOOSE"),
11418 Self::UnknownValue(u) => u.0.name(),
11419 }
11420 }
11421 }
11422
11423 impl std::default::Default for SubstitutionOption {
11424 fn default() -> Self {
11425 use std::convert::From;
11426 Self::from(0)
11427 }
11428 }
11429
11430 impl std::fmt::Display for SubstitutionOption {
11431 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11432 wkt::internal::display_enum(f, self.name(), self.value())
11433 }
11434 }
11435
11436 impl std::convert::From<i32> for SubstitutionOption {
11437 fn from(value: i32) -> Self {
11438 match value {
11439 0 => Self::MustMatch,
11440 1 => Self::AllowLoose,
11441 _ => Self::UnknownValue(substitution_option::UnknownValue(
11442 wkt::internal::UnknownEnumValue::Integer(value),
11443 )),
11444 }
11445 }
11446 }
11447
11448 impl std::convert::From<&str> for SubstitutionOption {
11449 fn from(value: &str) -> Self {
11450 use std::string::ToString;
11451 match value {
11452 "MUST_MATCH" => Self::MustMatch,
11453 "ALLOW_LOOSE" => Self::AllowLoose,
11454 _ => Self::UnknownValue(substitution_option::UnknownValue(
11455 wkt::internal::UnknownEnumValue::String(value.to_string()),
11456 )),
11457 }
11458 }
11459 }
11460
11461 impl serde::ser::Serialize for SubstitutionOption {
11462 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11463 where
11464 S: serde::Serializer,
11465 {
11466 match self {
11467 Self::MustMatch => serializer.serialize_i32(0),
11468 Self::AllowLoose => serializer.serialize_i32(1),
11469 Self::UnknownValue(u) => u.0.serialize(serializer),
11470 }
11471 }
11472 }
11473
11474 impl<'de> serde::de::Deserialize<'de> for SubstitutionOption {
11475 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11476 where
11477 D: serde::Deserializer<'de>,
11478 {
11479 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SubstitutionOption>::new(
11480 ".google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption",
11481 ))
11482 }
11483 }
11484
11485 /// Specifies the behavior when writing build logs to Cloud Storage.
11486 ///
11487 /// # Working with unknown values
11488 ///
11489 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11490 /// additional enum variants at any time. Adding new variants is not considered
11491 /// a breaking change. Applications should write their code in anticipation of:
11492 ///
11493 /// - New values appearing in future releases of the client library, **and**
11494 /// - New values received dynamically, without application changes.
11495 ///
11496 /// Please consult the [Working with enums] section in the user guide for some
11497 /// guidelines.
11498 ///
11499 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11500 #[derive(Clone, Debug, PartialEq)]
11501 #[non_exhaustive]
11502 pub enum LogStreamingOption {
11503 /// Service may automatically determine build log streaming behavior.
11504 StreamDefault,
11505 /// Build logs should be streamed to Cloud Storage.
11506 StreamOn,
11507 /// Build logs should not be streamed to Cloud Storage; they will be
11508 /// written when the build is completed.
11509 StreamOff,
11510 /// If set, the enum was initialized with an unknown value.
11511 ///
11512 /// Applications can examine the value using [LogStreamingOption::value] or
11513 /// [LogStreamingOption::name].
11514 UnknownValue(log_streaming_option::UnknownValue),
11515 }
11516
11517 #[doc(hidden)]
11518 pub mod log_streaming_option {
11519 #[allow(unused_imports)]
11520 use super::*;
11521 #[derive(Clone, Debug, PartialEq)]
11522 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11523 }
11524
11525 impl LogStreamingOption {
11526 /// Gets the enum value.
11527 ///
11528 /// Returns `None` if the enum contains an unknown value deserialized from
11529 /// the string representation of enums.
11530 pub fn value(&self) -> std::option::Option<i32> {
11531 match self {
11532 Self::StreamDefault => std::option::Option::Some(0),
11533 Self::StreamOn => std::option::Option::Some(1),
11534 Self::StreamOff => std::option::Option::Some(2),
11535 Self::UnknownValue(u) => u.0.value(),
11536 }
11537 }
11538
11539 /// Gets the enum value as a string.
11540 ///
11541 /// Returns `None` if the enum contains an unknown value deserialized from
11542 /// the integer representation of enums.
11543 pub fn name(&self) -> std::option::Option<&str> {
11544 match self {
11545 Self::StreamDefault => std::option::Option::Some("STREAM_DEFAULT"),
11546 Self::StreamOn => std::option::Option::Some("STREAM_ON"),
11547 Self::StreamOff => std::option::Option::Some("STREAM_OFF"),
11548 Self::UnknownValue(u) => u.0.name(),
11549 }
11550 }
11551 }
11552
11553 impl std::default::Default for LogStreamingOption {
11554 fn default() -> Self {
11555 use std::convert::From;
11556 Self::from(0)
11557 }
11558 }
11559
11560 impl std::fmt::Display for LogStreamingOption {
11561 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11562 wkt::internal::display_enum(f, self.name(), self.value())
11563 }
11564 }
11565
11566 impl std::convert::From<i32> for LogStreamingOption {
11567 fn from(value: i32) -> Self {
11568 match value {
11569 0 => Self::StreamDefault,
11570 1 => Self::StreamOn,
11571 2 => Self::StreamOff,
11572 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11573 wkt::internal::UnknownEnumValue::Integer(value),
11574 )),
11575 }
11576 }
11577 }
11578
11579 impl std::convert::From<&str> for LogStreamingOption {
11580 fn from(value: &str) -> Self {
11581 use std::string::ToString;
11582 match value {
11583 "STREAM_DEFAULT" => Self::StreamDefault,
11584 "STREAM_ON" => Self::StreamOn,
11585 "STREAM_OFF" => Self::StreamOff,
11586 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11587 wkt::internal::UnknownEnumValue::String(value.to_string()),
11588 )),
11589 }
11590 }
11591 }
11592
11593 impl serde::ser::Serialize for LogStreamingOption {
11594 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11595 where
11596 S: serde::Serializer,
11597 {
11598 match self {
11599 Self::StreamDefault => serializer.serialize_i32(0),
11600 Self::StreamOn => serializer.serialize_i32(1),
11601 Self::StreamOff => serializer.serialize_i32(2),
11602 Self::UnknownValue(u) => u.0.serialize(serializer),
11603 }
11604 }
11605 }
11606
11607 impl<'de> serde::de::Deserialize<'de> for LogStreamingOption {
11608 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11609 where
11610 D: serde::Deserializer<'de>,
11611 {
11612 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogStreamingOption>::new(
11613 ".google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption",
11614 ))
11615 }
11616 }
11617
11618 /// Specifies the logging mode.
11619 ///
11620 /// # Working with unknown values
11621 ///
11622 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11623 /// additional enum variants at any time. Adding new variants is not considered
11624 /// a breaking change. Applications should write their code in anticipation of:
11625 ///
11626 /// - New values appearing in future releases of the client library, **and**
11627 /// - New values received dynamically, without application changes.
11628 ///
11629 /// Please consult the [Working with enums] section in the user guide for some
11630 /// guidelines.
11631 ///
11632 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11633 #[derive(Clone, Debug, PartialEq)]
11634 #[non_exhaustive]
11635 pub enum LoggingMode {
11636 /// The service determines the logging mode. The default is `LEGACY`. Do not
11637 /// rely on the default logging behavior as it may change in the future.
11638 LoggingUnspecified,
11639 /// Build logs are stored in Cloud Logging and Cloud Storage.
11640 Legacy,
11641 /// Build logs are stored in Cloud Storage.
11642 GcsOnly,
11643 /// This option is the same as CLOUD_LOGGING_ONLY.
11644 #[deprecated]
11645 StackdriverOnly,
11646 /// Build logs are stored in Cloud Logging. Selecting this option will not
11647 /// allow [logs
11648 /// streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log).
11649 CloudLoggingOnly,
11650 /// Turn off all logging. No build logs will be captured.
11651 None,
11652 /// If set, the enum was initialized with an unknown value.
11653 ///
11654 /// Applications can examine the value using [LoggingMode::value] or
11655 /// [LoggingMode::name].
11656 UnknownValue(logging_mode::UnknownValue),
11657 }
11658
11659 #[doc(hidden)]
11660 pub mod logging_mode {
11661 #[allow(unused_imports)]
11662 use super::*;
11663 #[derive(Clone, Debug, PartialEq)]
11664 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11665 }
11666
11667 impl LoggingMode {
11668 /// Gets the enum value.
11669 ///
11670 /// Returns `None` if the enum contains an unknown value deserialized from
11671 /// the string representation of enums.
11672 pub fn value(&self) -> std::option::Option<i32> {
11673 match self {
11674 Self::LoggingUnspecified => std::option::Option::Some(0),
11675 Self::Legacy => std::option::Option::Some(1),
11676 Self::GcsOnly => std::option::Option::Some(2),
11677 Self::StackdriverOnly => std::option::Option::Some(3),
11678 Self::CloudLoggingOnly => std::option::Option::Some(5),
11679 Self::None => std::option::Option::Some(4),
11680 Self::UnknownValue(u) => u.0.value(),
11681 }
11682 }
11683
11684 /// Gets the enum value as a string.
11685 ///
11686 /// Returns `None` if the enum contains an unknown value deserialized from
11687 /// the integer representation of enums.
11688 pub fn name(&self) -> std::option::Option<&str> {
11689 match self {
11690 Self::LoggingUnspecified => std::option::Option::Some("LOGGING_UNSPECIFIED"),
11691 Self::Legacy => std::option::Option::Some("LEGACY"),
11692 Self::GcsOnly => std::option::Option::Some("GCS_ONLY"),
11693 Self::StackdriverOnly => std::option::Option::Some("STACKDRIVER_ONLY"),
11694 Self::CloudLoggingOnly => std::option::Option::Some("CLOUD_LOGGING_ONLY"),
11695 Self::None => std::option::Option::Some("NONE"),
11696 Self::UnknownValue(u) => u.0.name(),
11697 }
11698 }
11699 }
11700
11701 impl std::default::Default for LoggingMode {
11702 fn default() -> Self {
11703 use std::convert::From;
11704 Self::from(0)
11705 }
11706 }
11707
11708 impl std::fmt::Display for LoggingMode {
11709 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11710 wkt::internal::display_enum(f, self.name(), self.value())
11711 }
11712 }
11713
11714 impl std::convert::From<i32> for LoggingMode {
11715 fn from(value: i32) -> Self {
11716 match value {
11717 0 => Self::LoggingUnspecified,
11718 1 => Self::Legacy,
11719 2 => Self::GcsOnly,
11720 3 => Self::StackdriverOnly,
11721 4 => Self::None,
11722 5 => Self::CloudLoggingOnly,
11723 _ => Self::UnknownValue(logging_mode::UnknownValue(
11724 wkt::internal::UnknownEnumValue::Integer(value),
11725 )),
11726 }
11727 }
11728 }
11729
11730 impl std::convert::From<&str> for LoggingMode {
11731 fn from(value: &str) -> Self {
11732 use std::string::ToString;
11733 match value {
11734 "LOGGING_UNSPECIFIED" => Self::LoggingUnspecified,
11735 "LEGACY" => Self::Legacy,
11736 "GCS_ONLY" => Self::GcsOnly,
11737 "STACKDRIVER_ONLY" => Self::StackdriverOnly,
11738 "CLOUD_LOGGING_ONLY" => Self::CloudLoggingOnly,
11739 "NONE" => Self::None,
11740 _ => Self::UnknownValue(logging_mode::UnknownValue(
11741 wkt::internal::UnknownEnumValue::String(value.to_string()),
11742 )),
11743 }
11744 }
11745 }
11746
11747 impl serde::ser::Serialize for LoggingMode {
11748 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11749 where
11750 S: serde::Serializer,
11751 {
11752 match self {
11753 Self::LoggingUnspecified => serializer.serialize_i32(0),
11754 Self::Legacy => serializer.serialize_i32(1),
11755 Self::GcsOnly => serializer.serialize_i32(2),
11756 Self::StackdriverOnly => serializer.serialize_i32(3),
11757 Self::CloudLoggingOnly => serializer.serialize_i32(5),
11758 Self::None => serializer.serialize_i32(4),
11759 Self::UnknownValue(u) => u.0.serialize(serializer),
11760 }
11761 }
11762 }
11763
11764 impl<'de> serde::de::Deserialize<'de> for LoggingMode {
11765 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11766 where
11767 D: serde::Deserializer<'de>,
11768 {
11769 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggingMode>::new(
11770 ".google.devtools.cloudbuild.v1.BuildOptions.LoggingMode",
11771 ))
11772 }
11773 }
11774
11775 /// Default Cloud Storage log bucket behavior options.
11776 ///
11777 /// # Working with unknown values
11778 ///
11779 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11780 /// additional enum variants at any time. Adding new variants is not considered
11781 /// a breaking change. Applications should write their code in anticipation of:
11782 ///
11783 /// - New values appearing in future releases of the client library, **and**
11784 /// - New values received dynamically, without application changes.
11785 ///
11786 /// Please consult the [Working with enums] section in the user guide for some
11787 /// guidelines.
11788 ///
11789 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11790 #[derive(Clone, Debug, PartialEq)]
11791 #[non_exhaustive]
11792 pub enum DefaultLogsBucketBehavior {
11793 /// Unspecified.
11794 Unspecified,
11795 /// Bucket is located in user-owned project in the same region as the
11796 /// build. The builder service account must have access to create and write
11797 /// to Cloud Storage buckets in the build project.
11798 RegionalUserOwnedBucket,
11799 /// Bucket is located in a Google-owned project and is not regionalized.
11800 LegacyBucket,
11801 /// If set, the enum was initialized with an unknown value.
11802 ///
11803 /// Applications can examine the value using [DefaultLogsBucketBehavior::value] or
11804 /// [DefaultLogsBucketBehavior::name].
11805 UnknownValue(default_logs_bucket_behavior::UnknownValue),
11806 }
11807
11808 #[doc(hidden)]
11809 pub mod default_logs_bucket_behavior {
11810 #[allow(unused_imports)]
11811 use super::*;
11812 #[derive(Clone, Debug, PartialEq)]
11813 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11814 }
11815
11816 impl DefaultLogsBucketBehavior {
11817 /// Gets the enum value.
11818 ///
11819 /// Returns `None` if the enum contains an unknown value deserialized from
11820 /// the string representation of enums.
11821 pub fn value(&self) -> std::option::Option<i32> {
11822 match self {
11823 Self::Unspecified => std::option::Option::Some(0),
11824 Self::RegionalUserOwnedBucket => std::option::Option::Some(1),
11825 Self::LegacyBucket => std::option::Option::Some(2),
11826 Self::UnknownValue(u) => u.0.value(),
11827 }
11828 }
11829
11830 /// Gets the enum value as a string.
11831 ///
11832 /// Returns `None` if the enum contains an unknown value deserialized from
11833 /// the integer representation of enums.
11834 pub fn name(&self) -> std::option::Option<&str> {
11835 match self {
11836 Self::Unspecified => {
11837 std::option::Option::Some("DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED")
11838 }
11839 Self::RegionalUserOwnedBucket => {
11840 std::option::Option::Some("REGIONAL_USER_OWNED_BUCKET")
11841 }
11842 Self::LegacyBucket => std::option::Option::Some("LEGACY_BUCKET"),
11843 Self::UnknownValue(u) => u.0.name(),
11844 }
11845 }
11846 }
11847
11848 impl std::default::Default for DefaultLogsBucketBehavior {
11849 fn default() -> Self {
11850 use std::convert::From;
11851 Self::from(0)
11852 }
11853 }
11854
11855 impl std::fmt::Display for DefaultLogsBucketBehavior {
11856 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11857 wkt::internal::display_enum(f, self.name(), self.value())
11858 }
11859 }
11860
11861 impl std::convert::From<i32> for DefaultLogsBucketBehavior {
11862 fn from(value: i32) -> Self {
11863 match value {
11864 0 => Self::Unspecified,
11865 1 => Self::RegionalUserOwnedBucket,
11866 2 => Self::LegacyBucket,
11867 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11868 wkt::internal::UnknownEnumValue::Integer(value),
11869 )),
11870 }
11871 }
11872 }
11873
11874 impl std::convert::From<&str> for DefaultLogsBucketBehavior {
11875 fn from(value: &str) -> Self {
11876 use std::string::ToString;
11877 match value {
11878 "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11879 "REGIONAL_USER_OWNED_BUCKET" => Self::RegionalUserOwnedBucket,
11880 "LEGACY_BUCKET" => Self::LegacyBucket,
11881 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11882 wkt::internal::UnknownEnumValue::String(value.to_string()),
11883 )),
11884 }
11885 }
11886 }
11887
11888 impl serde::ser::Serialize for DefaultLogsBucketBehavior {
11889 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11890 where
11891 S: serde::Serializer,
11892 {
11893 match self {
11894 Self::Unspecified => serializer.serialize_i32(0),
11895 Self::RegionalUserOwnedBucket => serializer.serialize_i32(1),
11896 Self::LegacyBucket => serializer.serialize_i32(2),
11897 Self::UnknownValue(u) => u.0.serialize(serializer),
11898 }
11899 }
11900 }
11901
11902 impl<'de> serde::de::Deserialize<'de> for DefaultLogsBucketBehavior {
11903 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11904 where
11905 D: serde::Deserializer<'de>,
11906 {
11907 deserializer.deserialize_any(
11908 wkt::internal::EnumVisitor::<DefaultLogsBucketBehavior>::new(
11909 ".google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior",
11910 ),
11911 )
11912 }
11913 }
11914}
11915
11916/// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by
11917/// the ReceiveTriggerWebhook method.
11918#[derive(Clone, Default, PartialEq)]
11919#[non_exhaustive]
11920pub struct ReceiveTriggerWebhookRequest {
11921 /// The name of the `ReceiveTriggerWebhook` to retrieve.
11922 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
11923 pub name: std::string::String,
11924
11925 /// HTTP request body.
11926 pub body: std::option::Option<google_cloud_api::model::HttpBody>,
11927
11928 /// Project in which the specified trigger lives
11929 pub project_id: std::string::String,
11930
11931 /// Name of the trigger to run the payload against
11932 pub trigger: std::string::String,
11933
11934 /// Secret token used for authorization if an OAuth token isn't provided.
11935 pub secret: std::string::String,
11936
11937 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11938}
11939
11940impl ReceiveTriggerWebhookRequest {
11941 /// Creates a new default instance.
11942 pub fn new() -> Self {
11943 std::default::Default::default()
11944 }
11945
11946 /// Sets the value of [name][crate::model::ReceiveTriggerWebhookRequest::name].
11947 ///
11948 /// # Example
11949 /// ```ignore,no_run
11950 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11951 /// let x = ReceiveTriggerWebhookRequest::new().set_name("example");
11952 /// ```
11953 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11954 self.name = v.into();
11955 self
11956 }
11957
11958 /// Sets the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
11959 ///
11960 /// # Example
11961 /// ```ignore,no_run
11962 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11963 /// use google_cloud_api::model::HttpBody;
11964 /// let x = ReceiveTriggerWebhookRequest::new().set_body(HttpBody::default()/* use setters */);
11965 /// ```
11966 pub fn set_body<T>(mut self, v: T) -> Self
11967 where
11968 T: std::convert::Into<google_cloud_api::model::HttpBody>,
11969 {
11970 self.body = std::option::Option::Some(v.into());
11971 self
11972 }
11973
11974 /// Sets or clears the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
11975 ///
11976 /// # Example
11977 /// ```ignore,no_run
11978 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11979 /// use google_cloud_api::model::HttpBody;
11980 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(Some(HttpBody::default()/* use setters */));
11981 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(None::<HttpBody>);
11982 /// ```
11983 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
11984 where
11985 T: std::convert::Into<google_cloud_api::model::HttpBody>,
11986 {
11987 self.body = v.map(|x| x.into());
11988 self
11989 }
11990
11991 /// Sets the value of [project_id][crate::model::ReceiveTriggerWebhookRequest::project_id].
11992 ///
11993 /// # Example
11994 /// ```ignore,no_run
11995 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11996 /// let x = ReceiveTriggerWebhookRequest::new().set_project_id("example");
11997 /// ```
11998 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11999 self.project_id = v.into();
12000 self
12001 }
12002
12003 /// Sets the value of [trigger][crate::model::ReceiveTriggerWebhookRequest::trigger].
12004 ///
12005 /// # Example
12006 /// ```ignore,no_run
12007 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12008 /// let x = ReceiveTriggerWebhookRequest::new().set_trigger("example");
12009 /// ```
12010 pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12011 self.trigger = v.into();
12012 self
12013 }
12014
12015 /// Sets the value of [secret][crate::model::ReceiveTriggerWebhookRequest::secret].
12016 ///
12017 /// # Example
12018 /// ```ignore,no_run
12019 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12020 /// let x = ReceiveTriggerWebhookRequest::new().set_secret("example");
12021 /// ```
12022 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12023 self.secret = v.into();
12024 self
12025 }
12026}
12027
12028impl wkt::message::Message for ReceiveTriggerWebhookRequest {
12029 fn typename() -> &'static str {
12030 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest"
12031 }
12032}
12033
12034/// ReceiveTriggerWebhookResponse [Experimental] is the response object for the
12035/// ReceiveTriggerWebhook method.
12036#[derive(Clone, Default, PartialEq)]
12037#[non_exhaustive]
12038pub struct ReceiveTriggerWebhookResponse {
12039 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12040}
12041
12042impl ReceiveTriggerWebhookResponse {
12043 /// Creates a new default instance.
12044 pub fn new() -> Self {
12045 std::default::Default::default()
12046 }
12047}
12048
12049impl wkt::message::Message for ReceiveTriggerWebhookResponse {
12050 fn typename() -> &'static str {
12051 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse"
12052 }
12053}
12054
12055/// GitHubEnterpriseConfig represents a configuration for a GitHub Enterprise
12056/// server.
12057#[derive(Clone, Default, PartialEq)]
12058#[non_exhaustive]
12059pub struct GitHubEnterpriseConfig {
12060 /// The full resource name for the GitHubEnterpriseConfig
12061 /// For example:
12062 /// "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}"
12063 pub name: std::string::String,
12064
12065 /// The URL of the github enterprise host the configuration is for.
12066 pub host_url: std::string::String,
12067
12068 /// Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise
12069 /// server.
12070 pub app_id: i64,
12071
12072 /// Output only. Time when the installation was associated with the project.
12073 pub create_time: std::option::Option<wkt::Timestamp>,
12074
12075 /// The key that should be attached to webhook calls to the ReceiveWebhook
12076 /// endpoint.
12077 pub webhook_key: std::string::String,
12078
12079 /// Optional. The network to be used when reaching out to the GitHub
12080 /// Enterprise server. The VPC network must be enabled for private
12081 /// service connection. This should be set if the GitHub Enterprise server is
12082 /// hosted on-premises and not reachable by public internet.
12083 /// If this field is left empty, no network peering will occur and calls to
12084 /// the GitHub Enterprise server will be made over the public internet.
12085 /// Must be in the format
12086 /// `projects/{project}/global/networks/{network}`, where {project}
12087 /// is a project number or id and {network} is the name of a
12088 /// VPC network in the project.
12089 pub peered_network: std::string::String,
12090
12091 /// Optional. Names of secrets in Secret Manager.
12092 pub secrets: std::option::Option<crate::model::GitHubEnterpriseSecrets>,
12093
12094 /// Optional. Name to display for this config.
12095 pub display_name: std::string::String,
12096
12097 /// Optional. SSL certificate to use for requests to GitHub Enterprise.
12098 pub ssl_ca: std::string::String,
12099
12100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12101}
12102
12103impl GitHubEnterpriseConfig {
12104 /// Creates a new default instance.
12105 pub fn new() -> Self {
12106 std::default::Default::default()
12107 }
12108
12109 /// Sets the value of [name][crate::model::GitHubEnterpriseConfig::name].
12110 ///
12111 /// # Example
12112 /// ```ignore,no_run
12113 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12114 /// let x = GitHubEnterpriseConfig::new().set_name("example");
12115 /// ```
12116 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12117 self.name = v.into();
12118 self
12119 }
12120
12121 /// Sets the value of [host_url][crate::model::GitHubEnterpriseConfig::host_url].
12122 ///
12123 /// # Example
12124 /// ```ignore,no_run
12125 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12126 /// let x = GitHubEnterpriseConfig::new().set_host_url("example");
12127 /// ```
12128 pub fn set_host_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12129 self.host_url = v.into();
12130 self
12131 }
12132
12133 /// Sets the value of [app_id][crate::model::GitHubEnterpriseConfig::app_id].
12134 ///
12135 /// # Example
12136 /// ```ignore,no_run
12137 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12138 /// let x = GitHubEnterpriseConfig::new().set_app_id(42);
12139 /// ```
12140 pub fn set_app_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12141 self.app_id = v.into();
12142 self
12143 }
12144
12145 /// Sets the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12146 ///
12147 /// # Example
12148 /// ```ignore,no_run
12149 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12150 /// use wkt::Timestamp;
12151 /// let x = GitHubEnterpriseConfig::new().set_create_time(Timestamp::default()/* use setters */);
12152 /// ```
12153 pub fn set_create_time<T>(mut self, v: T) -> Self
12154 where
12155 T: std::convert::Into<wkt::Timestamp>,
12156 {
12157 self.create_time = std::option::Option::Some(v.into());
12158 self
12159 }
12160
12161 /// Sets or clears the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12162 ///
12163 /// # Example
12164 /// ```ignore,no_run
12165 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12166 /// use wkt::Timestamp;
12167 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12168 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(None::<Timestamp>);
12169 /// ```
12170 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12171 where
12172 T: std::convert::Into<wkt::Timestamp>,
12173 {
12174 self.create_time = v.map(|x| x.into());
12175 self
12176 }
12177
12178 /// Sets the value of [webhook_key][crate::model::GitHubEnterpriseConfig::webhook_key].
12179 ///
12180 /// # Example
12181 /// ```ignore,no_run
12182 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12183 /// let x = GitHubEnterpriseConfig::new().set_webhook_key("example");
12184 /// ```
12185 pub fn set_webhook_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12186 self.webhook_key = v.into();
12187 self
12188 }
12189
12190 /// Sets the value of [peered_network][crate::model::GitHubEnterpriseConfig::peered_network].
12191 ///
12192 /// # Example
12193 /// ```ignore,no_run
12194 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12195 /// let x = GitHubEnterpriseConfig::new().set_peered_network("example");
12196 /// ```
12197 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12198 self.peered_network = v.into();
12199 self
12200 }
12201
12202 /// Sets the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12203 ///
12204 /// # Example
12205 /// ```ignore,no_run
12206 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12207 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12208 /// let x = GitHubEnterpriseConfig::new().set_secrets(GitHubEnterpriseSecrets::default()/* use setters */);
12209 /// ```
12210 pub fn set_secrets<T>(mut self, v: T) -> Self
12211 where
12212 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12213 {
12214 self.secrets = std::option::Option::Some(v.into());
12215 self
12216 }
12217
12218 /// Sets or clears the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12219 ///
12220 /// # Example
12221 /// ```ignore,no_run
12222 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12223 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12224 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(Some(GitHubEnterpriseSecrets::default()/* use setters */));
12225 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(None::<GitHubEnterpriseSecrets>);
12226 /// ```
12227 pub fn set_or_clear_secrets<T>(mut self, v: std::option::Option<T>) -> Self
12228 where
12229 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12230 {
12231 self.secrets = v.map(|x| x.into());
12232 self
12233 }
12234
12235 /// Sets the value of [display_name][crate::model::GitHubEnterpriseConfig::display_name].
12236 ///
12237 /// # Example
12238 /// ```ignore,no_run
12239 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12240 /// let x = GitHubEnterpriseConfig::new().set_display_name("example");
12241 /// ```
12242 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12243 self.display_name = v.into();
12244 self
12245 }
12246
12247 /// Sets the value of [ssl_ca][crate::model::GitHubEnterpriseConfig::ssl_ca].
12248 ///
12249 /// # Example
12250 /// ```ignore,no_run
12251 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12252 /// let x = GitHubEnterpriseConfig::new().set_ssl_ca("example");
12253 /// ```
12254 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12255 self.ssl_ca = v.into();
12256 self
12257 }
12258}
12259
12260impl wkt::message::Message for GitHubEnterpriseConfig {
12261 fn typename() -> &'static str {
12262 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseConfig"
12263 }
12264}
12265
12266/// GitHubEnterpriseSecrets represents the names of all necessary secrets in
12267/// Secret Manager for a GitHub Enterprise server.
12268/// Format is: projects/\<project number\>/secrets/\<secret name\>.
12269#[derive(Clone, Default, PartialEq)]
12270#[non_exhaustive]
12271pub struct GitHubEnterpriseSecrets {
12272 /// The resource name for the private key secret version.
12273 pub private_key_version_name: std::string::String,
12274
12275 /// The resource name for the webhook secret secret version in Secret Manager.
12276 pub webhook_secret_version_name: std::string::String,
12277
12278 /// The resource name for the OAuth secret secret version in Secret Manager.
12279 pub oauth_secret_version_name: std::string::String,
12280
12281 /// The resource name for the OAuth client ID secret version in Secret Manager.
12282 pub oauth_client_id_version_name: std::string::String,
12283
12284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12285}
12286
12287impl GitHubEnterpriseSecrets {
12288 /// Creates a new default instance.
12289 pub fn new() -> Self {
12290 std::default::Default::default()
12291 }
12292
12293 /// Sets the value of [private_key_version_name][crate::model::GitHubEnterpriseSecrets::private_key_version_name].
12294 ///
12295 /// # Example
12296 /// ```ignore,no_run
12297 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12298 /// let x = GitHubEnterpriseSecrets::new().set_private_key_version_name("example");
12299 /// ```
12300 pub fn set_private_key_version_name<T: std::convert::Into<std::string::String>>(
12301 mut self,
12302 v: T,
12303 ) -> Self {
12304 self.private_key_version_name = v.into();
12305 self
12306 }
12307
12308 /// Sets the value of [webhook_secret_version_name][crate::model::GitHubEnterpriseSecrets::webhook_secret_version_name].
12309 ///
12310 /// # Example
12311 /// ```ignore,no_run
12312 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12313 /// let x = GitHubEnterpriseSecrets::new().set_webhook_secret_version_name("example");
12314 /// ```
12315 pub fn set_webhook_secret_version_name<T: std::convert::Into<std::string::String>>(
12316 mut self,
12317 v: T,
12318 ) -> Self {
12319 self.webhook_secret_version_name = v.into();
12320 self
12321 }
12322
12323 /// Sets the value of [oauth_secret_version_name][crate::model::GitHubEnterpriseSecrets::oauth_secret_version_name].
12324 ///
12325 /// # Example
12326 /// ```ignore,no_run
12327 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12328 /// let x = GitHubEnterpriseSecrets::new().set_oauth_secret_version_name("example");
12329 /// ```
12330 pub fn set_oauth_secret_version_name<T: std::convert::Into<std::string::String>>(
12331 mut self,
12332 v: T,
12333 ) -> Self {
12334 self.oauth_secret_version_name = v.into();
12335 self
12336 }
12337
12338 /// Sets the value of [oauth_client_id_version_name][crate::model::GitHubEnterpriseSecrets::oauth_client_id_version_name].
12339 ///
12340 /// # Example
12341 /// ```ignore,no_run
12342 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12343 /// let x = GitHubEnterpriseSecrets::new().set_oauth_client_id_version_name("example");
12344 /// ```
12345 pub fn set_oauth_client_id_version_name<T: std::convert::Into<std::string::String>>(
12346 mut self,
12347 v: T,
12348 ) -> Self {
12349 self.oauth_client_id_version_name = v.into();
12350 self
12351 }
12352}
12353
12354impl wkt::message::Message for GitHubEnterpriseSecrets {
12355 fn typename() -> &'static str {
12356 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets"
12357 }
12358}
12359
12360/// Configuration for a `WorkerPool`.
12361///
12362/// Cloud Build owns and maintains a pool of workers for general use and have no
12363/// access to a project's private network. By default, builds submitted to
12364/// Cloud Build will use a worker from this pool.
12365///
12366/// If your build needs access to resources on a private network,
12367/// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give
12368/// your builds access to any single VPC network that you
12369/// administer, including any on-prem resources connected to that VPC
12370/// network. For an overview of private pools, see
12371/// [Private pools
12372/// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview).
12373#[derive(Clone, Default, PartialEq)]
12374#[non_exhaustive]
12375pub struct WorkerPool {
12376 /// Output only. The resource name of the `WorkerPool`, with format
12377 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
12378 /// The value of `{worker_pool}` is provided by `worker_pool_id` in
12379 /// `CreateWorkerPool` request and the value of `{location}` is determined by
12380 /// the endpoint accessed.
12381 pub name: std::string::String,
12382
12383 /// A user-specified, human-readable name for the `WorkerPool`. If provided,
12384 /// this value must be 1-63 characters.
12385 pub display_name: std::string::String,
12386
12387 /// Output only. A unique identifier for the `WorkerPool`.
12388 pub uid: std::string::String,
12389
12390 /// User specified annotations. See <https://google.aip.dev/128#annotations>
12391 /// for more details such as format and size limitations.
12392 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12393
12394 /// Output only. Time at which the request to create the `WorkerPool` was
12395 /// received.
12396 pub create_time: std::option::Option<wkt::Timestamp>,
12397
12398 /// Output only. Time at which the request to update the `WorkerPool` was
12399 /// received.
12400 pub update_time: std::option::Option<wkt::Timestamp>,
12401
12402 /// Output only. Time at which the request to delete the `WorkerPool` was
12403 /// received.
12404 pub delete_time: std::option::Option<wkt::Timestamp>,
12405
12406 /// Output only. `WorkerPool` state.
12407 pub state: crate::model::worker_pool::State,
12408
12409 /// Output only. Checksum computed by the server. May be sent on update and
12410 /// delete requests to ensure that the client has an up-to-date value before
12411 /// proceeding.
12412 pub etag: std::string::String,
12413
12414 /// Configuration for the `WorkerPool`.
12415 pub config: std::option::Option<crate::model::worker_pool::Config>,
12416
12417 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12418}
12419
12420impl WorkerPool {
12421 /// Creates a new default instance.
12422 pub fn new() -> Self {
12423 std::default::Default::default()
12424 }
12425
12426 /// Sets the value of [name][crate::model::WorkerPool::name].
12427 ///
12428 /// # Example
12429 /// ```ignore,no_run
12430 /// # use google_cloud_build_v1::model::WorkerPool;
12431 /// let x = WorkerPool::new().set_name("example");
12432 /// ```
12433 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12434 self.name = v.into();
12435 self
12436 }
12437
12438 /// Sets the value of [display_name][crate::model::WorkerPool::display_name].
12439 ///
12440 /// # Example
12441 /// ```ignore,no_run
12442 /// # use google_cloud_build_v1::model::WorkerPool;
12443 /// let x = WorkerPool::new().set_display_name("example");
12444 /// ```
12445 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12446 self.display_name = v.into();
12447 self
12448 }
12449
12450 /// Sets the value of [uid][crate::model::WorkerPool::uid].
12451 ///
12452 /// # Example
12453 /// ```ignore,no_run
12454 /// # use google_cloud_build_v1::model::WorkerPool;
12455 /// let x = WorkerPool::new().set_uid("example");
12456 /// ```
12457 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12458 self.uid = v.into();
12459 self
12460 }
12461
12462 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
12463 ///
12464 /// # Example
12465 /// ```ignore,no_run
12466 /// # use google_cloud_build_v1::model::WorkerPool;
12467 /// let x = WorkerPool::new().set_annotations([
12468 /// ("key0", "abc"),
12469 /// ("key1", "xyz"),
12470 /// ]);
12471 /// ```
12472 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12473 where
12474 T: std::iter::IntoIterator<Item = (K, V)>,
12475 K: std::convert::Into<std::string::String>,
12476 V: std::convert::Into<std::string::String>,
12477 {
12478 use std::iter::Iterator;
12479 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12480 self
12481 }
12482
12483 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
12484 ///
12485 /// # Example
12486 /// ```ignore,no_run
12487 /// # use google_cloud_build_v1::model::WorkerPool;
12488 /// use wkt::Timestamp;
12489 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
12490 /// ```
12491 pub fn set_create_time<T>(mut self, v: T) -> Self
12492 where
12493 T: std::convert::Into<wkt::Timestamp>,
12494 {
12495 self.create_time = std::option::Option::Some(v.into());
12496 self
12497 }
12498
12499 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
12500 ///
12501 /// # Example
12502 /// ```ignore,no_run
12503 /// # use google_cloud_build_v1::model::WorkerPool;
12504 /// use wkt::Timestamp;
12505 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12506 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
12507 /// ```
12508 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12509 where
12510 T: std::convert::Into<wkt::Timestamp>,
12511 {
12512 self.create_time = v.map(|x| x.into());
12513 self
12514 }
12515
12516 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
12517 ///
12518 /// # Example
12519 /// ```ignore,no_run
12520 /// # use google_cloud_build_v1::model::WorkerPool;
12521 /// use wkt::Timestamp;
12522 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
12523 /// ```
12524 pub fn set_update_time<T>(mut self, v: T) -> Self
12525 where
12526 T: std::convert::Into<wkt::Timestamp>,
12527 {
12528 self.update_time = std::option::Option::Some(v.into());
12529 self
12530 }
12531
12532 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
12533 ///
12534 /// # Example
12535 /// ```ignore,no_run
12536 /// # use google_cloud_build_v1::model::WorkerPool;
12537 /// use wkt::Timestamp;
12538 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12539 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
12540 /// ```
12541 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12542 where
12543 T: std::convert::Into<wkt::Timestamp>,
12544 {
12545 self.update_time = v.map(|x| x.into());
12546 self
12547 }
12548
12549 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
12550 ///
12551 /// # Example
12552 /// ```ignore,no_run
12553 /// # use google_cloud_build_v1::model::WorkerPool;
12554 /// use wkt::Timestamp;
12555 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
12556 /// ```
12557 pub fn set_delete_time<T>(mut self, v: T) -> Self
12558 where
12559 T: std::convert::Into<wkt::Timestamp>,
12560 {
12561 self.delete_time = std::option::Option::Some(v.into());
12562 self
12563 }
12564
12565 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
12566 ///
12567 /// # Example
12568 /// ```ignore,no_run
12569 /// # use google_cloud_build_v1::model::WorkerPool;
12570 /// use wkt::Timestamp;
12571 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12572 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
12573 /// ```
12574 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12575 where
12576 T: std::convert::Into<wkt::Timestamp>,
12577 {
12578 self.delete_time = v.map(|x| x.into());
12579 self
12580 }
12581
12582 /// Sets the value of [state][crate::model::WorkerPool::state].
12583 ///
12584 /// # Example
12585 /// ```ignore,no_run
12586 /// # use google_cloud_build_v1::model::WorkerPool;
12587 /// use google_cloud_build_v1::model::worker_pool::State;
12588 /// let x0 = WorkerPool::new().set_state(State::Creating);
12589 /// let x1 = WorkerPool::new().set_state(State::Running);
12590 /// let x2 = WorkerPool::new().set_state(State::Deleting);
12591 /// ```
12592 pub fn set_state<T: std::convert::Into<crate::model::worker_pool::State>>(
12593 mut self,
12594 v: T,
12595 ) -> Self {
12596 self.state = v.into();
12597 self
12598 }
12599
12600 /// Sets the value of [etag][crate::model::WorkerPool::etag].
12601 ///
12602 /// # Example
12603 /// ```ignore,no_run
12604 /// # use google_cloud_build_v1::model::WorkerPool;
12605 /// let x = WorkerPool::new().set_etag("example");
12606 /// ```
12607 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12608 self.etag = v.into();
12609 self
12610 }
12611
12612 /// Sets the value of [config][crate::model::WorkerPool::config].
12613 ///
12614 /// Note that all the setters affecting `config` are mutually
12615 /// exclusive.
12616 ///
12617 /// # Example
12618 /// ```ignore,no_run
12619 /// # use google_cloud_build_v1::model::WorkerPool;
12620 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12621 /// let x = WorkerPool::new().set_config(Some(
12622 /// google_cloud_build_v1::model::worker_pool::Config::PrivatePoolV1Config(PrivatePoolV1Config::default().into())));
12623 /// ```
12624 pub fn set_config<
12625 T: std::convert::Into<std::option::Option<crate::model::worker_pool::Config>>,
12626 >(
12627 mut self,
12628 v: T,
12629 ) -> Self {
12630 self.config = v.into();
12631 self
12632 }
12633
12634 /// The value of [config][crate::model::WorkerPool::config]
12635 /// if it holds a `PrivatePoolV1Config`, `None` if the field is not set or
12636 /// holds a different branch.
12637 pub fn private_pool_v1_config(
12638 &self,
12639 ) -> std::option::Option<&std::boxed::Box<crate::model::PrivatePoolV1Config>> {
12640 #[allow(unreachable_patterns)]
12641 self.config.as_ref().and_then(|v| match v {
12642 crate::model::worker_pool::Config::PrivatePoolV1Config(v) => {
12643 std::option::Option::Some(v)
12644 }
12645 _ => std::option::Option::None,
12646 })
12647 }
12648
12649 /// Sets the value of [config][crate::model::WorkerPool::config]
12650 /// to hold a `PrivatePoolV1Config`.
12651 ///
12652 /// Note that all the setters affecting `config` are
12653 /// mutually exclusive.
12654 ///
12655 /// # Example
12656 /// ```ignore,no_run
12657 /// # use google_cloud_build_v1::model::WorkerPool;
12658 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12659 /// let x = WorkerPool::new().set_private_pool_v1_config(PrivatePoolV1Config::default()/* use setters */);
12660 /// assert!(x.private_pool_v1_config().is_some());
12661 /// ```
12662 pub fn set_private_pool_v1_config<
12663 T: std::convert::Into<std::boxed::Box<crate::model::PrivatePoolV1Config>>,
12664 >(
12665 mut self,
12666 v: T,
12667 ) -> Self {
12668 self.config = std::option::Option::Some(
12669 crate::model::worker_pool::Config::PrivatePoolV1Config(v.into()),
12670 );
12671 self
12672 }
12673}
12674
12675impl wkt::message::Message for WorkerPool {
12676 fn typename() -> &'static str {
12677 "type.googleapis.com/google.devtools.cloudbuild.v1.WorkerPool"
12678 }
12679}
12680
12681/// Defines additional types related to [WorkerPool].
12682pub mod worker_pool {
12683 #[allow(unused_imports)]
12684 use super::*;
12685
12686 /// State of the `WorkerPool`.
12687 ///
12688 /// # Working with unknown values
12689 ///
12690 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12691 /// additional enum variants at any time. Adding new variants is not considered
12692 /// a breaking change. Applications should write their code in anticipation of:
12693 ///
12694 /// - New values appearing in future releases of the client library, **and**
12695 /// - New values received dynamically, without application changes.
12696 ///
12697 /// Please consult the [Working with enums] section in the user guide for some
12698 /// guidelines.
12699 ///
12700 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12701 #[derive(Clone, Debug, PartialEq)]
12702 #[non_exhaustive]
12703 pub enum State {
12704 /// State of the `WorkerPool` is unknown.
12705 Unspecified,
12706 /// `WorkerPool` is being created.
12707 Creating,
12708 /// `WorkerPool` is running.
12709 Running,
12710 /// `WorkerPool` is being deleted: cancelling builds and draining workers.
12711 Deleting,
12712 /// `WorkerPool` is deleted.
12713 Deleted,
12714 /// `WorkerPool` is being updated; new builds cannot be run.
12715 Updating,
12716 /// If set, the enum was initialized with an unknown value.
12717 ///
12718 /// Applications can examine the value using [State::value] or
12719 /// [State::name].
12720 UnknownValue(state::UnknownValue),
12721 }
12722
12723 #[doc(hidden)]
12724 pub mod state {
12725 #[allow(unused_imports)]
12726 use super::*;
12727 #[derive(Clone, Debug, PartialEq)]
12728 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12729 }
12730
12731 impl State {
12732 /// Gets the enum value.
12733 ///
12734 /// Returns `None` if the enum contains an unknown value deserialized from
12735 /// the string representation of enums.
12736 pub fn value(&self) -> std::option::Option<i32> {
12737 match self {
12738 Self::Unspecified => std::option::Option::Some(0),
12739 Self::Creating => std::option::Option::Some(1),
12740 Self::Running => std::option::Option::Some(2),
12741 Self::Deleting => std::option::Option::Some(3),
12742 Self::Deleted => std::option::Option::Some(4),
12743 Self::Updating => std::option::Option::Some(5),
12744 Self::UnknownValue(u) => u.0.value(),
12745 }
12746 }
12747
12748 /// Gets the enum value as a string.
12749 ///
12750 /// Returns `None` if the enum contains an unknown value deserialized from
12751 /// the integer representation of enums.
12752 pub fn name(&self) -> std::option::Option<&str> {
12753 match self {
12754 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12755 Self::Creating => std::option::Option::Some("CREATING"),
12756 Self::Running => std::option::Option::Some("RUNNING"),
12757 Self::Deleting => std::option::Option::Some("DELETING"),
12758 Self::Deleted => std::option::Option::Some("DELETED"),
12759 Self::Updating => std::option::Option::Some("UPDATING"),
12760 Self::UnknownValue(u) => u.0.name(),
12761 }
12762 }
12763 }
12764
12765 impl std::default::Default for State {
12766 fn default() -> Self {
12767 use std::convert::From;
12768 Self::from(0)
12769 }
12770 }
12771
12772 impl std::fmt::Display for State {
12773 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12774 wkt::internal::display_enum(f, self.name(), self.value())
12775 }
12776 }
12777
12778 impl std::convert::From<i32> for State {
12779 fn from(value: i32) -> Self {
12780 match value {
12781 0 => Self::Unspecified,
12782 1 => Self::Creating,
12783 2 => Self::Running,
12784 3 => Self::Deleting,
12785 4 => Self::Deleted,
12786 5 => Self::Updating,
12787 _ => Self::UnknownValue(state::UnknownValue(
12788 wkt::internal::UnknownEnumValue::Integer(value),
12789 )),
12790 }
12791 }
12792 }
12793
12794 impl std::convert::From<&str> for State {
12795 fn from(value: &str) -> Self {
12796 use std::string::ToString;
12797 match value {
12798 "STATE_UNSPECIFIED" => Self::Unspecified,
12799 "CREATING" => Self::Creating,
12800 "RUNNING" => Self::Running,
12801 "DELETING" => Self::Deleting,
12802 "DELETED" => Self::Deleted,
12803 "UPDATING" => Self::Updating,
12804 _ => Self::UnknownValue(state::UnknownValue(
12805 wkt::internal::UnknownEnumValue::String(value.to_string()),
12806 )),
12807 }
12808 }
12809 }
12810
12811 impl serde::ser::Serialize for State {
12812 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12813 where
12814 S: serde::Serializer,
12815 {
12816 match self {
12817 Self::Unspecified => serializer.serialize_i32(0),
12818 Self::Creating => serializer.serialize_i32(1),
12819 Self::Running => serializer.serialize_i32(2),
12820 Self::Deleting => serializer.serialize_i32(3),
12821 Self::Deleted => serializer.serialize_i32(4),
12822 Self::Updating => serializer.serialize_i32(5),
12823 Self::UnknownValue(u) => u.0.serialize(serializer),
12824 }
12825 }
12826 }
12827
12828 impl<'de> serde::de::Deserialize<'de> for State {
12829 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12830 where
12831 D: serde::Deserializer<'de>,
12832 {
12833 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12834 ".google.devtools.cloudbuild.v1.WorkerPool.State",
12835 ))
12836 }
12837 }
12838
12839 /// Configuration for the `WorkerPool`.
12840 #[derive(Clone, Debug, PartialEq)]
12841 #[non_exhaustive]
12842 pub enum Config {
12843 /// Private Pool configuration.
12844 PrivatePoolV1Config(std::boxed::Box<crate::model::PrivatePoolV1Config>),
12845 }
12846}
12847
12848/// Configuration for a V1 `PrivatePool`.
12849#[derive(Clone, Default, PartialEq)]
12850#[non_exhaustive]
12851pub struct PrivatePoolV1Config {
12852 /// Machine configuration for the workers in the pool.
12853 pub worker_config: std::option::Option<crate::model::private_pool_v_1_config::WorkerConfig>,
12854
12855 /// Network configuration for the pool.
12856 pub network_config: std::option::Option<crate::model::private_pool_v_1_config::NetworkConfig>,
12857
12858 /// Immutable. Private Service Connect(PSC) Network configuration for the pool.
12859 pub private_service_connect:
12860 std::option::Option<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12861
12862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12863}
12864
12865impl PrivatePoolV1Config {
12866 /// Creates a new default instance.
12867 pub fn new() -> Self {
12868 std::default::Default::default()
12869 }
12870
12871 /// Sets the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12872 ///
12873 /// # Example
12874 /// ```ignore,no_run
12875 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12876 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12877 /// let x = PrivatePoolV1Config::new().set_worker_config(WorkerConfig::default()/* use setters */);
12878 /// ```
12879 pub fn set_worker_config<T>(mut self, v: T) -> Self
12880 where
12881 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12882 {
12883 self.worker_config = std::option::Option::Some(v.into());
12884 self
12885 }
12886
12887 /// Sets or clears the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12888 ///
12889 /// # Example
12890 /// ```ignore,no_run
12891 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12892 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12893 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(Some(WorkerConfig::default()/* use setters */));
12894 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(None::<WorkerConfig>);
12895 /// ```
12896 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
12897 where
12898 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12899 {
12900 self.worker_config = v.map(|x| x.into());
12901 self
12902 }
12903
12904 /// Sets the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12905 ///
12906 /// # Example
12907 /// ```ignore,no_run
12908 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12909 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12910 /// let x = PrivatePoolV1Config::new().set_network_config(NetworkConfig::default()/* use setters */);
12911 /// ```
12912 pub fn set_network_config<T>(mut self, v: T) -> Self
12913 where
12914 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12915 {
12916 self.network_config = std::option::Option::Some(v.into());
12917 self
12918 }
12919
12920 /// Sets or clears the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12921 ///
12922 /// # Example
12923 /// ```ignore,no_run
12924 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12925 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12926 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(Some(NetworkConfig::default()/* use setters */));
12927 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(None::<NetworkConfig>);
12928 /// ```
12929 pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
12930 where
12931 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12932 {
12933 self.network_config = v.map(|x| x.into());
12934 self
12935 }
12936
12937 /// Sets the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12938 ///
12939 /// # Example
12940 /// ```ignore,no_run
12941 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12942 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12943 /// let x = PrivatePoolV1Config::new().set_private_service_connect(PrivateServiceConnect::default()/* use setters */);
12944 /// ```
12945 pub fn set_private_service_connect<T>(mut self, v: T) -> Self
12946 where
12947 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12948 {
12949 self.private_service_connect = std::option::Option::Some(v.into());
12950 self
12951 }
12952
12953 /// Sets or clears the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12954 ///
12955 /// # Example
12956 /// ```ignore,no_run
12957 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12958 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12959 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(Some(PrivateServiceConnect::default()/* use setters */));
12960 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(None::<PrivateServiceConnect>);
12961 /// ```
12962 pub fn set_or_clear_private_service_connect<T>(mut self, v: std::option::Option<T>) -> Self
12963 where
12964 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12965 {
12966 self.private_service_connect = v.map(|x| x.into());
12967 self
12968 }
12969}
12970
12971impl wkt::message::Message for PrivatePoolV1Config {
12972 fn typename() -> &'static str {
12973 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config"
12974 }
12975}
12976
12977/// Defines additional types related to [PrivatePoolV1Config].
12978pub mod private_pool_v_1_config {
12979 #[allow(unused_imports)]
12980 use super::*;
12981
12982 /// Defines the configuration to be used for creating workers in
12983 /// the pool.
12984 #[derive(Clone, Default, PartialEq)]
12985 #[non_exhaustive]
12986 pub struct WorkerConfig {
12987 /// Optional. Machine type of a worker, such as `e2-medium`.
12988 /// See [Worker pool config
12989 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
12990 /// If left blank, Cloud Build will use a sensible default.
12991 pub machine_type: std::string::String,
12992
12993 /// Size of the disk attached to the worker, in GB.
12994 /// See [Worker pool config
12995 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
12996 /// Specify a value of up to 4000. If `0` is specified, Cloud Build will use
12997 /// a standard disk size.
12998 pub disk_size_gb: i64,
12999
13000 /// Optional. Enable nested virtualization on the worker, if supported by the
13001 /// machine type. By default, nested virtualization is disabled.
13002 pub enable_nested_virtualization: std::option::Option<bool>,
13003
13004 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13005 }
13006
13007 impl WorkerConfig {
13008 /// Creates a new default instance.
13009 pub fn new() -> Self {
13010 std::default::Default::default()
13011 }
13012
13013 /// Sets the value of [machine_type][crate::model::private_pool_v_1_config::WorkerConfig::machine_type].
13014 ///
13015 /// # Example
13016 /// ```ignore,no_run
13017 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13018 /// let x = WorkerConfig::new().set_machine_type("example");
13019 /// ```
13020 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
13021 mut self,
13022 v: T,
13023 ) -> Self {
13024 self.machine_type = v.into();
13025 self
13026 }
13027
13028 /// Sets the value of [disk_size_gb][crate::model::private_pool_v_1_config::WorkerConfig::disk_size_gb].
13029 ///
13030 /// # Example
13031 /// ```ignore,no_run
13032 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13033 /// let x = WorkerConfig::new().set_disk_size_gb(42);
13034 /// ```
13035 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13036 self.disk_size_gb = v.into();
13037 self
13038 }
13039
13040 /// Sets the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
13041 ///
13042 /// # Example
13043 /// ```ignore,no_run
13044 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13045 /// let x = WorkerConfig::new().set_enable_nested_virtualization(true);
13046 /// ```
13047 pub fn set_enable_nested_virtualization<T>(mut self, v: T) -> Self
13048 where
13049 T: std::convert::Into<bool>,
13050 {
13051 self.enable_nested_virtualization = std::option::Option::Some(v.into());
13052 self
13053 }
13054
13055 /// Sets or clears the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
13056 ///
13057 /// # Example
13058 /// ```ignore,no_run
13059 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13060 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(Some(false));
13061 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(None::<bool>);
13062 /// ```
13063 pub fn set_or_clear_enable_nested_virtualization<T>(
13064 mut self,
13065 v: std::option::Option<T>,
13066 ) -> Self
13067 where
13068 T: std::convert::Into<bool>,
13069 {
13070 self.enable_nested_virtualization = v.map(|x| x.into());
13071 self
13072 }
13073 }
13074
13075 impl wkt::message::Message for WorkerConfig {
13076 fn typename() -> &'static str {
13077 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.WorkerConfig"
13078 }
13079 }
13080
13081 /// Defines the network configuration for the pool.
13082 #[derive(Clone, Default, PartialEq)]
13083 #[non_exhaustive]
13084 pub struct NetworkConfig {
13085 /// Required. Immutable. The network definition that the workers are peered
13086 /// to. If this section is left empty, the workers will be peered to
13087 /// `WorkerPool.project_id` on the service producer network. Must be in the
13088 /// format `projects/{project}/global/networks/{network}`, where `{project}`
13089 /// is a project number, such as `12345`, and `{network}` is the name of a
13090 /// VPC network in the project. See
13091 /// [Understanding network configuration
13092 /// options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment)
13093 pub peered_network: std::string::String,
13094
13095 /// Option to configure network egress for the workers.
13096 pub egress_option: crate::model::private_pool_v_1_config::network_config::EgressOption,
13097
13098 /// Immutable. Subnet IP range within the peered network. This is specified
13099 /// in CIDR notation with a slash and the subnet prefix size. You can
13100 /// optionally specify an IP address before the subnet prefix value. e.g.
13101 /// `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a
13102 /// prefix size of 29 bits.
13103 /// `/16` would specify a prefix size of 16 bits, with an automatically
13104 /// determined IP within the peered VPC.
13105 /// If unspecified, a value of `/24` will be used.
13106 pub peered_network_ip_range: std::string::String,
13107
13108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13109 }
13110
13111 impl NetworkConfig {
13112 /// Creates a new default instance.
13113 pub fn new() -> Self {
13114 std::default::Default::default()
13115 }
13116
13117 /// Sets the value of [peered_network][crate::model::private_pool_v_1_config::NetworkConfig::peered_network].
13118 ///
13119 /// # Example
13120 /// ```ignore,no_run
13121 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13122 /// let x = NetworkConfig::new().set_peered_network("example");
13123 /// ```
13124 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(
13125 mut self,
13126 v: T,
13127 ) -> Self {
13128 self.peered_network = v.into();
13129 self
13130 }
13131
13132 /// Sets the value of [egress_option][crate::model::private_pool_v_1_config::NetworkConfig::egress_option].
13133 ///
13134 /// # Example
13135 /// ```ignore,no_run
13136 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13137 /// use google_cloud_build_v1::model::private_pool_v_1_config::network_config::EgressOption;
13138 /// let x0 = NetworkConfig::new().set_egress_option(EgressOption::NoPublicEgress);
13139 /// let x1 = NetworkConfig::new().set_egress_option(EgressOption::PublicEgress);
13140 /// ```
13141 pub fn set_egress_option<
13142 T: std::convert::Into<crate::model::private_pool_v_1_config::network_config::EgressOption>,
13143 >(
13144 mut self,
13145 v: T,
13146 ) -> Self {
13147 self.egress_option = v.into();
13148 self
13149 }
13150
13151 /// Sets the value of [peered_network_ip_range][crate::model::private_pool_v_1_config::NetworkConfig::peered_network_ip_range].
13152 ///
13153 /// # Example
13154 /// ```ignore,no_run
13155 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13156 /// let x = NetworkConfig::new().set_peered_network_ip_range("example");
13157 /// ```
13158 pub fn set_peered_network_ip_range<T: std::convert::Into<std::string::String>>(
13159 mut self,
13160 v: T,
13161 ) -> Self {
13162 self.peered_network_ip_range = v.into();
13163 self
13164 }
13165 }
13166
13167 impl wkt::message::Message for NetworkConfig {
13168 fn typename() -> &'static str {
13169 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig"
13170 }
13171 }
13172
13173 /// Defines additional types related to [NetworkConfig].
13174 pub mod network_config {
13175 #[allow(unused_imports)]
13176 use super::*;
13177
13178 /// Defines the egress option for the pool.
13179 ///
13180 /// # Working with unknown values
13181 ///
13182 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13183 /// additional enum variants at any time. Adding new variants is not considered
13184 /// a breaking change. Applications should write their code in anticipation of:
13185 ///
13186 /// - New values appearing in future releases of the client library, **and**
13187 /// - New values received dynamically, without application changes.
13188 ///
13189 /// Please consult the [Working with enums] section in the user guide for some
13190 /// guidelines.
13191 ///
13192 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13193 #[derive(Clone, Debug, PartialEq)]
13194 #[non_exhaustive]
13195 pub enum EgressOption {
13196 /// If set, defaults to PUBLIC_EGRESS.
13197 Unspecified,
13198 /// If set, workers are created without any public address, which prevents
13199 /// network egress to public IPs unless a network proxy is configured.
13200 NoPublicEgress,
13201 /// If set, workers are created with a public address which allows for
13202 /// public internet egress.
13203 PublicEgress,
13204 /// If set, the enum was initialized with an unknown value.
13205 ///
13206 /// Applications can examine the value using [EgressOption::value] or
13207 /// [EgressOption::name].
13208 UnknownValue(egress_option::UnknownValue),
13209 }
13210
13211 #[doc(hidden)]
13212 pub mod egress_option {
13213 #[allow(unused_imports)]
13214 use super::*;
13215 #[derive(Clone, Debug, PartialEq)]
13216 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13217 }
13218
13219 impl EgressOption {
13220 /// Gets the enum value.
13221 ///
13222 /// Returns `None` if the enum contains an unknown value deserialized from
13223 /// the string representation of enums.
13224 pub fn value(&self) -> std::option::Option<i32> {
13225 match self {
13226 Self::Unspecified => std::option::Option::Some(0),
13227 Self::NoPublicEgress => std::option::Option::Some(1),
13228 Self::PublicEgress => std::option::Option::Some(2),
13229 Self::UnknownValue(u) => u.0.value(),
13230 }
13231 }
13232
13233 /// Gets the enum value as a string.
13234 ///
13235 /// Returns `None` if the enum contains an unknown value deserialized from
13236 /// the integer representation of enums.
13237 pub fn name(&self) -> std::option::Option<&str> {
13238 match self {
13239 Self::Unspecified => std::option::Option::Some("EGRESS_OPTION_UNSPECIFIED"),
13240 Self::NoPublicEgress => std::option::Option::Some("NO_PUBLIC_EGRESS"),
13241 Self::PublicEgress => std::option::Option::Some("PUBLIC_EGRESS"),
13242 Self::UnknownValue(u) => u.0.name(),
13243 }
13244 }
13245 }
13246
13247 impl std::default::Default for EgressOption {
13248 fn default() -> Self {
13249 use std::convert::From;
13250 Self::from(0)
13251 }
13252 }
13253
13254 impl std::fmt::Display for EgressOption {
13255 fn fmt(
13256 &self,
13257 f: &mut std::fmt::Formatter<'_>,
13258 ) -> std::result::Result<(), std::fmt::Error> {
13259 wkt::internal::display_enum(f, self.name(), self.value())
13260 }
13261 }
13262
13263 impl std::convert::From<i32> for EgressOption {
13264 fn from(value: i32) -> Self {
13265 match value {
13266 0 => Self::Unspecified,
13267 1 => Self::NoPublicEgress,
13268 2 => Self::PublicEgress,
13269 _ => Self::UnknownValue(egress_option::UnknownValue(
13270 wkt::internal::UnknownEnumValue::Integer(value),
13271 )),
13272 }
13273 }
13274 }
13275
13276 impl std::convert::From<&str> for EgressOption {
13277 fn from(value: &str) -> Self {
13278 use std::string::ToString;
13279 match value {
13280 "EGRESS_OPTION_UNSPECIFIED" => Self::Unspecified,
13281 "NO_PUBLIC_EGRESS" => Self::NoPublicEgress,
13282 "PUBLIC_EGRESS" => Self::PublicEgress,
13283 _ => Self::UnknownValue(egress_option::UnknownValue(
13284 wkt::internal::UnknownEnumValue::String(value.to_string()),
13285 )),
13286 }
13287 }
13288 }
13289
13290 impl serde::ser::Serialize for EgressOption {
13291 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13292 where
13293 S: serde::Serializer,
13294 {
13295 match self {
13296 Self::Unspecified => serializer.serialize_i32(0),
13297 Self::NoPublicEgress => serializer.serialize_i32(1),
13298 Self::PublicEgress => serializer.serialize_i32(2),
13299 Self::UnknownValue(u) => u.0.serialize(serializer),
13300 }
13301 }
13302 }
13303
13304 impl<'de> serde::de::Deserialize<'de> for EgressOption {
13305 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13306 where
13307 D: serde::Deserializer<'de>,
13308 {
13309 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EgressOption>::new(
13310 ".google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig.EgressOption",
13311 ))
13312 }
13313 }
13314 }
13315
13316 /// Defines the Private Service Connect network configuration for the pool.
13317 #[derive(Clone, Default, PartialEq)]
13318 #[non_exhaustive]
13319 pub struct PrivateServiceConnect {
13320 /// Required. Immutable. The network attachment that the worker network
13321 /// interface is peered to. Must be in the format
13322 /// `projects/{project}/regions/{region}/networkAttachments/{networkAttachment}`.
13323 /// The region of network attachment must be the same as the worker pool.
13324 /// See [Network
13325 /// Attachments](https://cloud.google.com/vpc/docs/about-network-attachments)
13326 pub network_attachment: std::string::String,
13327
13328 /// Required. Immutable. Disable public IP on the primary network interface.
13329 ///
13330 /// If true, workers are created without any public address, which prevents
13331 /// network egress to public IPs unless a network proxy is configured.
13332 /// If false, workers are created with a public address which allows for
13333 /// public internet egress. The public address only applies to traffic
13334 /// through the primary network interface.
13335 /// If `route_all_traffic` is set to true, all traffic will go through the
13336 /// non-primary network interface, this boolean has no effect.
13337 pub public_ip_address_disabled: bool,
13338
13339 /// Immutable. Route all traffic through PSC interface. Enable this if you
13340 /// want full control of traffic in the private pool. Configure Cloud NAT for
13341 /// the subnet of network attachment if you need to access public Internet.
13342 ///
13343 /// If false, Only route RFC 1918 (10.0.0.0/8, 172.16.0.0/12, and
13344 /// 192.168.0.0/16) and RFC 6598 (100.64.0.0/10) through PSC interface.
13345 pub route_all_traffic: bool,
13346
13347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13348 }
13349
13350 impl PrivateServiceConnect {
13351 /// Creates a new default instance.
13352 pub fn new() -> Self {
13353 std::default::Default::default()
13354 }
13355
13356 /// Sets the value of [network_attachment][crate::model::private_pool_v_1_config::PrivateServiceConnect::network_attachment].
13357 ///
13358 /// # Example
13359 /// ```ignore,no_run
13360 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13361 /// let x = PrivateServiceConnect::new().set_network_attachment("example");
13362 /// ```
13363 pub fn set_network_attachment<T: std::convert::Into<std::string::String>>(
13364 mut self,
13365 v: T,
13366 ) -> Self {
13367 self.network_attachment = v.into();
13368 self
13369 }
13370
13371 /// Sets the value of [public_ip_address_disabled][crate::model::private_pool_v_1_config::PrivateServiceConnect::public_ip_address_disabled].
13372 ///
13373 /// # Example
13374 /// ```ignore,no_run
13375 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13376 /// let x = PrivateServiceConnect::new().set_public_ip_address_disabled(true);
13377 /// ```
13378 pub fn set_public_ip_address_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13379 self.public_ip_address_disabled = v.into();
13380 self
13381 }
13382
13383 /// Sets the value of [route_all_traffic][crate::model::private_pool_v_1_config::PrivateServiceConnect::route_all_traffic].
13384 ///
13385 /// # Example
13386 /// ```ignore,no_run
13387 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13388 /// let x = PrivateServiceConnect::new().set_route_all_traffic(true);
13389 /// ```
13390 pub fn set_route_all_traffic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13391 self.route_all_traffic = v.into();
13392 self
13393 }
13394 }
13395
13396 impl wkt::message::Message for PrivateServiceConnect {
13397 fn typename() -> &'static str {
13398 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.PrivateServiceConnect"
13399 }
13400 }
13401}
13402
13403/// Request to create a new `WorkerPool`.
13404#[derive(Clone, Default, PartialEq)]
13405#[non_exhaustive]
13406pub struct CreateWorkerPoolRequest {
13407 /// Required. The parent resource where this worker pool will be created.
13408 /// Format: `projects/{project}/locations/{location}`.
13409 pub parent: std::string::String,
13410
13411 /// Required. `WorkerPool` resource to create.
13412 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13413
13414 /// Required. Immutable. The ID to use for the `WorkerPool`, which will become
13415 /// the final component of the resource name.
13416 ///
13417 /// This value should be 1-63 characters, and valid characters
13418 /// are /[a-z][0-9]-/.
13419 pub worker_pool_id: std::string::String,
13420
13421 /// If set, validate the request and preview the response, but do not actually
13422 /// post it.
13423 pub validate_only: bool,
13424
13425 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13426}
13427
13428impl CreateWorkerPoolRequest {
13429 /// Creates a new default instance.
13430 pub fn new() -> Self {
13431 std::default::Default::default()
13432 }
13433
13434 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
13435 ///
13436 /// # Example
13437 /// ```ignore,no_run
13438 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13439 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
13440 /// ```
13441 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13442 self.parent = v.into();
13443 self
13444 }
13445
13446 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13447 ///
13448 /// # Example
13449 /// ```ignore,no_run
13450 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13451 /// use google_cloud_build_v1::model::WorkerPool;
13452 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13453 /// ```
13454 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13455 where
13456 T: std::convert::Into<crate::model::WorkerPool>,
13457 {
13458 self.worker_pool = std::option::Option::Some(v.into());
13459 self
13460 }
13461
13462 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13463 ///
13464 /// # Example
13465 /// ```ignore,no_run
13466 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13467 /// use google_cloud_build_v1::model::WorkerPool;
13468 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13469 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13470 /// ```
13471 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13472 where
13473 T: std::convert::Into<crate::model::WorkerPool>,
13474 {
13475 self.worker_pool = v.map(|x| x.into());
13476 self
13477 }
13478
13479 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
13480 ///
13481 /// # Example
13482 /// ```ignore,no_run
13483 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13484 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
13485 /// ```
13486 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13487 self.worker_pool_id = v.into();
13488 self
13489 }
13490
13491 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
13492 ///
13493 /// # Example
13494 /// ```ignore,no_run
13495 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13496 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
13497 /// ```
13498 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13499 self.validate_only = v.into();
13500 self
13501 }
13502}
13503
13504impl wkt::message::Message for CreateWorkerPoolRequest {
13505 fn typename() -> &'static str {
13506 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolRequest"
13507 }
13508}
13509
13510/// Request to get a `WorkerPool` with the specified name.
13511#[derive(Clone, Default, PartialEq)]
13512#[non_exhaustive]
13513pub struct GetWorkerPoolRequest {
13514 /// Required. The name of the `WorkerPool` to retrieve.
13515 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13516 pub name: std::string::String,
13517
13518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13519}
13520
13521impl GetWorkerPoolRequest {
13522 /// Creates a new default instance.
13523 pub fn new() -> Self {
13524 std::default::Default::default()
13525 }
13526
13527 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
13528 ///
13529 /// # Example
13530 /// ```ignore,no_run
13531 /// # use google_cloud_build_v1::model::GetWorkerPoolRequest;
13532 /// let x = GetWorkerPoolRequest::new().set_name("example");
13533 /// ```
13534 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13535 self.name = v.into();
13536 self
13537 }
13538}
13539
13540impl wkt::message::Message for GetWorkerPoolRequest {
13541 fn typename() -> &'static str {
13542 "type.googleapis.com/google.devtools.cloudbuild.v1.GetWorkerPoolRequest"
13543 }
13544}
13545
13546/// Request to delete a `WorkerPool`.
13547#[derive(Clone, Default, PartialEq)]
13548#[non_exhaustive]
13549pub struct DeleteWorkerPoolRequest {
13550 /// Required. The name of the `WorkerPool` to delete.
13551 /// Format:
13552 /// `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13553 pub name: std::string::String,
13554
13555 /// Optional. If provided, it must match the server's etag on the workerpool
13556 /// for the request to be processed.
13557 pub etag: std::string::String,
13558
13559 /// If set to true, and the `WorkerPool` is not found, the request will succeed
13560 /// but no action will be taken on the server.
13561 pub allow_missing: bool,
13562
13563 /// If set, validate the request and preview the response, but do not actually
13564 /// post it.
13565 pub validate_only: bool,
13566
13567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13568}
13569
13570impl DeleteWorkerPoolRequest {
13571 /// Creates a new default instance.
13572 pub fn new() -> Self {
13573 std::default::Default::default()
13574 }
13575
13576 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
13577 ///
13578 /// # Example
13579 /// ```ignore,no_run
13580 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13581 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
13582 /// ```
13583 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13584 self.name = v.into();
13585 self
13586 }
13587
13588 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
13589 ///
13590 /// # Example
13591 /// ```ignore,no_run
13592 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13593 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
13594 /// ```
13595 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13596 self.etag = v.into();
13597 self
13598 }
13599
13600 /// Sets the value of [allow_missing][crate::model::DeleteWorkerPoolRequest::allow_missing].
13601 ///
13602 /// # Example
13603 /// ```ignore,no_run
13604 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13605 /// let x = DeleteWorkerPoolRequest::new().set_allow_missing(true);
13606 /// ```
13607 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13608 self.allow_missing = v.into();
13609 self
13610 }
13611
13612 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
13613 ///
13614 /// # Example
13615 /// ```ignore,no_run
13616 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13617 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
13618 /// ```
13619 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13620 self.validate_only = v.into();
13621 self
13622 }
13623}
13624
13625impl wkt::message::Message for DeleteWorkerPoolRequest {
13626 fn typename() -> &'static str {
13627 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest"
13628 }
13629}
13630
13631/// Request to update a `WorkerPool`.
13632#[derive(Clone, Default, PartialEq)]
13633#[non_exhaustive]
13634pub struct UpdateWorkerPoolRequest {
13635 /// Required. The `WorkerPool` to update.
13636 ///
13637 /// The `name` field is used to identify the `WorkerPool` to update.
13638 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13639 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13640
13641 /// Optional. A mask specifying which fields in `worker_pool` to update.
13642 pub update_mask: std::option::Option<wkt::FieldMask>,
13643
13644 /// If set, validate the request and preview the response, but do not actually
13645 /// post it.
13646 pub validate_only: bool,
13647
13648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13649}
13650
13651impl UpdateWorkerPoolRequest {
13652 /// Creates a new default instance.
13653 pub fn new() -> Self {
13654 std::default::Default::default()
13655 }
13656
13657 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13658 ///
13659 /// # Example
13660 /// ```ignore,no_run
13661 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13662 /// use google_cloud_build_v1::model::WorkerPool;
13663 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13664 /// ```
13665 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13666 where
13667 T: std::convert::Into<crate::model::WorkerPool>,
13668 {
13669 self.worker_pool = std::option::Option::Some(v.into());
13670 self
13671 }
13672
13673 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13674 ///
13675 /// # Example
13676 /// ```ignore,no_run
13677 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13678 /// use google_cloud_build_v1::model::WorkerPool;
13679 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13680 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13681 /// ```
13682 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13683 where
13684 T: std::convert::Into<crate::model::WorkerPool>,
13685 {
13686 self.worker_pool = v.map(|x| x.into());
13687 self
13688 }
13689
13690 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13691 ///
13692 /// # Example
13693 /// ```ignore,no_run
13694 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13695 /// use wkt::FieldMask;
13696 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13697 /// ```
13698 pub fn set_update_mask<T>(mut self, v: T) -> Self
13699 where
13700 T: std::convert::Into<wkt::FieldMask>,
13701 {
13702 self.update_mask = std::option::Option::Some(v.into());
13703 self
13704 }
13705
13706 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13707 ///
13708 /// # Example
13709 /// ```ignore,no_run
13710 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13711 /// use wkt::FieldMask;
13712 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13713 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13714 /// ```
13715 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13716 where
13717 T: std::convert::Into<wkt::FieldMask>,
13718 {
13719 self.update_mask = v.map(|x| x.into());
13720 self
13721 }
13722
13723 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
13724 ///
13725 /// # Example
13726 /// ```ignore,no_run
13727 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13728 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
13729 /// ```
13730 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13731 self.validate_only = v.into();
13732 self
13733 }
13734}
13735
13736impl wkt::message::Message for UpdateWorkerPoolRequest {
13737 fn typename() -> &'static str {
13738 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest"
13739 }
13740}
13741
13742/// Request to list `WorkerPool`s.
13743#[derive(Clone, Default, PartialEq)]
13744#[non_exhaustive]
13745pub struct ListWorkerPoolsRequest {
13746 /// Required. The parent of the collection of `WorkerPools`.
13747 /// Format: `projects/{project}/locations/{location}`.
13748 pub parent: std::string::String,
13749
13750 /// The maximum number of `WorkerPool`s to return. The service may return
13751 /// fewer than this value. If omitted, the server will use a sensible default.
13752 pub page_size: i32,
13753
13754 /// A page token, received from a previous `ListWorkerPools` call. Provide this
13755 /// to retrieve the subsequent page.
13756 pub page_token: std::string::String,
13757
13758 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13759}
13760
13761impl ListWorkerPoolsRequest {
13762 /// Creates a new default instance.
13763 pub fn new() -> Self {
13764 std::default::Default::default()
13765 }
13766
13767 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
13768 ///
13769 /// # Example
13770 /// ```ignore,no_run
13771 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13772 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
13773 /// ```
13774 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13775 self.parent = v.into();
13776 self
13777 }
13778
13779 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
13780 ///
13781 /// # Example
13782 /// ```ignore,no_run
13783 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13784 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
13785 /// ```
13786 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13787 self.page_size = v.into();
13788 self
13789 }
13790
13791 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
13792 ///
13793 /// # Example
13794 /// ```ignore,no_run
13795 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13796 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
13797 /// ```
13798 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13799 self.page_token = v.into();
13800 self
13801 }
13802}
13803
13804impl wkt::message::Message for ListWorkerPoolsRequest {
13805 fn typename() -> &'static str {
13806 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsRequest"
13807 }
13808}
13809
13810/// Response containing existing `WorkerPools`.
13811#[derive(Clone, Default, PartialEq)]
13812#[non_exhaustive]
13813pub struct ListWorkerPoolsResponse {
13814 /// `WorkerPools` for the specified project.
13815 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
13816
13817 /// Continuation token used to page through large result sets. Provide this
13818 /// value in a subsequent ListWorkerPoolsRequest to return the next page of
13819 /// results.
13820 pub next_page_token: std::string::String,
13821
13822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13823}
13824
13825impl ListWorkerPoolsResponse {
13826 /// Creates a new default instance.
13827 pub fn new() -> Self {
13828 std::default::Default::default()
13829 }
13830
13831 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
13832 ///
13833 /// # Example
13834 /// ```ignore,no_run
13835 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13836 /// use google_cloud_build_v1::model::WorkerPool;
13837 /// let x = ListWorkerPoolsResponse::new()
13838 /// .set_worker_pools([
13839 /// WorkerPool::default()/* use setters */,
13840 /// WorkerPool::default()/* use (different) setters */,
13841 /// ]);
13842 /// ```
13843 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
13844 where
13845 T: std::iter::IntoIterator<Item = V>,
13846 V: std::convert::Into<crate::model::WorkerPool>,
13847 {
13848 use std::iter::Iterator;
13849 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
13850 self
13851 }
13852
13853 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
13854 ///
13855 /// # Example
13856 /// ```ignore,no_run
13857 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13858 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
13859 /// ```
13860 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13861 self.next_page_token = v.into();
13862 self
13863 }
13864}
13865
13866impl wkt::message::Message for ListWorkerPoolsResponse {
13867 fn typename() -> &'static str {
13868 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsResponse"
13869 }
13870}
13871
13872#[doc(hidden)]
13873impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
13874 type PageItem = crate::model::WorkerPool;
13875
13876 fn items(self) -> std::vec::Vec<Self::PageItem> {
13877 self.worker_pools
13878 }
13879
13880 fn next_page_token(&self) -> std::string::String {
13881 use std::clone::Clone;
13882 self.next_page_token.clone()
13883 }
13884}
13885
13886/// Metadata for the `CreateWorkerPool` operation.
13887#[derive(Clone, Default, PartialEq)]
13888#[non_exhaustive]
13889pub struct CreateWorkerPoolOperationMetadata {
13890 /// The resource name of the `WorkerPool` to create.
13891 /// Format:
13892 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13893 pub worker_pool: std::string::String,
13894
13895 /// Time the operation was created.
13896 pub create_time: std::option::Option<wkt::Timestamp>,
13897
13898 /// Time the operation was completed.
13899 pub complete_time: std::option::Option<wkt::Timestamp>,
13900
13901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13902}
13903
13904impl CreateWorkerPoolOperationMetadata {
13905 /// Creates a new default instance.
13906 pub fn new() -> Self {
13907 std::default::Default::default()
13908 }
13909
13910 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolOperationMetadata::worker_pool].
13911 ///
13912 /// # Example
13913 /// ```ignore,no_run
13914 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13915 /// let x = CreateWorkerPoolOperationMetadata::new().set_worker_pool("example");
13916 /// ```
13917 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13918 self.worker_pool = v.into();
13919 self
13920 }
13921
13922 /// Sets the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13923 ///
13924 /// # Example
13925 /// ```ignore,no_run
13926 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13927 /// use wkt::Timestamp;
13928 /// let x = CreateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
13929 /// ```
13930 pub fn set_create_time<T>(mut self, v: T) -> Self
13931 where
13932 T: std::convert::Into<wkt::Timestamp>,
13933 {
13934 self.create_time = std::option::Option::Some(v.into());
13935 self
13936 }
13937
13938 /// Sets or clears the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13939 ///
13940 /// # Example
13941 /// ```ignore,no_run
13942 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13943 /// use wkt::Timestamp;
13944 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13945 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
13946 /// ```
13947 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13948 where
13949 T: std::convert::Into<wkt::Timestamp>,
13950 {
13951 self.create_time = v.map(|x| x.into());
13952 self
13953 }
13954
13955 /// Sets the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
13956 ///
13957 /// # Example
13958 /// ```ignore,no_run
13959 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13960 /// use wkt::Timestamp;
13961 /// let x = CreateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
13962 /// ```
13963 pub fn set_complete_time<T>(mut self, v: T) -> Self
13964 where
13965 T: std::convert::Into<wkt::Timestamp>,
13966 {
13967 self.complete_time = std::option::Option::Some(v.into());
13968 self
13969 }
13970
13971 /// Sets or clears the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
13972 ///
13973 /// # Example
13974 /// ```ignore,no_run
13975 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13976 /// use wkt::Timestamp;
13977 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
13978 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
13979 /// ```
13980 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
13981 where
13982 T: std::convert::Into<wkt::Timestamp>,
13983 {
13984 self.complete_time = v.map(|x| x.into());
13985 self
13986 }
13987}
13988
13989impl wkt::message::Message for CreateWorkerPoolOperationMetadata {
13990 fn typename() -> &'static str {
13991 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata"
13992 }
13993}
13994
13995/// Metadata for the `UpdateWorkerPool` operation.
13996#[derive(Clone, Default, PartialEq)]
13997#[non_exhaustive]
13998pub struct UpdateWorkerPoolOperationMetadata {
13999 /// The resource name of the `WorkerPool` being updated.
14000 /// Format:
14001 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14002 pub worker_pool: std::string::String,
14003
14004 /// Time the operation was created.
14005 pub create_time: std::option::Option<wkt::Timestamp>,
14006
14007 /// Time the operation was completed.
14008 pub complete_time: std::option::Option<wkt::Timestamp>,
14009
14010 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14011}
14012
14013impl UpdateWorkerPoolOperationMetadata {
14014 /// Creates a new default instance.
14015 pub fn new() -> Self {
14016 std::default::Default::default()
14017 }
14018
14019 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolOperationMetadata::worker_pool].
14020 ///
14021 /// # Example
14022 /// ```ignore,no_run
14023 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14024 /// let x = UpdateWorkerPoolOperationMetadata::new().set_worker_pool("example");
14025 /// ```
14026 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14027 self.worker_pool = v.into();
14028 self
14029 }
14030
14031 /// Sets the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
14032 ///
14033 /// # Example
14034 /// ```ignore,no_run
14035 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14036 /// use wkt::Timestamp;
14037 /// let x = UpdateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14038 /// ```
14039 pub fn set_create_time<T>(mut self, v: T) -> Self
14040 where
14041 T: std::convert::Into<wkt::Timestamp>,
14042 {
14043 self.create_time = std::option::Option::Some(v.into());
14044 self
14045 }
14046
14047 /// Sets or clears the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
14048 ///
14049 /// # Example
14050 /// ```ignore,no_run
14051 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14052 /// use wkt::Timestamp;
14053 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14054 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14055 /// ```
14056 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14057 where
14058 T: std::convert::Into<wkt::Timestamp>,
14059 {
14060 self.create_time = v.map(|x| x.into());
14061 self
14062 }
14063
14064 /// Sets the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
14065 ///
14066 /// # Example
14067 /// ```ignore,no_run
14068 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14069 /// use wkt::Timestamp;
14070 /// let x = UpdateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14071 /// ```
14072 pub fn set_complete_time<T>(mut self, v: T) -> Self
14073 where
14074 T: std::convert::Into<wkt::Timestamp>,
14075 {
14076 self.complete_time = std::option::Option::Some(v.into());
14077 self
14078 }
14079
14080 /// Sets or clears the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
14081 ///
14082 /// # Example
14083 /// ```ignore,no_run
14084 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14085 /// use wkt::Timestamp;
14086 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14087 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14088 /// ```
14089 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14090 where
14091 T: std::convert::Into<wkt::Timestamp>,
14092 {
14093 self.complete_time = v.map(|x| x.into());
14094 self
14095 }
14096}
14097
14098impl wkt::message::Message for UpdateWorkerPoolOperationMetadata {
14099 fn typename() -> &'static str {
14100 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata"
14101 }
14102}
14103
14104/// Metadata for the `DeleteWorkerPool` operation.
14105#[derive(Clone, Default, PartialEq)]
14106#[non_exhaustive]
14107pub struct DeleteWorkerPoolOperationMetadata {
14108 /// The resource name of the `WorkerPool` being deleted.
14109 /// Format:
14110 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14111 pub worker_pool: std::string::String,
14112
14113 /// Time the operation was created.
14114 pub create_time: std::option::Option<wkt::Timestamp>,
14115
14116 /// Time the operation was completed.
14117 pub complete_time: std::option::Option<wkt::Timestamp>,
14118
14119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14120}
14121
14122impl DeleteWorkerPoolOperationMetadata {
14123 /// Creates a new default instance.
14124 pub fn new() -> Self {
14125 std::default::Default::default()
14126 }
14127
14128 /// Sets the value of [worker_pool][crate::model::DeleteWorkerPoolOperationMetadata::worker_pool].
14129 ///
14130 /// # Example
14131 /// ```ignore,no_run
14132 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14133 /// let x = DeleteWorkerPoolOperationMetadata::new().set_worker_pool("example");
14134 /// ```
14135 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14136 self.worker_pool = v.into();
14137 self
14138 }
14139
14140 /// Sets the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14141 ///
14142 /// # Example
14143 /// ```ignore,no_run
14144 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14145 /// use wkt::Timestamp;
14146 /// let x = DeleteWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14147 /// ```
14148 pub fn set_create_time<T>(mut self, v: T) -> Self
14149 where
14150 T: std::convert::Into<wkt::Timestamp>,
14151 {
14152 self.create_time = std::option::Option::Some(v.into());
14153 self
14154 }
14155
14156 /// Sets or clears the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14157 ///
14158 /// # Example
14159 /// ```ignore,no_run
14160 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14161 /// use wkt::Timestamp;
14162 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14163 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14164 /// ```
14165 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14166 where
14167 T: std::convert::Into<wkt::Timestamp>,
14168 {
14169 self.create_time = v.map(|x| x.into());
14170 self
14171 }
14172
14173 /// Sets the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14174 ///
14175 /// # Example
14176 /// ```ignore,no_run
14177 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14178 /// use wkt::Timestamp;
14179 /// let x = DeleteWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14180 /// ```
14181 pub fn set_complete_time<T>(mut self, v: T) -> Self
14182 where
14183 T: std::convert::Into<wkt::Timestamp>,
14184 {
14185 self.complete_time = std::option::Option::Some(v.into());
14186 self
14187 }
14188
14189 /// Sets or clears the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14190 ///
14191 /// # Example
14192 /// ```ignore,no_run
14193 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14194 /// use wkt::Timestamp;
14195 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14196 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14197 /// ```
14198 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14199 where
14200 T: std::convert::Into<wkt::Timestamp>,
14201 {
14202 self.complete_time = v.map(|x| x.into());
14203 self
14204 }
14205}
14206
14207impl wkt::message::Message for DeleteWorkerPoolOperationMetadata {
14208 fn typename() -> &'static str {
14209 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata"
14210 }
14211}