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 lazy_static;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Returns the default service account that will be used for `Builds`.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct GetDefaultServiceAccountRequest {
43 /// Required. The name of the `DefaultServiceAccount` to retrieve.
44 /// Format:
45 /// `projects/{project}/locations/{location}/defaultServiceAccount`
46 pub name: std::string::String,
47
48 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
49}
50
51impl GetDefaultServiceAccountRequest {
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 pub fn new() -> Self {
100 std::default::Default::default()
101 }
102
103 /// Sets the value of [name][crate::model::DefaultServiceAccount::name].
104 ///
105 /// # Example
106 /// ```ignore,no_run
107 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
108 /// let x = DefaultServiceAccount::new().set_name("example");
109 /// ```
110 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
111 self.name = v.into();
112 self
113 }
114
115 /// Sets the value of [service_account_email][crate::model::DefaultServiceAccount::service_account_email].
116 ///
117 /// # Example
118 /// ```ignore,no_run
119 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
120 /// let x = DefaultServiceAccount::new().set_service_account_email("example");
121 /// ```
122 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
123 mut self,
124 v: T,
125 ) -> Self {
126 self.service_account_email = v.into();
127 self
128 }
129}
130
131impl wkt::message::Message for DefaultServiceAccount {
132 fn typename() -> &'static str {
133 "type.googleapis.com/google.devtools.cloudbuild.v1.DefaultServiceAccount"
134 }
135}
136
137/// Specifies a build to retry.
138#[derive(Clone, Default, PartialEq)]
139#[non_exhaustive]
140pub struct RetryBuildRequest {
141 /// The name of the `Build` to retry.
142 /// Format: `projects/{project}/locations/{location}/builds/{build}`
143 pub name: std::string::String,
144
145 /// Required. ID of the project.
146 pub project_id: std::string::String,
147
148 /// Required. Build ID of the original build.
149 pub id: std::string::String,
150
151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
152}
153
154impl RetryBuildRequest {
155 pub fn new() -> Self {
156 std::default::Default::default()
157 }
158
159 /// Sets the value of [name][crate::model::RetryBuildRequest::name].
160 ///
161 /// # Example
162 /// ```ignore,no_run
163 /// # use google_cloud_build_v1::model::RetryBuildRequest;
164 /// let x = RetryBuildRequest::new().set_name("example");
165 /// ```
166 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167 self.name = v.into();
168 self
169 }
170
171 /// Sets the value of [project_id][crate::model::RetryBuildRequest::project_id].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_cloud_build_v1::model::RetryBuildRequest;
176 /// let x = RetryBuildRequest::new().set_project_id("example");
177 /// ```
178 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
179 self.project_id = v.into();
180 self
181 }
182
183 /// Sets the value of [id][crate::model::RetryBuildRequest::id].
184 ///
185 /// # Example
186 /// ```ignore,no_run
187 /// # use google_cloud_build_v1::model::RetryBuildRequest;
188 /// let x = RetryBuildRequest::new().set_id("example");
189 /// ```
190 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
191 self.id = v.into();
192 self
193 }
194}
195
196impl wkt::message::Message for RetryBuildRequest {
197 fn typename() -> &'static str {
198 "type.googleapis.com/google.devtools.cloudbuild.v1.RetryBuildRequest"
199 }
200}
201
202/// Specifies a build trigger to run and the source to use.
203#[derive(Clone, Default, PartialEq)]
204#[non_exhaustive]
205pub struct RunBuildTriggerRequest {
206 /// The name of the `Trigger` to run.
207 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
208 pub name: std::string::String,
209
210 /// Required. ID of the project.
211 pub project_id: std::string::String,
212
213 /// Required. ID of the trigger.
214 pub trigger_id: std::string::String,
215
216 /// Source to build against this trigger.
217 /// Branch and tag names cannot consist of regular expressions.
218 pub source: std::option::Option<crate::model::RepoSource>,
219
220 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
221}
222
223impl RunBuildTriggerRequest {
224 pub fn new() -> Self {
225 std::default::Default::default()
226 }
227
228 /// Sets the value of [name][crate::model::RunBuildTriggerRequest::name].
229 ///
230 /// # Example
231 /// ```ignore,no_run
232 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
233 /// let x = RunBuildTriggerRequest::new().set_name("example");
234 /// ```
235 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
236 self.name = v.into();
237 self
238 }
239
240 /// Sets the value of [project_id][crate::model::RunBuildTriggerRequest::project_id].
241 ///
242 /// # Example
243 /// ```ignore,no_run
244 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
245 /// let x = RunBuildTriggerRequest::new().set_project_id("example");
246 /// ```
247 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
248 self.project_id = v.into();
249 self
250 }
251
252 /// Sets the value of [trigger_id][crate::model::RunBuildTriggerRequest::trigger_id].
253 ///
254 /// # Example
255 /// ```ignore,no_run
256 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
257 /// let x = RunBuildTriggerRequest::new().set_trigger_id("example");
258 /// ```
259 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
260 self.trigger_id = v.into();
261 self
262 }
263
264 /// Sets the value of [source][crate::model::RunBuildTriggerRequest::source].
265 ///
266 /// # Example
267 /// ```ignore,no_run
268 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
269 /// use google_cloud_build_v1::model::RepoSource;
270 /// let x = RunBuildTriggerRequest::new().set_source(RepoSource::default()/* use setters */);
271 /// ```
272 pub fn set_source<T>(mut self, v: T) -> Self
273 where
274 T: std::convert::Into<crate::model::RepoSource>,
275 {
276 self.source = std::option::Option::Some(v.into());
277 self
278 }
279
280 /// Sets or clears the value of [source][crate::model::RunBuildTriggerRequest::source].
281 ///
282 /// # Example
283 /// ```ignore,no_run
284 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
285 /// use google_cloud_build_v1::model::RepoSource;
286 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(Some(RepoSource::default()/* use setters */));
287 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(None::<RepoSource>);
288 /// ```
289 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
290 where
291 T: std::convert::Into<crate::model::RepoSource>,
292 {
293 self.source = v.map(|x| x.into());
294 self
295 }
296}
297
298impl wkt::message::Message for RunBuildTriggerRequest {
299 fn typename() -> &'static str {
300 "type.googleapis.com/google.devtools.cloudbuild.v1.RunBuildTriggerRequest"
301 }
302}
303
304/// Location of the source in an archive file in Cloud Storage.
305#[derive(Clone, Default, PartialEq)]
306#[non_exhaustive]
307pub struct StorageSource {
308 /// Cloud Storage bucket containing the source (see
309 /// [Bucket Name
310 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
311 pub bucket: std::string::String,
312
313 /// Required. Cloud Storage object containing the source.
314 ///
315 /// This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`)
316 /// containing source to build.
317 pub object: std::string::String,
318
319 /// Optional. Cloud Storage generation for the object. If the generation is
320 /// omitted, the latest generation will be used.
321 pub generation: i64,
322
323 /// Optional. Option to specify the tool to fetch the source file for the
324 /// build.
325 pub source_fetcher: crate::model::storage_source::SourceFetcher,
326
327 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
328}
329
330impl StorageSource {
331 pub fn new() -> Self {
332 std::default::Default::default()
333 }
334
335 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
336 ///
337 /// # Example
338 /// ```ignore,no_run
339 /// # use google_cloud_build_v1::model::StorageSource;
340 /// let x = StorageSource::new().set_bucket("example");
341 /// ```
342 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
343 self.bucket = v.into();
344 self
345 }
346
347 /// Sets the value of [object][crate::model::StorageSource::object].
348 ///
349 /// # Example
350 /// ```ignore,no_run
351 /// # use google_cloud_build_v1::model::StorageSource;
352 /// let x = StorageSource::new().set_object("example");
353 /// ```
354 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
355 self.object = v.into();
356 self
357 }
358
359 /// Sets the value of [generation][crate::model::StorageSource::generation].
360 ///
361 /// # Example
362 /// ```ignore,no_run
363 /// # use google_cloud_build_v1::model::StorageSource;
364 /// let x = StorageSource::new().set_generation(42);
365 /// ```
366 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
367 self.generation = v.into();
368 self
369 }
370
371 /// Sets the value of [source_fetcher][crate::model::StorageSource::source_fetcher].
372 ///
373 /// # Example
374 /// ```ignore,no_run
375 /// # use google_cloud_build_v1::model::StorageSource;
376 /// use google_cloud_build_v1::model::storage_source::SourceFetcher;
377 /// let x0 = StorageSource::new().set_source_fetcher(SourceFetcher::Gsutil);
378 /// let x1 = StorageSource::new().set_source_fetcher(SourceFetcher::GcsFetcher);
379 /// ```
380 pub fn set_source_fetcher<
381 T: std::convert::Into<crate::model::storage_source::SourceFetcher>,
382 >(
383 mut self,
384 v: T,
385 ) -> Self {
386 self.source_fetcher = v.into();
387 self
388 }
389}
390
391impl wkt::message::Message for StorageSource {
392 fn typename() -> &'static str {
393 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSource"
394 }
395}
396
397/// Defines additional types related to [StorageSource].
398pub mod storage_source {
399 #[allow(unused_imports)]
400 use super::*;
401
402 /// Specifies the tool to fetch the source file for the build.
403 ///
404 /// # Working with unknown values
405 ///
406 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
407 /// additional enum variants at any time. Adding new variants is not considered
408 /// a breaking change. Applications should write their code in anticipation of:
409 ///
410 /// - New values appearing in future releases of the client library, **and**
411 /// - New values received dynamically, without application changes.
412 ///
413 /// Please consult the [Working with enums] section in the user guide for some
414 /// guidelines.
415 ///
416 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
417 #[derive(Clone, Debug, PartialEq)]
418 #[non_exhaustive]
419 pub enum SourceFetcher {
420 /// Unspecified defaults to GSUTIL.
421 Unspecified,
422 /// Use the "gsutil" tool to download the source file.
423 Gsutil,
424 /// Use the Cloud Storage Fetcher tool to download the source file.
425 GcsFetcher,
426 /// If set, the enum was initialized with an unknown value.
427 ///
428 /// Applications can examine the value using [SourceFetcher::value] or
429 /// [SourceFetcher::name].
430 UnknownValue(source_fetcher::UnknownValue),
431 }
432
433 #[doc(hidden)]
434 pub mod source_fetcher {
435 #[allow(unused_imports)]
436 use super::*;
437 #[derive(Clone, Debug, PartialEq)]
438 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
439 }
440
441 impl SourceFetcher {
442 /// Gets the enum value.
443 ///
444 /// Returns `None` if the enum contains an unknown value deserialized from
445 /// the string representation of enums.
446 pub fn value(&self) -> std::option::Option<i32> {
447 match self {
448 Self::Unspecified => std::option::Option::Some(0),
449 Self::Gsutil => std::option::Option::Some(1),
450 Self::GcsFetcher => std::option::Option::Some(2),
451 Self::UnknownValue(u) => u.0.value(),
452 }
453 }
454
455 /// Gets the enum value as a string.
456 ///
457 /// Returns `None` if the enum contains an unknown value deserialized from
458 /// the integer representation of enums.
459 pub fn name(&self) -> std::option::Option<&str> {
460 match self {
461 Self::Unspecified => std::option::Option::Some("SOURCE_FETCHER_UNSPECIFIED"),
462 Self::Gsutil => std::option::Option::Some("GSUTIL"),
463 Self::GcsFetcher => std::option::Option::Some("GCS_FETCHER"),
464 Self::UnknownValue(u) => u.0.name(),
465 }
466 }
467 }
468
469 impl std::default::Default for SourceFetcher {
470 fn default() -> Self {
471 use std::convert::From;
472 Self::from(0)
473 }
474 }
475
476 impl std::fmt::Display for SourceFetcher {
477 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
478 wkt::internal::display_enum(f, self.name(), self.value())
479 }
480 }
481
482 impl std::convert::From<i32> for SourceFetcher {
483 fn from(value: i32) -> Self {
484 match value {
485 0 => Self::Unspecified,
486 1 => Self::Gsutil,
487 2 => Self::GcsFetcher,
488 _ => Self::UnknownValue(source_fetcher::UnknownValue(
489 wkt::internal::UnknownEnumValue::Integer(value),
490 )),
491 }
492 }
493 }
494
495 impl std::convert::From<&str> for SourceFetcher {
496 fn from(value: &str) -> Self {
497 use std::string::ToString;
498 match value {
499 "SOURCE_FETCHER_UNSPECIFIED" => Self::Unspecified,
500 "GSUTIL" => Self::Gsutil,
501 "GCS_FETCHER" => Self::GcsFetcher,
502 _ => Self::UnknownValue(source_fetcher::UnknownValue(
503 wkt::internal::UnknownEnumValue::String(value.to_string()),
504 )),
505 }
506 }
507 }
508
509 impl serde::ser::Serialize for SourceFetcher {
510 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
511 where
512 S: serde::Serializer,
513 {
514 match self {
515 Self::Unspecified => serializer.serialize_i32(0),
516 Self::Gsutil => serializer.serialize_i32(1),
517 Self::GcsFetcher => serializer.serialize_i32(2),
518 Self::UnknownValue(u) => u.0.serialize(serializer),
519 }
520 }
521 }
522
523 impl<'de> serde::de::Deserialize<'de> for SourceFetcher {
524 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
525 where
526 D: serde::Deserializer<'de>,
527 {
528 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SourceFetcher>::new(
529 ".google.devtools.cloudbuild.v1.StorageSource.SourceFetcher",
530 ))
531 }
532 }
533}
534
535/// Location of the source in any accessible Git repository.
536#[derive(Clone, Default, PartialEq)]
537#[non_exhaustive]
538pub struct GitSource {
539 /// Required. Location of the Git repo to build.
540 ///
541 /// This will be used as a `git remote`, see
542 /// <https://git-scm.com/docs/git-remote>.
543 pub url: std::string::String,
544
545 /// Optional. Directory, relative to the source root, in which to run the
546 /// build.
547 ///
548 /// This must be a relative path. If a step's `dir` is specified and is an
549 /// absolute path, this value is ignored for that step's execution.
550 pub dir: std::string::String,
551
552 /// Optional. The revision to fetch from the Git repository such as a branch, a
553 /// tag, a commit SHA, or any Git ref.
554 ///
555 /// Cloud Build uses `git fetch` to fetch the revision from the Git
556 /// repository; therefore make sure that the string you provide for `revision`
557 /// is parsable by the command. For information on string values accepted by
558 /// `git fetch`, see
559 /// <https://git-scm.com/docs/gitrevisions#_specifying_revisions>. For
560 /// information on `git fetch`, see <https://git-scm.com/docs/git-fetch>.
561 pub revision: std::string::String,
562
563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
564}
565
566impl GitSource {
567 pub fn new() -> Self {
568 std::default::Default::default()
569 }
570
571 /// Sets the value of [url][crate::model::GitSource::url].
572 ///
573 /// # Example
574 /// ```ignore,no_run
575 /// # use google_cloud_build_v1::model::GitSource;
576 /// let x = GitSource::new().set_url("example");
577 /// ```
578 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
579 self.url = v.into();
580 self
581 }
582
583 /// Sets the value of [dir][crate::model::GitSource::dir].
584 ///
585 /// # Example
586 /// ```ignore,no_run
587 /// # use google_cloud_build_v1::model::GitSource;
588 /// let x = GitSource::new().set_dir("example");
589 /// ```
590 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
591 self.dir = v.into();
592 self
593 }
594
595 /// Sets the value of [revision][crate::model::GitSource::revision].
596 ///
597 /// # Example
598 /// ```ignore,no_run
599 /// # use google_cloud_build_v1::model::GitSource;
600 /// let x = GitSource::new().set_revision("example");
601 /// ```
602 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
603 self.revision = v.into();
604 self
605 }
606}
607
608impl wkt::message::Message for GitSource {
609 fn typename() -> &'static str {
610 "type.googleapis.com/google.devtools.cloudbuild.v1.GitSource"
611 }
612}
613
614/// Location of the source in a Google Cloud Source Repository.
615#[derive(Clone, Default, PartialEq)]
616#[non_exhaustive]
617pub struct RepoSource {
618 /// Optional. ID of the project that owns the Cloud Source Repository. If
619 /// omitted, the project ID requesting the build is assumed.
620 pub project_id: std::string::String,
621
622 /// Required. Name of the Cloud Source Repository.
623 pub repo_name: std::string::String,
624
625 /// Optional. Directory, relative to the source root, in which to run the
626 /// build.
627 ///
628 /// This must be a relative path. If a step's `dir` is specified and is an
629 /// absolute path, this value is ignored for that step's execution.
630 pub dir: std::string::String,
631
632 /// Optional. Only trigger a build if the revision regex does NOT match the
633 /// revision regex.
634 pub invert_regex: bool,
635
636 /// Optional. Substitutions to use in a triggered build.
637 /// Should only be used with RunBuildTrigger
638 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
639
640 /// A revision within the Cloud Source Repository must be specified in
641 /// one of these ways.
642 pub revision: std::option::Option<crate::model::repo_source::Revision>,
643
644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
645}
646
647impl RepoSource {
648 pub fn new() -> Self {
649 std::default::Default::default()
650 }
651
652 /// Sets the value of [project_id][crate::model::RepoSource::project_id].
653 ///
654 /// # Example
655 /// ```ignore,no_run
656 /// # use google_cloud_build_v1::model::RepoSource;
657 /// let x = RepoSource::new().set_project_id("example");
658 /// ```
659 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
660 self.project_id = v.into();
661 self
662 }
663
664 /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
665 ///
666 /// # Example
667 /// ```ignore,no_run
668 /// # use google_cloud_build_v1::model::RepoSource;
669 /// let x = RepoSource::new().set_repo_name("example");
670 /// ```
671 pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
672 self.repo_name = v.into();
673 self
674 }
675
676 /// Sets the value of [dir][crate::model::RepoSource::dir].
677 ///
678 /// # Example
679 /// ```ignore,no_run
680 /// # use google_cloud_build_v1::model::RepoSource;
681 /// let x = RepoSource::new().set_dir("example");
682 /// ```
683 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
684 self.dir = v.into();
685 self
686 }
687
688 /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
689 ///
690 /// # Example
691 /// ```ignore,no_run
692 /// # use google_cloud_build_v1::model::RepoSource;
693 /// let x = RepoSource::new().set_invert_regex(true);
694 /// ```
695 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
696 self.invert_regex = v.into();
697 self
698 }
699
700 /// Sets the value of [substitutions][crate::model::RepoSource::substitutions].
701 ///
702 /// # Example
703 /// ```ignore,no_run
704 /// # use google_cloud_build_v1::model::RepoSource;
705 /// let x = RepoSource::new().set_substitutions([
706 /// ("key0", "abc"),
707 /// ("key1", "xyz"),
708 /// ]);
709 /// ```
710 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
711 where
712 T: std::iter::IntoIterator<Item = (K, V)>,
713 K: std::convert::Into<std::string::String>,
714 V: std::convert::Into<std::string::String>,
715 {
716 use std::iter::Iterator;
717 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
718 self
719 }
720
721 /// Sets the value of [revision][crate::model::RepoSource::revision].
722 ///
723 /// Note that all the setters affecting `revision` are mutually
724 /// exclusive.
725 ///
726 /// # Example
727 /// ```ignore,no_run
728 /// # use google_cloud_build_v1::model::RepoSource;
729 /// use google_cloud_build_v1::model::repo_source::Revision;
730 /// let x = RepoSource::new().set_revision(Some(Revision::BranchName("example".to_string())));
731 /// ```
732 pub fn set_revision<
733 T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
734 >(
735 mut self,
736 v: T,
737 ) -> Self {
738 self.revision = v.into();
739 self
740 }
741
742 /// The value of [revision][crate::model::RepoSource::revision]
743 /// if it holds a `BranchName`, `None` if the field is not set or
744 /// holds a different branch.
745 pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
746 #[allow(unreachable_patterns)]
747 self.revision.as_ref().and_then(|v| match v {
748 crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
749 _ => std::option::Option::None,
750 })
751 }
752
753 /// Sets the value of [revision][crate::model::RepoSource::revision]
754 /// to hold a `BranchName`.
755 ///
756 /// Note that all the setters affecting `revision` are
757 /// mutually exclusive.
758 ///
759 /// # Example
760 /// ```ignore,no_run
761 /// # use google_cloud_build_v1::model::RepoSource;
762 /// let x = RepoSource::new().set_branch_name("example");
763 /// assert!(x.branch_name().is_some());
764 /// assert!(x.tag_name().is_none());
765 /// assert!(x.commit_sha().is_none());
766 /// ```
767 pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
768 self.revision =
769 std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
770 self
771 }
772
773 /// The value of [revision][crate::model::RepoSource::revision]
774 /// if it holds a `TagName`, `None` if the field is not set or
775 /// holds a different branch.
776 pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
777 #[allow(unreachable_patterns)]
778 self.revision.as_ref().and_then(|v| match v {
779 crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
780 _ => std::option::Option::None,
781 })
782 }
783
784 /// Sets the value of [revision][crate::model::RepoSource::revision]
785 /// to hold a `TagName`.
786 ///
787 /// Note that all the setters affecting `revision` are
788 /// mutually exclusive.
789 ///
790 /// # Example
791 /// ```ignore,no_run
792 /// # use google_cloud_build_v1::model::RepoSource;
793 /// let x = RepoSource::new().set_tag_name("example");
794 /// assert!(x.tag_name().is_some());
795 /// assert!(x.branch_name().is_none());
796 /// assert!(x.commit_sha().is_none());
797 /// ```
798 pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
799 self.revision =
800 std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
801 self
802 }
803
804 /// The value of [revision][crate::model::RepoSource::revision]
805 /// if it holds a `CommitSha`, `None` if the field is not set or
806 /// holds a different branch.
807 pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
808 #[allow(unreachable_patterns)]
809 self.revision.as_ref().and_then(|v| match v {
810 crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
811 _ => std::option::Option::None,
812 })
813 }
814
815 /// Sets the value of [revision][crate::model::RepoSource::revision]
816 /// to hold a `CommitSha`.
817 ///
818 /// Note that all the setters affecting `revision` are
819 /// mutually exclusive.
820 ///
821 /// # Example
822 /// ```ignore,no_run
823 /// # use google_cloud_build_v1::model::RepoSource;
824 /// let x = RepoSource::new().set_commit_sha("example");
825 /// assert!(x.commit_sha().is_some());
826 /// assert!(x.branch_name().is_none());
827 /// assert!(x.tag_name().is_none());
828 /// ```
829 pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
830 self.revision =
831 std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
832 self
833 }
834}
835
836impl wkt::message::Message for RepoSource {
837 fn typename() -> &'static str {
838 "type.googleapis.com/google.devtools.cloudbuild.v1.RepoSource"
839 }
840}
841
842/// Defines additional types related to [RepoSource].
843pub mod repo_source {
844 #[allow(unused_imports)]
845 use super::*;
846
847 /// A revision within the Cloud Source Repository must be specified in
848 /// one of these ways.
849 #[derive(Clone, Debug, PartialEq)]
850 #[non_exhaustive]
851 pub enum Revision {
852 /// Regex matching branches to build.
853 ///
854 /// The syntax of the regular expressions accepted is the syntax accepted by
855 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
856 BranchName(std::string::String),
857 /// Regex matching tags to build.
858 ///
859 /// The syntax of the regular expressions accepted is the syntax accepted by
860 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
861 TagName(std::string::String),
862 /// Explicit commit SHA to build.
863 CommitSha(std::string::String),
864 }
865}
866
867/// Location of the source manifest in Cloud Storage.
868/// This feature is in Preview; see description
869/// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
870#[derive(Clone, Default, PartialEq)]
871#[non_exhaustive]
872pub struct StorageSourceManifest {
873 /// Required. Cloud Storage bucket containing the source manifest (see [Bucket
874 /// Name
875 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
876 pub bucket: std::string::String,
877
878 /// Required. Cloud Storage object containing the source manifest.
879 ///
880 /// This object must be a JSON file.
881 pub object: std::string::String,
882
883 /// Cloud Storage generation for the object. If the generation is
884 /// omitted, the latest generation will be used.
885 pub generation: i64,
886
887 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
888}
889
890impl StorageSourceManifest {
891 pub fn new() -> Self {
892 std::default::Default::default()
893 }
894
895 /// Sets the value of [bucket][crate::model::StorageSourceManifest::bucket].
896 ///
897 /// # Example
898 /// ```ignore,no_run
899 /// # use google_cloud_build_v1::model::StorageSourceManifest;
900 /// let x = StorageSourceManifest::new().set_bucket("example");
901 /// ```
902 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
903 self.bucket = v.into();
904 self
905 }
906
907 /// Sets the value of [object][crate::model::StorageSourceManifest::object].
908 ///
909 /// # Example
910 /// ```ignore,no_run
911 /// # use google_cloud_build_v1::model::StorageSourceManifest;
912 /// let x = StorageSourceManifest::new().set_object("example");
913 /// ```
914 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
915 self.object = v.into();
916 self
917 }
918
919 /// Sets the value of [generation][crate::model::StorageSourceManifest::generation].
920 ///
921 /// # Example
922 /// ```ignore,no_run
923 /// # use google_cloud_build_v1::model::StorageSourceManifest;
924 /// let x = StorageSourceManifest::new().set_generation(42);
925 /// ```
926 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
927 self.generation = v.into();
928 self
929 }
930}
931
932impl wkt::message::Message for StorageSourceManifest {
933 fn typename() -> &'static str {
934 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSourceManifest"
935 }
936}
937
938/// Location of the source in a 2nd-gen Google Cloud Build repository resource.
939#[derive(Clone, Default, PartialEq)]
940#[non_exhaustive]
941pub struct ConnectedRepository {
942 /// Required. Name of the Google Cloud Build repository, formatted as
943 /// `projects/*/locations/*/connections/*/repositories/*`.
944 pub repository: std::string::String,
945
946 /// Optional. Directory, relative to the source root, in which to run the
947 /// build.
948 pub dir: std::string::String,
949
950 /// Required. The revision to fetch from the Git repository such as a branch, a
951 /// tag, a commit SHA, or any Git ref.
952 pub revision: std::string::String,
953
954 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
955}
956
957impl ConnectedRepository {
958 pub fn new() -> Self {
959 std::default::Default::default()
960 }
961
962 /// Sets the value of [repository][crate::model::ConnectedRepository::repository].
963 ///
964 /// # Example
965 /// ```ignore,no_run
966 /// # use google_cloud_build_v1::model::ConnectedRepository;
967 /// let x = ConnectedRepository::new().set_repository("example");
968 /// ```
969 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
970 self.repository = v.into();
971 self
972 }
973
974 /// Sets the value of [dir][crate::model::ConnectedRepository::dir].
975 ///
976 /// # Example
977 /// ```ignore,no_run
978 /// # use google_cloud_build_v1::model::ConnectedRepository;
979 /// let x = ConnectedRepository::new().set_dir("example");
980 /// ```
981 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
982 self.dir = v.into();
983 self
984 }
985
986 /// Sets the value of [revision][crate::model::ConnectedRepository::revision].
987 ///
988 /// # Example
989 /// ```ignore,no_run
990 /// # use google_cloud_build_v1::model::ConnectedRepository;
991 /// let x = ConnectedRepository::new().set_revision("example");
992 /// ```
993 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
994 self.revision = v.into();
995 self
996 }
997}
998
999impl wkt::message::Message for ConnectedRepository {
1000 fn typename() -> &'static str {
1001 "type.googleapis.com/google.devtools.cloudbuild.v1.ConnectedRepository"
1002 }
1003}
1004
1005/// Location of the source in a supported storage service.
1006#[derive(Clone, Default, PartialEq)]
1007#[non_exhaustive]
1008pub struct Source {
1009 /// Location of source.
1010 pub source: std::option::Option<crate::model::source::Source>,
1011
1012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1013}
1014
1015impl Source {
1016 pub fn new() -> Self {
1017 std::default::Default::default()
1018 }
1019
1020 /// Sets the value of [source][crate::model::Source::source].
1021 ///
1022 /// Note that all the setters affecting `source` are mutually
1023 /// exclusive.
1024 ///
1025 /// # Example
1026 /// ```ignore,no_run
1027 /// # use google_cloud_build_v1::model::Source;
1028 /// use google_cloud_build_v1::model::StorageSource;
1029 /// let x = Source::new().set_source(Some(
1030 /// google_cloud_build_v1::model::source::Source::StorageSource(StorageSource::default().into())));
1031 /// ```
1032 pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
1033 mut self,
1034 v: T,
1035 ) -> Self {
1036 self.source = v.into();
1037 self
1038 }
1039
1040 /// The value of [source][crate::model::Source::source]
1041 /// if it holds a `StorageSource`, `None` if the field is not set or
1042 /// holds a different branch.
1043 pub fn storage_source(
1044 &self,
1045 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
1046 #[allow(unreachable_patterns)]
1047 self.source.as_ref().and_then(|v| match v {
1048 crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
1049 _ => std::option::Option::None,
1050 })
1051 }
1052
1053 /// Sets the value of [source][crate::model::Source::source]
1054 /// to hold a `StorageSource`.
1055 ///
1056 /// Note that all the setters affecting `source` are
1057 /// mutually exclusive.
1058 ///
1059 /// # Example
1060 /// ```ignore,no_run
1061 /// # use google_cloud_build_v1::model::Source;
1062 /// use google_cloud_build_v1::model::StorageSource;
1063 /// let x = Source::new().set_storage_source(StorageSource::default()/* use setters */);
1064 /// assert!(x.storage_source().is_some());
1065 /// assert!(x.repo_source().is_none());
1066 /// assert!(x.git_source().is_none());
1067 /// assert!(x.storage_source_manifest().is_none());
1068 /// assert!(x.connected_repository().is_none());
1069 /// ```
1070 pub fn set_storage_source<
1071 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
1072 >(
1073 mut self,
1074 v: T,
1075 ) -> Self {
1076 self.source =
1077 std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
1078 self
1079 }
1080
1081 /// The value of [source][crate::model::Source::source]
1082 /// if it holds a `RepoSource`, `None` if the field is not set or
1083 /// holds a different branch.
1084 pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
1085 #[allow(unreachable_patterns)]
1086 self.source.as_ref().and_then(|v| match v {
1087 crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
1088 _ => std::option::Option::None,
1089 })
1090 }
1091
1092 /// Sets the value of [source][crate::model::Source::source]
1093 /// to hold a `RepoSource`.
1094 ///
1095 /// Note that all the setters affecting `source` are
1096 /// mutually exclusive.
1097 ///
1098 /// # Example
1099 /// ```ignore,no_run
1100 /// # use google_cloud_build_v1::model::Source;
1101 /// use google_cloud_build_v1::model::RepoSource;
1102 /// let x = Source::new().set_repo_source(RepoSource::default()/* use setters */);
1103 /// assert!(x.repo_source().is_some());
1104 /// assert!(x.storage_source().is_none());
1105 /// assert!(x.git_source().is_none());
1106 /// assert!(x.storage_source_manifest().is_none());
1107 /// assert!(x.connected_repository().is_none());
1108 /// ```
1109 pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
1110 mut self,
1111 v: T,
1112 ) -> Self {
1113 self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
1114 self
1115 }
1116
1117 /// The value of [source][crate::model::Source::source]
1118 /// if it holds a `GitSource`, `None` if the field is not set or
1119 /// holds a different branch.
1120 pub fn git_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSource>> {
1121 #[allow(unreachable_patterns)]
1122 self.source.as_ref().and_then(|v| match v {
1123 crate::model::source::Source::GitSource(v) => std::option::Option::Some(v),
1124 _ => std::option::Option::None,
1125 })
1126 }
1127
1128 /// Sets the value of [source][crate::model::Source::source]
1129 /// to hold a `GitSource`.
1130 ///
1131 /// Note that all the setters affecting `source` are
1132 /// mutually exclusive.
1133 ///
1134 /// # Example
1135 /// ```ignore,no_run
1136 /// # use google_cloud_build_v1::model::Source;
1137 /// use google_cloud_build_v1::model::GitSource;
1138 /// let x = Source::new().set_git_source(GitSource::default()/* use setters */);
1139 /// assert!(x.git_source().is_some());
1140 /// assert!(x.storage_source().is_none());
1141 /// assert!(x.repo_source().is_none());
1142 /// assert!(x.storage_source_manifest().is_none());
1143 /// assert!(x.connected_repository().is_none());
1144 /// ```
1145 pub fn set_git_source<T: std::convert::Into<std::boxed::Box<crate::model::GitSource>>>(
1146 mut self,
1147 v: T,
1148 ) -> Self {
1149 self.source = std::option::Option::Some(crate::model::source::Source::GitSource(v.into()));
1150 self
1151 }
1152
1153 /// The value of [source][crate::model::Source::source]
1154 /// if it holds a `StorageSourceManifest`, `None` if the field is not set or
1155 /// holds a different branch.
1156 pub fn storage_source_manifest(
1157 &self,
1158 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSourceManifest>> {
1159 #[allow(unreachable_patterns)]
1160 self.source.as_ref().and_then(|v| match v {
1161 crate::model::source::Source::StorageSourceManifest(v) => std::option::Option::Some(v),
1162 _ => std::option::Option::None,
1163 })
1164 }
1165
1166 /// Sets the value of [source][crate::model::Source::source]
1167 /// to hold a `StorageSourceManifest`.
1168 ///
1169 /// Note that all the setters affecting `source` are
1170 /// mutually exclusive.
1171 ///
1172 /// # Example
1173 /// ```ignore,no_run
1174 /// # use google_cloud_build_v1::model::Source;
1175 /// use google_cloud_build_v1::model::StorageSourceManifest;
1176 /// let x = Source::new().set_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
1177 /// assert!(x.storage_source_manifest().is_some());
1178 /// assert!(x.storage_source().is_none());
1179 /// assert!(x.repo_source().is_none());
1180 /// assert!(x.git_source().is_none());
1181 /// assert!(x.connected_repository().is_none());
1182 /// ```
1183 pub fn set_storage_source_manifest<
1184 T: std::convert::Into<std::boxed::Box<crate::model::StorageSourceManifest>>,
1185 >(
1186 mut self,
1187 v: T,
1188 ) -> Self {
1189 self.source = std::option::Option::Some(
1190 crate::model::source::Source::StorageSourceManifest(v.into()),
1191 );
1192 self
1193 }
1194
1195 /// The value of [source][crate::model::Source::source]
1196 /// if it holds a `ConnectedRepository`, `None` if the field is not set or
1197 /// holds a different branch.
1198 pub fn connected_repository(
1199 &self,
1200 ) -> std::option::Option<&std::boxed::Box<crate::model::ConnectedRepository>> {
1201 #[allow(unreachable_patterns)]
1202 self.source.as_ref().and_then(|v| match v {
1203 crate::model::source::Source::ConnectedRepository(v) => std::option::Option::Some(v),
1204 _ => std::option::Option::None,
1205 })
1206 }
1207
1208 /// Sets the value of [source][crate::model::Source::source]
1209 /// to hold a `ConnectedRepository`.
1210 ///
1211 /// Note that all the setters affecting `source` are
1212 /// mutually exclusive.
1213 ///
1214 /// # Example
1215 /// ```ignore,no_run
1216 /// # use google_cloud_build_v1::model::Source;
1217 /// use google_cloud_build_v1::model::ConnectedRepository;
1218 /// let x = Source::new().set_connected_repository(ConnectedRepository::default()/* use setters */);
1219 /// assert!(x.connected_repository().is_some());
1220 /// assert!(x.storage_source().is_none());
1221 /// assert!(x.repo_source().is_none());
1222 /// assert!(x.git_source().is_none());
1223 /// assert!(x.storage_source_manifest().is_none());
1224 /// ```
1225 pub fn set_connected_repository<
1226 T: std::convert::Into<std::boxed::Box<crate::model::ConnectedRepository>>,
1227 >(
1228 mut self,
1229 v: T,
1230 ) -> Self {
1231 self.source =
1232 std::option::Option::Some(crate::model::source::Source::ConnectedRepository(v.into()));
1233 self
1234 }
1235}
1236
1237impl wkt::message::Message for Source {
1238 fn typename() -> &'static str {
1239 "type.googleapis.com/google.devtools.cloudbuild.v1.Source"
1240 }
1241}
1242
1243/// Defines additional types related to [Source].
1244pub mod source {
1245 #[allow(unused_imports)]
1246 use super::*;
1247
1248 /// Location of source.
1249 #[derive(Clone, Debug, PartialEq)]
1250 #[non_exhaustive]
1251 pub enum Source {
1252 /// If provided, get the source from this location in Cloud Storage.
1253 StorageSource(std::boxed::Box<crate::model::StorageSource>),
1254 /// If provided, get the source from this location in a Cloud Source
1255 /// Repository.
1256 RepoSource(std::boxed::Box<crate::model::RepoSource>),
1257 /// If provided, get the source from this Git repository.
1258 GitSource(std::boxed::Box<crate::model::GitSource>),
1259 /// If provided, get the source from this manifest in Cloud Storage.
1260 /// This feature is in Preview; see description
1261 /// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
1262 StorageSourceManifest(std::boxed::Box<crate::model::StorageSourceManifest>),
1263 /// Optional. If provided, get the source from this 2nd-gen Google Cloud
1264 /// Build repository resource.
1265 ConnectedRepository(std::boxed::Box<crate::model::ConnectedRepository>),
1266 }
1267}
1268
1269/// An image built by the pipeline.
1270#[derive(Clone, Default, PartialEq)]
1271#[non_exhaustive]
1272pub struct BuiltImage {
1273 /// Name used to push the container image to Google Container Registry, as
1274 /// presented to `docker push`.
1275 pub name: std::string::String,
1276
1277 /// Docker Registry 2.0 digest.
1278 pub digest: std::string::String,
1279
1280 /// Output only. Stores timing information for pushing the specified image.
1281 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1282
1283 /// Output only. Path to the artifact in Artifact Registry.
1284 pub artifact_registry_package: std::string::String,
1285
1286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1287}
1288
1289impl BuiltImage {
1290 pub fn new() -> Self {
1291 std::default::Default::default()
1292 }
1293
1294 /// Sets the value of [name][crate::model::BuiltImage::name].
1295 ///
1296 /// # Example
1297 /// ```ignore,no_run
1298 /// # use google_cloud_build_v1::model::BuiltImage;
1299 /// let x = BuiltImage::new().set_name("example");
1300 /// ```
1301 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1302 self.name = v.into();
1303 self
1304 }
1305
1306 /// Sets the value of [digest][crate::model::BuiltImage::digest].
1307 ///
1308 /// # Example
1309 /// ```ignore,no_run
1310 /// # use google_cloud_build_v1::model::BuiltImage;
1311 /// let x = BuiltImage::new().set_digest("example");
1312 /// ```
1313 pub fn set_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1314 self.digest = v.into();
1315 self
1316 }
1317
1318 /// Sets the value of [push_timing][crate::model::BuiltImage::push_timing].
1319 ///
1320 /// # Example
1321 /// ```ignore,no_run
1322 /// # use google_cloud_build_v1::model::BuiltImage;
1323 /// use google_cloud_build_v1::model::TimeSpan;
1324 /// let x = BuiltImage::new().set_push_timing(TimeSpan::default()/* use setters */);
1325 /// ```
1326 pub fn set_push_timing<T>(mut self, v: T) -> Self
1327 where
1328 T: std::convert::Into<crate::model::TimeSpan>,
1329 {
1330 self.push_timing = std::option::Option::Some(v.into());
1331 self
1332 }
1333
1334 /// Sets or clears the value of [push_timing][crate::model::BuiltImage::push_timing].
1335 ///
1336 /// # Example
1337 /// ```ignore,no_run
1338 /// # use google_cloud_build_v1::model::BuiltImage;
1339 /// use google_cloud_build_v1::model::TimeSpan;
1340 /// let x = BuiltImage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1341 /// let x = BuiltImage::new().set_or_clear_push_timing(None::<TimeSpan>);
1342 /// ```
1343 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1344 where
1345 T: std::convert::Into<crate::model::TimeSpan>,
1346 {
1347 self.push_timing = v.map(|x| x.into());
1348 self
1349 }
1350
1351 /// Sets the value of [artifact_registry_package][crate::model::BuiltImage::artifact_registry_package].
1352 ///
1353 /// # Example
1354 /// ```ignore,no_run
1355 /// # use google_cloud_build_v1::model::BuiltImage;
1356 /// let x = BuiltImage::new().set_artifact_registry_package("example");
1357 /// ```
1358 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1359 mut self,
1360 v: T,
1361 ) -> Self {
1362 self.artifact_registry_package = v.into();
1363 self
1364 }
1365}
1366
1367impl wkt::message::Message for BuiltImage {
1368 fn typename() -> &'static str {
1369 "type.googleapis.com/google.devtools.cloudbuild.v1.BuiltImage"
1370 }
1371}
1372
1373/// Artifact uploaded using the PythonPackage directive.
1374#[derive(Clone, Default, PartialEq)]
1375#[non_exhaustive]
1376pub struct UploadedPythonPackage {
1377 /// URI of the uploaded artifact.
1378 pub uri: std::string::String,
1379
1380 /// Hash types and values of the Python Artifact.
1381 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1382
1383 /// Output only. Stores timing information for pushing the specified artifact.
1384 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1385
1386 /// Output only. Path to the artifact in Artifact Registry.
1387 pub artifact_registry_package: std::string::String,
1388
1389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1390}
1391
1392impl UploadedPythonPackage {
1393 pub fn new() -> Self {
1394 std::default::Default::default()
1395 }
1396
1397 /// Sets the value of [uri][crate::model::UploadedPythonPackage::uri].
1398 ///
1399 /// # Example
1400 /// ```ignore,no_run
1401 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1402 /// let x = UploadedPythonPackage::new().set_uri("example");
1403 /// ```
1404 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1405 self.uri = v.into();
1406 self
1407 }
1408
1409 /// Sets the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1410 ///
1411 /// # Example
1412 /// ```ignore,no_run
1413 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1414 /// use google_cloud_build_v1::model::FileHashes;
1415 /// let x = UploadedPythonPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1416 /// ```
1417 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1418 where
1419 T: std::convert::Into<crate::model::FileHashes>,
1420 {
1421 self.file_hashes = std::option::Option::Some(v.into());
1422 self
1423 }
1424
1425 /// Sets or clears the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1426 ///
1427 /// # Example
1428 /// ```ignore,no_run
1429 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1430 /// use google_cloud_build_v1::model::FileHashes;
1431 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1432 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1433 /// ```
1434 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1435 where
1436 T: std::convert::Into<crate::model::FileHashes>,
1437 {
1438 self.file_hashes = v.map(|x| x.into());
1439 self
1440 }
1441
1442 /// Sets the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1443 ///
1444 /// # Example
1445 /// ```ignore,no_run
1446 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1447 /// use google_cloud_build_v1::model::TimeSpan;
1448 /// let x = UploadedPythonPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1449 /// ```
1450 pub fn set_push_timing<T>(mut self, v: T) -> Self
1451 where
1452 T: std::convert::Into<crate::model::TimeSpan>,
1453 {
1454 self.push_timing = std::option::Option::Some(v.into());
1455 self
1456 }
1457
1458 /// Sets or clears the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1459 ///
1460 /// # Example
1461 /// ```ignore,no_run
1462 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1463 /// use google_cloud_build_v1::model::TimeSpan;
1464 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1465 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1466 /// ```
1467 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1468 where
1469 T: std::convert::Into<crate::model::TimeSpan>,
1470 {
1471 self.push_timing = v.map(|x| x.into());
1472 self
1473 }
1474
1475 /// Sets the value of [artifact_registry_package][crate::model::UploadedPythonPackage::artifact_registry_package].
1476 ///
1477 /// # Example
1478 /// ```ignore,no_run
1479 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1480 /// let x = UploadedPythonPackage::new().set_artifact_registry_package("example");
1481 /// ```
1482 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1483 mut self,
1484 v: T,
1485 ) -> Self {
1486 self.artifact_registry_package = v.into();
1487 self
1488 }
1489}
1490
1491impl wkt::message::Message for UploadedPythonPackage {
1492 fn typename() -> &'static str {
1493 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedPythonPackage"
1494 }
1495}
1496
1497/// A Maven artifact uploaded using the MavenArtifact directive.
1498#[derive(Clone, Default, PartialEq)]
1499#[non_exhaustive]
1500pub struct UploadedMavenArtifact {
1501 /// URI of the uploaded artifact.
1502 pub uri: std::string::String,
1503
1504 /// Hash types and values of the Maven Artifact.
1505 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1506
1507 /// Output only. Stores timing information for pushing the specified artifact.
1508 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1509
1510 /// Output only. Path to the artifact in Artifact Registry.
1511 pub artifact_registry_package: std::string::String,
1512
1513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1514}
1515
1516impl UploadedMavenArtifact {
1517 pub fn new() -> Self {
1518 std::default::Default::default()
1519 }
1520
1521 /// Sets the value of [uri][crate::model::UploadedMavenArtifact::uri].
1522 ///
1523 /// # Example
1524 /// ```ignore,no_run
1525 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1526 /// let x = UploadedMavenArtifact::new().set_uri("example");
1527 /// ```
1528 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1529 self.uri = v.into();
1530 self
1531 }
1532
1533 /// Sets the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1534 ///
1535 /// # Example
1536 /// ```ignore,no_run
1537 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1538 /// use google_cloud_build_v1::model::FileHashes;
1539 /// let x = UploadedMavenArtifact::new().set_file_hashes(FileHashes::default()/* use setters */);
1540 /// ```
1541 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1542 where
1543 T: std::convert::Into<crate::model::FileHashes>,
1544 {
1545 self.file_hashes = std::option::Option::Some(v.into());
1546 self
1547 }
1548
1549 /// Sets or clears the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1550 ///
1551 /// # Example
1552 /// ```ignore,no_run
1553 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1554 /// use google_cloud_build_v1::model::FileHashes;
1555 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1556 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(None::<FileHashes>);
1557 /// ```
1558 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1559 where
1560 T: std::convert::Into<crate::model::FileHashes>,
1561 {
1562 self.file_hashes = v.map(|x| x.into());
1563 self
1564 }
1565
1566 /// Sets the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1567 ///
1568 /// # Example
1569 /// ```ignore,no_run
1570 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1571 /// use google_cloud_build_v1::model::TimeSpan;
1572 /// let x = UploadedMavenArtifact::new().set_push_timing(TimeSpan::default()/* use setters */);
1573 /// ```
1574 pub fn set_push_timing<T>(mut self, v: T) -> Self
1575 where
1576 T: std::convert::Into<crate::model::TimeSpan>,
1577 {
1578 self.push_timing = std::option::Option::Some(v.into());
1579 self
1580 }
1581
1582 /// Sets or clears the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1583 ///
1584 /// # Example
1585 /// ```ignore,no_run
1586 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1587 /// use google_cloud_build_v1::model::TimeSpan;
1588 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1589 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(None::<TimeSpan>);
1590 /// ```
1591 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1592 where
1593 T: std::convert::Into<crate::model::TimeSpan>,
1594 {
1595 self.push_timing = v.map(|x| x.into());
1596 self
1597 }
1598
1599 /// Sets the value of [artifact_registry_package][crate::model::UploadedMavenArtifact::artifact_registry_package].
1600 ///
1601 /// # Example
1602 /// ```ignore,no_run
1603 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1604 /// let x = UploadedMavenArtifact::new().set_artifact_registry_package("example");
1605 /// ```
1606 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1607 mut self,
1608 v: T,
1609 ) -> Self {
1610 self.artifact_registry_package = v.into();
1611 self
1612 }
1613}
1614
1615impl wkt::message::Message for UploadedMavenArtifact {
1616 fn typename() -> &'static str {
1617 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedMavenArtifact"
1618 }
1619}
1620
1621/// A Go module artifact uploaded to Artifact Registry using the GoModule
1622/// directive.
1623#[derive(Clone, Default, PartialEq)]
1624#[non_exhaustive]
1625pub struct UploadedGoModule {
1626 /// URI of the uploaded artifact.
1627 pub uri: std::string::String,
1628
1629 /// Hash types and values of the Go Module Artifact.
1630 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1631
1632 /// Output only. Stores timing information for pushing the specified artifact.
1633 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1634
1635 /// Output only. Path to the artifact in Artifact Registry.
1636 pub artifact_registry_package: std::string::String,
1637
1638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1639}
1640
1641impl UploadedGoModule {
1642 pub fn new() -> Self {
1643 std::default::Default::default()
1644 }
1645
1646 /// Sets the value of [uri][crate::model::UploadedGoModule::uri].
1647 ///
1648 /// # Example
1649 /// ```ignore,no_run
1650 /// # use google_cloud_build_v1::model::UploadedGoModule;
1651 /// let x = UploadedGoModule::new().set_uri("example");
1652 /// ```
1653 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1654 self.uri = v.into();
1655 self
1656 }
1657
1658 /// Sets the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1659 ///
1660 /// # Example
1661 /// ```ignore,no_run
1662 /// # use google_cloud_build_v1::model::UploadedGoModule;
1663 /// use google_cloud_build_v1::model::FileHashes;
1664 /// let x = UploadedGoModule::new().set_file_hashes(FileHashes::default()/* use setters */);
1665 /// ```
1666 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1667 where
1668 T: std::convert::Into<crate::model::FileHashes>,
1669 {
1670 self.file_hashes = std::option::Option::Some(v.into());
1671 self
1672 }
1673
1674 /// Sets or clears the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1675 ///
1676 /// # Example
1677 /// ```ignore,no_run
1678 /// # use google_cloud_build_v1::model::UploadedGoModule;
1679 /// use google_cloud_build_v1::model::FileHashes;
1680 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1681 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(None::<FileHashes>);
1682 /// ```
1683 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1684 where
1685 T: std::convert::Into<crate::model::FileHashes>,
1686 {
1687 self.file_hashes = v.map(|x| x.into());
1688 self
1689 }
1690
1691 /// Sets the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1692 ///
1693 /// # Example
1694 /// ```ignore,no_run
1695 /// # use google_cloud_build_v1::model::UploadedGoModule;
1696 /// use google_cloud_build_v1::model::TimeSpan;
1697 /// let x = UploadedGoModule::new().set_push_timing(TimeSpan::default()/* use setters */);
1698 /// ```
1699 pub fn set_push_timing<T>(mut self, v: T) -> Self
1700 where
1701 T: std::convert::Into<crate::model::TimeSpan>,
1702 {
1703 self.push_timing = std::option::Option::Some(v.into());
1704 self
1705 }
1706
1707 /// Sets or clears the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1708 ///
1709 /// # Example
1710 /// ```ignore,no_run
1711 /// # use google_cloud_build_v1::model::UploadedGoModule;
1712 /// use google_cloud_build_v1::model::TimeSpan;
1713 /// let x = UploadedGoModule::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1714 /// let x = UploadedGoModule::new().set_or_clear_push_timing(None::<TimeSpan>);
1715 /// ```
1716 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1717 where
1718 T: std::convert::Into<crate::model::TimeSpan>,
1719 {
1720 self.push_timing = v.map(|x| x.into());
1721 self
1722 }
1723
1724 /// Sets the value of [artifact_registry_package][crate::model::UploadedGoModule::artifact_registry_package].
1725 ///
1726 /// # Example
1727 /// ```ignore,no_run
1728 /// # use google_cloud_build_v1::model::UploadedGoModule;
1729 /// let x = UploadedGoModule::new().set_artifact_registry_package("example");
1730 /// ```
1731 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1732 mut self,
1733 v: T,
1734 ) -> Self {
1735 self.artifact_registry_package = v.into();
1736 self
1737 }
1738}
1739
1740impl wkt::message::Message for UploadedGoModule {
1741 fn typename() -> &'static str {
1742 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedGoModule"
1743 }
1744}
1745
1746/// An npm package uploaded to Artifact Registry using the NpmPackage
1747/// directive.
1748#[derive(Clone, Default, PartialEq)]
1749#[non_exhaustive]
1750pub struct UploadedNpmPackage {
1751 /// URI of the uploaded npm package.
1752 pub uri: std::string::String,
1753
1754 /// Hash types and values of the npm package.
1755 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1756
1757 /// Output only. Stores timing information for pushing the specified artifact.
1758 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1759
1760 /// Output only. Path to the artifact in Artifact Registry.
1761 pub artifact_registry_package: std::string::String,
1762
1763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1764}
1765
1766impl UploadedNpmPackage {
1767 pub fn new() -> Self {
1768 std::default::Default::default()
1769 }
1770
1771 /// Sets the value of [uri][crate::model::UploadedNpmPackage::uri].
1772 ///
1773 /// # Example
1774 /// ```ignore,no_run
1775 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1776 /// let x = UploadedNpmPackage::new().set_uri("example");
1777 /// ```
1778 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1779 self.uri = v.into();
1780 self
1781 }
1782
1783 /// Sets the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1784 ///
1785 /// # Example
1786 /// ```ignore,no_run
1787 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1788 /// use google_cloud_build_v1::model::FileHashes;
1789 /// let x = UploadedNpmPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1790 /// ```
1791 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1792 where
1793 T: std::convert::Into<crate::model::FileHashes>,
1794 {
1795 self.file_hashes = std::option::Option::Some(v.into());
1796 self
1797 }
1798
1799 /// Sets or clears the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1800 ///
1801 /// # Example
1802 /// ```ignore,no_run
1803 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1804 /// use google_cloud_build_v1::model::FileHashes;
1805 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1806 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1807 /// ```
1808 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1809 where
1810 T: std::convert::Into<crate::model::FileHashes>,
1811 {
1812 self.file_hashes = v.map(|x| x.into());
1813 self
1814 }
1815
1816 /// Sets the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1817 ///
1818 /// # Example
1819 /// ```ignore,no_run
1820 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1821 /// use google_cloud_build_v1::model::TimeSpan;
1822 /// let x = UploadedNpmPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1823 /// ```
1824 pub fn set_push_timing<T>(mut self, v: T) -> Self
1825 where
1826 T: std::convert::Into<crate::model::TimeSpan>,
1827 {
1828 self.push_timing = std::option::Option::Some(v.into());
1829 self
1830 }
1831
1832 /// Sets or clears the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1833 ///
1834 /// # Example
1835 /// ```ignore,no_run
1836 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1837 /// use google_cloud_build_v1::model::TimeSpan;
1838 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1839 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1840 /// ```
1841 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1842 where
1843 T: std::convert::Into<crate::model::TimeSpan>,
1844 {
1845 self.push_timing = v.map(|x| x.into());
1846 self
1847 }
1848
1849 /// Sets the value of [artifact_registry_package][crate::model::UploadedNpmPackage::artifact_registry_package].
1850 ///
1851 /// # Example
1852 /// ```ignore,no_run
1853 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1854 /// let x = UploadedNpmPackage::new().set_artifact_registry_package("example");
1855 /// ```
1856 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1857 mut self,
1858 v: T,
1859 ) -> Self {
1860 self.artifact_registry_package = v.into();
1861 self
1862 }
1863}
1864
1865impl wkt::message::Message for UploadedNpmPackage {
1866 fn typename() -> &'static str {
1867 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedNpmPackage"
1868 }
1869}
1870
1871/// A step in the build pipeline.
1872#[derive(Clone, Default, PartialEq)]
1873#[non_exhaustive]
1874pub struct BuildStep {
1875 /// Required. The name of the container image that will run this particular
1876 /// build step.
1877 ///
1878 /// If the image is available in the host's Docker daemon's cache, it
1879 /// will be run directly. If not, the host will attempt to pull the image
1880 /// first, using the builder service account's credentials if necessary.
1881 ///
1882 /// The Docker daemon's cache will already have the latest versions of all of
1883 /// the officially supported build steps
1884 /// ([<https://github.com/GoogleCloudPlatform/cloud-builders>](https://github.com/GoogleCloudPlatform/cloud-builders)).
1885 /// The Docker daemon will also have cached many of the layers for some popular
1886 /// images, like "ubuntu", "debian", but they will be refreshed at the time you
1887 /// attempt to use them.
1888 ///
1889 /// If you built an image in a previous build step, it will be stored in the
1890 /// host's Docker daemon's cache and is available to use as the name for a
1891 /// later build step.
1892 pub name: std::string::String,
1893
1894 /// A list of environment variable definitions to be used when running a step.
1895 ///
1896 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
1897 /// being given the value "VALUE".
1898 pub env: std::vec::Vec<std::string::String>,
1899
1900 /// A list of arguments that will be presented to the step when it is started.
1901 ///
1902 /// If the image used to run the step's container has an entrypoint, the `args`
1903 /// are used as arguments to that entrypoint. If the image does not define
1904 /// an entrypoint, the first element in args is used as the entrypoint,
1905 /// and the remainder will be used as arguments.
1906 pub args: std::vec::Vec<std::string::String>,
1907
1908 /// Working directory to use when running this step's container.
1909 ///
1910 /// If this value is a relative path, it is relative to the build's working
1911 /// directory. If this value is absolute, it may be outside the build's working
1912 /// directory, in which case the contents of the path may not be persisted
1913 /// across build step executions, unless a `volume` for that path is specified.
1914 ///
1915 /// If the build specifies a `RepoSource` with `dir` and a step with a `dir`,
1916 /// which specifies an absolute path, the `RepoSource` `dir` is ignored for
1917 /// the step's execution.
1918 pub dir: std::string::String,
1919
1920 /// Unique identifier for this build step, used in `wait_for` to
1921 /// reference this build step as a dependency.
1922 pub id: std::string::String,
1923
1924 /// The ID(s) of the step(s) that this build step depends on.
1925 /// This build step will not start until all the build steps in `wait_for`
1926 /// have completed successfully. If `wait_for` is empty, this build step will
1927 /// start when all previous build steps in the `Build.Steps` list have
1928 /// completed successfully.
1929 pub wait_for: std::vec::Vec<std::string::String>,
1930
1931 /// Entrypoint to be used instead of the build step image's default entrypoint.
1932 /// If unset, the image's default entrypoint is used.
1933 pub entrypoint: std::string::String,
1934
1935 /// A list of environment variables which are encrypted using a Cloud Key
1936 /// Management Service crypto key. These values must be specified in the
1937 /// build's `Secret`.
1938 pub secret_env: std::vec::Vec<std::string::String>,
1939
1940 /// List of volumes to mount into the build step.
1941 ///
1942 /// Each volume is created as an empty volume prior to execution of the
1943 /// build step. Upon completion of the build, volumes and their contents are
1944 /// discarded.
1945 ///
1946 /// Using a named volume in only one step is not valid as it is indicative
1947 /// of a build request with an incorrect configuration.
1948 pub volumes: std::vec::Vec<crate::model::Volume>,
1949
1950 /// Output only. Stores timing information for executing this build step.
1951 pub timing: std::option::Option<crate::model::TimeSpan>,
1952
1953 /// Output only. Stores timing information for pulling this build step's
1954 /// builder image only.
1955 pub pull_timing: std::option::Option<crate::model::TimeSpan>,
1956
1957 /// Time limit for executing this build step. If not defined, the step has no
1958 /// time limit and will be allowed to continue to run until either it completes
1959 /// or the build itself times out.
1960 pub timeout: std::option::Option<wkt::Duration>,
1961
1962 /// Output only. Status of the build step. At this time, build step status is
1963 /// only updated on build completion; step status is not updated in real-time
1964 /// as the build progresses.
1965 pub status: crate::model::build::Status,
1966
1967 /// Allow this build step to fail without failing the entire build.
1968 ///
1969 /// If false, the entire build will fail if this step fails. Otherwise, the
1970 /// build will succeed, but this step will still have a failure status.
1971 /// Error information will be reported in the failure_detail field.
1972 pub allow_failure: bool,
1973
1974 /// Output only. Return code from running the step.
1975 pub exit_code: i32,
1976
1977 /// Allow this build step to fail without failing the entire build if and
1978 /// only if the exit code is one of the specified codes. If allow_failure
1979 /// is also specified, this field will take precedence.
1980 pub allow_exit_codes: std::vec::Vec<i32>,
1981
1982 /// A shell script to be executed in the step.
1983 ///
1984 /// When script is provided, the user cannot specify the entrypoint or args.
1985 pub script: std::string::String,
1986
1987 /// Option to include built-in and custom substitutions as env variables
1988 /// for this build step. This option will override the global option
1989 /// in BuildOption.
1990 pub automap_substitutions: std::option::Option<bool>,
1991
1992 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1993}
1994
1995impl BuildStep {
1996 pub fn new() -> Self {
1997 std::default::Default::default()
1998 }
1999
2000 /// Sets the value of [name][crate::model::BuildStep::name].
2001 ///
2002 /// # Example
2003 /// ```ignore,no_run
2004 /// # use google_cloud_build_v1::model::BuildStep;
2005 /// let x = BuildStep::new().set_name("example");
2006 /// ```
2007 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2008 self.name = v.into();
2009 self
2010 }
2011
2012 /// Sets the value of [env][crate::model::BuildStep::env].
2013 ///
2014 /// # Example
2015 /// ```ignore,no_run
2016 /// # use google_cloud_build_v1::model::BuildStep;
2017 /// let x = BuildStep::new().set_env(["a", "b", "c"]);
2018 /// ```
2019 pub fn set_env<T, V>(mut self, v: T) -> Self
2020 where
2021 T: std::iter::IntoIterator<Item = V>,
2022 V: std::convert::Into<std::string::String>,
2023 {
2024 use std::iter::Iterator;
2025 self.env = v.into_iter().map(|i| i.into()).collect();
2026 self
2027 }
2028
2029 /// Sets the value of [args][crate::model::BuildStep::args].
2030 ///
2031 /// # Example
2032 /// ```ignore,no_run
2033 /// # use google_cloud_build_v1::model::BuildStep;
2034 /// let x = BuildStep::new().set_args(["a", "b", "c"]);
2035 /// ```
2036 pub fn set_args<T, V>(mut self, v: T) -> Self
2037 where
2038 T: std::iter::IntoIterator<Item = V>,
2039 V: std::convert::Into<std::string::String>,
2040 {
2041 use std::iter::Iterator;
2042 self.args = v.into_iter().map(|i| i.into()).collect();
2043 self
2044 }
2045
2046 /// Sets the value of [dir][crate::model::BuildStep::dir].
2047 ///
2048 /// # Example
2049 /// ```ignore,no_run
2050 /// # use google_cloud_build_v1::model::BuildStep;
2051 /// let x = BuildStep::new().set_dir("example");
2052 /// ```
2053 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2054 self.dir = v.into();
2055 self
2056 }
2057
2058 /// Sets the value of [id][crate::model::BuildStep::id].
2059 ///
2060 /// # Example
2061 /// ```ignore,no_run
2062 /// # use google_cloud_build_v1::model::BuildStep;
2063 /// let x = BuildStep::new().set_id("example");
2064 /// ```
2065 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2066 self.id = v.into();
2067 self
2068 }
2069
2070 /// Sets the value of [wait_for][crate::model::BuildStep::wait_for].
2071 ///
2072 /// # Example
2073 /// ```ignore,no_run
2074 /// # use google_cloud_build_v1::model::BuildStep;
2075 /// let x = BuildStep::new().set_wait_for(["a", "b", "c"]);
2076 /// ```
2077 pub fn set_wait_for<T, V>(mut self, v: T) -> Self
2078 where
2079 T: std::iter::IntoIterator<Item = V>,
2080 V: std::convert::Into<std::string::String>,
2081 {
2082 use std::iter::Iterator;
2083 self.wait_for = v.into_iter().map(|i| i.into()).collect();
2084 self
2085 }
2086
2087 /// Sets the value of [entrypoint][crate::model::BuildStep::entrypoint].
2088 ///
2089 /// # Example
2090 /// ```ignore,no_run
2091 /// # use google_cloud_build_v1::model::BuildStep;
2092 /// let x = BuildStep::new().set_entrypoint("example");
2093 /// ```
2094 pub fn set_entrypoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2095 self.entrypoint = v.into();
2096 self
2097 }
2098
2099 /// Sets the value of [secret_env][crate::model::BuildStep::secret_env].
2100 ///
2101 /// # Example
2102 /// ```ignore,no_run
2103 /// # use google_cloud_build_v1::model::BuildStep;
2104 /// let x = BuildStep::new().set_secret_env(["a", "b", "c"]);
2105 /// ```
2106 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
2107 where
2108 T: std::iter::IntoIterator<Item = V>,
2109 V: std::convert::Into<std::string::String>,
2110 {
2111 use std::iter::Iterator;
2112 self.secret_env = v.into_iter().map(|i| i.into()).collect();
2113 self
2114 }
2115
2116 /// Sets the value of [volumes][crate::model::BuildStep::volumes].
2117 ///
2118 /// # Example
2119 /// ```ignore,no_run
2120 /// # use google_cloud_build_v1::model::BuildStep;
2121 /// use google_cloud_build_v1::model::Volume;
2122 /// let x = BuildStep::new()
2123 /// .set_volumes([
2124 /// Volume::default()/* use setters */,
2125 /// Volume::default()/* use (different) setters */,
2126 /// ]);
2127 /// ```
2128 pub fn set_volumes<T, V>(mut self, v: T) -> Self
2129 where
2130 T: std::iter::IntoIterator<Item = V>,
2131 V: std::convert::Into<crate::model::Volume>,
2132 {
2133 use std::iter::Iterator;
2134 self.volumes = v.into_iter().map(|i| i.into()).collect();
2135 self
2136 }
2137
2138 /// Sets the value of [timing][crate::model::BuildStep::timing].
2139 ///
2140 /// # Example
2141 /// ```ignore,no_run
2142 /// # use google_cloud_build_v1::model::BuildStep;
2143 /// use google_cloud_build_v1::model::TimeSpan;
2144 /// let x = BuildStep::new().set_timing(TimeSpan::default()/* use setters */);
2145 /// ```
2146 pub fn set_timing<T>(mut self, v: T) -> Self
2147 where
2148 T: std::convert::Into<crate::model::TimeSpan>,
2149 {
2150 self.timing = std::option::Option::Some(v.into());
2151 self
2152 }
2153
2154 /// Sets or clears the value of [timing][crate::model::BuildStep::timing].
2155 ///
2156 /// # Example
2157 /// ```ignore,no_run
2158 /// # use google_cloud_build_v1::model::BuildStep;
2159 /// use google_cloud_build_v1::model::TimeSpan;
2160 /// let x = BuildStep::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
2161 /// let x = BuildStep::new().set_or_clear_timing(None::<TimeSpan>);
2162 /// ```
2163 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
2164 where
2165 T: std::convert::Into<crate::model::TimeSpan>,
2166 {
2167 self.timing = v.map(|x| x.into());
2168 self
2169 }
2170
2171 /// Sets the value of [pull_timing][crate::model::BuildStep::pull_timing].
2172 ///
2173 /// # Example
2174 /// ```ignore,no_run
2175 /// # use google_cloud_build_v1::model::BuildStep;
2176 /// use google_cloud_build_v1::model::TimeSpan;
2177 /// let x = BuildStep::new().set_pull_timing(TimeSpan::default()/* use setters */);
2178 /// ```
2179 pub fn set_pull_timing<T>(mut self, v: T) -> Self
2180 where
2181 T: std::convert::Into<crate::model::TimeSpan>,
2182 {
2183 self.pull_timing = std::option::Option::Some(v.into());
2184 self
2185 }
2186
2187 /// Sets or clears the value of [pull_timing][crate::model::BuildStep::pull_timing].
2188 ///
2189 /// # Example
2190 /// ```ignore,no_run
2191 /// # use google_cloud_build_v1::model::BuildStep;
2192 /// use google_cloud_build_v1::model::TimeSpan;
2193 /// let x = BuildStep::new().set_or_clear_pull_timing(Some(TimeSpan::default()/* use setters */));
2194 /// let x = BuildStep::new().set_or_clear_pull_timing(None::<TimeSpan>);
2195 /// ```
2196 pub fn set_or_clear_pull_timing<T>(mut self, v: std::option::Option<T>) -> Self
2197 where
2198 T: std::convert::Into<crate::model::TimeSpan>,
2199 {
2200 self.pull_timing = v.map(|x| x.into());
2201 self
2202 }
2203
2204 /// Sets the value of [timeout][crate::model::BuildStep::timeout].
2205 ///
2206 /// # Example
2207 /// ```ignore,no_run
2208 /// # use google_cloud_build_v1::model::BuildStep;
2209 /// use wkt::Duration;
2210 /// let x = BuildStep::new().set_timeout(Duration::default()/* use setters */);
2211 /// ```
2212 pub fn set_timeout<T>(mut self, v: T) -> Self
2213 where
2214 T: std::convert::Into<wkt::Duration>,
2215 {
2216 self.timeout = std::option::Option::Some(v.into());
2217 self
2218 }
2219
2220 /// Sets or clears the value of [timeout][crate::model::BuildStep::timeout].
2221 ///
2222 /// # Example
2223 /// ```ignore,no_run
2224 /// # use google_cloud_build_v1::model::BuildStep;
2225 /// use wkt::Duration;
2226 /// let x = BuildStep::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
2227 /// let x = BuildStep::new().set_or_clear_timeout(None::<Duration>);
2228 /// ```
2229 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2230 where
2231 T: std::convert::Into<wkt::Duration>,
2232 {
2233 self.timeout = v.map(|x| x.into());
2234 self
2235 }
2236
2237 /// Sets the value of [status][crate::model::BuildStep::status].
2238 ///
2239 /// # Example
2240 /// ```ignore,no_run
2241 /// # use google_cloud_build_v1::model::BuildStep;
2242 /// use google_cloud_build_v1::model::build::Status;
2243 /// let x0 = BuildStep::new().set_status(Status::Pending);
2244 /// let x1 = BuildStep::new().set_status(Status::Queued);
2245 /// let x2 = BuildStep::new().set_status(Status::Working);
2246 /// ```
2247 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2248 self.status = v.into();
2249 self
2250 }
2251
2252 /// Sets the value of [allow_failure][crate::model::BuildStep::allow_failure].
2253 ///
2254 /// # Example
2255 /// ```ignore,no_run
2256 /// # use google_cloud_build_v1::model::BuildStep;
2257 /// let x = BuildStep::new().set_allow_failure(true);
2258 /// ```
2259 pub fn set_allow_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2260 self.allow_failure = v.into();
2261 self
2262 }
2263
2264 /// Sets the value of [exit_code][crate::model::BuildStep::exit_code].
2265 ///
2266 /// # Example
2267 /// ```ignore,no_run
2268 /// # use google_cloud_build_v1::model::BuildStep;
2269 /// let x = BuildStep::new().set_exit_code(42);
2270 /// ```
2271 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2272 self.exit_code = v.into();
2273 self
2274 }
2275
2276 /// Sets the value of [allow_exit_codes][crate::model::BuildStep::allow_exit_codes].
2277 ///
2278 /// # Example
2279 /// ```ignore,no_run
2280 /// # use google_cloud_build_v1::model::BuildStep;
2281 /// let x = BuildStep::new().set_allow_exit_codes([1, 2, 3]);
2282 /// ```
2283 pub fn set_allow_exit_codes<T, V>(mut self, v: T) -> Self
2284 where
2285 T: std::iter::IntoIterator<Item = V>,
2286 V: std::convert::Into<i32>,
2287 {
2288 use std::iter::Iterator;
2289 self.allow_exit_codes = v.into_iter().map(|i| i.into()).collect();
2290 self
2291 }
2292
2293 /// Sets the value of [script][crate::model::BuildStep::script].
2294 ///
2295 /// # Example
2296 /// ```ignore,no_run
2297 /// # use google_cloud_build_v1::model::BuildStep;
2298 /// let x = BuildStep::new().set_script("example");
2299 /// ```
2300 pub fn set_script<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2301 self.script = v.into();
2302 self
2303 }
2304
2305 /// Sets the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2306 ///
2307 /// # Example
2308 /// ```ignore,no_run
2309 /// # use google_cloud_build_v1::model::BuildStep;
2310 /// let x = BuildStep::new().set_automap_substitutions(true);
2311 /// ```
2312 pub fn set_automap_substitutions<T>(mut self, v: T) -> Self
2313 where
2314 T: std::convert::Into<bool>,
2315 {
2316 self.automap_substitutions = std::option::Option::Some(v.into());
2317 self
2318 }
2319
2320 /// Sets or clears 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_or_clear_automap_substitutions(Some(false));
2326 /// let x = BuildStep::new().set_or_clear_automap_substitutions(None::<bool>);
2327 /// ```
2328 pub fn set_or_clear_automap_substitutions<T>(mut self, v: std::option::Option<T>) -> Self
2329 where
2330 T: std::convert::Into<bool>,
2331 {
2332 self.automap_substitutions = v.map(|x| x.into());
2333 self
2334 }
2335}
2336
2337impl wkt::message::Message for BuildStep {
2338 fn typename() -> &'static str {
2339 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildStep"
2340 }
2341}
2342
2343/// Volume describes a Docker container volume which is mounted into build steps
2344/// in order to persist files across build step execution.
2345#[derive(Clone, Default, PartialEq)]
2346#[non_exhaustive]
2347pub struct Volume {
2348 /// Name of the volume to mount.
2349 ///
2350 /// Volume names must be unique per build step and must be valid names for
2351 /// Docker volumes. Each named volume must be used by at least two build steps.
2352 pub name: std::string::String,
2353
2354 /// Path at which to mount the volume.
2355 ///
2356 /// Paths must be absolute and cannot conflict with other volume paths on the
2357 /// same build step or with certain reserved volume paths.
2358 pub path: std::string::String,
2359
2360 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2361}
2362
2363impl Volume {
2364 pub fn new() -> Self {
2365 std::default::Default::default()
2366 }
2367
2368 /// Sets the value of [name][crate::model::Volume::name].
2369 ///
2370 /// # Example
2371 /// ```ignore,no_run
2372 /// # use google_cloud_build_v1::model::Volume;
2373 /// let x = Volume::new().set_name("example");
2374 /// ```
2375 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2376 self.name = v.into();
2377 self
2378 }
2379
2380 /// Sets the value of [path][crate::model::Volume::path].
2381 ///
2382 /// # Example
2383 /// ```ignore,no_run
2384 /// # use google_cloud_build_v1::model::Volume;
2385 /// let x = Volume::new().set_path("example");
2386 /// ```
2387 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2388 self.path = v.into();
2389 self
2390 }
2391}
2392
2393impl wkt::message::Message for Volume {
2394 fn typename() -> &'static str {
2395 "type.googleapis.com/google.devtools.cloudbuild.v1.Volume"
2396 }
2397}
2398
2399/// Artifacts created by the build pipeline.
2400#[derive(Clone, Default, PartialEq)]
2401#[non_exhaustive]
2402pub struct Results {
2403 /// Container images that were built as a part of the build.
2404 pub images: std::vec::Vec<crate::model::BuiltImage>,
2405
2406 /// List of build step digests, in the order corresponding to build step
2407 /// indices.
2408 pub build_step_images: std::vec::Vec<std::string::String>,
2409
2410 /// Path to the artifact manifest for non-container artifacts uploaded to Cloud
2411 /// Storage. Only populated when artifacts are uploaded to Cloud Storage.
2412 pub artifact_manifest: std::string::String,
2413
2414 /// Number of non-container artifacts uploaded to Cloud Storage. Only populated
2415 /// when artifacts are uploaded to Cloud Storage.
2416 pub num_artifacts: i64,
2417
2418 /// List of build step outputs, produced by builder images, in the order
2419 /// corresponding to build step indices.
2420 ///
2421 /// [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders)
2422 /// can produce this output by writing to `$BUILDER_OUTPUT/output`. Only the
2423 /// first 50KB of data is stored. Note that the `$BUILDER_OUTPUT` variable is
2424 /// read-only and can't be substituted.
2425 pub build_step_outputs: std::vec::Vec<::bytes::Bytes>,
2426
2427 /// Time to push all non-container artifacts to Cloud Storage.
2428 pub artifact_timing: std::option::Option<crate::model::TimeSpan>,
2429
2430 /// Python artifacts uploaded to Artifact Registry at the end of the build.
2431 pub python_packages: std::vec::Vec<crate::model::UploadedPythonPackage>,
2432
2433 /// Maven artifacts uploaded to Artifact Registry at the end of the build.
2434 pub maven_artifacts: std::vec::Vec<crate::model::UploadedMavenArtifact>,
2435
2436 /// Optional. Go module artifacts uploaded to Artifact Registry at the end of
2437 /// the build.
2438 pub go_modules: std::vec::Vec<crate::model::UploadedGoModule>,
2439
2440 /// Npm packages uploaded to Artifact Registry at the end of the build.
2441 pub npm_packages: std::vec::Vec<crate::model::UploadedNpmPackage>,
2442
2443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2444}
2445
2446impl Results {
2447 pub fn new() -> Self {
2448 std::default::Default::default()
2449 }
2450
2451 /// Sets the value of [images][crate::model::Results::images].
2452 ///
2453 /// # Example
2454 /// ```ignore,no_run
2455 /// # use google_cloud_build_v1::model::Results;
2456 /// use google_cloud_build_v1::model::BuiltImage;
2457 /// let x = Results::new()
2458 /// .set_images([
2459 /// BuiltImage::default()/* use setters */,
2460 /// BuiltImage::default()/* use (different) setters */,
2461 /// ]);
2462 /// ```
2463 pub fn set_images<T, V>(mut self, v: T) -> Self
2464 where
2465 T: std::iter::IntoIterator<Item = V>,
2466 V: std::convert::Into<crate::model::BuiltImage>,
2467 {
2468 use std::iter::Iterator;
2469 self.images = v.into_iter().map(|i| i.into()).collect();
2470 self
2471 }
2472
2473 /// Sets the value of [build_step_images][crate::model::Results::build_step_images].
2474 ///
2475 /// # Example
2476 /// ```ignore,no_run
2477 /// # use google_cloud_build_v1::model::Results;
2478 /// let x = Results::new().set_build_step_images(["a", "b", "c"]);
2479 /// ```
2480 pub fn set_build_step_images<T, V>(mut self, v: T) -> Self
2481 where
2482 T: std::iter::IntoIterator<Item = V>,
2483 V: std::convert::Into<std::string::String>,
2484 {
2485 use std::iter::Iterator;
2486 self.build_step_images = v.into_iter().map(|i| i.into()).collect();
2487 self
2488 }
2489
2490 /// Sets the value of [artifact_manifest][crate::model::Results::artifact_manifest].
2491 ///
2492 /// # Example
2493 /// ```ignore,no_run
2494 /// # use google_cloud_build_v1::model::Results;
2495 /// let x = Results::new().set_artifact_manifest("example");
2496 /// ```
2497 pub fn set_artifact_manifest<T: std::convert::Into<std::string::String>>(
2498 mut self,
2499 v: T,
2500 ) -> Self {
2501 self.artifact_manifest = v.into();
2502 self
2503 }
2504
2505 /// Sets the value of [num_artifacts][crate::model::Results::num_artifacts].
2506 ///
2507 /// # Example
2508 /// ```ignore,no_run
2509 /// # use google_cloud_build_v1::model::Results;
2510 /// let x = Results::new().set_num_artifacts(42);
2511 /// ```
2512 pub fn set_num_artifacts<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2513 self.num_artifacts = v.into();
2514 self
2515 }
2516
2517 /// Sets the value of [build_step_outputs][crate::model::Results::build_step_outputs].
2518 ///
2519 /// # Example
2520 /// ```ignore,no_run
2521 /// # use google_cloud_build_v1::model::Results;
2522 /// let b1 = bytes::Bytes::from_static(b"abc");
2523 /// let b2 = bytes::Bytes::from_static(b"xyz");
2524 /// let x = Results::new().set_build_step_outputs([b1, b2]);
2525 /// ```
2526 pub fn set_build_step_outputs<T, V>(mut self, v: T) -> Self
2527 where
2528 T: std::iter::IntoIterator<Item = V>,
2529 V: std::convert::Into<::bytes::Bytes>,
2530 {
2531 use std::iter::Iterator;
2532 self.build_step_outputs = v.into_iter().map(|i| i.into()).collect();
2533 self
2534 }
2535
2536 /// Sets the value of [artifact_timing][crate::model::Results::artifact_timing].
2537 ///
2538 /// # Example
2539 /// ```ignore,no_run
2540 /// # use google_cloud_build_v1::model::Results;
2541 /// use google_cloud_build_v1::model::TimeSpan;
2542 /// let x = Results::new().set_artifact_timing(TimeSpan::default()/* use setters */);
2543 /// ```
2544 pub fn set_artifact_timing<T>(mut self, v: T) -> Self
2545 where
2546 T: std::convert::Into<crate::model::TimeSpan>,
2547 {
2548 self.artifact_timing = std::option::Option::Some(v.into());
2549 self
2550 }
2551
2552 /// Sets or clears the value of [artifact_timing][crate::model::Results::artifact_timing].
2553 ///
2554 /// # Example
2555 /// ```ignore,no_run
2556 /// # use google_cloud_build_v1::model::Results;
2557 /// use google_cloud_build_v1::model::TimeSpan;
2558 /// let x = Results::new().set_or_clear_artifact_timing(Some(TimeSpan::default()/* use setters */));
2559 /// let x = Results::new().set_or_clear_artifact_timing(None::<TimeSpan>);
2560 /// ```
2561 pub fn set_or_clear_artifact_timing<T>(mut self, v: std::option::Option<T>) -> Self
2562 where
2563 T: std::convert::Into<crate::model::TimeSpan>,
2564 {
2565 self.artifact_timing = v.map(|x| x.into());
2566 self
2567 }
2568
2569 /// Sets the value of [python_packages][crate::model::Results::python_packages].
2570 ///
2571 /// # Example
2572 /// ```ignore,no_run
2573 /// # use google_cloud_build_v1::model::Results;
2574 /// use google_cloud_build_v1::model::UploadedPythonPackage;
2575 /// let x = Results::new()
2576 /// .set_python_packages([
2577 /// UploadedPythonPackage::default()/* use setters */,
2578 /// UploadedPythonPackage::default()/* use (different) setters */,
2579 /// ]);
2580 /// ```
2581 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
2582 where
2583 T: std::iter::IntoIterator<Item = V>,
2584 V: std::convert::Into<crate::model::UploadedPythonPackage>,
2585 {
2586 use std::iter::Iterator;
2587 self.python_packages = v.into_iter().map(|i| i.into()).collect();
2588 self
2589 }
2590
2591 /// Sets the value of [maven_artifacts][crate::model::Results::maven_artifacts].
2592 ///
2593 /// # Example
2594 /// ```ignore,no_run
2595 /// # use google_cloud_build_v1::model::Results;
2596 /// use google_cloud_build_v1::model::UploadedMavenArtifact;
2597 /// let x = Results::new()
2598 /// .set_maven_artifacts([
2599 /// UploadedMavenArtifact::default()/* use setters */,
2600 /// UploadedMavenArtifact::default()/* use (different) setters */,
2601 /// ]);
2602 /// ```
2603 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
2604 where
2605 T: std::iter::IntoIterator<Item = V>,
2606 V: std::convert::Into<crate::model::UploadedMavenArtifact>,
2607 {
2608 use std::iter::Iterator;
2609 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
2610 self
2611 }
2612
2613 /// Sets the value of [go_modules][crate::model::Results::go_modules].
2614 ///
2615 /// # Example
2616 /// ```ignore,no_run
2617 /// # use google_cloud_build_v1::model::Results;
2618 /// use google_cloud_build_v1::model::UploadedGoModule;
2619 /// let x = Results::new()
2620 /// .set_go_modules([
2621 /// UploadedGoModule::default()/* use setters */,
2622 /// UploadedGoModule::default()/* use (different) setters */,
2623 /// ]);
2624 /// ```
2625 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
2626 where
2627 T: std::iter::IntoIterator<Item = V>,
2628 V: std::convert::Into<crate::model::UploadedGoModule>,
2629 {
2630 use std::iter::Iterator;
2631 self.go_modules = v.into_iter().map(|i| i.into()).collect();
2632 self
2633 }
2634
2635 /// Sets the value of [npm_packages][crate::model::Results::npm_packages].
2636 ///
2637 /// # Example
2638 /// ```ignore,no_run
2639 /// # use google_cloud_build_v1::model::Results;
2640 /// use google_cloud_build_v1::model::UploadedNpmPackage;
2641 /// let x = Results::new()
2642 /// .set_npm_packages([
2643 /// UploadedNpmPackage::default()/* use setters */,
2644 /// UploadedNpmPackage::default()/* use (different) setters */,
2645 /// ]);
2646 /// ```
2647 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
2648 where
2649 T: std::iter::IntoIterator<Item = V>,
2650 V: std::convert::Into<crate::model::UploadedNpmPackage>,
2651 {
2652 use std::iter::Iterator;
2653 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
2654 self
2655 }
2656}
2657
2658impl wkt::message::Message for Results {
2659 fn typename() -> &'static str {
2660 "type.googleapis.com/google.devtools.cloudbuild.v1.Results"
2661 }
2662}
2663
2664/// An artifact that was uploaded during a build. This
2665/// is a single record in the artifact manifest JSON file.
2666#[derive(Clone, Default, PartialEq)]
2667#[non_exhaustive]
2668pub struct ArtifactResult {
2669 /// The path of an artifact in a Cloud Storage bucket, with the
2670 /// generation number. For example,
2671 /// `gs://mybucket/path/to/output.jar#generation`.
2672 pub location: std::string::String,
2673
2674 /// The file hash of the artifact.
2675 pub file_hash: std::vec::Vec<crate::model::FileHashes>,
2676
2677 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2678}
2679
2680impl ArtifactResult {
2681 pub fn new() -> Self {
2682 std::default::Default::default()
2683 }
2684
2685 /// Sets the value of [location][crate::model::ArtifactResult::location].
2686 ///
2687 /// # Example
2688 /// ```ignore,no_run
2689 /// # use google_cloud_build_v1::model::ArtifactResult;
2690 /// let x = ArtifactResult::new().set_location("example");
2691 /// ```
2692 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2693 self.location = v.into();
2694 self
2695 }
2696
2697 /// Sets the value of [file_hash][crate::model::ArtifactResult::file_hash].
2698 ///
2699 /// # Example
2700 /// ```ignore,no_run
2701 /// # use google_cloud_build_v1::model::ArtifactResult;
2702 /// use google_cloud_build_v1::model::FileHashes;
2703 /// let x = ArtifactResult::new()
2704 /// .set_file_hash([
2705 /// FileHashes::default()/* use setters */,
2706 /// FileHashes::default()/* use (different) setters */,
2707 /// ]);
2708 /// ```
2709 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
2710 where
2711 T: std::iter::IntoIterator<Item = V>,
2712 V: std::convert::Into<crate::model::FileHashes>,
2713 {
2714 use std::iter::Iterator;
2715 self.file_hash = v.into_iter().map(|i| i.into()).collect();
2716 self
2717 }
2718}
2719
2720impl wkt::message::Message for ArtifactResult {
2721 fn typename() -> &'static str {
2722 "type.googleapis.com/google.devtools.cloudbuild.v1.ArtifactResult"
2723 }
2724}
2725
2726/// A build resource in the Cloud Build API.
2727///
2728/// At a high level, a `Build` describes where to find source code, how to build
2729/// it (for example, the builder image to run on the source), and where to store
2730/// the built artifacts.
2731///
2732/// Fields can include the following variables, which will be expanded when the
2733/// build is created:
2734///
2735/// - $PROJECT_ID: the project ID of the build.
2736/// - $PROJECT_NUMBER: the project number of the build.
2737/// - $LOCATION: the location/region of the build.
2738/// - $BUILD_ID: the autogenerated ID of the build.
2739/// - $REPO_NAME: the source repository name specified by RepoSource.
2740/// - $BRANCH_NAME: the branch name specified by RepoSource.
2741/// - $TAG_NAME: the tag name specified by RepoSource.
2742/// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or
2743/// resolved from the specified branch or tag.
2744/// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA.
2745#[derive(Clone, Default, PartialEq)]
2746#[non_exhaustive]
2747pub struct Build {
2748 /// Output only. The 'Build' name with format:
2749 /// `projects/{project}/locations/{location}/builds/{build}`, where {build}
2750 /// is a unique identifier generated by the service.
2751 pub name: std::string::String,
2752
2753 /// Output only. Unique identifier of the build.
2754 pub id: std::string::String,
2755
2756 /// Output only. ID of the project.
2757 pub project_id: std::string::String,
2758
2759 /// Output only. Status of the build.
2760 pub status: crate::model::build::Status,
2761
2762 /// Output only. Customer-readable message about the current status.
2763 pub status_detail: std::string::String,
2764
2765 /// Optional. The location of the source files to build.
2766 pub source: std::option::Option<crate::model::Source>,
2767
2768 /// Required. The operations to be performed on the workspace.
2769 pub steps: std::vec::Vec<crate::model::BuildStep>,
2770
2771 /// Output only. Results of the build.
2772 pub results: std::option::Option<crate::model::Results>,
2773
2774 /// Output only. Time at which the request to create the build was received.
2775 pub create_time: std::option::Option<wkt::Timestamp>,
2776
2777 /// Output only. Time at which execution of the build was started.
2778 pub start_time: std::option::Option<wkt::Timestamp>,
2779
2780 /// Output only. Time at which execution of the build was finished.
2781 ///
2782 /// The difference between finish_time and start_time is the duration of the
2783 /// build's execution.
2784 pub finish_time: std::option::Option<wkt::Timestamp>,
2785
2786 /// Amount of time that this build should be allowed to run, to second
2787 /// granularity. If this amount of time elapses, work on the build will cease
2788 /// and the build status will be `TIMEOUT`.
2789 ///
2790 /// `timeout` starts ticking from `startTime`.
2791 ///
2792 /// Default time is 60 minutes.
2793 pub timeout: std::option::Option<wkt::Duration>,
2794
2795 /// A list of images to be pushed upon the successful completion of all build
2796 /// steps.
2797 ///
2798 /// The images are pushed using the builder service account's credentials.
2799 ///
2800 /// The digests of the pushed images will be stored in the `Build` resource's
2801 /// results field.
2802 ///
2803 /// If any of the images fail to be pushed, the build status is marked
2804 /// `FAILURE`.
2805 pub images: std::vec::Vec<std::string::String>,
2806
2807 /// TTL in queue for this build. If provided and the build is enqueued longer
2808 /// than this value, the build will expire and the build status will be
2809 /// `EXPIRED`.
2810 ///
2811 /// The TTL starts ticking from create_time.
2812 pub queue_ttl: std::option::Option<wkt::Duration>,
2813
2814 /// Artifacts produced by the build that should be uploaded upon
2815 /// successful completion of all build steps.
2816 pub artifacts: std::option::Option<crate::model::Artifacts>,
2817
2818 /// Cloud Storage bucket where logs should be written (see
2819 /// [Bucket Name
2820 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
2821 /// Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`.
2822 pub logs_bucket: std::string::String,
2823
2824 /// Output only. A permanent fixed identifier for source.
2825 pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
2826
2827 /// Output only. The ID of the `BuildTrigger` that triggered this build, if it
2828 /// was triggered automatically.
2829 pub build_trigger_id: std::string::String,
2830
2831 /// Special options for this build.
2832 pub options: std::option::Option<crate::model::BuildOptions>,
2833
2834 /// Output only. URL to logs for this build in Google Cloud Console.
2835 pub log_url: std::string::String,
2836
2837 /// Substitutions data for `Build` resource.
2838 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
2839
2840 /// Tags for annotation of a `Build`. These are not docker tags.
2841 pub tags: std::vec::Vec<std::string::String>,
2842
2843 /// Secrets to decrypt using Cloud Key Management Service.
2844 /// Note: Secret Manager is the recommended technique
2845 /// for managing sensitive data with Cloud Build. Use `available_secrets` to
2846 /// configure builds to access secrets from Secret Manager. For instructions,
2847 /// see: <https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets>
2848 pub secrets: std::vec::Vec<crate::model::Secret>,
2849
2850 /// Output only. Stores timing information for phases of the build. Valid keys
2851 /// are:
2852 ///
2853 /// * BUILD: time to execute all build steps.
2854 /// * PUSH: time to push all artifacts including docker images and non docker
2855 /// artifacts.
2856 /// * FETCHSOURCE: time to fetch source.
2857 /// * SETUPBUILD: time to set up build.
2858 ///
2859 /// If the build does not specify source or images,
2860 /// these keys will not be included.
2861 pub timing: std::collections::HashMap<std::string::String, crate::model::TimeSpan>,
2862
2863 /// Output only. Describes this build's approval configuration, status,
2864 /// and result.
2865 pub approval: std::option::Option<crate::model::BuildApproval>,
2866
2867 /// IAM service account whose credentials will be used at build runtime.
2868 /// Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
2869 /// ACCOUNT can be email address or uniqueId of the service account.
2870 pub service_account: std::string::String,
2871
2872 /// Secrets and secret environment variables.
2873 pub available_secrets: std::option::Option<crate::model::Secrets>,
2874
2875 /// Output only. Non-fatal problems encountered during the execution of the
2876 /// build.
2877 pub warnings: std::vec::Vec<crate::model::build::Warning>,
2878
2879 /// Optional. Configuration for git operations.
2880 pub git_config: std::option::Option<crate::model::GitConfig>,
2881
2882 /// Output only. Contains information about the build when status=FAILURE.
2883 pub failure_info: std::option::Option<crate::model::build::FailureInfo>,
2884
2885 /// Optional. Dependencies that the Cloud Build worker will fetch before
2886 /// executing user steps.
2887 pub dependencies: std::vec::Vec<crate::model::Dependency>,
2888
2889 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2890}
2891
2892impl Build {
2893 pub fn new() -> Self {
2894 std::default::Default::default()
2895 }
2896
2897 /// Sets the value of [name][crate::model::Build::name].
2898 ///
2899 /// # Example
2900 /// ```ignore,no_run
2901 /// # use google_cloud_build_v1::model::Build;
2902 /// let x = Build::new().set_name("example");
2903 /// ```
2904 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2905 self.name = v.into();
2906 self
2907 }
2908
2909 /// Sets the value of [id][crate::model::Build::id].
2910 ///
2911 /// # Example
2912 /// ```ignore,no_run
2913 /// # use google_cloud_build_v1::model::Build;
2914 /// let x = Build::new().set_id("example");
2915 /// ```
2916 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2917 self.id = v.into();
2918 self
2919 }
2920
2921 /// Sets the value of [project_id][crate::model::Build::project_id].
2922 ///
2923 /// # Example
2924 /// ```ignore,no_run
2925 /// # use google_cloud_build_v1::model::Build;
2926 /// let x = Build::new().set_project_id("example");
2927 /// ```
2928 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2929 self.project_id = v.into();
2930 self
2931 }
2932
2933 /// Sets the value of [status][crate::model::Build::status].
2934 ///
2935 /// # Example
2936 /// ```ignore,no_run
2937 /// # use google_cloud_build_v1::model::Build;
2938 /// use google_cloud_build_v1::model::build::Status;
2939 /// let x0 = Build::new().set_status(Status::Pending);
2940 /// let x1 = Build::new().set_status(Status::Queued);
2941 /// let x2 = Build::new().set_status(Status::Working);
2942 /// ```
2943 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2944 self.status = v.into();
2945 self
2946 }
2947
2948 /// Sets the value of [status_detail][crate::model::Build::status_detail].
2949 ///
2950 /// # Example
2951 /// ```ignore,no_run
2952 /// # use google_cloud_build_v1::model::Build;
2953 /// let x = Build::new().set_status_detail("example");
2954 /// ```
2955 pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2956 self.status_detail = v.into();
2957 self
2958 }
2959
2960 /// Sets the value of [source][crate::model::Build::source].
2961 ///
2962 /// # Example
2963 /// ```ignore,no_run
2964 /// # use google_cloud_build_v1::model::Build;
2965 /// use google_cloud_build_v1::model::Source;
2966 /// let x = Build::new().set_source(Source::default()/* use setters */);
2967 /// ```
2968 pub fn set_source<T>(mut self, v: T) -> Self
2969 where
2970 T: std::convert::Into<crate::model::Source>,
2971 {
2972 self.source = std::option::Option::Some(v.into());
2973 self
2974 }
2975
2976 /// Sets or clears the value of [source][crate::model::Build::source].
2977 ///
2978 /// # Example
2979 /// ```ignore,no_run
2980 /// # use google_cloud_build_v1::model::Build;
2981 /// use google_cloud_build_v1::model::Source;
2982 /// let x = Build::new().set_or_clear_source(Some(Source::default()/* use setters */));
2983 /// let x = Build::new().set_or_clear_source(None::<Source>);
2984 /// ```
2985 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
2986 where
2987 T: std::convert::Into<crate::model::Source>,
2988 {
2989 self.source = v.map(|x| x.into());
2990 self
2991 }
2992
2993 /// Sets the value of [steps][crate::model::Build::steps].
2994 ///
2995 /// # Example
2996 /// ```ignore,no_run
2997 /// # use google_cloud_build_v1::model::Build;
2998 /// use google_cloud_build_v1::model::BuildStep;
2999 /// let x = Build::new()
3000 /// .set_steps([
3001 /// BuildStep::default()/* use setters */,
3002 /// BuildStep::default()/* use (different) setters */,
3003 /// ]);
3004 /// ```
3005 pub fn set_steps<T, V>(mut self, v: T) -> Self
3006 where
3007 T: std::iter::IntoIterator<Item = V>,
3008 V: std::convert::Into<crate::model::BuildStep>,
3009 {
3010 use std::iter::Iterator;
3011 self.steps = v.into_iter().map(|i| i.into()).collect();
3012 self
3013 }
3014
3015 /// Sets the value of [results][crate::model::Build::results].
3016 ///
3017 /// # Example
3018 /// ```ignore,no_run
3019 /// # use google_cloud_build_v1::model::Build;
3020 /// use google_cloud_build_v1::model::Results;
3021 /// let x = Build::new().set_results(Results::default()/* use setters */);
3022 /// ```
3023 pub fn set_results<T>(mut self, v: T) -> Self
3024 where
3025 T: std::convert::Into<crate::model::Results>,
3026 {
3027 self.results = std::option::Option::Some(v.into());
3028 self
3029 }
3030
3031 /// Sets or clears the value of [results][crate::model::Build::results].
3032 ///
3033 /// # Example
3034 /// ```ignore,no_run
3035 /// # use google_cloud_build_v1::model::Build;
3036 /// use google_cloud_build_v1::model::Results;
3037 /// let x = Build::new().set_or_clear_results(Some(Results::default()/* use setters */));
3038 /// let x = Build::new().set_or_clear_results(None::<Results>);
3039 /// ```
3040 pub fn set_or_clear_results<T>(mut self, v: std::option::Option<T>) -> Self
3041 where
3042 T: std::convert::Into<crate::model::Results>,
3043 {
3044 self.results = v.map(|x| x.into());
3045 self
3046 }
3047
3048 /// Sets the value of [create_time][crate::model::Build::create_time].
3049 ///
3050 /// # Example
3051 /// ```ignore,no_run
3052 /// # use google_cloud_build_v1::model::Build;
3053 /// use wkt::Timestamp;
3054 /// let x = Build::new().set_create_time(Timestamp::default()/* use setters */);
3055 /// ```
3056 pub fn set_create_time<T>(mut self, v: T) -> Self
3057 where
3058 T: std::convert::Into<wkt::Timestamp>,
3059 {
3060 self.create_time = std::option::Option::Some(v.into());
3061 self
3062 }
3063
3064 /// Sets or clears the value of [create_time][crate::model::Build::create_time].
3065 ///
3066 /// # Example
3067 /// ```ignore,no_run
3068 /// # use google_cloud_build_v1::model::Build;
3069 /// use wkt::Timestamp;
3070 /// let x = Build::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3071 /// let x = Build::new().set_or_clear_create_time(None::<Timestamp>);
3072 /// ```
3073 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3074 where
3075 T: std::convert::Into<wkt::Timestamp>,
3076 {
3077 self.create_time = v.map(|x| x.into());
3078 self
3079 }
3080
3081 /// Sets the value of [start_time][crate::model::Build::start_time].
3082 ///
3083 /// # Example
3084 /// ```ignore,no_run
3085 /// # use google_cloud_build_v1::model::Build;
3086 /// use wkt::Timestamp;
3087 /// let x = Build::new().set_start_time(Timestamp::default()/* use setters */);
3088 /// ```
3089 pub fn set_start_time<T>(mut self, v: T) -> Self
3090 where
3091 T: std::convert::Into<wkt::Timestamp>,
3092 {
3093 self.start_time = std::option::Option::Some(v.into());
3094 self
3095 }
3096
3097 /// Sets or clears the value of [start_time][crate::model::Build::start_time].
3098 ///
3099 /// # Example
3100 /// ```ignore,no_run
3101 /// # use google_cloud_build_v1::model::Build;
3102 /// use wkt::Timestamp;
3103 /// let x = Build::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3104 /// let x = Build::new().set_or_clear_start_time(None::<Timestamp>);
3105 /// ```
3106 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3107 where
3108 T: std::convert::Into<wkt::Timestamp>,
3109 {
3110 self.start_time = v.map(|x| x.into());
3111 self
3112 }
3113
3114 /// Sets the value of [finish_time][crate::model::Build::finish_time].
3115 ///
3116 /// # Example
3117 /// ```ignore,no_run
3118 /// # use google_cloud_build_v1::model::Build;
3119 /// use wkt::Timestamp;
3120 /// let x = Build::new().set_finish_time(Timestamp::default()/* use setters */);
3121 /// ```
3122 pub fn set_finish_time<T>(mut self, v: T) -> Self
3123 where
3124 T: std::convert::Into<wkt::Timestamp>,
3125 {
3126 self.finish_time = std::option::Option::Some(v.into());
3127 self
3128 }
3129
3130 /// Sets or clears the value of [finish_time][crate::model::Build::finish_time].
3131 ///
3132 /// # Example
3133 /// ```ignore,no_run
3134 /// # use google_cloud_build_v1::model::Build;
3135 /// use wkt::Timestamp;
3136 /// let x = Build::new().set_or_clear_finish_time(Some(Timestamp::default()/* use setters */));
3137 /// let x = Build::new().set_or_clear_finish_time(None::<Timestamp>);
3138 /// ```
3139 pub fn set_or_clear_finish_time<T>(mut self, v: std::option::Option<T>) -> Self
3140 where
3141 T: std::convert::Into<wkt::Timestamp>,
3142 {
3143 self.finish_time = v.map(|x| x.into());
3144 self
3145 }
3146
3147 /// Sets the value of [timeout][crate::model::Build::timeout].
3148 ///
3149 /// # Example
3150 /// ```ignore,no_run
3151 /// # use google_cloud_build_v1::model::Build;
3152 /// use wkt::Duration;
3153 /// let x = Build::new().set_timeout(Duration::default()/* use setters */);
3154 /// ```
3155 pub fn set_timeout<T>(mut self, v: T) -> Self
3156 where
3157 T: std::convert::Into<wkt::Duration>,
3158 {
3159 self.timeout = std::option::Option::Some(v.into());
3160 self
3161 }
3162
3163 /// Sets or clears the value of [timeout][crate::model::Build::timeout].
3164 ///
3165 /// # Example
3166 /// ```ignore,no_run
3167 /// # use google_cloud_build_v1::model::Build;
3168 /// use wkt::Duration;
3169 /// let x = Build::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
3170 /// let x = Build::new().set_or_clear_timeout(None::<Duration>);
3171 /// ```
3172 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3173 where
3174 T: std::convert::Into<wkt::Duration>,
3175 {
3176 self.timeout = v.map(|x| x.into());
3177 self
3178 }
3179
3180 /// Sets the value of [images][crate::model::Build::images].
3181 ///
3182 /// # Example
3183 /// ```ignore,no_run
3184 /// # use google_cloud_build_v1::model::Build;
3185 /// let x = Build::new().set_images(["a", "b", "c"]);
3186 /// ```
3187 pub fn set_images<T, V>(mut self, v: T) -> Self
3188 where
3189 T: std::iter::IntoIterator<Item = V>,
3190 V: std::convert::Into<std::string::String>,
3191 {
3192 use std::iter::Iterator;
3193 self.images = v.into_iter().map(|i| i.into()).collect();
3194 self
3195 }
3196
3197 /// Sets the value of [queue_ttl][crate::model::Build::queue_ttl].
3198 ///
3199 /// # Example
3200 /// ```ignore,no_run
3201 /// # use google_cloud_build_v1::model::Build;
3202 /// use wkt::Duration;
3203 /// let x = Build::new().set_queue_ttl(Duration::default()/* use setters */);
3204 /// ```
3205 pub fn set_queue_ttl<T>(mut self, v: T) -> Self
3206 where
3207 T: std::convert::Into<wkt::Duration>,
3208 {
3209 self.queue_ttl = std::option::Option::Some(v.into());
3210 self
3211 }
3212
3213 /// Sets or clears the value of [queue_ttl][crate::model::Build::queue_ttl].
3214 ///
3215 /// # Example
3216 /// ```ignore,no_run
3217 /// # use google_cloud_build_v1::model::Build;
3218 /// use wkt::Duration;
3219 /// let x = Build::new().set_or_clear_queue_ttl(Some(Duration::default()/* use setters */));
3220 /// let x = Build::new().set_or_clear_queue_ttl(None::<Duration>);
3221 /// ```
3222 pub fn set_or_clear_queue_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3223 where
3224 T: std::convert::Into<wkt::Duration>,
3225 {
3226 self.queue_ttl = v.map(|x| x.into());
3227 self
3228 }
3229
3230 /// Sets the value of [artifacts][crate::model::Build::artifacts].
3231 ///
3232 /// # Example
3233 /// ```ignore,no_run
3234 /// # use google_cloud_build_v1::model::Build;
3235 /// use google_cloud_build_v1::model::Artifacts;
3236 /// let x = Build::new().set_artifacts(Artifacts::default()/* use setters */);
3237 /// ```
3238 pub fn set_artifacts<T>(mut self, v: T) -> Self
3239 where
3240 T: std::convert::Into<crate::model::Artifacts>,
3241 {
3242 self.artifacts = std::option::Option::Some(v.into());
3243 self
3244 }
3245
3246 /// Sets or clears the value of [artifacts][crate::model::Build::artifacts].
3247 ///
3248 /// # Example
3249 /// ```ignore,no_run
3250 /// # use google_cloud_build_v1::model::Build;
3251 /// use google_cloud_build_v1::model::Artifacts;
3252 /// let x = Build::new().set_or_clear_artifacts(Some(Artifacts::default()/* use setters */));
3253 /// let x = Build::new().set_or_clear_artifacts(None::<Artifacts>);
3254 /// ```
3255 pub fn set_or_clear_artifacts<T>(mut self, v: std::option::Option<T>) -> Self
3256 where
3257 T: std::convert::Into<crate::model::Artifacts>,
3258 {
3259 self.artifacts = v.map(|x| x.into());
3260 self
3261 }
3262
3263 /// Sets the value of [logs_bucket][crate::model::Build::logs_bucket].
3264 ///
3265 /// # Example
3266 /// ```ignore,no_run
3267 /// # use google_cloud_build_v1::model::Build;
3268 /// let x = Build::new().set_logs_bucket("example");
3269 /// ```
3270 pub fn set_logs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3271 self.logs_bucket = v.into();
3272 self
3273 }
3274
3275 /// Sets the value of [source_provenance][crate::model::Build::source_provenance].
3276 ///
3277 /// # Example
3278 /// ```ignore,no_run
3279 /// # use google_cloud_build_v1::model::Build;
3280 /// use google_cloud_build_v1::model::SourceProvenance;
3281 /// let x = Build::new().set_source_provenance(SourceProvenance::default()/* use setters */);
3282 /// ```
3283 pub fn set_source_provenance<T>(mut self, v: T) -> Self
3284 where
3285 T: std::convert::Into<crate::model::SourceProvenance>,
3286 {
3287 self.source_provenance = std::option::Option::Some(v.into());
3288 self
3289 }
3290
3291 /// Sets or clears the value of [source_provenance][crate::model::Build::source_provenance].
3292 ///
3293 /// # Example
3294 /// ```ignore,no_run
3295 /// # use google_cloud_build_v1::model::Build;
3296 /// use google_cloud_build_v1::model::SourceProvenance;
3297 /// let x = Build::new().set_or_clear_source_provenance(Some(SourceProvenance::default()/* use setters */));
3298 /// let x = Build::new().set_or_clear_source_provenance(None::<SourceProvenance>);
3299 /// ```
3300 pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3301 where
3302 T: std::convert::Into<crate::model::SourceProvenance>,
3303 {
3304 self.source_provenance = v.map(|x| x.into());
3305 self
3306 }
3307
3308 /// Sets the value of [build_trigger_id][crate::model::Build::build_trigger_id].
3309 ///
3310 /// # Example
3311 /// ```ignore,no_run
3312 /// # use google_cloud_build_v1::model::Build;
3313 /// let x = Build::new().set_build_trigger_id("example");
3314 /// ```
3315 pub fn set_build_trigger_id<T: std::convert::Into<std::string::String>>(
3316 mut self,
3317 v: T,
3318 ) -> Self {
3319 self.build_trigger_id = v.into();
3320 self
3321 }
3322
3323 /// Sets the value of [options][crate::model::Build::options].
3324 ///
3325 /// # Example
3326 /// ```ignore,no_run
3327 /// # use google_cloud_build_v1::model::Build;
3328 /// use google_cloud_build_v1::model::BuildOptions;
3329 /// let x = Build::new().set_options(BuildOptions::default()/* use setters */);
3330 /// ```
3331 pub fn set_options<T>(mut self, v: T) -> Self
3332 where
3333 T: std::convert::Into<crate::model::BuildOptions>,
3334 {
3335 self.options = std::option::Option::Some(v.into());
3336 self
3337 }
3338
3339 /// Sets or clears the value of [options][crate::model::Build::options].
3340 ///
3341 /// # Example
3342 /// ```ignore,no_run
3343 /// # use google_cloud_build_v1::model::Build;
3344 /// use google_cloud_build_v1::model::BuildOptions;
3345 /// let x = Build::new().set_or_clear_options(Some(BuildOptions::default()/* use setters */));
3346 /// let x = Build::new().set_or_clear_options(None::<BuildOptions>);
3347 /// ```
3348 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3349 where
3350 T: std::convert::Into<crate::model::BuildOptions>,
3351 {
3352 self.options = v.map(|x| x.into());
3353 self
3354 }
3355
3356 /// Sets the value of [log_url][crate::model::Build::log_url].
3357 ///
3358 /// # Example
3359 /// ```ignore,no_run
3360 /// # use google_cloud_build_v1::model::Build;
3361 /// let x = Build::new().set_log_url("example");
3362 /// ```
3363 pub fn set_log_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3364 self.log_url = v.into();
3365 self
3366 }
3367
3368 /// Sets the value of [substitutions][crate::model::Build::substitutions].
3369 ///
3370 /// # Example
3371 /// ```ignore,no_run
3372 /// # use google_cloud_build_v1::model::Build;
3373 /// let x = Build::new().set_substitutions([
3374 /// ("key0", "abc"),
3375 /// ("key1", "xyz"),
3376 /// ]);
3377 /// ```
3378 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
3379 where
3380 T: std::iter::IntoIterator<Item = (K, V)>,
3381 K: std::convert::Into<std::string::String>,
3382 V: std::convert::Into<std::string::String>,
3383 {
3384 use std::iter::Iterator;
3385 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3386 self
3387 }
3388
3389 /// Sets the value of [tags][crate::model::Build::tags].
3390 ///
3391 /// # Example
3392 /// ```ignore,no_run
3393 /// # use google_cloud_build_v1::model::Build;
3394 /// let x = Build::new().set_tags(["a", "b", "c"]);
3395 /// ```
3396 pub fn set_tags<T, V>(mut self, v: T) -> Self
3397 where
3398 T: std::iter::IntoIterator<Item = V>,
3399 V: std::convert::Into<std::string::String>,
3400 {
3401 use std::iter::Iterator;
3402 self.tags = v.into_iter().map(|i| i.into()).collect();
3403 self
3404 }
3405
3406 /// Sets the value of [secrets][crate::model::Build::secrets].
3407 ///
3408 /// # Example
3409 /// ```ignore,no_run
3410 /// # use google_cloud_build_v1::model::Build;
3411 /// use google_cloud_build_v1::model::Secret;
3412 /// let x = Build::new()
3413 /// .set_secrets([
3414 /// Secret::default()/* use setters */,
3415 /// Secret::default()/* use (different) setters */,
3416 /// ]);
3417 /// ```
3418 pub fn set_secrets<T, V>(mut self, v: T) -> Self
3419 where
3420 T: std::iter::IntoIterator<Item = V>,
3421 V: std::convert::Into<crate::model::Secret>,
3422 {
3423 use std::iter::Iterator;
3424 self.secrets = v.into_iter().map(|i| i.into()).collect();
3425 self
3426 }
3427
3428 /// Sets the value of [timing][crate::model::Build::timing].
3429 ///
3430 /// # Example
3431 /// ```ignore,no_run
3432 /// # use google_cloud_build_v1::model::Build;
3433 /// use google_cloud_build_v1::model::TimeSpan;
3434 /// let x = Build::new().set_timing([
3435 /// ("key0", TimeSpan::default()/* use setters */),
3436 /// ("key1", TimeSpan::default()/* use (different) setters */),
3437 /// ]);
3438 /// ```
3439 pub fn set_timing<T, K, V>(mut self, v: T) -> Self
3440 where
3441 T: std::iter::IntoIterator<Item = (K, V)>,
3442 K: std::convert::Into<std::string::String>,
3443 V: std::convert::Into<crate::model::TimeSpan>,
3444 {
3445 use std::iter::Iterator;
3446 self.timing = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3447 self
3448 }
3449
3450 /// Sets the value of [approval][crate::model::Build::approval].
3451 ///
3452 /// # Example
3453 /// ```ignore,no_run
3454 /// # use google_cloud_build_v1::model::Build;
3455 /// use google_cloud_build_v1::model::BuildApproval;
3456 /// let x = Build::new().set_approval(BuildApproval::default()/* use setters */);
3457 /// ```
3458 pub fn set_approval<T>(mut self, v: T) -> Self
3459 where
3460 T: std::convert::Into<crate::model::BuildApproval>,
3461 {
3462 self.approval = std::option::Option::Some(v.into());
3463 self
3464 }
3465
3466 /// Sets or clears the value of [approval][crate::model::Build::approval].
3467 ///
3468 /// # Example
3469 /// ```ignore,no_run
3470 /// # use google_cloud_build_v1::model::Build;
3471 /// use google_cloud_build_v1::model::BuildApproval;
3472 /// let x = Build::new().set_or_clear_approval(Some(BuildApproval::default()/* use setters */));
3473 /// let x = Build::new().set_or_clear_approval(None::<BuildApproval>);
3474 /// ```
3475 pub fn set_or_clear_approval<T>(mut self, v: std::option::Option<T>) -> Self
3476 where
3477 T: std::convert::Into<crate::model::BuildApproval>,
3478 {
3479 self.approval = v.map(|x| x.into());
3480 self
3481 }
3482
3483 /// Sets the value of [service_account][crate::model::Build::service_account].
3484 ///
3485 /// # Example
3486 /// ```ignore,no_run
3487 /// # use google_cloud_build_v1::model::Build;
3488 /// let x = Build::new().set_service_account("example");
3489 /// ```
3490 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3491 self.service_account = v.into();
3492 self
3493 }
3494
3495 /// Sets the value of [available_secrets][crate::model::Build::available_secrets].
3496 ///
3497 /// # Example
3498 /// ```ignore,no_run
3499 /// # use google_cloud_build_v1::model::Build;
3500 /// use google_cloud_build_v1::model::Secrets;
3501 /// let x = Build::new().set_available_secrets(Secrets::default()/* use setters */);
3502 /// ```
3503 pub fn set_available_secrets<T>(mut self, v: T) -> Self
3504 where
3505 T: std::convert::Into<crate::model::Secrets>,
3506 {
3507 self.available_secrets = std::option::Option::Some(v.into());
3508 self
3509 }
3510
3511 /// Sets or clears the value of [available_secrets][crate::model::Build::available_secrets].
3512 ///
3513 /// # Example
3514 /// ```ignore,no_run
3515 /// # use google_cloud_build_v1::model::Build;
3516 /// use google_cloud_build_v1::model::Secrets;
3517 /// let x = Build::new().set_or_clear_available_secrets(Some(Secrets::default()/* use setters */));
3518 /// let x = Build::new().set_or_clear_available_secrets(None::<Secrets>);
3519 /// ```
3520 pub fn set_or_clear_available_secrets<T>(mut self, v: std::option::Option<T>) -> Self
3521 where
3522 T: std::convert::Into<crate::model::Secrets>,
3523 {
3524 self.available_secrets = v.map(|x| x.into());
3525 self
3526 }
3527
3528 /// Sets the value of [warnings][crate::model::Build::warnings].
3529 ///
3530 /// # Example
3531 /// ```ignore,no_run
3532 /// # use google_cloud_build_v1::model::Build;
3533 /// use google_cloud_build_v1::model::build::Warning;
3534 /// let x = Build::new()
3535 /// .set_warnings([
3536 /// Warning::default()/* use setters */,
3537 /// Warning::default()/* use (different) setters */,
3538 /// ]);
3539 /// ```
3540 pub fn set_warnings<T, V>(mut self, v: T) -> Self
3541 where
3542 T: std::iter::IntoIterator<Item = V>,
3543 V: std::convert::Into<crate::model::build::Warning>,
3544 {
3545 use std::iter::Iterator;
3546 self.warnings = v.into_iter().map(|i| i.into()).collect();
3547 self
3548 }
3549
3550 /// Sets the value of [git_config][crate::model::Build::git_config].
3551 ///
3552 /// # Example
3553 /// ```ignore,no_run
3554 /// # use google_cloud_build_v1::model::Build;
3555 /// use google_cloud_build_v1::model::GitConfig;
3556 /// let x = Build::new().set_git_config(GitConfig::default()/* use setters */);
3557 /// ```
3558 pub fn set_git_config<T>(mut self, v: T) -> Self
3559 where
3560 T: std::convert::Into<crate::model::GitConfig>,
3561 {
3562 self.git_config = std::option::Option::Some(v.into());
3563 self
3564 }
3565
3566 /// Sets or clears the value of [git_config][crate::model::Build::git_config].
3567 ///
3568 /// # Example
3569 /// ```ignore,no_run
3570 /// # use google_cloud_build_v1::model::Build;
3571 /// use google_cloud_build_v1::model::GitConfig;
3572 /// let x = Build::new().set_or_clear_git_config(Some(GitConfig::default()/* use setters */));
3573 /// let x = Build::new().set_or_clear_git_config(None::<GitConfig>);
3574 /// ```
3575 pub fn set_or_clear_git_config<T>(mut self, v: std::option::Option<T>) -> Self
3576 where
3577 T: std::convert::Into<crate::model::GitConfig>,
3578 {
3579 self.git_config = v.map(|x| x.into());
3580 self
3581 }
3582
3583 /// Sets the value of [failure_info][crate::model::Build::failure_info].
3584 ///
3585 /// # Example
3586 /// ```ignore,no_run
3587 /// # use google_cloud_build_v1::model::Build;
3588 /// use google_cloud_build_v1::model::build::FailureInfo;
3589 /// let x = Build::new().set_failure_info(FailureInfo::default()/* use setters */);
3590 /// ```
3591 pub fn set_failure_info<T>(mut self, v: T) -> Self
3592 where
3593 T: std::convert::Into<crate::model::build::FailureInfo>,
3594 {
3595 self.failure_info = std::option::Option::Some(v.into());
3596 self
3597 }
3598
3599 /// Sets or clears the value of [failure_info][crate::model::Build::failure_info].
3600 ///
3601 /// # Example
3602 /// ```ignore,no_run
3603 /// # use google_cloud_build_v1::model::Build;
3604 /// use google_cloud_build_v1::model::build::FailureInfo;
3605 /// let x = Build::new().set_or_clear_failure_info(Some(FailureInfo::default()/* use setters */));
3606 /// let x = Build::new().set_or_clear_failure_info(None::<FailureInfo>);
3607 /// ```
3608 pub fn set_or_clear_failure_info<T>(mut self, v: std::option::Option<T>) -> Self
3609 where
3610 T: std::convert::Into<crate::model::build::FailureInfo>,
3611 {
3612 self.failure_info = v.map(|x| x.into());
3613 self
3614 }
3615
3616 /// Sets the value of [dependencies][crate::model::Build::dependencies].
3617 ///
3618 /// # Example
3619 /// ```ignore,no_run
3620 /// # use google_cloud_build_v1::model::Build;
3621 /// use google_cloud_build_v1::model::Dependency;
3622 /// let x = Build::new()
3623 /// .set_dependencies([
3624 /// Dependency::default()/* use setters */,
3625 /// Dependency::default()/* use (different) setters */,
3626 /// ]);
3627 /// ```
3628 pub fn set_dependencies<T, V>(mut self, v: T) -> Self
3629 where
3630 T: std::iter::IntoIterator<Item = V>,
3631 V: std::convert::Into<crate::model::Dependency>,
3632 {
3633 use std::iter::Iterator;
3634 self.dependencies = v.into_iter().map(|i| i.into()).collect();
3635 self
3636 }
3637}
3638
3639impl wkt::message::Message for Build {
3640 fn typename() -> &'static str {
3641 "type.googleapis.com/google.devtools.cloudbuild.v1.Build"
3642 }
3643}
3644
3645/// Defines additional types related to [Build].
3646pub mod build {
3647 #[allow(unused_imports)]
3648 use super::*;
3649
3650 /// A non-fatal problem encountered during the execution of the build.
3651 #[derive(Clone, Default, PartialEq)]
3652 #[non_exhaustive]
3653 pub struct Warning {
3654 /// Explanation of the warning generated.
3655 pub text: std::string::String,
3656
3657 /// The priority for this warning.
3658 pub priority: crate::model::build::warning::Priority,
3659
3660 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3661 }
3662
3663 impl Warning {
3664 pub fn new() -> Self {
3665 std::default::Default::default()
3666 }
3667
3668 /// Sets the value of [text][crate::model::build::Warning::text].
3669 ///
3670 /// # Example
3671 /// ```ignore,no_run
3672 /// # use google_cloud_build_v1::model::build::Warning;
3673 /// let x = Warning::new().set_text("example");
3674 /// ```
3675 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3676 self.text = v.into();
3677 self
3678 }
3679
3680 /// Sets the value of [priority][crate::model::build::Warning::priority].
3681 ///
3682 /// # Example
3683 /// ```ignore,no_run
3684 /// # use google_cloud_build_v1::model::build::Warning;
3685 /// use google_cloud_build_v1::model::build::warning::Priority;
3686 /// let x0 = Warning::new().set_priority(Priority::Info);
3687 /// let x1 = Warning::new().set_priority(Priority::Warning);
3688 /// let x2 = Warning::new().set_priority(Priority::Alert);
3689 /// ```
3690 pub fn set_priority<T: std::convert::Into<crate::model::build::warning::Priority>>(
3691 mut self,
3692 v: T,
3693 ) -> Self {
3694 self.priority = v.into();
3695 self
3696 }
3697 }
3698
3699 impl wkt::message::Message for Warning {
3700 fn typename() -> &'static str {
3701 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.Warning"
3702 }
3703 }
3704
3705 /// Defines additional types related to [Warning].
3706 pub mod warning {
3707 #[allow(unused_imports)]
3708 use super::*;
3709
3710 /// The relative importance of this warning.
3711 ///
3712 /// # Working with unknown values
3713 ///
3714 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3715 /// additional enum variants at any time. Adding new variants is not considered
3716 /// a breaking change. Applications should write their code in anticipation of:
3717 ///
3718 /// - New values appearing in future releases of the client library, **and**
3719 /// - New values received dynamically, without application changes.
3720 ///
3721 /// Please consult the [Working with enums] section in the user guide for some
3722 /// guidelines.
3723 ///
3724 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3725 #[derive(Clone, Debug, PartialEq)]
3726 #[non_exhaustive]
3727 pub enum Priority {
3728 /// Should not be used.
3729 Unspecified,
3730 /// e.g. deprecation warnings and alternative feature highlights.
3731 Info,
3732 /// e.g. automated detection of possible issues with the build.
3733 Warning,
3734 /// e.g. alerts that a feature used in the build is pending removal
3735 Alert,
3736 /// If set, the enum was initialized with an unknown value.
3737 ///
3738 /// Applications can examine the value using [Priority::value] or
3739 /// [Priority::name].
3740 UnknownValue(priority::UnknownValue),
3741 }
3742
3743 #[doc(hidden)]
3744 pub mod priority {
3745 #[allow(unused_imports)]
3746 use super::*;
3747 #[derive(Clone, Debug, PartialEq)]
3748 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3749 }
3750
3751 impl Priority {
3752 /// Gets the enum value.
3753 ///
3754 /// Returns `None` if the enum contains an unknown value deserialized from
3755 /// the string representation of enums.
3756 pub fn value(&self) -> std::option::Option<i32> {
3757 match self {
3758 Self::Unspecified => std::option::Option::Some(0),
3759 Self::Info => std::option::Option::Some(1),
3760 Self::Warning => std::option::Option::Some(2),
3761 Self::Alert => std::option::Option::Some(3),
3762 Self::UnknownValue(u) => u.0.value(),
3763 }
3764 }
3765
3766 /// Gets the enum value as a string.
3767 ///
3768 /// Returns `None` if the enum contains an unknown value deserialized from
3769 /// the integer representation of enums.
3770 pub fn name(&self) -> std::option::Option<&str> {
3771 match self {
3772 Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
3773 Self::Info => std::option::Option::Some("INFO"),
3774 Self::Warning => std::option::Option::Some("WARNING"),
3775 Self::Alert => std::option::Option::Some("ALERT"),
3776 Self::UnknownValue(u) => u.0.name(),
3777 }
3778 }
3779 }
3780
3781 impl std::default::Default for Priority {
3782 fn default() -> Self {
3783 use std::convert::From;
3784 Self::from(0)
3785 }
3786 }
3787
3788 impl std::fmt::Display for Priority {
3789 fn fmt(
3790 &self,
3791 f: &mut std::fmt::Formatter<'_>,
3792 ) -> std::result::Result<(), std::fmt::Error> {
3793 wkt::internal::display_enum(f, self.name(), self.value())
3794 }
3795 }
3796
3797 impl std::convert::From<i32> for Priority {
3798 fn from(value: i32) -> Self {
3799 match value {
3800 0 => Self::Unspecified,
3801 1 => Self::Info,
3802 2 => Self::Warning,
3803 3 => Self::Alert,
3804 _ => Self::UnknownValue(priority::UnknownValue(
3805 wkt::internal::UnknownEnumValue::Integer(value),
3806 )),
3807 }
3808 }
3809 }
3810
3811 impl std::convert::From<&str> for Priority {
3812 fn from(value: &str) -> Self {
3813 use std::string::ToString;
3814 match value {
3815 "PRIORITY_UNSPECIFIED" => Self::Unspecified,
3816 "INFO" => Self::Info,
3817 "WARNING" => Self::Warning,
3818 "ALERT" => Self::Alert,
3819 _ => Self::UnknownValue(priority::UnknownValue(
3820 wkt::internal::UnknownEnumValue::String(value.to_string()),
3821 )),
3822 }
3823 }
3824 }
3825
3826 impl serde::ser::Serialize for Priority {
3827 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3828 where
3829 S: serde::Serializer,
3830 {
3831 match self {
3832 Self::Unspecified => serializer.serialize_i32(0),
3833 Self::Info => serializer.serialize_i32(1),
3834 Self::Warning => serializer.serialize_i32(2),
3835 Self::Alert => serializer.serialize_i32(3),
3836 Self::UnknownValue(u) => u.0.serialize(serializer),
3837 }
3838 }
3839 }
3840
3841 impl<'de> serde::de::Deserialize<'de> for Priority {
3842 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3843 where
3844 D: serde::Deserializer<'de>,
3845 {
3846 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
3847 ".google.devtools.cloudbuild.v1.Build.Warning.Priority",
3848 ))
3849 }
3850 }
3851 }
3852
3853 /// A fatal problem encountered during the execution of the build.
3854 #[derive(Clone, Default, PartialEq)]
3855 #[non_exhaustive]
3856 pub struct FailureInfo {
3857 /// The name of the failure.
3858 pub r#type: crate::model::build::failure_info::FailureType,
3859
3860 /// Explains the failure issue in more detail using hard-coded text.
3861 pub detail: std::string::String,
3862
3863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3864 }
3865
3866 impl FailureInfo {
3867 pub fn new() -> Self {
3868 std::default::Default::default()
3869 }
3870
3871 /// Sets the value of [r#type][crate::model::build::FailureInfo::type].
3872 ///
3873 /// # Example
3874 /// ```ignore,no_run
3875 /// # use google_cloud_build_v1::model::build::FailureInfo;
3876 /// use google_cloud_build_v1::model::build::failure_info::FailureType;
3877 /// let x0 = FailureInfo::new().set_type(FailureType::PushFailed);
3878 /// let x1 = FailureInfo::new().set_type(FailureType::PushImageNotFound);
3879 /// let x2 = FailureInfo::new().set_type(FailureType::PushNotAuthorized);
3880 /// ```
3881 pub fn set_type<T: std::convert::Into<crate::model::build::failure_info::FailureType>>(
3882 mut self,
3883 v: T,
3884 ) -> Self {
3885 self.r#type = v.into();
3886 self
3887 }
3888
3889 /// Sets the value of [detail][crate::model::build::FailureInfo::detail].
3890 ///
3891 /// # Example
3892 /// ```ignore,no_run
3893 /// # use google_cloud_build_v1::model::build::FailureInfo;
3894 /// let x = FailureInfo::new().set_detail("example");
3895 /// ```
3896 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3897 self.detail = v.into();
3898 self
3899 }
3900 }
3901
3902 impl wkt::message::Message for FailureInfo {
3903 fn typename() -> &'static str {
3904 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.FailureInfo"
3905 }
3906 }
3907
3908 /// Defines additional types related to [FailureInfo].
3909 pub mod failure_info {
3910 #[allow(unused_imports)]
3911 use super::*;
3912
3913 /// The name of a fatal problem encountered during the execution of the
3914 /// build.
3915 ///
3916 /// # Working with unknown values
3917 ///
3918 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3919 /// additional enum variants at any time. Adding new variants is not considered
3920 /// a breaking change. Applications should write their code in anticipation of:
3921 ///
3922 /// - New values appearing in future releases of the client library, **and**
3923 /// - New values received dynamically, without application changes.
3924 ///
3925 /// Please consult the [Working with enums] section in the user guide for some
3926 /// guidelines.
3927 ///
3928 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3929 #[derive(Clone, Debug, PartialEq)]
3930 #[non_exhaustive]
3931 pub enum FailureType {
3932 /// Type unspecified
3933 Unspecified,
3934 /// Unable to push the image to the repository.
3935 PushFailed,
3936 /// Final image not found.
3937 PushImageNotFound,
3938 /// Unauthorized push of the final image.
3939 PushNotAuthorized,
3940 /// Backend logging failures. Should retry.
3941 LoggingFailure,
3942 /// A build step has failed.
3943 UserBuildStep,
3944 /// The source fetching has failed.
3945 FetchSourceFailed,
3946 /// If set, the enum was initialized with an unknown value.
3947 ///
3948 /// Applications can examine the value using [FailureType::value] or
3949 /// [FailureType::name].
3950 UnknownValue(failure_type::UnknownValue),
3951 }
3952
3953 #[doc(hidden)]
3954 pub mod failure_type {
3955 #[allow(unused_imports)]
3956 use super::*;
3957 #[derive(Clone, Debug, PartialEq)]
3958 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3959 }
3960
3961 impl FailureType {
3962 /// Gets the enum value.
3963 ///
3964 /// Returns `None` if the enum contains an unknown value deserialized from
3965 /// the string representation of enums.
3966 pub fn value(&self) -> std::option::Option<i32> {
3967 match self {
3968 Self::Unspecified => std::option::Option::Some(0),
3969 Self::PushFailed => std::option::Option::Some(1),
3970 Self::PushImageNotFound => std::option::Option::Some(2),
3971 Self::PushNotAuthorized => std::option::Option::Some(3),
3972 Self::LoggingFailure => std::option::Option::Some(4),
3973 Self::UserBuildStep => std::option::Option::Some(5),
3974 Self::FetchSourceFailed => std::option::Option::Some(6),
3975 Self::UnknownValue(u) => u.0.value(),
3976 }
3977 }
3978
3979 /// Gets the enum value as a string.
3980 ///
3981 /// Returns `None` if the enum contains an unknown value deserialized from
3982 /// the integer representation of enums.
3983 pub fn name(&self) -> std::option::Option<&str> {
3984 match self {
3985 Self::Unspecified => std::option::Option::Some("FAILURE_TYPE_UNSPECIFIED"),
3986 Self::PushFailed => std::option::Option::Some("PUSH_FAILED"),
3987 Self::PushImageNotFound => std::option::Option::Some("PUSH_IMAGE_NOT_FOUND"),
3988 Self::PushNotAuthorized => std::option::Option::Some("PUSH_NOT_AUTHORIZED"),
3989 Self::LoggingFailure => std::option::Option::Some("LOGGING_FAILURE"),
3990 Self::UserBuildStep => std::option::Option::Some("USER_BUILD_STEP"),
3991 Self::FetchSourceFailed => std::option::Option::Some("FETCH_SOURCE_FAILED"),
3992 Self::UnknownValue(u) => u.0.name(),
3993 }
3994 }
3995 }
3996
3997 impl std::default::Default for FailureType {
3998 fn default() -> Self {
3999 use std::convert::From;
4000 Self::from(0)
4001 }
4002 }
4003
4004 impl std::fmt::Display for FailureType {
4005 fn fmt(
4006 &self,
4007 f: &mut std::fmt::Formatter<'_>,
4008 ) -> std::result::Result<(), std::fmt::Error> {
4009 wkt::internal::display_enum(f, self.name(), self.value())
4010 }
4011 }
4012
4013 impl std::convert::From<i32> for FailureType {
4014 fn from(value: i32) -> Self {
4015 match value {
4016 0 => Self::Unspecified,
4017 1 => Self::PushFailed,
4018 2 => Self::PushImageNotFound,
4019 3 => Self::PushNotAuthorized,
4020 4 => Self::LoggingFailure,
4021 5 => Self::UserBuildStep,
4022 6 => Self::FetchSourceFailed,
4023 _ => Self::UnknownValue(failure_type::UnknownValue(
4024 wkt::internal::UnknownEnumValue::Integer(value),
4025 )),
4026 }
4027 }
4028 }
4029
4030 impl std::convert::From<&str> for FailureType {
4031 fn from(value: &str) -> Self {
4032 use std::string::ToString;
4033 match value {
4034 "FAILURE_TYPE_UNSPECIFIED" => Self::Unspecified,
4035 "PUSH_FAILED" => Self::PushFailed,
4036 "PUSH_IMAGE_NOT_FOUND" => Self::PushImageNotFound,
4037 "PUSH_NOT_AUTHORIZED" => Self::PushNotAuthorized,
4038 "LOGGING_FAILURE" => Self::LoggingFailure,
4039 "USER_BUILD_STEP" => Self::UserBuildStep,
4040 "FETCH_SOURCE_FAILED" => Self::FetchSourceFailed,
4041 _ => Self::UnknownValue(failure_type::UnknownValue(
4042 wkt::internal::UnknownEnumValue::String(value.to_string()),
4043 )),
4044 }
4045 }
4046 }
4047
4048 impl serde::ser::Serialize for FailureType {
4049 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4050 where
4051 S: serde::Serializer,
4052 {
4053 match self {
4054 Self::Unspecified => serializer.serialize_i32(0),
4055 Self::PushFailed => serializer.serialize_i32(1),
4056 Self::PushImageNotFound => serializer.serialize_i32(2),
4057 Self::PushNotAuthorized => serializer.serialize_i32(3),
4058 Self::LoggingFailure => serializer.serialize_i32(4),
4059 Self::UserBuildStep => serializer.serialize_i32(5),
4060 Self::FetchSourceFailed => serializer.serialize_i32(6),
4061 Self::UnknownValue(u) => u.0.serialize(serializer),
4062 }
4063 }
4064 }
4065
4066 impl<'de> serde::de::Deserialize<'de> for FailureType {
4067 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4068 where
4069 D: serde::Deserializer<'de>,
4070 {
4071 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureType>::new(
4072 ".google.devtools.cloudbuild.v1.Build.FailureInfo.FailureType",
4073 ))
4074 }
4075 }
4076 }
4077
4078 /// Possible status of a build or build step.
4079 ///
4080 /// # Working with unknown values
4081 ///
4082 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4083 /// additional enum variants at any time. Adding new variants is not considered
4084 /// a breaking change. Applications should write their code in anticipation of:
4085 ///
4086 /// - New values appearing in future releases of the client library, **and**
4087 /// - New values received dynamically, without application changes.
4088 ///
4089 /// Please consult the [Working with enums] section in the user guide for some
4090 /// guidelines.
4091 ///
4092 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4093 #[derive(Clone, Debug, PartialEq)]
4094 #[non_exhaustive]
4095 pub enum Status {
4096 /// Status of the build is unknown.
4097 Unknown,
4098 /// Build has been created and is pending execution and queuing. It has not
4099 /// been queued.
4100 Pending,
4101 /// Build or step is queued; work has not yet begun.
4102 Queued,
4103 /// Build or step is being executed.
4104 Working,
4105 /// Build or step finished successfully.
4106 Success,
4107 /// Build or step failed to complete successfully.
4108 Failure,
4109 /// Build or step failed due to an internal cause.
4110 InternalError,
4111 /// Build or step took longer than was allowed.
4112 Timeout,
4113 /// Build or step was canceled by a user.
4114 Cancelled,
4115 /// Build was enqueued for longer than the value of `queue_ttl`.
4116 Expired,
4117 /// If set, the enum was initialized with an unknown value.
4118 ///
4119 /// Applications can examine the value using [Status::value] or
4120 /// [Status::name].
4121 UnknownValue(status::UnknownValue),
4122 }
4123
4124 #[doc(hidden)]
4125 pub mod status {
4126 #[allow(unused_imports)]
4127 use super::*;
4128 #[derive(Clone, Debug, PartialEq)]
4129 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4130 }
4131
4132 impl Status {
4133 /// Gets the enum value.
4134 ///
4135 /// Returns `None` if the enum contains an unknown value deserialized from
4136 /// the string representation of enums.
4137 pub fn value(&self) -> std::option::Option<i32> {
4138 match self {
4139 Self::Unknown => std::option::Option::Some(0),
4140 Self::Pending => std::option::Option::Some(10),
4141 Self::Queued => std::option::Option::Some(1),
4142 Self::Working => std::option::Option::Some(2),
4143 Self::Success => std::option::Option::Some(3),
4144 Self::Failure => std::option::Option::Some(4),
4145 Self::InternalError => std::option::Option::Some(5),
4146 Self::Timeout => std::option::Option::Some(6),
4147 Self::Cancelled => std::option::Option::Some(7),
4148 Self::Expired => std::option::Option::Some(9),
4149 Self::UnknownValue(u) => u.0.value(),
4150 }
4151 }
4152
4153 /// Gets the enum value as a string.
4154 ///
4155 /// Returns `None` if the enum contains an unknown value deserialized from
4156 /// the integer representation of enums.
4157 pub fn name(&self) -> std::option::Option<&str> {
4158 match self {
4159 Self::Unknown => std::option::Option::Some("STATUS_UNKNOWN"),
4160 Self::Pending => std::option::Option::Some("PENDING"),
4161 Self::Queued => std::option::Option::Some("QUEUED"),
4162 Self::Working => std::option::Option::Some("WORKING"),
4163 Self::Success => std::option::Option::Some("SUCCESS"),
4164 Self::Failure => std::option::Option::Some("FAILURE"),
4165 Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
4166 Self::Timeout => std::option::Option::Some("TIMEOUT"),
4167 Self::Cancelled => std::option::Option::Some("CANCELLED"),
4168 Self::Expired => std::option::Option::Some("EXPIRED"),
4169 Self::UnknownValue(u) => u.0.name(),
4170 }
4171 }
4172 }
4173
4174 impl std::default::Default for Status {
4175 fn default() -> Self {
4176 use std::convert::From;
4177 Self::from(0)
4178 }
4179 }
4180
4181 impl std::fmt::Display for Status {
4182 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4183 wkt::internal::display_enum(f, self.name(), self.value())
4184 }
4185 }
4186
4187 impl std::convert::From<i32> for Status {
4188 fn from(value: i32) -> Self {
4189 match value {
4190 0 => Self::Unknown,
4191 1 => Self::Queued,
4192 2 => Self::Working,
4193 3 => Self::Success,
4194 4 => Self::Failure,
4195 5 => Self::InternalError,
4196 6 => Self::Timeout,
4197 7 => Self::Cancelled,
4198 9 => Self::Expired,
4199 10 => Self::Pending,
4200 _ => Self::UnknownValue(status::UnknownValue(
4201 wkt::internal::UnknownEnumValue::Integer(value),
4202 )),
4203 }
4204 }
4205 }
4206
4207 impl std::convert::From<&str> for Status {
4208 fn from(value: &str) -> Self {
4209 use std::string::ToString;
4210 match value {
4211 "STATUS_UNKNOWN" => Self::Unknown,
4212 "PENDING" => Self::Pending,
4213 "QUEUED" => Self::Queued,
4214 "WORKING" => Self::Working,
4215 "SUCCESS" => Self::Success,
4216 "FAILURE" => Self::Failure,
4217 "INTERNAL_ERROR" => Self::InternalError,
4218 "TIMEOUT" => Self::Timeout,
4219 "CANCELLED" => Self::Cancelled,
4220 "EXPIRED" => Self::Expired,
4221 _ => Self::UnknownValue(status::UnknownValue(
4222 wkt::internal::UnknownEnumValue::String(value.to_string()),
4223 )),
4224 }
4225 }
4226 }
4227
4228 impl serde::ser::Serialize for Status {
4229 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4230 where
4231 S: serde::Serializer,
4232 {
4233 match self {
4234 Self::Unknown => serializer.serialize_i32(0),
4235 Self::Pending => serializer.serialize_i32(10),
4236 Self::Queued => serializer.serialize_i32(1),
4237 Self::Working => serializer.serialize_i32(2),
4238 Self::Success => serializer.serialize_i32(3),
4239 Self::Failure => serializer.serialize_i32(4),
4240 Self::InternalError => serializer.serialize_i32(5),
4241 Self::Timeout => serializer.serialize_i32(6),
4242 Self::Cancelled => serializer.serialize_i32(7),
4243 Self::Expired => serializer.serialize_i32(9),
4244 Self::UnknownValue(u) => u.0.serialize(serializer),
4245 }
4246 }
4247 }
4248
4249 impl<'de> serde::de::Deserialize<'de> for Status {
4250 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4251 where
4252 D: serde::Deserializer<'de>,
4253 {
4254 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
4255 ".google.devtools.cloudbuild.v1.Build.Status",
4256 ))
4257 }
4258 }
4259}
4260
4261/// A dependency that the Cloud Build worker will fetch before executing user
4262/// steps.
4263#[derive(Clone, Default, PartialEq)]
4264#[non_exhaustive]
4265pub struct Dependency {
4266 /// The type of dependency to fetch.
4267 pub dep: std::option::Option<crate::model::dependency::Dep>,
4268
4269 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4270}
4271
4272impl Dependency {
4273 pub fn new() -> Self {
4274 std::default::Default::default()
4275 }
4276
4277 /// Sets the value of [dep][crate::model::Dependency::dep].
4278 ///
4279 /// Note that all the setters affecting `dep` are mutually
4280 /// exclusive.
4281 ///
4282 /// # Example
4283 /// ```ignore,no_run
4284 /// # use google_cloud_build_v1::model::Dependency;
4285 /// use google_cloud_build_v1::model::dependency::Dep;
4286 /// let x = Dependency::new().set_dep(Some(Dep::Empty(true)));
4287 /// ```
4288 pub fn set_dep<T: std::convert::Into<std::option::Option<crate::model::dependency::Dep>>>(
4289 mut self,
4290 v: T,
4291 ) -> Self {
4292 self.dep = v.into();
4293 self
4294 }
4295
4296 /// The value of [dep][crate::model::Dependency::dep]
4297 /// if it holds a `Empty`, `None` if the field is not set or
4298 /// holds a different branch.
4299 pub fn empty(&self) -> std::option::Option<&bool> {
4300 #[allow(unreachable_patterns)]
4301 self.dep.as_ref().and_then(|v| match v {
4302 crate::model::dependency::Dep::Empty(v) => std::option::Option::Some(v),
4303 _ => std::option::Option::None,
4304 })
4305 }
4306
4307 /// Sets the value of [dep][crate::model::Dependency::dep]
4308 /// to hold a `Empty`.
4309 ///
4310 /// Note that all the setters affecting `dep` are
4311 /// mutually exclusive.
4312 ///
4313 /// # Example
4314 /// ```ignore,no_run
4315 /// # use google_cloud_build_v1::model::Dependency;
4316 /// let x = Dependency::new().set_empty(true);
4317 /// assert!(x.empty().is_some());
4318 /// assert!(x.git_source().is_none());
4319 /// ```
4320 pub fn set_empty<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4321 self.dep = std::option::Option::Some(crate::model::dependency::Dep::Empty(v.into()));
4322 self
4323 }
4324
4325 /// The value of [dep][crate::model::Dependency::dep]
4326 /// if it holds a `GitSource`, `None` if the field is not set or
4327 /// holds a different branch.
4328 pub fn git_source(
4329 &self,
4330 ) -> std::option::Option<&std::boxed::Box<crate::model::dependency::GitSourceDependency>> {
4331 #[allow(unreachable_patterns)]
4332 self.dep.as_ref().and_then(|v| match v {
4333 crate::model::dependency::Dep::GitSource(v) => std::option::Option::Some(v),
4334 _ => std::option::Option::None,
4335 })
4336 }
4337
4338 /// Sets the value of [dep][crate::model::Dependency::dep]
4339 /// to hold a `GitSource`.
4340 ///
4341 /// Note that all the setters affecting `dep` are
4342 /// mutually exclusive.
4343 ///
4344 /// # Example
4345 /// ```ignore,no_run
4346 /// # use google_cloud_build_v1::model::Dependency;
4347 /// use google_cloud_build_v1::model::dependency::GitSourceDependency;
4348 /// let x = Dependency::new().set_git_source(GitSourceDependency::default()/* use setters */);
4349 /// assert!(x.git_source().is_some());
4350 /// assert!(x.empty().is_none());
4351 /// ```
4352 pub fn set_git_source<
4353 T: std::convert::Into<std::boxed::Box<crate::model::dependency::GitSourceDependency>>,
4354 >(
4355 mut self,
4356 v: T,
4357 ) -> Self {
4358 self.dep = std::option::Option::Some(crate::model::dependency::Dep::GitSource(v.into()));
4359 self
4360 }
4361}
4362
4363impl wkt::message::Message for Dependency {
4364 fn typename() -> &'static str {
4365 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency"
4366 }
4367}
4368
4369/// Defines additional types related to [Dependency].
4370pub mod dependency {
4371 #[allow(unused_imports)]
4372 use super::*;
4373
4374 /// Represents a git repository as a build dependency.
4375 #[derive(Clone, Default, PartialEq)]
4376 #[non_exhaustive]
4377 pub struct GitSourceDependency {
4378 /// Required. The kind of repo (url or dev connect).
4379 pub repository: std::option::Option<crate::model::dependency::GitSourceRepository>,
4380
4381 /// Required. The revision that we will fetch the repo at.
4382 pub revision: std::string::String,
4383
4384 /// Optional. True if submodules should be fetched too (default false).
4385 pub recurse_submodules: bool,
4386
4387 /// Optional. How much history should be fetched for the build (default 1, -1
4388 /// for all history).
4389 pub depth: i64,
4390
4391 /// Required. Where should the files be placed on the worker.
4392 pub dest_path: std::string::String,
4393
4394 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4395 }
4396
4397 impl GitSourceDependency {
4398 pub fn new() -> Self {
4399 std::default::Default::default()
4400 }
4401
4402 /// Sets the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4403 ///
4404 /// # Example
4405 /// ```ignore,no_run
4406 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4407 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4408 /// let x = GitSourceDependency::new().set_repository(GitSourceRepository::default()/* use setters */);
4409 /// ```
4410 pub fn set_repository<T>(mut self, v: T) -> Self
4411 where
4412 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4413 {
4414 self.repository = std::option::Option::Some(v.into());
4415 self
4416 }
4417
4418 /// Sets or clears the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4419 ///
4420 /// # Example
4421 /// ```ignore,no_run
4422 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4423 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4424 /// let x = GitSourceDependency::new().set_or_clear_repository(Some(GitSourceRepository::default()/* use setters */));
4425 /// let x = GitSourceDependency::new().set_or_clear_repository(None::<GitSourceRepository>);
4426 /// ```
4427 pub fn set_or_clear_repository<T>(mut self, v: std::option::Option<T>) -> Self
4428 where
4429 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4430 {
4431 self.repository = v.map(|x| x.into());
4432 self
4433 }
4434
4435 /// Sets the value of [revision][crate::model::dependency::GitSourceDependency::revision].
4436 ///
4437 /// # Example
4438 /// ```ignore,no_run
4439 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4440 /// let x = GitSourceDependency::new().set_revision("example");
4441 /// ```
4442 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4443 self.revision = v.into();
4444 self
4445 }
4446
4447 /// Sets the value of [recurse_submodules][crate::model::dependency::GitSourceDependency::recurse_submodules].
4448 ///
4449 /// # Example
4450 /// ```ignore,no_run
4451 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4452 /// let x = GitSourceDependency::new().set_recurse_submodules(true);
4453 /// ```
4454 pub fn set_recurse_submodules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4455 self.recurse_submodules = v.into();
4456 self
4457 }
4458
4459 /// Sets the value of [depth][crate::model::dependency::GitSourceDependency::depth].
4460 ///
4461 /// # Example
4462 /// ```ignore,no_run
4463 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4464 /// let x = GitSourceDependency::new().set_depth(42);
4465 /// ```
4466 pub fn set_depth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4467 self.depth = v.into();
4468 self
4469 }
4470
4471 /// Sets the value of [dest_path][crate::model::dependency::GitSourceDependency::dest_path].
4472 ///
4473 /// # Example
4474 /// ```ignore,no_run
4475 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4476 /// let x = GitSourceDependency::new().set_dest_path("example");
4477 /// ```
4478 pub fn set_dest_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4479 self.dest_path = v.into();
4480 self
4481 }
4482 }
4483
4484 impl wkt::message::Message for GitSourceDependency {
4485 fn typename() -> &'static str {
4486 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceDependency"
4487 }
4488 }
4489
4490 /// A repository for a git source.
4491 #[derive(Clone, Default, PartialEq)]
4492 #[non_exhaustive]
4493 pub struct GitSourceRepository {
4494 /// The type of git source repo (url or dev connect).
4495 pub repotype:
4496 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4497
4498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4499 }
4500
4501 impl GitSourceRepository {
4502 pub fn new() -> Self {
4503 std::default::Default::default()
4504 }
4505
4506 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype].
4507 ///
4508 /// Note that all the setters affecting `repotype` are mutually
4509 /// exclusive.
4510 ///
4511 /// # Example
4512 /// ```ignore,no_run
4513 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4514 /// use google_cloud_build_v1::model::dependency::git_source_repository::Repotype;
4515 /// let x = GitSourceRepository::new().set_repotype(Some(Repotype::Url("example".to_string())));
4516 /// ```
4517 pub fn set_repotype<
4518 T: std::convert::Into<
4519 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4520 >,
4521 >(
4522 mut self,
4523 v: T,
4524 ) -> Self {
4525 self.repotype = v.into();
4526 self
4527 }
4528
4529 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4530 /// if it holds a `Url`, `None` if the field is not set or
4531 /// holds a different branch.
4532 pub fn url(&self) -> std::option::Option<&std::string::String> {
4533 #[allow(unreachable_patterns)]
4534 self.repotype.as_ref().and_then(|v| match v {
4535 crate::model::dependency::git_source_repository::Repotype::Url(v) => {
4536 std::option::Option::Some(v)
4537 }
4538 _ => std::option::Option::None,
4539 })
4540 }
4541
4542 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4543 /// to hold a `Url`.
4544 ///
4545 /// Note that all the setters affecting `repotype` are
4546 /// mutually exclusive.
4547 ///
4548 /// # Example
4549 /// ```ignore,no_run
4550 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4551 /// let x = GitSourceRepository::new().set_url("example");
4552 /// assert!(x.url().is_some());
4553 /// assert!(x.developer_connect().is_none());
4554 /// ```
4555 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4556 self.repotype = std::option::Option::Some(
4557 crate::model::dependency::git_source_repository::Repotype::Url(v.into()),
4558 );
4559 self
4560 }
4561
4562 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4563 /// if it holds a `DeveloperConnect`, `None` if the field is not set or
4564 /// holds a different branch.
4565 pub fn developer_connect(&self) -> std::option::Option<&std::string::String> {
4566 #[allow(unreachable_patterns)]
4567 self.repotype.as_ref().and_then(|v| match v {
4568 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(v) => {
4569 std::option::Option::Some(v)
4570 }
4571 _ => std::option::Option::None,
4572 })
4573 }
4574
4575 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4576 /// to hold a `DeveloperConnect`.
4577 ///
4578 /// Note that all the setters affecting `repotype` are
4579 /// mutually exclusive.
4580 ///
4581 /// # Example
4582 /// ```ignore,no_run
4583 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4584 /// let x = GitSourceRepository::new().set_developer_connect("example");
4585 /// assert!(x.developer_connect().is_some());
4586 /// assert!(x.url().is_none());
4587 /// ```
4588 pub fn set_developer_connect<T: std::convert::Into<std::string::String>>(
4589 mut self,
4590 v: T,
4591 ) -> Self {
4592 self.repotype = std::option::Option::Some(
4593 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(
4594 v.into(),
4595 ),
4596 );
4597 self
4598 }
4599 }
4600
4601 impl wkt::message::Message for GitSourceRepository {
4602 fn typename() -> &'static str {
4603 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceRepository"
4604 }
4605 }
4606
4607 /// Defines additional types related to [GitSourceRepository].
4608 pub mod git_source_repository {
4609 #[allow(unused_imports)]
4610 use super::*;
4611
4612 /// The type of git source repo (url or dev connect).
4613 #[derive(Clone, Debug, PartialEq)]
4614 #[non_exhaustive]
4615 pub enum Repotype {
4616 /// Location of the Git repository.
4617 Url(std::string::String),
4618 /// The Developer Connect Git repository link formatted as
4619 /// `projects/*/locations/*/connections/*/gitRepositoryLink/*`
4620 DeveloperConnect(std::string::String),
4621 }
4622 }
4623
4624 /// The type of dependency to fetch.
4625 #[derive(Clone, Debug, PartialEq)]
4626 #[non_exhaustive]
4627 pub enum Dep {
4628 /// If set to true disable all dependency fetching (ignoring the default
4629 /// source as well).
4630 Empty(bool),
4631 /// Represents a git repository as a build dependency.
4632 GitSource(std::boxed::Box<crate::model::dependency::GitSourceDependency>),
4633 }
4634}
4635
4636/// GitConfig is a configuration for git operations.
4637#[derive(Clone, Default, PartialEq)]
4638#[non_exhaustive]
4639pub struct GitConfig {
4640 /// Configuration for HTTP related git operations.
4641 pub http: std::option::Option<crate::model::git_config::HttpConfig>,
4642
4643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4644}
4645
4646impl GitConfig {
4647 pub fn new() -> Self {
4648 std::default::Default::default()
4649 }
4650
4651 /// Sets the value of [http][crate::model::GitConfig::http].
4652 ///
4653 /// # Example
4654 /// ```ignore,no_run
4655 /// # use google_cloud_build_v1::model::GitConfig;
4656 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4657 /// let x = GitConfig::new().set_http(HttpConfig::default()/* use setters */);
4658 /// ```
4659 pub fn set_http<T>(mut self, v: T) -> Self
4660 where
4661 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4662 {
4663 self.http = std::option::Option::Some(v.into());
4664 self
4665 }
4666
4667 /// Sets or clears the value of [http][crate::model::GitConfig::http].
4668 ///
4669 /// # Example
4670 /// ```ignore,no_run
4671 /// # use google_cloud_build_v1::model::GitConfig;
4672 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4673 /// let x = GitConfig::new().set_or_clear_http(Some(HttpConfig::default()/* use setters */));
4674 /// let x = GitConfig::new().set_or_clear_http(None::<HttpConfig>);
4675 /// ```
4676 pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
4677 where
4678 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4679 {
4680 self.http = v.map(|x| x.into());
4681 self
4682 }
4683}
4684
4685impl wkt::message::Message for GitConfig {
4686 fn typename() -> &'static str {
4687 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig"
4688 }
4689}
4690
4691/// Defines additional types related to [GitConfig].
4692pub mod git_config {
4693 #[allow(unused_imports)]
4694 use super::*;
4695
4696 /// HttpConfig is a configuration for HTTP related git operations.
4697 #[derive(Clone, Default, PartialEq)]
4698 #[non_exhaustive]
4699 pub struct HttpConfig {
4700 /// SecretVersion resource of the HTTP proxy URL. The Service Account used in
4701 /// the build (either the default Service Account or
4702 /// user-specified Service Account) should have
4703 /// `secretmanager.versions.access` permissions on this secret. The proxy URL
4704 /// should be in format `[protocol://][user[:password]@]proxyhost[:port]`.
4705 pub proxy_secret_version_name: std::string::String,
4706
4707 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4708 }
4709
4710 impl HttpConfig {
4711 pub fn new() -> Self {
4712 std::default::Default::default()
4713 }
4714
4715 /// Sets the value of [proxy_secret_version_name][crate::model::git_config::HttpConfig::proxy_secret_version_name].
4716 ///
4717 /// # Example
4718 /// ```ignore,no_run
4719 /// # use google_cloud_build_v1::model::git_config::HttpConfig;
4720 /// let x = HttpConfig::new().set_proxy_secret_version_name("example");
4721 /// ```
4722 pub fn set_proxy_secret_version_name<T: std::convert::Into<std::string::String>>(
4723 mut self,
4724 v: T,
4725 ) -> Self {
4726 self.proxy_secret_version_name = v.into();
4727 self
4728 }
4729 }
4730
4731 impl wkt::message::Message for HttpConfig {
4732 fn typename() -> &'static str {
4733 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig.HttpConfig"
4734 }
4735 }
4736}
4737
4738/// Artifacts produced by a build that should be uploaded upon
4739/// successful completion of all build steps.
4740#[derive(Clone, Default, PartialEq)]
4741#[non_exhaustive]
4742pub struct Artifacts {
4743 /// A list of images to be pushed upon the successful completion of all build
4744 /// steps.
4745 ///
4746 /// The images will be pushed using the builder service account's credentials.
4747 ///
4748 /// The digests of the pushed images will be stored in the Build resource's
4749 /// results field.
4750 ///
4751 /// If any of the images fail to be pushed, the build is marked FAILURE.
4752 pub images: std::vec::Vec<std::string::String>,
4753
4754 /// A list of objects to be uploaded to Cloud Storage upon successful
4755 /// completion of all build steps.
4756 ///
4757 /// Files in the workspace matching specified paths globs will be uploaded to
4758 /// the specified Cloud Storage location using the builder service account's
4759 /// credentials.
4760 ///
4761 /// The location and generation of the uploaded objects will be stored in the
4762 /// Build resource's results field.
4763 ///
4764 /// If any objects fail to be pushed, the build is marked FAILURE.
4765 pub objects: std::option::Option<crate::model::artifacts::ArtifactObjects>,
4766
4767 /// A list of Maven artifacts to be uploaded to Artifact Registry upon
4768 /// successful completion of all build steps.
4769 ///
4770 /// Artifacts in the workspace matching specified paths globs will be uploaded
4771 /// to the specified Artifact Registry repository using the builder service
4772 /// account's credentials.
4773 ///
4774 /// If any artifacts fail to be pushed, the build is marked FAILURE.
4775 pub maven_artifacts: std::vec::Vec<crate::model::artifacts::MavenArtifact>,
4776
4777 /// Optional. A list of Go modules to be uploaded to Artifact Registry upon
4778 /// successful completion of all build steps.
4779 ///
4780 /// If any objects fail to be pushed, the build is marked FAILURE.
4781 pub go_modules: std::vec::Vec<crate::model::artifacts::GoModule>,
4782
4783 /// A list of Python packages to be uploaded to Artifact Registry upon
4784 /// successful completion of all build steps.
4785 ///
4786 /// The build service account credentials will be used to perform the upload.
4787 ///
4788 /// If any objects fail to be pushed, the build is marked FAILURE.
4789 pub python_packages: std::vec::Vec<crate::model::artifacts::PythonPackage>,
4790
4791 /// A list of npm packages to be uploaded to Artifact Registry upon
4792 /// successful completion of all build steps.
4793 ///
4794 /// Npm packages in the specified paths will be uploaded
4795 /// to the specified Artifact Registry repository using the builder service
4796 /// account's credentials.
4797 ///
4798 /// If any packages fail to be pushed, the build is marked FAILURE.
4799 pub npm_packages: std::vec::Vec<crate::model::artifacts::NpmPackage>,
4800
4801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4802}
4803
4804impl Artifacts {
4805 pub fn new() -> Self {
4806 std::default::Default::default()
4807 }
4808
4809 /// Sets the value of [images][crate::model::Artifacts::images].
4810 ///
4811 /// # Example
4812 /// ```ignore,no_run
4813 /// # use google_cloud_build_v1::model::Artifacts;
4814 /// let x = Artifacts::new().set_images(["a", "b", "c"]);
4815 /// ```
4816 pub fn set_images<T, V>(mut self, v: T) -> Self
4817 where
4818 T: std::iter::IntoIterator<Item = V>,
4819 V: std::convert::Into<std::string::String>,
4820 {
4821 use std::iter::Iterator;
4822 self.images = v.into_iter().map(|i| i.into()).collect();
4823 self
4824 }
4825
4826 /// Sets the value of [objects][crate::model::Artifacts::objects].
4827 ///
4828 /// # Example
4829 /// ```ignore,no_run
4830 /// # use google_cloud_build_v1::model::Artifacts;
4831 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4832 /// let x = Artifacts::new().set_objects(ArtifactObjects::default()/* use setters */);
4833 /// ```
4834 pub fn set_objects<T>(mut self, v: T) -> Self
4835 where
4836 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4837 {
4838 self.objects = std::option::Option::Some(v.into());
4839 self
4840 }
4841
4842 /// Sets or clears the value of [objects][crate::model::Artifacts::objects].
4843 ///
4844 /// # Example
4845 /// ```ignore,no_run
4846 /// # use google_cloud_build_v1::model::Artifacts;
4847 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4848 /// let x = Artifacts::new().set_or_clear_objects(Some(ArtifactObjects::default()/* use setters */));
4849 /// let x = Artifacts::new().set_or_clear_objects(None::<ArtifactObjects>);
4850 /// ```
4851 pub fn set_or_clear_objects<T>(mut self, v: std::option::Option<T>) -> Self
4852 where
4853 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4854 {
4855 self.objects = v.map(|x| x.into());
4856 self
4857 }
4858
4859 /// Sets the value of [maven_artifacts][crate::model::Artifacts::maven_artifacts].
4860 ///
4861 /// # Example
4862 /// ```ignore,no_run
4863 /// # use google_cloud_build_v1::model::Artifacts;
4864 /// use google_cloud_build_v1::model::artifacts::MavenArtifact;
4865 /// let x = Artifacts::new()
4866 /// .set_maven_artifacts([
4867 /// MavenArtifact::default()/* use setters */,
4868 /// MavenArtifact::default()/* use (different) setters */,
4869 /// ]);
4870 /// ```
4871 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
4872 where
4873 T: std::iter::IntoIterator<Item = V>,
4874 V: std::convert::Into<crate::model::artifacts::MavenArtifact>,
4875 {
4876 use std::iter::Iterator;
4877 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
4878 self
4879 }
4880
4881 /// Sets the value of [go_modules][crate::model::Artifacts::go_modules].
4882 ///
4883 /// # Example
4884 /// ```ignore,no_run
4885 /// # use google_cloud_build_v1::model::Artifacts;
4886 /// use google_cloud_build_v1::model::artifacts::GoModule;
4887 /// let x = Artifacts::new()
4888 /// .set_go_modules([
4889 /// GoModule::default()/* use setters */,
4890 /// GoModule::default()/* use (different) setters */,
4891 /// ]);
4892 /// ```
4893 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
4894 where
4895 T: std::iter::IntoIterator<Item = V>,
4896 V: std::convert::Into<crate::model::artifacts::GoModule>,
4897 {
4898 use std::iter::Iterator;
4899 self.go_modules = v.into_iter().map(|i| i.into()).collect();
4900 self
4901 }
4902
4903 /// Sets the value of [python_packages][crate::model::Artifacts::python_packages].
4904 ///
4905 /// # Example
4906 /// ```ignore,no_run
4907 /// # use google_cloud_build_v1::model::Artifacts;
4908 /// use google_cloud_build_v1::model::artifacts::PythonPackage;
4909 /// let x = Artifacts::new()
4910 /// .set_python_packages([
4911 /// PythonPackage::default()/* use setters */,
4912 /// PythonPackage::default()/* use (different) setters */,
4913 /// ]);
4914 /// ```
4915 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
4916 where
4917 T: std::iter::IntoIterator<Item = V>,
4918 V: std::convert::Into<crate::model::artifacts::PythonPackage>,
4919 {
4920 use std::iter::Iterator;
4921 self.python_packages = v.into_iter().map(|i| i.into()).collect();
4922 self
4923 }
4924
4925 /// Sets the value of [npm_packages][crate::model::Artifacts::npm_packages].
4926 ///
4927 /// # Example
4928 /// ```ignore,no_run
4929 /// # use google_cloud_build_v1::model::Artifacts;
4930 /// use google_cloud_build_v1::model::artifacts::NpmPackage;
4931 /// let x = Artifacts::new()
4932 /// .set_npm_packages([
4933 /// NpmPackage::default()/* use setters */,
4934 /// NpmPackage::default()/* use (different) setters */,
4935 /// ]);
4936 /// ```
4937 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
4938 where
4939 T: std::iter::IntoIterator<Item = V>,
4940 V: std::convert::Into<crate::model::artifacts::NpmPackage>,
4941 {
4942 use std::iter::Iterator;
4943 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
4944 self
4945 }
4946}
4947
4948impl wkt::message::Message for Artifacts {
4949 fn typename() -> &'static str {
4950 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts"
4951 }
4952}
4953
4954/// Defines additional types related to [Artifacts].
4955pub mod artifacts {
4956 #[allow(unused_imports)]
4957 use super::*;
4958
4959 /// Files in the workspace to upload to Cloud Storage upon successful
4960 /// completion of all build steps.
4961 #[derive(Clone, Default, PartialEq)]
4962 #[non_exhaustive]
4963 pub struct ArtifactObjects {
4964 /// Cloud Storage bucket and optional object path, in the form
4965 /// "gs://bucket/path/to/somewhere/". (see [Bucket Name
4966 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
4967 ///
4968 /// Files in the workspace matching any path pattern will be uploaded to
4969 /// Cloud Storage with this location as a prefix.
4970 pub location: std::string::String,
4971
4972 /// Path globs used to match files in the build's workspace.
4973 pub paths: std::vec::Vec<std::string::String>,
4974
4975 /// Output only. Stores timing information for pushing all artifact objects.
4976 pub timing: std::option::Option<crate::model::TimeSpan>,
4977
4978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4979 }
4980
4981 impl ArtifactObjects {
4982 pub fn new() -> Self {
4983 std::default::Default::default()
4984 }
4985
4986 /// Sets the value of [location][crate::model::artifacts::ArtifactObjects::location].
4987 ///
4988 /// # Example
4989 /// ```ignore,no_run
4990 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4991 /// let x = ArtifactObjects::new().set_location("example");
4992 /// ```
4993 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4994 self.location = v.into();
4995 self
4996 }
4997
4998 /// Sets the value of [paths][crate::model::artifacts::ArtifactObjects::paths].
4999 ///
5000 /// # Example
5001 /// ```ignore,no_run
5002 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5003 /// let x = ArtifactObjects::new().set_paths(["a", "b", "c"]);
5004 /// ```
5005 pub fn set_paths<T, V>(mut self, v: T) -> Self
5006 where
5007 T: std::iter::IntoIterator<Item = V>,
5008 V: std::convert::Into<std::string::String>,
5009 {
5010 use std::iter::Iterator;
5011 self.paths = v.into_iter().map(|i| i.into()).collect();
5012 self
5013 }
5014
5015 /// Sets the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5016 ///
5017 /// # Example
5018 /// ```ignore,no_run
5019 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5020 /// use google_cloud_build_v1::model::TimeSpan;
5021 /// let x = ArtifactObjects::new().set_timing(TimeSpan::default()/* use setters */);
5022 /// ```
5023 pub fn set_timing<T>(mut self, v: T) -> Self
5024 where
5025 T: std::convert::Into<crate::model::TimeSpan>,
5026 {
5027 self.timing = std::option::Option::Some(v.into());
5028 self
5029 }
5030
5031 /// Sets or clears the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5032 ///
5033 /// # Example
5034 /// ```ignore,no_run
5035 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5036 /// use google_cloud_build_v1::model::TimeSpan;
5037 /// let x = ArtifactObjects::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
5038 /// let x = ArtifactObjects::new().set_or_clear_timing(None::<TimeSpan>);
5039 /// ```
5040 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
5041 where
5042 T: std::convert::Into<crate::model::TimeSpan>,
5043 {
5044 self.timing = v.map(|x| x.into());
5045 self
5046 }
5047 }
5048
5049 impl wkt::message::Message for ArtifactObjects {
5050 fn typename() -> &'static str {
5051 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects"
5052 }
5053 }
5054
5055 /// A Maven artifact to upload to Artifact Registry upon successful completion
5056 /// of all build steps.
5057 #[derive(Clone, Default, PartialEq)]
5058 #[non_exhaustive]
5059 pub struct MavenArtifact {
5060 /// Artifact Registry repository, in the form
5061 /// "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY"
5062 ///
5063 /// Artifact in the workspace specified by path will be uploaded to
5064 /// Artifact Registry with this location as a prefix.
5065 pub repository: std::string::String,
5066
5067 /// Optional. Path to an artifact in the build's workspace to be uploaded to
5068 /// Artifact Registry.
5069 /// This can be either an absolute path,
5070 /// e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar
5071 /// or a relative path from /workspace,
5072 /// e.g. my-app/target/my-app-1.0.SNAPSHOT.jar.
5073 pub path: std::string::String,
5074
5075 /// Maven `artifactId` value used when uploading the artifact to Artifact
5076 /// Registry.
5077 pub artifact_id: std::string::String,
5078
5079 /// Maven `groupId` value used when uploading the artifact to Artifact
5080 /// Registry.
5081 pub group_id: std::string::String,
5082
5083 /// Maven `version` value used when uploading the artifact to Artifact
5084 /// Registry.
5085 pub version: std::string::String,
5086
5087 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5088 }
5089
5090 impl MavenArtifact {
5091 pub fn new() -> Self {
5092 std::default::Default::default()
5093 }
5094
5095 /// Sets the value of [repository][crate::model::artifacts::MavenArtifact::repository].
5096 ///
5097 /// # Example
5098 /// ```ignore,no_run
5099 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5100 /// let x = MavenArtifact::new().set_repository("example");
5101 /// ```
5102 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5103 self.repository = v.into();
5104 self
5105 }
5106
5107 /// Sets the value of [path][crate::model::artifacts::MavenArtifact::path].
5108 ///
5109 /// # Example
5110 /// ```ignore,no_run
5111 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5112 /// let x = MavenArtifact::new().set_path("example");
5113 /// ```
5114 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5115 self.path = v.into();
5116 self
5117 }
5118
5119 /// Sets the value of [artifact_id][crate::model::artifacts::MavenArtifact::artifact_id].
5120 ///
5121 /// # Example
5122 /// ```ignore,no_run
5123 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5124 /// let x = MavenArtifact::new().set_artifact_id("example");
5125 /// ```
5126 pub fn set_artifact_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5127 self.artifact_id = v.into();
5128 self
5129 }
5130
5131 /// Sets the value of [group_id][crate::model::artifacts::MavenArtifact::group_id].
5132 ///
5133 /// # Example
5134 /// ```ignore,no_run
5135 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5136 /// let x = MavenArtifact::new().set_group_id("example");
5137 /// ```
5138 pub fn set_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5139 self.group_id = v.into();
5140 self
5141 }
5142
5143 /// Sets the value of [version][crate::model::artifacts::MavenArtifact::version].
5144 ///
5145 /// # Example
5146 /// ```ignore,no_run
5147 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5148 /// let x = MavenArtifact::new().set_version("example");
5149 /// ```
5150 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5151 self.version = v.into();
5152 self
5153 }
5154 }
5155
5156 impl wkt::message::Message for MavenArtifact {
5157 fn typename() -> &'static str {
5158 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.MavenArtifact"
5159 }
5160 }
5161
5162 /// Go module to upload to Artifact Registry upon successful completion of all
5163 /// build steps. A module refers to all dependencies in a go.mod file.
5164 #[derive(Clone, Default, PartialEq)]
5165 #[non_exhaustive]
5166 pub struct GoModule {
5167 /// Optional. Artifact Registry repository name.
5168 ///
5169 /// Specified Go modules will be zipped and uploaded to Artifact Registry
5170 /// with this location as a prefix.
5171 /// e.g. my-go-repo
5172 pub repository_name: std::string::String,
5173
5174 /// Optional. Location of the Artifact Registry repository. i.e. us-east1
5175 /// Defaults to the build’s location.
5176 pub repository_location: std::string::String,
5177
5178 /// Optional. Project ID of the Artifact Registry repository.
5179 /// Defaults to the build project.
5180 pub repository_project_id: std::string::String,
5181
5182 /// Optional. Source path of the go.mod file in the build's workspace. If not
5183 /// specified, this will default to the current directory.
5184 /// e.g. ~/code/go/mypackage
5185 pub source_path: std::string::String,
5186
5187 /// Optional. The Go module's "module path".
5188 /// e.g. example.com/foo/v2
5189 pub module_path: std::string::String,
5190
5191 /// Optional. The Go module's semantic version in the form vX.Y.Z. e.g.
5192 /// v0.1.1 Pre-release identifiers can also be added by appending a dash and
5193 /// dot separated ASCII alphanumeric characters and hyphens.
5194 /// e.g. v0.2.3-alpha.x.12m.5
5195 pub module_version: std::string::String,
5196
5197 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5198 }
5199
5200 impl GoModule {
5201 pub fn new() -> Self {
5202 std::default::Default::default()
5203 }
5204
5205 /// Sets the value of [repository_name][crate::model::artifacts::GoModule::repository_name].
5206 ///
5207 /// # Example
5208 /// ```ignore,no_run
5209 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5210 /// let x = GoModule::new().set_repository_name("example");
5211 /// ```
5212 pub fn set_repository_name<T: std::convert::Into<std::string::String>>(
5213 mut self,
5214 v: T,
5215 ) -> Self {
5216 self.repository_name = v.into();
5217 self
5218 }
5219
5220 /// Sets the value of [repository_location][crate::model::artifacts::GoModule::repository_location].
5221 ///
5222 /// # Example
5223 /// ```ignore,no_run
5224 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5225 /// let x = GoModule::new().set_repository_location("example");
5226 /// ```
5227 pub fn set_repository_location<T: std::convert::Into<std::string::String>>(
5228 mut self,
5229 v: T,
5230 ) -> Self {
5231 self.repository_location = v.into();
5232 self
5233 }
5234
5235 /// Sets the value of [repository_project_id][crate::model::artifacts::GoModule::repository_project_id].
5236 ///
5237 /// # Example
5238 /// ```ignore,no_run
5239 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5240 /// let x = GoModule::new().set_repository_project_id("example");
5241 /// ```
5242 pub fn set_repository_project_id<T: std::convert::Into<std::string::String>>(
5243 mut self,
5244 v: T,
5245 ) -> Self {
5246 self.repository_project_id = v.into();
5247 self
5248 }
5249
5250 /// Sets the value of [source_path][crate::model::artifacts::GoModule::source_path].
5251 ///
5252 /// # Example
5253 /// ```ignore,no_run
5254 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5255 /// let x = GoModule::new().set_source_path("example");
5256 /// ```
5257 pub fn set_source_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5258 self.source_path = v.into();
5259 self
5260 }
5261
5262 /// Sets the value of [module_path][crate::model::artifacts::GoModule::module_path].
5263 ///
5264 /// # Example
5265 /// ```ignore,no_run
5266 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5267 /// let x = GoModule::new().set_module_path("example");
5268 /// ```
5269 pub fn set_module_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5270 self.module_path = v.into();
5271 self
5272 }
5273
5274 /// Sets the value of [module_version][crate::model::artifacts::GoModule::module_version].
5275 ///
5276 /// # Example
5277 /// ```ignore,no_run
5278 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5279 /// let x = GoModule::new().set_module_version("example");
5280 /// ```
5281 pub fn set_module_version<T: std::convert::Into<std::string::String>>(
5282 mut self,
5283 v: T,
5284 ) -> Self {
5285 self.module_version = v.into();
5286 self
5287 }
5288 }
5289
5290 impl wkt::message::Message for GoModule {
5291 fn typename() -> &'static str {
5292 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.GoModule"
5293 }
5294 }
5295
5296 /// Python package to upload to Artifact Registry upon successful completion
5297 /// of all build steps. A package can encapsulate multiple objects to be
5298 /// uploaded to a single repository.
5299 #[derive(Clone, Default, PartialEq)]
5300 #[non_exhaustive]
5301 pub struct PythonPackage {
5302 /// Artifact Registry repository, in the form
5303 /// "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY"
5304 ///
5305 /// Files in the workspace matching any path pattern will be uploaded to
5306 /// Artifact Registry with this location as a prefix.
5307 pub repository: std::string::String,
5308
5309 /// Path globs used to match files in the build's workspace. For Python/
5310 /// Twine, this is usually `dist/*`, and sometimes additionally an `.asc`
5311 /// file.
5312 pub paths: std::vec::Vec<std::string::String>,
5313
5314 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5315 }
5316
5317 impl PythonPackage {
5318 pub fn new() -> Self {
5319 std::default::Default::default()
5320 }
5321
5322 /// Sets the value of [repository][crate::model::artifacts::PythonPackage::repository].
5323 ///
5324 /// # Example
5325 /// ```ignore,no_run
5326 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5327 /// let x = PythonPackage::new().set_repository("example");
5328 /// ```
5329 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5330 self.repository = v.into();
5331 self
5332 }
5333
5334 /// Sets the value of [paths][crate::model::artifacts::PythonPackage::paths].
5335 ///
5336 /// # Example
5337 /// ```ignore,no_run
5338 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5339 /// let x = PythonPackage::new().set_paths(["a", "b", "c"]);
5340 /// ```
5341 pub fn set_paths<T, V>(mut self, v: T) -> Self
5342 where
5343 T: std::iter::IntoIterator<Item = V>,
5344 V: std::convert::Into<std::string::String>,
5345 {
5346 use std::iter::Iterator;
5347 self.paths = v.into_iter().map(|i| i.into()).collect();
5348 self
5349 }
5350 }
5351
5352 impl wkt::message::Message for PythonPackage {
5353 fn typename() -> &'static str {
5354 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.PythonPackage"
5355 }
5356 }
5357
5358 /// Npm package to upload to Artifact Registry upon successful completion
5359 /// of all build steps.
5360 #[derive(Clone, Default, PartialEq)]
5361 #[non_exhaustive]
5362 pub struct NpmPackage {
5363 /// Artifact Registry repository, in the form
5364 /// "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY"
5365 ///
5366 /// Npm package in the workspace specified by path will be zipped and
5367 /// uploaded to Artifact Registry with this location as a prefix.
5368 pub repository: std::string::String,
5369
5370 /// Optional. Path to the package.json.
5371 /// e.g. workspace/path/to/package
5372 ///
5373 /// Only one of `archive` or `package_path` can be specified.
5374 pub package_path: std::string::String,
5375
5376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5377 }
5378
5379 impl NpmPackage {
5380 pub fn new() -> Self {
5381 std::default::Default::default()
5382 }
5383
5384 /// Sets the value of [repository][crate::model::artifacts::NpmPackage::repository].
5385 ///
5386 /// # Example
5387 /// ```ignore,no_run
5388 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5389 /// let x = NpmPackage::new().set_repository("example");
5390 /// ```
5391 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5392 self.repository = v.into();
5393 self
5394 }
5395
5396 /// Sets the value of [package_path][crate::model::artifacts::NpmPackage::package_path].
5397 ///
5398 /// # Example
5399 /// ```ignore,no_run
5400 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5401 /// let x = NpmPackage::new().set_package_path("example");
5402 /// ```
5403 pub fn set_package_path<T: std::convert::Into<std::string::String>>(
5404 mut self,
5405 v: T,
5406 ) -> Self {
5407 self.package_path = v.into();
5408 self
5409 }
5410 }
5411
5412 impl wkt::message::Message for NpmPackage {
5413 fn typename() -> &'static str {
5414 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.NpmPackage"
5415 }
5416 }
5417}
5418
5419/// Start and end times for a build execution phase.
5420#[derive(Clone, Default, PartialEq)]
5421#[non_exhaustive]
5422pub struct TimeSpan {
5423 /// Start of time span.
5424 pub start_time: std::option::Option<wkt::Timestamp>,
5425
5426 /// End of time span.
5427 pub end_time: std::option::Option<wkt::Timestamp>,
5428
5429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5430}
5431
5432impl TimeSpan {
5433 pub fn new() -> Self {
5434 std::default::Default::default()
5435 }
5436
5437 /// Sets the value of [start_time][crate::model::TimeSpan::start_time].
5438 ///
5439 /// # Example
5440 /// ```ignore,no_run
5441 /// # use google_cloud_build_v1::model::TimeSpan;
5442 /// use wkt::Timestamp;
5443 /// let x = TimeSpan::new().set_start_time(Timestamp::default()/* use setters */);
5444 /// ```
5445 pub fn set_start_time<T>(mut self, v: T) -> Self
5446 where
5447 T: std::convert::Into<wkt::Timestamp>,
5448 {
5449 self.start_time = std::option::Option::Some(v.into());
5450 self
5451 }
5452
5453 /// Sets or clears the value of [start_time][crate::model::TimeSpan::start_time].
5454 ///
5455 /// # Example
5456 /// ```ignore,no_run
5457 /// # use google_cloud_build_v1::model::TimeSpan;
5458 /// use wkt::Timestamp;
5459 /// let x = TimeSpan::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
5460 /// let x = TimeSpan::new().set_or_clear_start_time(None::<Timestamp>);
5461 /// ```
5462 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5463 where
5464 T: std::convert::Into<wkt::Timestamp>,
5465 {
5466 self.start_time = v.map(|x| x.into());
5467 self
5468 }
5469
5470 /// Sets the value of [end_time][crate::model::TimeSpan::end_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_end_time(Timestamp::default()/* use setters */);
5477 /// ```
5478 pub fn set_end_time<T>(mut self, v: T) -> Self
5479 where
5480 T: std::convert::Into<wkt::Timestamp>,
5481 {
5482 self.end_time = std::option::Option::Some(v.into());
5483 self
5484 }
5485
5486 /// Sets or clears the value of [end_time][crate::model::TimeSpan::end_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_end_time(Some(Timestamp::default()/* use setters */));
5493 /// let x = TimeSpan::new().set_or_clear_end_time(None::<Timestamp>);
5494 /// ```
5495 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5496 where
5497 T: std::convert::Into<wkt::Timestamp>,
5498 {
5499 self.end_time = v.map(|x| x.into());
5500 self
5501 }
5502}
5503
5504impl wkt::message::Message for TimeSpan {
5505 fn typename() -> &'static str {
5506 "type.googleapis.com/google.devtools.cloudbuild.v1.TimeSpan"
5507 }
5508}
5509
5510/// Metadata for build operations.
5511#[derive(Clone, Default, PartialEq)]
5512#[non_exhaustive]
5513pub struct BuildOperationMetadata {
5514 /// The build that the operation is tracking.
5515 pub build: std::option::Option<crate::model::Build>,
5516
5517 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5518}
5519
5520impl BuildOperationMetadata {
5521 pub fn new() -> Self {
5522 std::default::Default::default()
5523 }
5524
5525 /// Sets the value of [build][crate::model::BuildOperationMetadata::build].
5526 ///
5527 /// # Example
5528 /// ```ignore,no_run
5529 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5530 /// use google_cloud_build_v1::model::Build;
5531 /// let x = BuildOperationMetadata::new().set_build(Build::default()/* use setters */);
5532 /// ```
5533 pub fn set_build<T>(mut self, v: T) -> Self
5534 where
5535 T: std::convert::Into<crate::model::Build>,
5536 {
5537 self.build = std::option::Option::Some(v.into());
5538 self
5539 }
5540
5541 /// Sets or clears the value of [build][crate::model::BuildOperationMetadata::build].
5542 ///
5543 /// # Example
5544 /// ```ignore,no_run
5545 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5546 /// use google_cloud_build_v1::model::Build;
5547 /// let x = BuildOperationMetadata::new().set_or_clear_build(Some(Build::default()/* use setters */));
5548 /// let x = BuildOperationMetadata::new().set_or_clear_build(None::<Build>);
5549 /// ```
5550 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
5551 where
5552 T: std::convert::Into<crate::model::Build>,
5553 {
5554 self.build = v.map(|x| x.into());
5555 self
5556 }
5557}
5558
5559impl wkt::message::Message for BuildOperationMetadata {
5560 fn typename() -> &'static str {
5561 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata"
5562 }
5563}
5564
5565/// Provenance of the source. Ways to find the original source, or verify that
5566/// some source was used for this build.
5567#[derive(Clone, Default, PartialEq)]
5568#[non_exhaustive]
5569pub struct SourceProvenance {
5570 /// A copy of the build's `source.storage_source`, if exists, with any
5571 /// generations resolved.
5572 pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
5573
5574 /// A copy of the build's `source.repo_source`, if exists, with any
5575 /// revisions resolved.
5576 pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
5577
5578 /// A copy of the build's `source.storage_source_manifest`, if exists, with any
5579 /// revisions resolved.
5580 /// This feature is in Preview.
5581 pub resolved_storage_source_manifest: std::option::Option<crate::model::StorageSourceManifest>,
5582
5583 /// Output only. A copy of the build's `source.connected_repository`, if
5584 /// exists, with any revisions resolved.
5585 pub resolved_connected_repository: std::option::Option<crate::model::ConnectedRepository>,
5586
5587 /// Output only. A copy of the build's `source.git_source`, if exists, with any
5588 /// revisions resolved.
5589 pub resolved_git_source: std::option::Option<crate::model::GitSource>,
5590
5591 /// Output only. Hash(es) of the build source, which can be used to verify that
5592 /// the original source integrity was maintained in the build. Note that
5593 /// `FileHashes` will only be populated if `BuildOptions` has requested a
5594 /// `SourceProvenanceHash`.
5595 ///
5596 /// The keys to this map are file paths used as build source and the values
5597 /// contain the hash values for those files.
5598 ///
5599 /// If the build source came in a single package such as a gzipped tarfile
5600 /// (`.tar.gz`), the `FileHash` will be for the single path to that file.
5601 pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
5602
5603 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5604}
5605
5606impl SourceProvenance {
5607 pub fn new() -> Self {
5608 std::default::Default::default()
5609 }
5610
5611 /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5612 ///
5613 /// # Example
5614 /// ```ignore,no_run
5615 /// # use google_cloud_build_v1::model::SourceProvenance;
5616 /// use google_cloud_build_v1::model::StorageSource;
5617 /// let x = SourceProvenance::new().set_resolved_storage_source(StorageSource::default()/* use setters */);
5618 /// ```
5619 pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
5620 where
5621 T: std::convert::Into<crate::model::StorageSource>,
5622 {
5623 self.resolved_storage_source = std::option::Option::Some(v.into());
5624 self
5625 }
5626
5627 /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5628 ///
5629 /// # Example
5630 /// ```ignore,no_run
5631 /// # use google_cloud_build_v1::model::SourceProvenance;
5632 /// use google_cloud_build_v1::model::StorageSource;
5633 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(Some(StorageSource::default()/* use setters */));
5634 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(None::<StorageSource>);
5635 /// ```
5636 pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
5637 where
5638 T: std::convert::Into<crate::model::StorageSource>,
5639 {
5640 self.resolved_storage_source = v.map(|x| x.into());
5641 self
5642 }
5643
5644 /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5645 ///
5646 /// # Example
5647 /// ```ignore,no_run
5648 /// # use google_cloud_build_v1::model::SourceProvenance;
5649 /// use google_cloud_build_v1::model::RepoSource;
5650 /// let x = SourceProvenance::new().set_resolved_repo_source(RepoSource::default()/* use setters */);
5651 /// ```
5652 pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
5653 where
5654 T: std::convert::Into<crate::model::RepoSource>,
5655 {
5656 self.resolved_repo_source = std::option::Option::Some(v.into());
5657 self
5658 }
5659
5660 /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5661 ///
5662 /// # Example
5663 /// ```ignore,no_run
5664 /// # use google_cloud_build_v1::model::SourceProvenance;
5665 /// use google_cloud_build_v1::model::RepoSource;
5666 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(Some(RepoSource::default()/* use setters */));
5667 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(None::<RepoSource>);
5668 /// ```
5669 pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
5670 where
5671 T: std::convert::Into<crate::model::RepoSource>,
5672 {
5673 self.resolved_repo_source = v.map(|x| x.into());
5674 self
5675 }
5676
5677 /// Sets the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5678 ///
5679 /// # Example
5680 /// ```ignore,no_run
5681 /// # use google_cloud_build_v1::model::SourceProvenance;
5682 /// use google_cloud_build_v1::model::StorageSourceManifest;
5683 /// let x = SourceProvenance::new().set_resolved_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
5684 /// ```
5685 pub fn set_resolved_storage_source_manifest<T>(mut self, v: T) -> Self
5686 where
5687 T: std::convert::Into<crate::model::StorageSourceManifest>,
5688 {
5689 self.resolved_storage_source_manifest = std::option::Option::Some(v.into());
5690 self
5691 }
5692
5693 /// Sets or clears the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5694 ///
5695 /// # Example
5696 /// ```ignore,no_run
5697 /// # use google_cloud_build_v1::model::SourceProvenance;
5698 /// use google_cloud_build_v1::model::StorageSourceManifest;
5699 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(Some(StorageSourceManifest::default()/* use setters */));
5700 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(None::<StorageSourceManifest>);
5701 /// ```
5702 pub fn set_or_clear_resolved_storage_source_manifest<T>(
5703 mut self,
5704 v: std::option::Option<T>,
5705 ) -> Self
5706 where
5707 T: std::convert::Into<crate::model::StorageSourceManifest>,
5708 {
5709 self.resolved_storage_source_manifest = v.map(|x| x.into());
5710 self
5711 }
5712
5713 /// Sets the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5714 ///
5715 /// # Example
5716 /// ```ignore,no_run
5717 /// # use google_cloud_build_v1::model::SourceProvenance;
5718 /// use google_cloud_build_v1::model::ConnectedRepository;
5719 /// let x = SourceProvenance::new().set_resolved_connected_repository(ConnectedRepository::default()/* use setters */);
5720 /// ```
5721 pub fn set_resolved_connected_repository<T>(mut self, v: T) -> Self
5722 where
5723 T: std::convert::Into<crate::model::ConnectedRepository>,
5724 {
5725 self.resolved_connected_repository = std::option::Option::Some(v.into());
5726 self
5727 }
5728
5729 /// Sets or clears the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5730 ///
5731 /// # Example
5732 /// ```ignore,no_run
5733 /// # use google_cloud_build_v1::model::SourceProvenance;
5734 /// use google_cloud_build_v1::model::ConnectedRepository;
5735 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(Some(ConnectedRepository::default()/* use setters */));
5736 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(None::<ConnectedRepository>);
5737 /// ```
5738 pub fn set_or_clear_resolved_connected_repository<T>(
5739 mut self,
5740 v: std::option::Option<T>,
5741 ) -> Self
5742 where
5743 T: std::convert::Into<crate::model::ConnectedRepository>,
5744 {
5745 self.resolved_connected_repository = v.map(|x| x.into());
5746 self
5747 }
5748
5749 /// Sets the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5750 ///
5751 /// # Example
5752 /// ```ignore,no_run
5753 /// # use google_cloud_build_v1::model::SourceProvenance;
5754 /// use google_cloud_build_v1::model::GitSource;
5755 /// let x = SourceProvenance::new().set_resolved_git_source(GitSource::default()/* use setters */);
5756 /// ```
5757 pub fn set_resolved_git_source<T>(mut self, v: T) -> Self
5758 where
5759 T: std::convert::Into<crate::model::GitSource>,
5760 {
5761 self.resolved_git_source = std::option::Option::Some(v.into());
5762 self
5763 }
5764
5765 /// Sets or clears the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5766 ///
5767 /// # Example
5768 /// ```ignore,no_run
5769 /// # use google_cloud_build_v1::model::SourceProvenance;
5770 /// use google_cloud_build_v1::model::GitSource;
5771 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(Some(GitSource::default()/* use setters */));
5772 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(None::<GitSource>);
5773 /// ```
5774 pub fn set_or_clear_resolved_git_source<T>(mut self, v: std::option::Option<T>) -> Self
5775 where
5776 T: std::convert::Into<crate::model::GitSource>,
5777 {
5778 self.resolved_git_source = v.map(|x| x.into());
5779 self
5780 }
5781
5782 /// Sets the value of [file_hashes][crate::model::SourceProvenance::file_hashes].
5783 ///
5784 /// # Example
5785 /// ```ignore,no_run
5786 /// # use google_cloud_build_v1::model::SourceProvenance;
5787 /// use google_cloud_build_v1::model::FileHashes;
5788 /// let x = SourceProvenance::new().set_file_hashes([
5789 /// ("key0", FileHashes::default()/* use setters */),
5790 /// ("key1", FileHashes::default()/* use (different) setters */),
5791 /// ]);
5792 /// ```
5793 pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
5794 where
5795 T: std::iter::IntoIterator<Item = (K, V)>,
5796 K: std::convert::Into<std::string::String>,
5797 V: std::convert::Into<crate::model::FileHashes>,
5798 {
5799 use std::iter::Iterator;
5800 self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5801 self
5802 }
5803}
5804
5805impl wkt::message::Message for SourceProvenance {
5806 fn typename() -> &'static str {
5807 "type.googleapis.com/google.devtools.cloudbuild.v1.SourceProvenance"
5808 }
5809}
5810
5811/// Container message for hashes of byte content of files, used in
5812/// SourceProvenance messages to verify integrity of source input to the build.
5813#[derive(Clone, Default, PartialEq)]
5814#[non_exhaustive]
5815pub struct FileHashes {
5816 /// Collection of file hashes.
5817 pub file_hash: std::vec::Vec<crate::model::Hash>,
5818
5819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5820}
5821
5822impl FileHashes {
5823 pub fn new() -> Self {
5824 std::default::Default::default()
5825 }
5826
5827 /// Sets the value of [file_hash][crate::model::FileHashes::file_hash].
5828 ///
5829 /// # Example
5830 /// ```ignore,no_run
5831 /// # use google_cloud_build_v1::model::FileHashes;
5832 /// use google_cloud_build_v1::model::Hash;
5833 /// let x = FileHashes::new()
5834 /// .set_file_hash([
5835 /// Hash::default()/* use setters */,
5836 /// Hash::default()/* use (different) setters */,
5837 /// ]);
5838 /// ```
5839 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
5840 where
5841 T: std::iter::IntoIterator<Item = V>,
5842 V: std::convert::Into<crate::model::Hash>,
5843 {
5844 use std::iter::Iterator;
5845 self.file_hash = v.into_iter().map(|i| i.into()).collect();
5846 self
5847 }
5848}
5849
5850impl wkt::message::Message for FileHashes {
5851 fn typename() -> &'static str {
5852 "type.googleapis.com/google.devtools.cloudbuild.v1.FileHashes"
5853 }
5854}
5855
5856/// Container message for hash values.
5857#[derive(Clone, Default, PartialEq)]
5858#[non_exhaustive]
5859pub struct Hash {
5860 /// The type of hash that was performed.
5861 pub r#type: crate::model::hash::HashType,
5862
5863 /// The hash value.
5864 pub value: ::bytes::Bytes,
5865
5866 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5867}
5868
5869impl Hash {
5870 pub fn new() -> Self {
5871 std::default::Default::default()
5872 }
5873
5874 /// Sets the value of [r#type][crate::model::Hash::type].
5875 ///
5876 /// # Example
5877 /// ```ignore,no_run
5878 /// # use google_cloud_build_v1::model::Hash;
5879 /// use google_cloud_build_v1::model::hash::HashType;
5880 /// let x0 = Hash::new().set_type(HashType::Sha256);
5881 /// let x1 = Hash::new().set_type(HashType::Md5);
5882 /// let x2 = Hash::new().set_type(HashType::GoModuleH1);
5883 /// ```
5884 pub fn set_type<T: std::convert::Into<crate::model::hash::HashType>>(mut self, v: T) -> Self {
5885 self.r#type = v.into();
5886 self
5887 }
5888
5889 /// Sets the value of [value][crate::model::Hash::value].
5890 ///
5891 /// # Example
5892 /// ```ignore,no_run
5893 /// # use google_cloud_build_v1::model::Hash;
5894 /// let x = Hash::new().set_value(bytes::Bytes::from_static(b"example"));
5895 /// ```
5896 pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5897 self.value = v.into();
5898 self
5899 }
5900}
5901
5902impl wkt::message::Message for Hash {
5903 fn typename() -> &'static str {
5904 "type.googleapis.com/google.devtools.cloudbuild.v1.Hash"
5905 }
5906}
5907
5908/// Defines additional types related to [Hash].
5909pub mod hash {
5910 #[allow(unused_imports)]
5911 use super::*;
5912
5913 /// Specifies the hash algorithm, if any.
5914 ///
5915 /// # Working with unknown values
5916 ///
5917 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5918 /// additional enum variants at any time. Adding new variants is not considered
5919 /// a breaking change. Applications should write their code in anticipation of:
5920 ///
5921 /// - New values appearing in future releases of the client library, **and**
5922 /// - New values received dynamically, without application changes.
5923 ///
5924 /// Please consult the [Working with enums] section in the user guide for some
5925 /// guidelines.
5926 ///
5927 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5928 #[derive(Clone, Debug, PartialEq)]
5929 #[non_exhaustive]
5930 pub enum HashType {
5931 /// No hash requested.
5932 None,
5933 /// Use a sha256 hash.
5934 Sha256,
5935 /// Use a md5 hash.
5936 Md5,
5937 /// Dirhash of a Go module's source code which is then hex-encoded.
5938 GoModuleH1,
5939 /// Use a sha512 hash.
5940 Sha512,
5941 /// If set, the enum was initialized with an unknown value.
5942 ///
5943 /// Applications can examine the value using [HashType::value] or
5944 /// [HashType::name].
5945 UnknownValue(hash_type::UnknownValue),
5946 }
5947
5948 #[doc(hidden)]
5949 pub mod hash_type {
5950 #[allow(unused_imports)]
5951 use super::*;
5952 #[derive(Clone, Debug, PartialEq)]
5953 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5954 }
5955
5956 impl HashType {
5957 /// Gets the enum value.
5958 ///
5959 /// Returns `None` if the enum contains an unknown value deserialized from
5960 /// the string representation of enums.
5961 pub fn value(&self) -> std::option::Option<i32> {
5962 match self {
5963 Self::None => std::option::Option::Some(0),
5964 Self::Sha256 => std::option::Option::Some(1),
5965 Self::Md5 => std::option::Option::Some(2),
5966 Self::GoModuleH1 => std::option::Option::Some(3),
5967 Self::Sha512 => std::option::Option::Some(4),
5968 Self::UnknownValue(u) => u.0.value(),
5969 }
5970 }
5971
5972 /// Gets the enum value as a string.
5973 ///
5974 /// Returns `None` if the enum contains an unknown value deserialized from
5975 /// the integer representation of enums.
5976 pub fn name(&self) -> std::option::Option<&str> {
5977 match self {
5978 Self::None => std::option::Option::Some("NONE"),
5979 Self::Sha256 => std::option::Option::Some("SHA256"),
5980 Self::Md5 => std::option::Option::Some("MD5"),
5981 Self::GoModuleH1 => std::option::Option::Some("GO_MODULE_H1"),
5982 Self::Sha512 => std::option::Option::Some("SHA512"),
5983 Self::UnknownValue(u) => u.0.name(),
5984 }
5985 }
5986 }
5987
5988 impl std::default::Default for HashType {
5989 fn default() -> Self {
5990 use std::convert::From;
5991 Self::from(0)
5992 }
5993 }
5994
5995 impl std::fmt::Display for HashType {
5996 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5997 wkt::internal::display_enum(f, self.name(), self.value())
5998 }
5999 }
6000
6001 impl std::convert::From<i32> for HashType {
6002 fn from(value: i32) -> Self {
6003 match value {
6004 0 => Self::None,
6005 1 => Self::Sha256,
6006 2 => Self::Md5,
6007 3 => Self::GoModuleH1,
6008 4 => Self::Sha512,
6009 _ => Self::UnknownValue(hash_type::UnknownValue(
6010 wkt::internal::UnknownEnumValue::Integer(value),
6011 )),
6012 }
6013 }
6014 }
6015
6016 impl std::convert::From<&str> for HashType {
6017 fn from(value: &str) -> Self {
6018 use std::string::ToString;
6019 match value {
6020 "NONE" => Self::None,
6021 "SHA256" => Self::Sha256,
6022 "MD5" => Self::Md5,
6023 "GO_MODULE_H1" => Self::GoModuleH1,
6024 "SHA512" => Self::Sha512,
6025 _ => Self::UnknownValue(hash_type::UnknownValue(
6026 wkt::internal::UnknownEnumValue::String(value.to_string()),
6027 )),
6028 }
6029 }
6030 }
6031
6032 impl serde::ser::Serialize for HashType {
6033 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6034 where
6035 S: serde::Serializer,
6036 {
6037 match self {
6038 Self::None => serializer.serialize_i32(0),
6039 Self::Sha256 => serializer.serialize_i32(1),
6040 Self::Md5 => serializer.serialize_i32(2),
6041 Self::GoModuleH1 => serializer.serialize_i32(3),
6042 Self::Sha512 => serializer.serialize_i32(4),
6043 Self::UnknownValue(u) => u.0.serialize(serializer),
6044 }
6045 }
6046 }
6047
6048 impl<'de> serde::de::Deserialize<'de> for HashType {
6049 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6050 where
6051 D: serde::Deserializer<'de>,
6052 {
6053 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HashType>::new(
6054 ".google.devtools.cloudbuild.v1.Hash.HashType",
6055 ))
6056 }
6057 }
6058}
6059
6060/// Secrets and secret environment variables.
6061#[derive(Clone, Default, PartialEq)]
6062#[non_exhaustive]
6063pub struct Secrets {
6064 /// Secrets in Secret Manager and associated secret environment variable.
6065 pub secret_manager: std::vec::Vec<crate::model::SecretManagerSecret>,
6066
6067 /// Secrets encrypted with KMS key and the associated secret environment
6068 /// variable.
6069 pub inline: std::vec::Vec<crate::model::InlineSecret>,
6070
6071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6072}
6073
6074impl Secrets {
6075 pub fn new() -> Self {
6076 std::default::Default::default()
6077 }
6078
6079 /// Sets the value of [secret_manager][crate::model::Secrets::secret_manager].
6080 ///
6081 /// # Example
6082 /// ```ignore,no_run
6083 /// # use google_cloud_build_v1::model::Secrets;
6084 /// use google_cloud_build_v1::model::SecretManagerSecret;
6085 /// let x = Secrets::new()
6086 /// .set_secret_manager([
6087 /// SecretManagerSecret::default()/* use setters */,
6088 /// SecretManagerSecret::default()/* use (different) setters */,
6089 /// ]);
6090 /// ```
6091 pub fn set_secret_manager<T, V>(mut self, v: T) -> Self
6092 where
6093 T: std::iter::IntoIterator<Item = V>,
6094 V: std::convert::Into<crate::model::SecretManagerSecret>,
6095 {
6096 use std::iter::Iterator;
6097 self.secret_manager = v.into_iter().map(|i| i.into()).collect();
6098 self
6099 }
6100
6101 /// Sets the value of [inline][crate::model::Secrets::inline].
6102 ///
6103 /// # Example
6104 /// ```ignore,no_run
6105 /// # use google_cloud_build_v1::model::Secrets;
6106 /// use google_cloud_build_v1::model::InlineSecret;
6107 /// let x = Secrets::new()
6108 /// .set_inline([
6109 /// InlineSecret::default()/* use setters */,
6110 /// InlineSecret::default()/* use (different) setters */,
6111 /// ]);
6112 /// ```
6113 pub fn set_inline<T, V>(mut self, v: T) -> Self
6114 where
6115 T: std::iter::IntoIterator<Item = V>,
6116 V: std::convert::Into<crate::model::InlineSecret>,
6117 {
6118 use std::iter::Iterator;
6119 self.inline = v.into_iter().map(|i| i.into()).collect();
6120 self
6121 }
6122}
6123
6124impl wkt::message::Message for Secrets {
6125 fn typename() -> &'static str {
6126 "type.googleapis.com/google.devtools.cloudbuild.v1.Secrets"
6127 }
6128}
6129
6130/// Pairs a set of secret environment variables mapped to encrypted
6131/// values with the Cloud KMS key to use to decrypt the value.
6132#[derive(Clone, Default, PartialEq)]
6133#[non_exhaustive]
6134pub struct InlineSecret {
6135 /// Resource name of Cloud KMS crypto key to decrypt the encrypted value.
6136 /// In format: projects/*/locations/*/keyRings/*/cryptoKeys/*
6137 pub kms_key_name: std::string::String,
6138
6139 /// Map of environment variable name to its encrypted value.
6140 ///
6141 /// Secret environment variables must be unique across all of a build's
6142 /// secrets, and must be used by at least one build step. Values can be at most
6143 /// 64 KB in size. There can be at most 100 secret values across all of a
6144 /// build's secrets.
6145 pub env_map: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6146
6147 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6148}
6149
6150impl InlineSecret {
6151 pub fn new() -> Self {
6152 std::default::Default::default()
6153 }
6154
6155 /// Sets the value of [kms_key_name][crate::model::InlineSecret::kms_key_name].
6156 ///
6157 /// # Example
6158 /// ```ignore,no_run
6159 /// # use google_cloud_build_v1::model::InlineSecret;
6160 /// let x = InlineSecret::new().set_kms_key_name("example");
6161 /// ```
6162 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6163 self.kms_key_name = v.into();
6164 self
6165 }
6166
6167 /// Sets the value of [env_map][crate::model::InlineSecret::env_map].
6168 ///
6169 /// # Example
6170 /// ```ignore,no_run
6171 /// # use google_cloud_build_v1::model::InlineSecret;
6172 /// let x = InlineSecret::new().set_env_map([
6173 /// ("key0", bytes::Bytes::from_static(b"abc")),
6174 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6175 /// ]);
6176 /// ```
6177 pub fn set_env_map<T, K, V>(mut self, v: T) -> Self
6178 where
6179 T: std::iter::IntoIterator<Item = (K, V)>,
6180 K: std::convert::Into<std::string::String>,
6181 V: std::convert::Into<::bytes::Bytes>,
6182 {
6183 use std::iter::Iterator;
6184 self.env_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6185 self
6186 }
6187}
6188
6189impl wkt::message::Message for InlineSecret {
6190 fn typename() -> &'static str {
6191 "type.googleapis.com/google.devtools.cloudbuild.v1.InlineSecret"
6192 }
6193}
6194
6195/// Pairs a secret environment variable with a SecretVersion in Secret Manager.
6196#[derive(Clone, Default, PartialEq)]
6197#[non_exhaustive]
6198pub struct SecretManagerSecret {
6199 /// Resource name of the SecretVersion. In format:
6200 /// projects/*/secrets/*/versions/*
6201 pub version_name: std::string::String,
6202
6203 /// Environment variable name to associate with the secret.
6204 /// Secret environment variables must be unique across all of a build's
6205 /// secrets, and must be used by at least one build step.
6206 pub env: std::string::String,
6207
6208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6209}
6210
6211impl SecretManagerSecret {
6212 pub fn new() -> Self {
6213 std::default::Default::default()
6214 }
6215
6216 /// Sets the value of [version_name][crate::model::SecretManagerSecret::version_name].
6217 ///
6218 /// # Example
6219 /// ```ignore,no_run
6220 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6221 /// let x = SecretManagerSecret::new().set_version_name("example");
6222 /// ```
6223 pub fn set_version_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6224 self.version_name = v.into();
6225 self
6226 }
6227
6228 /// Sets the value of [env][crate::model::SecretManagerSecret::env].
6229 ///
6230 /// # Example
6231 /// ```ignore,no_run
6232 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6233 /// let x = SecretManagerSecret::new().set_env("example");
6234 /// ```
6235 pub fn set_env<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6236 self.env = v.into();
6237 self
6238 }
6239}
6240
6241impl wkt::message::Message for SecretManagerSecret {
6242 fn typename() -> &'static str {
6243 "type.googleapis.com/google.devtools.cloudbuild.v1.SecretManagerSecret"
6244 }
6245}
6246
6247/// Pairs a set of secret environment variables containing encrypted
6248/// values with the Cloud KMS key to use to decrypt the value.
6249/// Note: Use `kmsKeyName` with `available_secrets` instead of using
6250/// `kmsKeyName` with `secret`. For instructions see:
6251/// <https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials>.
6252#[derive(Clone, Default, PartialEq)]
6253#[non_exhaustive]
6254pub struct Secret {
6255 /// Cloud KMS key name to use to decrypt these envs.
6256 pub kms_key_name: std::string::String,
6257
6258 /// Map of environment variable name to its encrypted value.
6259 ///
6260 /// Secret environment variables must be unique across all of a build's
6261 /// secrets, and must be used by at least one build step. Values can be at most
6262 /// 64 KB in size. There can be at most 100 secret values across all of a
6263 /// build's secrets.
6264 pub secret_env: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6265
6266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6267}
6268
6269impl Secret {
6270 pub fn new() -> Self {
6271 std::default::Default::default()
6272 }
6273
6274 /// Sets the value of [kms_key_name][crate::model::Secret::kms_key_name].
6275 ///
6276 /// # Example
6277 /// ```ignore,no_run
6278 /// # use google_cloud_build_v1::model::Secret;
6279 /// let x = Secret::new().set_kms_key_name("example");
6280 /// ```
6281 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6282 self.kms_key_name = v.into();
6283 self
6284 }
6285
6286 /// Sets the value of [secret_env][crate::model::Secret::secret_env].
6287 ///
6288 /// # Example
6289 /// ```ignore,no_run
6290 /// # use google_cloud_build_v1::model::Secret;
6291 /// let x = Secret::new().set_secret_env([
6292 /// ("key0", bytes::Bytes::from_static(b"abc")),
6293 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6294 /// ]);
6295 /// ```
6296 pub fn set_secret_env<T, K, V>(mut self, v: T) -> Self
6297 where
6298 T: std::iter::IntoIterator<Item = (K, V)>,
6299 K: std::convert::Into<std::string::String>,
6300 V: std::convert::Into<::bytes::Bytes>,
6301 {
6302 use std::iter::Iterator;
6303 self.secret_env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6304 self
6305 }
6306}
6307
6308impl wkt::message::Message for Secret {
6309 fn typename() -> &'static str {
6310 "type.googleapis.com/google.devtools.cloudbuild.v1.Secret"
6311 }
6312}
6313
6314/// Request to create a new build.
6315#[derive(Clone, Default, PartialEq)]
6316#[non_exhaustive]
6317pub struct CreateBuildRequest {
6318 /// The parent resource where this build will be created.
6319 /// Format: `projects/{project}/locations/{location}`
6320 pub parent: std::string::String,
6321
6322 /// Required. ID of the project.
6323 pub project_id: std::string::String,
6324
6325 /// Required. Build resource to create.
6326 pub build: std::option::Option<crate::model::Build>,
6327
6328 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6329}
6330
6331impl CreateBuildRequest {
6332 pub fn new() -> Self {
6333 std::default::Default::default()
6334 }
6335
6336 /// Sets the value of [parent][crate::model::CreateBuildRequest::parent].
6337 ///
6338 /// # Example
6339 /// ```ignore,no_run
6340 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6341 /// let x = CreateBuildRequest::new().set_parent("example");
6342 /// ```
6343 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6344 self.parent = v.into();
6345 self
6346 }
6347
6348 /// Sets the value of [project_id][crate::model::CreateBuildRequest::project_id].
6349 ///
6350 /// # Example
6351 /// ```ignore,no_run
6352 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6353 /// let x = CreateBuildRequest::new().set_project_id("example");
6354 /// ```
6355 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6356 self.project_id = v.into();
6357 self
6358 }
6359
6360 /// Sets the value of [build][crate::model::CreateBuildRequest::build].
6361 ///
6362 /// # Example
6363 /// ```ignore,no_run
6364 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6365 /// use google_cloud_build_v1::model::Build;
6366 /// let x = CreateBuildRequest::new().set_build(Build::default()/* use setters */);
6367 /// ```
6368 pub fn set_build<T>(mut self, v: T) -> Self
6369 where
6370 T: std::convert::Into<crate::model::Build>,
6371 {
6372 self.build = std::option::Option::Some(v.into());
6373 self
6374 }
6375
6376 /// Sets or clears the value of [build][crate::model::CreateBuildRequest::build].
6377 ///
6378 /// # Example
6379 /// ```ignore,no_run
6380 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6381 /// use google_cloud_build_v1::model::Build;
6382 /// let x = CreateBuildRequest::new().set_or_clear_build(Some(Build::default()/* use setters */));
6383 /// let x = CreateBuildRequest::new().set_or_clear_build(None::<Build>);
6384 /// ```
6385 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
6386 where
6387 T: std::convert::Into<crate::model::Build>,
6388 {
6389 self.build = v.map(|x| x.into());
6390 self
6391 }
6392}
6393
6394impl wkt::message::Message for CreateBuildRequest {
6395 fn typename() -> &'static str {
6396 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildRequest"
6397 }
6398}
6399
6400/// Request to get a build.
6401#[derive(Clone, Default, PartialEq)]
6402#[non_exhaustive]
6403pub struct GetBuildRequest {
6404 /// The name of the `Build` to retrieve.
6405 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6406 pub name: std::string::String,
6407
6408 /// Required. ID of the project.
6409 pub project_id: std::string::String,
6410
6411 /// Required. ID of the build.
6412 pub id: std::string::String,
6413
6414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6415}
6416
6417impl GetBuildRequest {
6418 pub fn new() -> Self {
6419 std::default::Default::default()
6420 }
6421
6422 /// Sets the value of [name][crate::model::GetBuildRequest::name].
6423 ///
6424 /// # Example
6425 /// ```ignore,no_run
6426 /// # use google_cloud_build_v1::model::GetBuildRequest;
6427 /// let x = GetBuildRequest::new().set_name("example");
6428 /// ```
6429 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6430 self.name = v.into();
6431 self
6432 }
6433
6434 /// Sets the value of [project_id][crate::model::GetBuildRequest::project_id].
6435 ///
6436 /// # Example
6437 /// ```ignore,no_run
6438 /// # use google_cloud_build_v1::model::GetBuildRequest;
6439 /// let x = GetBuildRequest::new().set_project_id("example");
6440 /// ```
6441 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6442 self.project_id = v.into();
6443 self
6444 }
6445
6446 /// Sets the value of [id][crate::model::GetBuildRequest::id].
6447 ///
6448 /// # Example
6449 /// ```ignore,no_run
6450 /// # use google_cloud_build_v1::model::GetBuildRequest;
6451 /// let x = GetBuildRequest::new().set_id("example");
6452 /// ```
6453 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6454 self.id = v.into();
6455 self
6456 }
6457}
6458
6459impl wkt::message::Message for GetBuildRequest {
6460 fn typename() -> &'static str {
6461 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildRequest"
6462 }
6463}
6464
6465/// Request to list builds.
6466#[derive(Clone, Default, PartialEq)]
6467#[non_exhaustive]
6468pub struct ListBuildsRequest {
6469 /// The parent of the collection of `Builds`.
6470 /// Format: `projects/{project}/locations/{location}`
6471 pub parent: std::string::String,
6472
6473 /// Required. ID of the project.
6474 pub project_id: std::string::String,
6475
6476 /// Number of results to return in the list.
6477 pub page_size: i32,
6478
6479 /// The page token for the next page of Builds.
6480 ///
6481 /// If unspecified, the first page of results is returned.
6482 ///
6483 /// If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
6484 /// In this case, the token should be discarded, and pagination should be
6485 /// restarted from the first page of results.
6486 ///
6487 /// See <https://google.aip.dev/158> for more.
6488 pub page_token: std::string::String,
6489
6490 /// The raw filter text to constrain the results.
6491 pub filter: std::string::String,
6492
6493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6494}
6495
6496impl ListBuildsRequest {
6497 pub fn new() -> Self {
6498 std::default::Default::default()
6499 }
6500
6501 /// Sets the value of [parent][crate::model::ListBuildsRequest::parent].
6502 ///
6503 /// # Example
6504 /// ```ignore,no_run
6505 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6506 /// let x = ListBuildsRequest::new().set_parent("example");
6507 /// ```
6508 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6509 self.parent = v.into();
6510 self
6511 }
6512
6513 /// Sets the value of [project_id][crate::model::ListBuildsRequest::project_id].
6514 ///
6515 /// # Example
6516 /// ```ignore,no_run
6517 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6518 /// let x = ListBuildsRequest::new().set_project_id("example");
6519 /// ```
6520 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6521 self.project_id = v.into();
6522 self
6523 }
6524
6525 /// Sets the value of [page_size][crate::model::ListBuildsRequest::page_size].
6526 ///
6527 /// # Example
6528 /// ```ignore,no_run
6529 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6530 /// let x = ListBuildsRequest::new().set_page_size(42);
6531 /// ```
6532 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6533 self.page_size = v.into();
6534 self
6535 }
6536
6537 /// Sets the value of [page_token][crate::model::ListBuildsRequest::page_token].
6538 ///
6539 /// # Example
6540 /// ```ignore,no_run
6541 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6542 /// let x = ListBuildsRequest::new().set_page_token("example");
6543 /// ```
6544 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6545 self.page_token = v.into();
6546 self
6547 }
6548
6549 /// Sets the value of [filter][crate::model::ListBuildsRequest::filter].
6550 ///
6551 /// # Example
6552 /// ```ignore,no_run
6553 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6554 /// let x = ListBuildsRequest::new().set_filter("example");
6555 /// ```
6556 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6557 self.filter = v.into();
6558 self
6559 }
6560}
6561
6562impl wkt::message::Message for ListBuildsRequest {
6563 fn typename() -> &'static str {
6564 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsRequest"
6565 }
6566}
6567
6568/// Response including listed builds.
6569#[derive(Clone, Default, PartialEq)]
6570#[non_exhaustive]
6571pub struct ListBuildsResponse {
6572 /// Builds will be sorted by `create_time`, descending.
6573 pub builds: std::vec::Vec<crate::model::Build>,
6574
6575 /// Token to receive the next page of results.
6576 /// This will be absent if the end of the response list has been reached.
6577 pub next_page_token: std::string::String,
6578
6579 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6580}
6581
6582impl ListBuildsResponse {
6583 pub fn new() -> Self {
6584 std::default::Default::default()
6585 }
6586
6587 /// Sets the value of [builds][crate::model::ListBuildsResponse::builds].
6588 ///
6589 /// # Example
6590 /// ```ignore,no_run
6591 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6592 /// use google_cloud_build_v1::model::Build;
6593 /// let x = ListBuildsResponse::new()
6594 /// .set_builds([
6595 /// Build::default()/* use setters */,
6596 /// Build::default()/* use (different) setters */,
6597 /// ]);
6598 /// ```
6599 pub fn set_builds<T, V>(mut self, v: T) -> Self
6600 where
6601 T: std::iter::IntoIterator<Item = V>,
6602 V: std::convert::Into<crate::model::Build>,
6603 {
6604 use std::iter::Iterator;
6605 self.builds = v.into_iter().map(|i| i.into()).collect();
6606 self
6607 }
6608
6609 /// Sets the value of [next_page_token][crate::model::ListBuildsResponse::next_page_token].
6610 ///
6611 /// # Example
6612 /// ```ignore,no_run
6613 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6614 /// let x = ListBuildsResponse::new().set_next_page_token("example");
6615 /// ```
6616 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6617 self.next_page_token = v.into();
6618 self
6619 }
6620}
6621
6622impl wkt::message::Message for ListBuildsResponse {
6623 fn typename() -> &'static str {
6624 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsResponse"
6625 }
6626}
6627
6628#[doc(hidden)]
6629impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildsResponse {
6630 type PageItem = crate::model::Build;
6631
6632 fn items(self) -> std::vec::Vec<Self::PageItem> {
6633 self.builds
6634 }
6635
6636 fn next_page_token(&self) -> std::string::String {
6637 use std::clone::Clone;
6638 self.next_page_token.clone()
6639 }
6640}
6641
6642/// Request to cancel an ongoing build.
6643#[derive(Clone, Default, PartialEq)]
6644#[non_exhaustive]
6645pub struct CancelBuildRequest {
6646 /// The name of the `Build` to cancel.
6647 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6648 pub name: std::string::String,
6649
6650 /// Required. ID of the project.
6651 pub project_id: std::string::String,
6652
6653 /// Required. ID of the build.
6654 pub id: std::string::String,
6655
6656 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6657}
6658
6659impl CancelBuildRequest {
6660 pub fn new() -> Self {
6661 std::default::Default::default()
6662 }
6663
6664 /// Sets the value of [name][crate::model::CancelBuildRequest::name].
6665 ///
6666 /// # Example
6667 /// ```ignore,no_run
6668 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6669 /// let x = CancelBuildRequest::new().set_name("example");
6670 /// ```
6671 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6672 self.name = v.into();
6673 self
6674 }
6675
6676 /// Sets the value of [project_id][crate::model::CancelBuildRequest::project_id].
6677 ///
6678 /// # Example
6679 /// ```ignore,no_run
6680 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6681 /// let x = CancelBuildRequest::new().set_project_id("example");
6682 /// ```
6683 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6684 self.project_id = v.into();
6685 self
6686 }
6687
6688 /// Sets the value of [id][crate::model::CancelBuildRequest::id].
6689 ///
6690 /// # Example
6691 /// ```ignore,no_run
6692 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6693 /// let x = CancelBuildRequest::new().set_id("example");
6694 /// ```
6695 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6696 self.id = v.into();
6697 self
6698 }
6699}
6700
6701impl wkt::message::Message for CancelBuildRequest {
6702 fn typename() -> &'static str {
6703 "type.googleapis.com/google.devtools.cloudbuild.v1.CancelBuildRequest"
6704 }
6705}
6706
6707/// Request to approve or reject a pending build.
6708#[derive(Clone, Default, PartialEq)]
6709#[non_exhaustive]
6710pub struct ApproveBuildRequest {
6711 /// Required. Name of the target build.
6712 /// For example: "projects/{$project_id}/builds/{$build_id}"
6713 pub name: std::string::String,
6714
6715 /// Approval decision and metadata.
6716 pub approval_result: std::option::Option<crate::model::ApprovalResult>,
6717
6718 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6719}
6720
6721impl ApproveBuildRequest {
6722 pub fn new() -> Self {
6723 std::default::Default::default()
6724 }
6725
6726 /// Sets the value of [name][crate::model::ApproveBuildRequest::name].
6727 ///
6728 /// # Example
6729 /// ```ignore,no_run
6730 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6731 /// let x = ApproveBuildRequest::new().set_name("example");
6732 /// ```
6733 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6734 self.name = v.into();
6735 self
6736 }
6737
6738 /// Sets the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6739 ///
6740 /// # Example
6741 /// ```ignore,no_run
6742 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6743 /// use google_cloud_build_v1::model::ApprovalResult;
6744 /// let x = ApproveBuildRequest::new().set_approval_result(ApprovalResult::default()/* use setters */);
6745 /// ```
6746 pub fn set_approval_result<T>(mut self, v: T) -> Self
6747 where
6748 T: std::convert::Into<crate::model::ApprovalResult>,
6749 {
6750 self.approval_result = std::option::Option::Some(v.into());
6751 self
6752 }
6753
6754 /// Sets or clears the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6755 ///
6756 /// # Example
6757 /// ```ignore,no_run
6758 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6759 /// use google_cloud_build_v1::model::ApprovalResult;
6760 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(Some(ApprovalResult::default()/* use setters */));
6761 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(None::<ApprovalResult>);
6762 /// ```
6763 pub fn set_or_clear_approval_result<T>(mut self, v: std::option::Option<T>) -> Self
6764 where
6765 T: std::convert::Into<crate::model::ApprovalResult>,
6766 {
6767 self.approval_result = v.map(|x| x.into());
6768 self
6769 }
6770}
6771
6772impl wkt::message::Message for ApproveBuildRequest {
6773 fn typename() -> &'static str {
6774 "type.googleapis.com/google.devtools.cloudbuild.v1.ApproveBuildRequest"
6775 }
6776}
6777
6778/// BuildApproval describes a build's approval configuration, state, and
6779/// result.
6780#[derive(Clone, Default, PartialEq)]
6781#[non_exhaustive]
6782pub struct BuildApproval {
6783 /// Output only. The state of this build's approval.
6784 pub state: crate::model::build_approval::State,
6785
6786 /// Output only. Configuration for manual approval of this build.
6787 pub config: std::option::Option<crate::model::ApprovalConfig>,
6788
6789 /// Output only. Result of manual approval for this Build.
6790 pub result: std::option::Option<crate::model::ApprovalResult>,
6791
6792 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6793}
6794
6795impl BuildApproval {
6796 pub fn new() -> Self {
6797 std::default::Default::default()
6798 }
6799
6800 /// Sets the value of [state][crate::model::BuildApproval::state].
6801 ///
6802 /// # Example
6803 /// ```ignore,no_run
6804 /// # use google_cloud_build_v1::model::BuildApproval;
6805 /// use google_cloud_build_v1::model::build_approval::State;
6806 /// let x0 = BuildApproval::new().set_state(State::Pending);
6807 /// let x1 = BuildApproval::new().set_state(State::Approved);
6808 /// let x2 = BuildApproval::new().set_state(State::Rejected);
6809 /// ```
6810 pub fn set_state<T: std::convert::Into<crate::model::build_approval::State>>(
6811 mut self,
6812 v: T,
6813 ) -> Self {
6814 self.state = v.into();
6815 self
6816 }
6817
6818 /// Sets the value of [config][crate::model::BuildApproval::config].
6819 ///
6820 /// # Example
6821 /// ```ignore,no_run
6822 /// # use google_cloud_build_v1::model::BuildApproval;
6823 /// use google_cloud_build_v1::model::ApprovalConfig;
6824 /// let x = BuildApproval::new().set_config(ApprovalConfig::default()/* use setters */);
6825 /// ```
6826 pub fn set_config<T>(mut self, v: T) -> Self
6827 where
6828 T: std::convert::Into<crate::model::ApprovalConfig>,
6829 {
6830 self.config = std::option::Option::Some(v.into());
6831 self
6832 }
6833
6834 /// Sets or clears the value of [config][crate::model::BuildApproval::config].
6835 ///
6836 /// # Example
6837 /// ```ignore,no_run
6838 /// # use google_cloud_build_v1::model::BuildApproval;
6839 /// use google_cloud_build_v1::model::ApprovalConfig;
6840 /// let x = BuildApproval::new().set_or_clear_config(Some(ApprovalConfig::default()/* use setters */));
6841 /// let x = BuildApproval::new().set_or_clear_config(None::<ApprovalConfig>);
6842 /// ```
6843 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
6844 where
6845 T: std::convert::Into<crate::model::ApprovalConfig>,
6846 {
6847 self.config = v.map(|x| x.into());
6848 self
6849 }
6850
6851 /// Sets the value of [result][crate::model::BuildApproval::result].
6852 ///
6853 /// # Example
6854 /// ```ignore,no_run
6855 /// # use google_cloud_build_v1::model::BuildApproval;
6856 /// use google_cloud_build_v1::model::ApprovalResult;
6857 /// let x = BuildApproval::new().set_result(ApprovalResult::default()/* use setters */);
6858 /// ```
6859 pub fn set_result<T>(mut self, v: T) -> Self
6860 where
6861 T: std::convert::Into<crate::model::ApprovalResult>,
6862 {
6863 self.result = std::option::Option::Some(v.into());
6864 self
6865 }
6866
6867 /// Sets or clears the value of [result][crate::model::BuildApproval::result].
6868 ///
6869 /// # Example
6870 /// ```ignore,no_run
6871 /// # use google_cloud_build_v1::model::BuildApproval;
6872 /// use google_cloud_build_v1::model::ApprovalResult;
6873 /// let x = BuildApproval::new().set_or_clear_result(Some(ApprovalResult::default()/* use setters */));
6874 /// let x = BuildApproval::new().set_or_clear_result(None::<ApprovalResult>);
6875 /// ```
6876 pub fn set_or_clear_result<T>(mut self, v: std::option::Option<T>) -> Self
6877 where
6878 T: std::convert::Into<crate::model::ApprovalResult>,
6879 {
6880 self.result = v.map(|x| x.into());
6881 self
6882 }
6883}
6884
6885impl wkt::message::Message for BuildApproval {
6886 fn typename() -> &'static str {
6887 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildApproval"
6888 }
6889}
6890
6891/// Defines additional types related to [BuildApproval].
6892pub mod build_approval {
6893 #[allow(unused_imports)]
6894 use super::*;
6895
6896 /// Specifies the current state of a build's approval.
6897 ///
6898 /// # Working with unknown values
6899 ///
6900 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6901 /// additional enum variants at any time. Adding new variants is not considered
6902 /// a breaking change. Applications should write their code in anticipation of:
6903 ///
6904 /// - New values appearing in future releases of the client library, **and**
6905 /// - New values received dynamically, without application changes.
6906 ///
6907 /// Please consult the [Working with enums] section in the user guide for some
6908 /// guidelines.
6909 ///
6910 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6911 #[derive(Clone, Debug, PartialEq)]
6912 #[non_exhaustive]
6913 pub enum State {
6914 /// Default enum type. This should not be used.
6915 Unspecified,
6916 /// Build approval is pending.
6917 Pending,
6918 /// Build approval has been approved.
6919 Approved,
6920 /// Build approval has been rejected.
6921 Rejected,
6922 /// Build was cancelled while it was still pending approval.
6923 Cancelled,
6924 /// If set, the enum was initialized with an unknown value.
6925 ///
6926 /// Applications can examine the value using [State::value] or
6927 /// [State::name].
6928 UnknownValue(state::UnknownValue),
6929 }
6930
6931 #[doc(hidden)]
6932 pub mod state {
6933 #[allow(unused_imports)]
6934 use super::*;
6935 #[derive(Clone, Debug, PartialEq)]
6936 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6937 }
6938
6939 impl State {
6940 /// Gets the enum value.
6941 ///
6942 /// Returns `None` if the enum contains an unknown value deserialized from
6943 /// the string representation of enums.
6944 pub fn value(&self) -> std::option::Option<i32> {
6945 match self {
6946 Self::Unspecified => std::option::Option::Some(0),
6947 Self::Pending => std::option::Option::Some(1),
6948 Self::Approved => std::option::Option::Some(2),
6949 Self::Rejected => std::option::Option::Some(3),
6950 Self::Cancelled => std::option::Option::Some(5),
6951 Self::UnknownValue(u) => u.0.value(),
6952 }
6953 }
6954
6955 /// Gets the enum value as a string.
6956 ///
6957 /// Returns `None` if the enum contains an unknown value deserialized from
6958 /// the integer representation of enums.
6959 pub fn name(&self) -> std::option::Option<&str> {
6960 match self {
6961 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6962 Self::Pending => std::option::Option::Some("PENDING"),
6963 Self::Approved => std::option::Option::Some("APPROVED"),
6964 Self::Rejected => std::option::Option::Some("REJECTED"),
6965 Self::Cancelled => std::option::Option::Some("CANCELLED"),
6966 Self::UnknownValue(u) => u.0.name(),
6967 }
6968 }
6969 }
6970
6971 impl std::default::Default for State {
6972 fn default() -> Self {
6973 use std::convert::From;
6974 Self::from(0)
6975 }
6976 }
6977
6978 impl std::fmt::Display for State {
6979 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6980 wkt::internal::display_enum(f, self.name(), self.value())
6981 }
6982 }
6983
6984 impl std::convert::From<i32> for State {
6985 fn from(value: i32) -> Self {
6986 match value {
6987 0 => Self::Unspecified,
6988 1 => Self::Pending,
6989 2 => Self::Approved,
6990 3 => Self::Rejected,
6991 5 => Self::Cancelled,
6992 _ => Self::UnknownValue(state::UnknownValue(
6993 wkt::internal::UnknownEnumValue::Integer(value),
6994 )),
6995 }
6996 }
6997 }
6998
6999 impl std::convert::From<&str> for State {
7000 fn from(value: &str) -> Self {
7001 use std::string::ToString;
7002 match value {
7003 "STATE_UNSPECIFIED" => Self::Unspecified,
7004 "PENDING" => Self::Pending,
7005 "APPROVED" => Self::Approved,
7006 "REJECTED" => Self::Rejected,
7007 "CANCELLED" => Self::Cancelled,
7008 _ => Self::UnknownValue(state::UnknownValue(
7009 wkt::internal::UnknownEnumValue::String(value.to_string()),
7010 )),
7011 }
7012 }
7013 }
7014
7015 impl serde::ser::Serialize for State {
7016 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7017 where
7018 S: serde::Serializer,
7019 {
7020 match self {
7021 Self::Unspecified => serializer.serialize_i32(0),
7022 Self::Pending => serializer.serialize_i32(1),
7023 Self::Approved => serializer.serialize_i32(2),
7024 Self::Rejected => serializer.serialize_i32(3),
7025 Self::Cancelled => serializer.serialize_i32(5),
7026 Self::UnknownValue(u) => u.0.serialize(serializer),
7027 }
7028 }
7029 }
7030
7031 impl<'de> serde::de::Deserialize<'de> for State {
7032 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7033 where
7034 D: serde::Deserializer<'de>,
7035 {
7036 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7037 ".google.devtools.cloudbuild.v1.BuildApproval.State",
7038 ))
7039 }
7040 }
7041}
7042
7043/// ApprovalConfig describes configuration for manual approval of a build.
7044#[derive(Clone, Default, PartialEq)]
7045#[non_exhaustive]
7046pub struct ApprovalConfig {
7047 /// Whether or not approval is needed. If this is set on a build, it will
7048 /// become pending when created, and will need to be explicitly approved
7049 /// to start.
7050 pub approval_required: bool,
7051
7052 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7053}
7054
7055impl ApprovalConfig {
7056 pub fn new() -> Self {
7057 std::default::Default::default()
7058 }
7059
7060 /// Sets the value of [approval_required][crate::model::ApprovalConfig::approval_required].
7061 ///
7062 /// # Example
7063 /// ```ignore,no_run
7064 /// # use google_cloud_build_v1::model::ApprovalConfig;
7065 /// let x = ApprovalConfig::new().set_approval_required(true);
7066 /// ```
7067 pub fn set_approval_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7068 self.approval_required = v.into();
7069 self
7070 }
7071}
7072
7073impl wkt::message::Message for ApprovalConfig {
7074 fn typename() -> &'static str {
7075 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalConfig"
7076 }
7077}
7078
7079/// ApprovalResult describes the decision and associated metadata of a manual
7080/// approval of a build.
7081#[derive(Clone, Default, PartialEq)]
7082#[non_exhaustive]
7083pub struct ApprovalResult {
7084 /// Output only. Email of the user that called the ApproveBuild API to
7085 /// approve or reject a build at the time that the API was called.
7086 pub approver_account: std::string::String,
7087
7088 /// Output only. The time when the approval decision was made.
7089 pub approval_time: std::option::Option<wkt::Timestamp>,
7090
7091 /// Required. The decision of this manual approval.
7092 pub decision: crate::model::approval_result::Decision,
7093
7094 /// Optional. An optional comment for this manual approval result.
7095 pub comment: std::string::String,
7096
7097 /// Optional. An optional URL tied to this manual approval result. This field
7098 /// is essentially the same as comment, except that it will be rendered by the
7099 /// UI differently. An example use case is a link to an external job that
7100 /// approved this Build.
7101 pub url: std::string::String,
7102
7103 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7104}
7105
7106impl ApprovalResult {
7107 pub fn new() -> Self {
7108 std::default::Default::default()
7109 }
7110
7111 /// Sets the value of [approver_account][crate::model::ApprovalResult::approver_account].
7112 ///
7113 /// # Example
7114 /// ```ignore,no_run
7115 /// # use google_cloud_build_v1::model::ApprovalResult;
7116 /// let x = ApprovalResult::new().set_approver_account("example");
7117 /// ```
7118 pub fn set_approver_account<T: std::convert::Into<std::string::String>>(
7119 mut self,
7120 v: T,
7121 ) -> Self {
7122 self.approver_account = v.into();
7123 self
7124 }
7125
7126 /// Sets the value of [approval_time][crate::model::ApprovalResult::approval_time].
7127 ///
7128 /// # Example
7129 /// ```ignore,no_run
7130 /// # use google_cloud_build_v1::model::ApprovalResult;
7131 /// use wkt::Timestamp;
7132 /// let x = ApprovalResult::new().set_approval_time(Timestamp::default()/* use setters */);
7133 /// ```
7134 pub fn set_approval_time<T>(mut self, v: T) -> Self
7135 where
7136 T: std::convert::Into<wkt::Timestamp>,
7137 {
7138 self.approval_time = std::option::Option::Some(v.into());
7139 self
7140 }
7141
7142 /// Sets or clears the value of [approval_time][crate::model::ApprovalResult::approval_time].
7143 ///
7144 /// # Example
7145 /// ```ignore,no_run
7146 /// # use google_cloud_build_v1::model::ApprovalResult;
7147 /// use wkt::Timestamp;
7148 /// let x = ApprovalResult::new().set_or_clear_approval_time(Some(Timestamp::default()/* use setters */));
7149 /// let x = ApprovalResult::new().set_or_clear_approval_time(None::<Timestamp>);
7150 /// ```
7151 pub fn set_or_clear_approval_time<T>(mut self, v: std::option::Option<T>) -> Self
7152 where
7153 T: std::convert::Into<wkt::Timestamp>,
7154 {
7155 self.approval_time = v.map(|x| x.into());
7156 self
7157 }
7158
7159 /// Sets the value of [decision][crate::model::ApprovalResult::decision].
7160 ///
7161 /// # Example
7162 /// ```ignore,no_run
7163 /// # use google_cloud_build_v1::model::ApprovalResult;
7164 /// use google_cloud_build_v1::model::approval_result::Decision;
7165 /// let x0 = ApprovalResult::new().set_decision(Decision::Approved);
7166 /// let x1 = ApprovalResult::new().set_decision(Decision::Rejected);
7167 /// ```
7168 pub fn set_decision<T: std::convert::Into<crate::model::approval_result::Decision>>(
7169 mut self,
7170 v: T,
7171 ) -> Self {
7172 self.decision = v.into();
7173 self
7174 }
7175
7176 /// Sets the value of [comment][crate::model::ApprovalResult::comment].
7177 ///
7178 /// # Example
7179 /// ```ignore,no_run
7180 /// # use google_cloud_build_v1::model::ApprovalResult;
7181 /// let x = ApprovalResult::new().set_comment("example");
7182 /// ```
7183 pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7184 self.comment = v.into();
7185 self
7186 }
7187
7188 /// Sets the value of [url][crate::model::ApprovalResult::url].
7189 ///
7190 /// # Example
7191 /// ```ignore,no_run
7192 /// # use google_cloud_build_v1::model::ApprovalResult;
7193 /// let x = ApprovalResult::new().set_url("example");
7194 /// ```
7195 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7196 self.url = v.into();
7197 self
7198 }
7199}
7200
7201impl wkt::message::Message for ApprovalResult {
7202 fn typename() -> &'static str {
7203 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalResult"
7204 }
7205}
7206
7207/// Defines additional types related to [ApprovalResult].
7208pub mod approval_result {
7209 #[allow(unused_imports)]
7210 use super::*;
7211
7212 /// Specifies whether or not this manual approval result is to approve
7213 /// or reject a build.
7214 ///
7215 /// # Working with unknown values
7216 ///
7217 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7218 /// additional enum variants at any time. Adding new variants is not considered
7219 /// a breaking change. Applications should write their code in anticipation of:
7220 ///
7221 /// - New values appearing in future releases of the client library, **and**
7222 /// - New values received dynamically, without application changes.
7223 ///
7224 /// Please consult the [Working with enums] section in the user guide for some
7225 /// guidelines.
7226 ///
7227 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7228 #[derive(Clone, Debug, PartialEq)]
7229 #[non_exhaustive]
7230 pub enum Decision {
7231 /// Default enum type. This should not be used.
7232 Unspecified,
7233 /// Build is approved.
7234 Approved,
7235 /// Build is rejected.
7236 Rejected,
7237 /// If set, the enum was initialized with an unknown value.
7238 ///
7239 /// Applications can examine the value using [Decision::value] or
7240 /// [Decision::name].
7241 UnknownValue(decision::UnknownValue),
7242 }
7243
7244 #[doc(hidden)]
7245 pub mod decision {
7246 #[allow(unused_imports)]
7247 use super::*;
7248 #[derive(Clone, Debug, PartialEq)]
7249 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7250 }
7251
7252 impl Decision {
7253 /// Gets the enum value.
7254 ///
7255 /// Returns `None` if the enum contains an unknown value deserialized from
7256 /// the string representation of enums.
7257 pub fn value(&self) -> std::option::Option<i32> {
7258 match self {
7259 Self::Unspecified => std::option::Option::Some(0),
7260 Self::Approved => std::option::Option::Some(1),
7261 Self::Rejected => std::option::Option::Some(2),
7262 Self::UnknownValue(u) => u.0.value(),
7263 }
7264 }
7265
7266 /// Gets the enum value as a string.
7267 ///
7268 /// Returns `None` if the enum contains an unknown value deserialized from
7269 /// the integer representation of enums.
7270 pub fn name(&self) -> std::option::Option<&str> {
7271 match self {
7272 Self::Unspecified => std::option::Option::Some("DECISION_UNSPECIFIED"),
7273 Self::Approved => std::option::Option::Some("APPROVED"),
7274 Self::Rejected => std::option::Option::Some("REJECTED"),
7275 Self::UnknownValue(u) => u.0.name(),
7276 }
7277 }
7278 }
7279
7280 impl std::default::Default for Decision {
7281 fn default() -> Self {
7282 use std::convert::From;
7283 Self::from(0)
7284 }
7285 }
7286
7287 impl std::fmt::Display for Decision {
7288 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7289 wkt::internal::display_enum(f, self.name(), self.value())
7290 }
7291 }
7292
7293 impl std::convert::From<i32> for Decision {
7294 fn from(value: i32) -> Self {
7295 match value {
7296 0 => Self::Unspecified,
7297 1 => Self::Approved,
7298 2 => Self::Rejected,
7299 _ => Self::UnknownValue(decision::UnknownValue(
7300 wkt::internal::UnknownEnumValue::Integer(value),
7301 )),
7302 }
7303 }
7304 }
7305
7306 impl std::convert::From<&str> for Decision {
7307 fn from(value: &str) -> Self {
7308 use std::string::ToString;
7309 match value {
7310 "DECISION_UNSPECIFIED" => Self::Unspecified,
7311 "APPROVED" => Self::Approved,
7312 "REJECTED" => Self::Rejected,
7313 _ => Self::UnknownValue(decision::UnknownValue(
7314 wkt::internal::UnknownEnumValue::String(value.to_string()),
7315 )),
7316 }
7317 }
7318 }
7319
7320 impl serde::ser::Serialize for Decision {
7321 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7322 where
7323 S: serde::Serializer,
7324 {
7325 match self {
7326 Self::Unspecified => serializer.serialize_i32(0),
7327 Self::Approved => serializer.serialize_i32(1),
7328 Self::Rejected => serializer.serialize_i32(2),
7329 Self::UnknownValue(u) => u.0.serialize(serializer),
7330 }
7331 }
7332 }
7333
7334 impl<'de> serde::de::Deserialize<'de> for Decision {
7335 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7336 where
7337 D: serde::Deserializer<'de>,
7338 {
7339 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Decision>::new(
7340 ".google.devtools.cloudbuild.v1.ApprovalResult.Decision",
7341 ))
7342 }
7343 }
7344}
7345
7346/// GitRepoSource describes a repo and ref of a code repository.
7347#[derive(Clone, Default, PartialEq)]
7348#[non_exhaustive]
7349pub struct GitRepoSource {
7350 /// The URI of the repo (e.g. <https://github.com/user/repo.git>).
7351 /// Either `uri` or `repository` can be specified and is required.
7352 pub uri: std::string::String,
7353
7354 /// The branch or tag to use. Must start with "refs/" (required).
7355 pub r#ref: std::string::String,
7356
7357 /// See RepoType below.
7358 pub repo_type: crate::model::git_file_source::RepoType,
7359
7360 /// The source of the SCM repo.
7361 pub source: std::option::Option<crate::model::git_repo_source::Source>,
7362
7363 /// The resource name of the enterprise config that should be applied
7364 /// to this source.
7365 pub enterprise_config: std::option::Option<crate::model::git_repo_source::EnterpriseConfig>,
7366
7367 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7368}
7369
7370impl GitRepoSource {
7371 pub fn new() -> Self {
7372 std::default::Default::default()
7373 }
7374
7375 /// Sets the value of [uri][crate::model::GitRepoSource::uri].
7376 ///
7377 /// # Example
7378 /// ```ignore,no_run
7379 /// # use google_cloud_build_v1::model::GitRepoSource;
7380 /// let x = GitRepoSource::new().set_uri("example");
7381 /// ```
7382 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7383 self.uri = v.into();
7384 self
7385 }
7386
7387 /// Sets the value of [r#ref][crate::model::GitRepoSource::ref].
7388 ///
7389 /// # Example
7390 /// ```ignore,no_run
7391 /// # use google_cloud_build_v1::model::GitRepoSource;
7392 /// let x = GitRepoSource::new().set_ref("example");
7393 /// ```
7394 pub fn set_ref<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7395 self.r#ref = v.into();
7396 self
7397 }
7398
7399 /// Sets the value of [repo_type][crate::model::GitRepoSource::repo_type].
7400 ///
7401 /// # Example
7402 /// ```ignore,no_run
7403 /// # use google_cloud_build_v1::model::GitRepoSource;
7404 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7405 /// let x0 = GitRepoSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7406 /// let x1 = GitRepoSource::new().set_repo_type(RepoType::Github);
7407 /// let x2 = GitRepoSource::new().set_repo_type(RepoType::BitbucketServer);
7408 /// ```
7409 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7410 mut self,
7411 v: T,
7412 ) -> Self {
7413 self.repo_type = v.into();
7414 self
7415 }
7416
7417 /// Sets the value of [source][crate::model::GitRepoSource::source].
7418 ///
7419 /// Note that all the setters affecting `source` are mutually
7420 /// exclusive.
7421 ///
7422 /// # Example
7423 /// ```ignore,no_run
7424 /// # use google_cloud_build_v1::model::GitRepoSource;
7425 /// use google_cloud_build_v1::model::git_repo_source::Source;
7426 /// let x = GitRepoSource::new().set_source(Some(Source::Repository("example".to_string())));
7427 /// ```
7428 pub fn set_source<
7429 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::Source>>,
7430 >(
7431 mut self,
7432 v: T,
7433 ) -> Self {
7434 self.source = v.into();
7435 self
7436 }
7437
7438 /// The value of [source][crate::model::GitRepoSource::source]
7439 /// if it holds a `Repository`, `None` if the field is not set or
7440 /// holds a different branch.
7441 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7442 #[allow(unreachable_patterns)]
7443 self.source.as_ref().and_then(|v| match v {
7444 crate::model::git_repo_source::Source::Repository(v) => std::option::Option::Some(v),
7445 _ => std::option::Option::None,
7446 })
7447 }
7448
7449 /// Sets the value of [source][crate::model::GitRepoSource::source]
7450 /// to hold a `Repository`.
7451 ///
7452 /// Note that all the setters affecting `source` are
7453 /// mutually exclusive.
7454 ///
7455 /// # Example
7456 /// ```ignore,no_run
7457 /// # use google_cloud_build_v1::model::GitRepoSource;
7458 /// let x = GitRepoSource::new().set_repository("example");
7459 /// assert!(x.repository().is_some());
7460 /// ```
7461 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7462 self.source =
7463 std::option::Option::Some(crate::model::git_repo_source::Source::Repository(v.into()));
7464 self
7465 }
7466
7467 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config].
7468 ///
7469 /// Note that all the setters affecting `enterprise_config` are mutually
7470 /// exclusive.
7471 ///
7472 /// # Example
7473 /// ```ignore,no_run
7474 /// # use google_cloud_build_v1::model::GitRepoSource;
7475 /// use google_cloud_build_v1::model::git_repo_source::EnterpriseConfig;
7476 /// let x = GitRepoSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7477 /// ```
7478 pub fn set_enterprise_config<
7479 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::EnterpriseConfig>>,
7480 >(
7481 mut self,
7482 v: T,
7483 ) -> Self {
7484 self.enterprise_config = v.into();
7485 self
7486 }
7487
7488 /// The value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7489 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7490 /// holds a different branch.
7491 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7492 #[allow(unreachable_patterns)]
7493 self.enterprise_config.as_ref().and_then(|v| match v {
7494 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7495 std::option::Option::Some(v)
7496 }
7497 _ => std::option::Option::None,
7498 })
7499 }
7500
7501 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7502 /// to hold a `GithubEnterpriseConfig`.
7503 ///
7504 /// Note that all the setters affecting `enterprise_config` are
7505 /// mutually exclusive.
7506 ///
7507 /// # Example
7508 /// ```ignore,no_run
7509 /// # use google_cloud_build_v1::model::GitRepoSource;
7510 /// let x = GitRepoSource::new().set_github_enterprise_config("example");
7511 /// assert!(x.github_enterprise_config().is_some());
7512 /// ```
7513 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7514 mut self,
7515 v: T,
7516 ) -> Self {
7517 self.enterprise_config = std::option::Option::Some(
7518 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7519 );
7520 self
7521 }
7522}
7523
7524impl wkt::message::Message for GitRepoSource {
7525 fn typename() -> &'static str {
7526 "type.googleapis.com/google.devtools.cloudbuild.v1.GitRepoSource"
7527 }
7528}
7529
7530/// Defines additional types related to [GitRepoSource].
7531pub mod git_repo_source {
7532 #[allow(unused_imports)]
7533 use super::*;
7534
7535 /// The source of the SCM repo.
7536 #[derive(Clone, Debug, PartialEq)]
7537 #[non_exhaustive]
7538 pub enum Source {
7539 /// The connected repository resource name, in the format
7540 /// `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or
7541 /// `repository` can be specified and is required.
7542 Repository(std::string::String),
7543 }
7544
7545 /// The resource name of the enterprise config that should be applied
7546 /// to this source.
7547 #[derive(Clone, Debug, PartialEq)]
7548 #[non_exhaustive]
7549 pub enum EnterpriseConfig {
7550 /// The full resource name of the github enterprise config.
7551 /// Format:
7552 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7553 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7554 GithubEnterpriseConfig(std::string::String),
7555 }
7556}
7557
7558/// GitFileSource describes a file within a (possibly remote) code repository.
7559#[derive(Clone, Default, PartialEq)]
7560#[non_exhaustive]
7561pub struct GitFileSource {
7562 /// The path of the file, with the repo root as the root of the path.
7563 pub path: std::string::String,
7564
7565 /// The URI of the repo.
7566 /// Either uri or repository can be specified.
7567 /// If unspecified, the repo from which the trigger invocation originated is
7568 /// assumed to be the repo from which to read the specified path.
7569 pub uri: std::string::String,
7570
7571 /// See RepoType above.
7572 pub repo_type: crate::model::git_file_source::RepoType,
7573
7574 /// The branch, tag, arbitrary ref, or SHA version of the repo to use when
7575 /// resolving the filename (optional).
7576 /// This field respects the same syntax/resolution as described here:
7577 /// <https://git-scm.com/docs/gitrevisions>
7578 /// If unspecified, the revision from which the trigger invocation originated
7579 /// is assumed to be the revision from which to read the specified path.
7580 pub revision: std::string::String,
7581
7582 /// The source of the SCM repo.
7583 pub source: std::option::Option<crate::model::git_file_source::Source>,
7584
7585 /// The resource name of the enterprise config that should be applied
7586 /// to this source.
7587 pub enterprise_config: std::option::Option<crate::model::git_file_source::EnterpriseConfig>,
7588
7589 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7590}
7591
7592impl GitFileSource {
7593 pub fn new() -> Self {
7594 std::default::Default::default()
7595 }
7596
7597 /// Sets the value of [path][crate::model::GitFileSource::path].
7598 ///
7599 /// # Example
7600 /// ```ignore,no_run
7601 /// # use google_cloud_build_v1::model::GitFileSource;
7602 /// let x = GitFileSource::new().set_path("example");
7603 /// ```
7604 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7605 self.path = v.into();
7606 self
7607 }
7608
7609 /// Sets the value of [uri][crate::model::GitFileSource::uri].
7610 ///
7611 /// # Example
7612 /// ```ignore,no_run
7613 /// # use google_cloud_build_v1::model::GitFileSource;
7614 /// let x = GitFileSource::new().set_uri("example");
7615 /// ```
7616 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7617 self.uri = v.into();
7618 self
7619 }
7620
7621 /// Sets the value of [repo_type][crate::model::GitFileSource::repo_type].
7622 ///
7623 /// # Example
7624 /// ```ignore,no_run
7625 /// # use google_cloud_build_v1::model::GitFileSource;
7626 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7627 /// let x0 = GitFileSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7628 /// let x1 = GitFileSource::new().set_repo_type(RepoType::Github);
7629 /// let x2 = GitFileSource::new().set_repo_type(RepoType::BitbucketServer);
7630 /// ```
7631 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7632 mut self,
7633 v: T,
7634 ) -> Self {
7635 self.repo_type = v.into();
7636 self
7637 }
7638
7639 /// Sets the value of [revision][crate::model::GitFileSource::revision].
7640 ///
7641 /// # Example
7642 /// ```ignore,no_run
7643 /// # use google_cloud_build_v1::model::GitFileSource;
7644 /// let x = GitFileSource::new().set_revision("example");
7645 /// ```
7646 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7647 self.revision = v.into();
7648 self
7649 }
7650
7651 /// Sets the value of [source][crate::model::GitFileSource::source].
7652 ///
7653 /// Note that all the setters affecting `source` are mutually
7654 /// exclusive.
7655 ///
7656 /// # Example
7657 /// ```ignore,no_run
7658 /// # use google_cloud_build_v1::model::GitFileSource;
7659 /// use google_cloud_build_v1::model::git_file_source::Source;
7660 /// let x = GitFileSource::new().set_source(Some(Source::Repository("example".to_string())));
7661 /// ```
7662 pub fn set_source<
7663 T: std::convert::Into<std::option::Option<crate::model::git_file_source::Source>>,
7664 >(
7665 mut self,
7666 v: T,
7667 ) -> Self {
7668 self.source = v.into();
7669 self
7670 }
7671
7672 /// The value of [source][crate::model::GitFileSource::source]
7673 /// if it holds a `Repository`, `None` if the field is not set or
7674 /// holds a different branch.
7675 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7676 #[allow(unreachable_patterns)]
7677 self.source.as_ref().and_then(|v| match v {
7678 crate::model::git_file_source::Source::Repository(v) => std::option::Option::Some(v),
7679 _ => std::option::Option::None,
7680 })
7681 }
7682
7683 /// Sets the value of [source][crate::model::GitFileSource::source]
7684 /// to hold a `Repository`.
7685 ///
7686 /// Note that all the setters affecting `source` are
7687 /// mutually exclusive.
7688 ///
7689 /// # Example
7690 /// ```ignore,no_run
7691 /// # use google_cloud_build_v1::model::GitFileSource;
7692 /// let x = GitFileSource::new().set_repository("example");
7693 /// assert!(x.repository().is_some());
7694 /// ```
7695 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7696 self.source =
7697 std::option::Option::Some(crate::model::git_file_source::Source::Repository(v.into()));
7698 self
7699 }
7700
7701 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config].
7702 ///
7703 /// Note that all the setters affecting `enterprise_config` are mutually
7704 /// exclusive.
7705 ///
7706 /// # Example
7707 /// ```ignore,no_run
7708 /// # use google_cloud_build_v1::model::GitFileSource;
7709 /// use google_cloud_build_v1::model::git_file_source::EnterpriseConfig;
7710 /// let x = GitFileSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7711 /// ```
7712 pub fn set_enterprise_config<
7713 T: std::convert::Into<std::option::Option<crate::model::git_file_source::EnterpriseConfig>>,
7714 >(
7715 mut self,
7716 v: T,
7717 ) -> Self {
7718 self.enterprise_config = v.into();
7719 self
7720 }
7721
7722 /// The value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7723 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7724 /// holds a different branch.
7725 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7726 #[allow(unreachable_patterns)]
7727 self.enterprise_config.as_ref().and_then(|v| match v {
7728 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7729 std::option::Option::Some(v)
7730 }
7731 _ => std::option::Option::None,
7732 })
7733 }
7734
7735 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7736 /// to hold a `GithubEnterpriseConfig`.
7737 ///
7738 /// Note that all the setters affecting `enterprise_config` 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_github_enterprise_config("example");
7745 /// assert!(x.github_enterprise_config().is_some());
7746 /// ```
7747 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7748 mut self,
7749 v: T,
7750 ) -> Self {
7751 self.enterprise_config = std::option::Option::Some(
7752 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7753 );
7754 self
7755 }
7756}
7757
7758impl wkt::message::Message for GitFileSource {
7759 fn typename() -> &'static str {
7760 "type.googleapis.com/google.devtools.cloudbuild.v1.GitFileSource"
7761 }
7762}
7763
7764/// Defines additional types related to [GitFileSource].
7765pub mod git_file_source {
7766 #[allow(unused_imports)]
7767 use super::*;
7768
7769 /// The type of the repo, since it may not be explicit from the `repo` field
7770 /// (e.g from a URL).
7771 ///
7772 /// # Working with unknown values
7773 ///
7774 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7775 /// additional enum variants at any time. Adding new variants is not considered
7776 /// a breaking change. Applications should write their code in anticipation of:
7777 ///
7778 /// - New values appearing in future releases of the client library, **and**
7779 /// - New values received dynamically, without application changes.
7780 ///
7781 /// Please consult the [Working with enums] section in the user guide for some
7782 /// guidelines.
7783 ///
7784 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7785 #[derive(Clone, Debug, PartialEq)]
7786 #[non_exhaustive]
7787 pub enum RepoType {
7788 /// The default, unknown repo type. Don't use it, instead use one of
7789 /// the other repo types.
7790 Unknown,
7791 /// A Google Cloud Source Repositories-hosted repo.
7792 CloudSourceRepositories,
7793 /// A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub
7794 /// Enterprise).
7795 Github,
7796 /// A Bitbucket Server-hosted repo.
7797 BitbucketServer,
7798 /// A GitLab-hosted repo.
7799 Gitlab,
7800 /// If set, the enum was initialized with an unknown value.
7801 ///
7802 /// Applications can examine the value using [RepoType::value] or
7803 /// [RepoType::name].
7804 UnknownValue(repo_type::UnknownValue),
7805 }
7806
7807 #[doc(hidden)]
7808 pub mod repo_type {
7809 #[allow(unused_imports)]
7810 use super::*;
7811 #[derive(Clone, Debug, PartialEq)]
7812 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7813 }
7814
7815 impl RepoType {
7816 /// Gets the enum value.
7817 ///
7818 /// Returns `None` if the enum contains an unknown value deserialized from
7819 /// the string representation of enums.
7820 pub fn value(&self) -> std::option::Option<i32> {
7821 match self {
7822 Self::Unknown => std::option::Option::Some(0),
7823 Self::CloudSourceRepositories => std::option::Option::Some(1),
7824 Self::Github => std::option::Option::Some(2),
7825 Self::BitbucketServer => std::option::Option::Some(3),
7826 Self::Gitlab => std::option::Option::Some(4),
7827 Self::UnknownValue(u) => u.0.value(),
7828 }
7829 }
7830
7831 /// Gets the enum value as a string.
7832 ///
7833 /// Returns `None` if the enum contains an unknown value deserialized from
7834 /// the integer representation of enums.
7835 pub fn name(&self) -> std::option::Option<&str> {
7836 match self {
7837 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7838 Self::CloudSourceRepositories => {
7839 std::option::Option::Some("CLOUD_SOURCE_REPOSITORIES")
7840 }
7841 Self::Github => std::option::Option::Some("GITHUB"),
7842 Self::BitbucketServer => std::option::Option::Some("BITBUCKET_SERVER"),
7843 Self::Gitlab => std::option::Option::Some("GITLAB"),
7844 Self::UnknownValue(u) => u.0.name(),
7845 }
7846 }
7847 }
7848
7849 impl std::default::Default for RepoType {
7850 fn default() -> Self {
7851 use std::convert::From;
7852 Self::from(0)
7853 }
7854 }
7855
7856 impl std::fmt::Display for RepoType {
7857 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7858 wkt::internal::display_enum(f, self.name(), self.value())
7859 }
7860 }
7861
7862 impl std::convert::From<i32> for RepoType {
7863 fn from(value: i32) -> Self {
7864 match value {
7865 0 => Self::Unknown,
7866 1 => Self::CloudSourceRepositories,
7867 2 => Self::Github,
7868 3 => Self::BitbucketServer,
7869 4 => Self::Gitlab,
7870 _ => Self::UnknownValue(repo_type::UnknownValue(
7871 wkt::internal::UnknownEnumValue::Integer(value),
7872 )),
7873 }
7874 }
7875 }
7876
7877 impl std::convert::From<&str> for RepoType {
7878 fn from(value: &str) -> Self {
7879 use std::string::ToString;
7880 match value {
7881 "UNKNOWN" => Self::Unknown,
7882 "CLOUD_SOURCE_REPOSITORIES" => Self::CloudSourceRepositories,
7883 "GITHUB" => Self::Github,
7884 "BITBUCKET_SERVER" => Self::BitbucketServer,
7885 "GITLAB" => Self::Gitlab,
7886 _ => Self::UnknownValue(repo_type::UnknownValue(
7887 wkt::internal::UnknownEnumValue::String(value.to_string()),
7888 )),
7889 }
7890 }
7891 }
7892
7893 impl serde::ser::Serialize for RepoType {
7894 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7895 where
7896 S: serde::Serializer,
7897 {
7898 match self {
7899 Self::Unknown => serializer.serialize_i32(0),
7900 Self::CloudSourceRepositories => serializer.serialize_i32(1),
7901 Self::Github => serializer.serialize_i32(2),
7902 Self::BitbucketServer => serializer.serialize_i32(3),
7903 Self::Gitlab => serializer.serialize_i32(4),
7904 Self::UnknownValue(u) => u.0.serialize(serializer),
7905 }
7906 }
7907 }
7908
7909 impl<'de> serde::de::Deserialize<'de> for RepoType {
7910 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7911 where
7912 D: serde::Deserializer<'de>,
7913 {
7914 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepoType>::new(
7915 ".google.devtools.cloudbuild.v1.GitFileSource.RepoType",
7916 ))
7917 }
7918 }
7919
7920 /// The source of the SCM repo.
7921 #[derive(Clone, Debug, PartialEq)]
7922 #[non_exhaustive]
7923 pub enum Source {
7924 /// The fully qualified resource name of the Repos API repository.
7925 /// Either URI or repository can be specified.
7926 /// If unspecified, the repo from which the trigger invocation originated is
7927 /// assumed to be the repo from which to read the specified path.
7928 Repository(std::string::String),
7929 }
7930
7931 /// The resource name of the enterprise config that should be applied
7932 /// to this source.
7933 #[derive(Clone, Debug, PartialEq)]
7934 #[non_exhaustive]
7935 pub enum EnterpriseConfig {
7936 /// The full resource name of the github enterprise config.
7937 /// Format:
7938 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7939 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7940 GithubEnterpriseConfig(std::string::String),
7941 }
7942}
7943
7944/// Configuration for an automated build in response to source repository
7945/// changes.
7946#[derive(Clone, Default, PartialEq)]
7947#[non_exhaustive]
7948pub struct BuildTrigger {
7949 /// The `Trigger` name with format:
7950 /// `projects/{project}/locations/{location}/triggers/{trigger}`, where
7951 /// {trigger} is a unique identifier generated by the service.
7952 pub resource_name: std::string::String,
7953
7954 /// Output only. Unique identifier of the trigger.
7955 pub id: std::string::String,
7956
7957 /// Human-readable description of this trigger.
7958 pub description: std::string::String,
7959
7960 /// User-assigned name of the trigger. Must be unique within the project.
7961 /// Trigger names must meet the following requirements:
7962 ///
7963 /// + They must contain only alphanumeric characters and dashes.
7964 /// + They can be 1-64 characters long.
7965 /// + They must begin and end with an alphanumeric character.
7966 pub name: std::string::String,
7967
7968 /// Tags for annotation of a `BuildTrigger`
7969 pub tags: std::vec::Vec<std::string::String>,
7970
7971 /// Template describing the types of source changes to trigger a build.
7972 ///
7973 /// Branch and tag names in trigger templates are interpreted as regular
7974 /// expressions. Any branch or tag change that matches that regular expression
7975 /// will trigger a build.
7976 ///
7977 /// Mutually exclusive with `github`.
7978 pub trigger_template: std::option::Option<crate::model::RepoSource>,
7979
7980 /// GitHubEventsConfig describes the configuration of a trigger that creates
7981 /// a build whenever a GitHub event is received.
7982 ///
7983 /// Mutually exclusive with `trigger_template`.
7984 pub github: std::option::Option<crate::model::GitHubEventsConfig>,
7985
7986 /// PubsubConfig describes the configuration of a trigger that
7987 /// creates a build whenever a Pub/Sub message is published.
7988 pub pubsub_config: std::option::Option<crate::model::PubsubConfig>,
7989
7990 /// WebhookConfig describes the configuration of a trigger that
7991 /// creates a build whenever a webhook is sent to a trigger's webhook URL.
7992 pub webhook_config: std::option::Option<crate::model::WebhookConfig>,
7993
7994 /// Output only. Time when the trigger was created.
7995 pub create_time: std::option::Option<wkt::Timestamp>,
7996
7997 /// If true, the trigger will never automatically execute a build.
7998 pub disabled: bool,
7999
8000 /// Substitutions for Build resource. The keys must match the following
8001 /// regular expression: `^_[A-Z0-9_]+$`.
8002 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
8003
8004 /// ignored_files and included_files are file glob matches using
8005 /// <https://golang.org/pkg/path/filepath/#Match> extended with support for "**".
8006 ///
8007 /// If ignored_files and changed files are both empty, then they are
8008 /// not used to determine whether or not to trigger a build.
8009 ///
8010 /// If ignored_files is not empty, then we ignore any files that match
8011 /// any of the ignored_file globs. If the change has no files that are
8012 /// outside of the ignored_files globs, then we do not trigger a build.
8013 pub ignored_files: std::vec::Vec<std::string::String>,
8014
8015 /// If any of the files altered in the commit pass the ignored_files
8016 /// filter and included_files is empty, then as far as this filter is
8017 /// concerned, we should trigger the build.
8018 ///
8019 /// If any of the files altered in the commit pass the ignored_files
8020 /// filter and included_files is not empty, then we make sure that at
8021 /// least one of those files matches a included_files glob. If not,
8022 /// then we do not trigger a build.
8023 pub included_files: std::vec::Vec<std::string::String>,
8024
8025 /// Optional. A Common Expression Language string.
8026 pub filter: std::string::String,
8027
8028 /// The repo and ref of the repository from which to build. This field
8029 /// is used only for those triggers that do not respond to SCM events.
8030 /// Triggers that respond to such events build source at whatever commit
8031 /// caused the event.
8032 /// This field is currently only used by Webhook, Pub/Sub, Manual, and Cron
8033 /// triggers.
8034 pub source_to_build: std::option::Option<crate::model::GitRepoSource>,
8035
8036 /// The service account used for all user-controlled operations including
8037 /// UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
8038 /// If no service account is set and the legacy Cloud Build service account
8039 /// (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the
8040 /// project then it will be used instead.
8041 /// Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
8042 pub service_account: std::string::String,
8043
8044 /// The configuration of a trigger that creates a build whenever an event from
8045 /// Repo API is received.
8046 pub repository_event_config: std::option::Option<crate::model::RepositoryEventConfig>,
8047
8048 /// Template describing the Build request to make when the trigger is matched.
8049 /// At least one of the template fields must be provided.
8050 pub build_template: std::option::Option<crate::model::build_trigger::BuildTemplate>,
8051
8052 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8053}
8054
8055impl BuildTrigger {
8056 pub fn new() -> Self {
8057 std::default::Default::default()
8058 }
8059
8060 /// Sets the value of [resource_name][crate::model::BuildTrigger::resource_name].
8061 ///
8062 /// # Example
8063 /// ```ignore,no_run
8064 /// # use google_cloud_build_v1::model::BuildTrigger;
8065 /// let x = BuildTrigger::new().set_resource_name("example");
8066 /// ```
8067 pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8068 self.resource_name = v.into();
8069 self
8070 }
8071
8072 /// Sets the value of [id][crate::model::BuildTrigger::id].
8073 ///
8074 /// # Example
8075 /// ```ignore,no_run
8076 /// # use google_cloud_build_v1::model::BuildTrigger;
8077 /// let x = BuildTrigger::new().set_id("example");
8078 /// ```
8079 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8080 self.id = v.into();
8081 self
8082 }
8083
8084 /// Sets the value of [description][crate::model::BuildTrigger::description].
8085 ///
8086 /// # Example
8087 /// ```ignore,no_run
8088 /// # use google_cloud_build_v1::model::BuildTrigger;
8089 /// let x = BuildTrigger::new().set_description("example");
8090 /// ```
8091 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8092 self.description = v.into();
8093 self
8094 }
8095
8096 /// Sets the value of [name][crate::model::BuildTrigger::name].
8097 ///
8098 /// # Example
8099 /// ```ignore,no_run
8100 /// # use google_cloud_build_v1::model::BuildTrigger;
8101 /// let x = BuildTrigger::new().set_name("example");
8102 /// ```
8103 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8104 self.name = v.into();
8105 self
8106 }
8107
8108 /// Sets the value of [tags][crate::model::BuildTrigger::tags].
8109 ///
8110 /// # Example
8111 /// ```ignore,no_run
8112 /// # use google_cloud_build_v1::model::BuildTrigger;
8113 /// let x = BuildTrigger::new().set_tags(["a", "b", "c"]);
8114 /// ```
8115 pub fn set_tags<T, V>(mut self, v: T) -> Self
8116 where
8117 T: std::iter::IntoIterator<Item = V>,
8118 V: std::convert::Into<std::string::String>,
8119 {
8120 use std::iter::Iterator;
8121 self.tags = v.into_iter().map(|i| i.into()).collect();
8122 self
8123 }
8124
8125 /// Sets the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8126 ///
8127 /// # Example
8128 /// ```ignore,no_run
8129 /// # use google_cloud_build_v1::model::BuildTrigger;
8130 /// use google_cloud_build_v1::model::RepoSource;
8131 /// let x = BuildTrigger::new().set_trigger_template(RepoSource::default()/* use setters */);
8132 /// ```
8133 pub fn set_trigger_template<T>(mut self, v: T) -> Self
8134 where
8135 T: std::convert::Into<crate::model::RepoSource>,
8136 {
8137 self.trigger_template = std::option::Option::Some(v.into());
8138 self
8139 }
8140
8141 /// Sets or clears the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8142 ///
8143 /// # Example
8144 /// ```ignore,no_run
8145 /// # use google_cloud_build_v1::model::BuildTrigger;
8146 /// use google_cloud_build_v1::model::RepoSource;
8147 /// let x = BuildTrigger::new().set_or_clear_trigger_template(Some(RepoSource::default()/* use setters */));
8148 /// let x = BuildTrigger::new().set_or_clear_trigger_template(None::<RepoSource>);
8149 /// ```
8150 pub fn set_or_clear_trigger_template<T>(mut self, v: std::option::Option<T>) -> Self
8151 where
8152 T: std::convert::Into<crate::model::RepoSource>,
8153 {
8154 self.trigger_template = v.map(|x| x.into());
8155 self
8156 }
8157
8158 /// Sets the value of [github][crate::model::BuildTrigger::github].
8159 ///
8160 /// # Example
8161 /// ```ignore,no_run
8162 /// # use google_cloud_build_v1::model::BuildTrigger;
8163 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8164 /// let x = BuildTrigger::new().set_github(GitHubEventsConfig::default()/* use setters */);
8165 /// ```
8166 pub fn set_github<T>(mut self, v: T) -> Self
8167 where
8168 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8169 {
8170 self.github = std::option::Option::Some(v.into());
8171 self
8172 }
8173
8174 /// Sets or clears the value of [github][crate::model::BuildTrigger::github].
8175 ///
8176 /// # Example
8177 /// ```ignore,no_run
8178 /// # use google_cloud_build_v1::model::BuildTrigger;
8179 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8180 /// let x = BuildTrigger::new().set_or_clear_github(Some(GitHubEventsConfig::default()/* use setters */));
8181 /// let x = BuildTrigger::new().set_or_clear_github(None::<GitHubEventsConfig>);
8182 /// ```
8183 pub fn set_or_clear_github<T>(mut self, v: std::option::Option<T>) -> Self
8184 where
8185 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8186 {
8187 self.github = v.map(|x| x.into());
8188 self
8189 }
8190
8191 /// Sets the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8192 ///
8193 /// # Example
8194 /// ```ignore,no_run
8195 /// # use google_cloud_build_v1::model::BuildTrigger;
8196 /// use google_cloud_build_v1::model::PubsubConfig;
8197 /// let x = BuildTrigger::new().set_pubsub_config(PubsubConfig::default()/* use setters */);
8198 /// ```
8199 pub fn set_pubsub_config<T>(mut self, v: T) -> Self
8200 where
8201 T: std::convert::Into<crate::model::PubsubConfig>,
8202 {
8203 self.pubsub_config = std::option::Option::Some(v.into());
8204 self
8205 }
8206
8207 /// Sets or clears the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8208 ///
8209 /// # Example
8210 /// ```ignore,no_run
8211 /// # use google_cloud_build_v1::model::BuildTrigger;
8212 /// use google_cloud_build_v1::model::PubsubConfig;
8213 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(Some(PubsubConfig::default()/* use setters */));
8214 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(None::<PubsubConfig>);
8215 /// ```
8216 pub fn set_or_clear_pubsub_config<T>(mut self, v: std::option::Option<T>) -> Self
8217 where
8218 T: std::convert::Into<crate::model::PubsubConfig>,
8219 {
8220 self.pubsub_config = v.map(|x| x.into());
8221 self
8222 }
8223
8224 /// Sets the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8225 ///
8226 /// # Example
8227 /// ```ignore,no_run
8228 /// # use google_cloud_build_v1::model::BuildTrigger;
8229 /// use google_cloud_build_v1::model::WebhookConfig;
8230 /// let x = BuildTrigger::new().set_webhook_config(WebhookConfig::default()/* use setters */);
8231 /// ```
8232 pub fn set_webhook_config<T>(mut self, v: T) -> Self
8233 where
8234 T: std::convert::Into<crate::model::WebhookConfig>,
8235 {
8236 self.webhook_config = std::option::Option::Some(v.into());
8237 self
8238 }
8239
8240 /// Sets or clears the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8241 ///
8242 /// # Example
8243 /// ```ignore,no_run
8244 /// # use google_cloud_build_v1::model::BuildTrigger;
8245 /// use google_cloud_build_v1::model::WebhookConfig;
8246 /// let x = BuildTrigger::new().set_or_clear_webhook_config(Some(WebhookConfig::default()/* use setters */));
8247 /// let x = BuildTrigger::new().set_or_clear_webhook_config(None::<WebhookConfig>);
8248 /// ```
8249 pub fn set_or_clear_webhook_config<T>(mut self, v: std::option::Option<T>) -> Self
8250 where
8251 T: std::convert::Into<crate::model::WebhookConfig>,
8252 {
8253 self.webhook_config = v.map(|x| x.into());
8254 self
8255 }
8256
8257 /// Sets the value of [create_time][crate::model::BuildTrigger::create_time].
8258 ///
8259 /// # Example
8260 /// ```ignore,no_run
8261 /// # use google_cloud_build_v1::model::BuildTrigger;
8262 /// use wkt::Timestamp;
8263 /// let x = BuildTrigger::new().set_create_time(Timestamp::default()/* use setters */);
8264 /// ```
8265 pub fn set_create_time<T>(mut self, v: T) -> Self
8266 where
8267 T: std::convert::Into<wkt::Timestamp>,
8268 {
8269 self.create_time = std::option::Option::Some(v.into());
8270 self
8271 }
8272
8273 /// Sets or clears the value of [create_time][crate::model::BuildTrigger::create_time].
8274 ///
8275 /// # Example
8276 /// ```ignore,no_run
8277 /// # use google_cloud_build_v1::model::BuildTrigger;
8278 /// use wkt::Timestamp;
8279 /// let x = BuildTrigger::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8280 /// let x = BuildTrigger::new().set_or_clear_create_time(None::<Timestamp>);
8281 /// ```
8282 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8283 where
8284 T: std::convert::Into<wkt::Timestamp>,
8285 {
8286 self.create_time = v.map(|x| x.into());
8287 self
8288 }
8289
8290 /// Sets the value of [disabled][crate::model::BuildTrigger::disabled].
8291 ///
8292 /// # Example
8293 /// ```ignore,no_run
8294 /// # use google_cloud_build_v1::model::BuildTrigger;
8295 /// let x = BuildTrigger::new().set_disabled(true);
8296 /// ```
8297 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8298 self.disabled = v.into();
8299 self
8300 }
8301
8302 /// Sets the value of [substitutions][crate::model::BuildTrigger::substitutions].
8303 ///
8304 /// # Example
8305 /// ```ignore,no_run
8306 /// # use google_cloud_build_v1::model::BuildTrigger;
8307 /// let x = BuildTrigger::new().set_substitutions([
8308 /// ("key0", "abc"),
8309 /// ("key1", "xyz"),
8310 /// ]);
8311 /// ```
8312 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
8313 where
8314 T: std::iter::IntoIterator<Item = (K, V)>,
8315 K: std::convert::Into<std::string::String>,
8316 V: std::convert::Into<std::string::String>,
8317 {
8318 use std::iter::Iterator;
8319 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8320 self
8321 }
8322
8323 /// Sets the value of [ignored_files][crate::model::BuildTrigger::ignored_files].
8324 ///
8325 /// # Example
8326 /// ```ignore,no_run
8327 /// # use google_cloud_build_v1::model::BuildTrigger;
8328 /// let x = BuildTrigger::new().set_ignored_files(["a", "b", "c"]);
8329 /// ```
8330 pub fn set_ignored_files<T, V>(mut self, v: T) -> Self
8331 where
8332 T: std::iter::IntoIterator<Item = V>,
8333 V: std::convert::Into<std::string::String>,
8334 {
8335 use std::iter::Iterator;
8336 self.ignored_files = v.into_iter().map(|i| i.into()).collect();
8337 self
8338 }
8339
8340 /// Sets the value of [included_files][crate::model::BuildTrigger::included_files].
8341 ///
8342 /// # Example
8343 /// ```ignore,no_run
8344 /// # use google_cloud_build_v1::model::BuildTrigger;
8345 /// let x = BuildTrigger::new().set_included_files(["a", "b", "c"]);
8346 /// ```
8347 pub fn set_included_files<T, V>(mut self, v: T) -> Self
8348 where
8349 T: std::iter::IntoIterator<Item = V>,
8350 V: std::convert::Into<std::string::String>,
8351 {
8352 use std::iter::Iterator;
8353 self.included_files = v.into_iter().map(|i| i.into()).collect();
8354 self
8355 }
8356
8357 /// Sets the value of [filter][crate::model::BuildTrigger::filter].
8358 ///
8359 /// # Example
8360 /// ```ignore,no_run
8361 /// # use google_cloud_build_v1::model::BuildTrigger;
8362 /// let x = BuildTrigger::new().set_filter("example");
8363 /// ```
8364 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8365 self.filter = v.into();
8366 self
8367 }
8368
8369 /// Sets the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8370 ///
8371 /// # Example
8372 /// ```ignore,no_run
8373 /// # use google_cloud_build_v1::model::BuildTrigger;
8374 /// use google_cloud_build_v1::model::GitRepoSource;
8375 /// let x = BuildTrigger::new().set_source_to_build(GitRepoSource::default()/* use setters */);
8376 /// ```
8377 pub fn set_source_to_build<T>(mut self, v: T) -> Self
8378 where
8379 T: std::convert::Into<crate::model::GitRepoSource>,
8380 {
8381 self.source_to_build = std::option::Option::Some(v.into());
8382 self
8383 }
8384
8385 /// Sets or clears the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8386 ///
8387 /// # Example
8388 /// ```ignore,no_run
8389 /// # use google_cloud_build_v1::model::BuildTrigger;
8390 /// use google_cloud_build_v1::model::GitRepoSource;
8391 /// let x = BuildTrigger::new().set_or_clear_source_to_build(Some(GitRepoSource::default()/* use setters */));
8392 /// let x = BuildTrigger::new().set_or_clear_source_to_build(None::<GitRepoSource>);
8393 /// ```
8394 pub fn set_or_clear_source_to_build<T>(mut self, v: std::option::Option<T>) -> Self
8395 where
8396 T: std::convert::Into<crate::model::GitRepoSource>,
8397 {
8398 self.source_to_build = v.map(|x| x.into());
8399 self
8400 }
8401
8402 /// Sets the value of [service_account][crate::model::BuildTrigger::service_account].
8403 ///
8404 /// # Example
8405 /// ```ignore,no_run
8406 /// # use google_cloud_build_v1::model::BuildTrigger;
8407 /// let x = BuildTrigger::new().set_service_account("example");
8408 /// ```
8409 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8410 self.service_account = v.into();
8411 self
8412 }
8413
8414 /// Sets the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8415 ///
8416 /// # Example
8417 /// ```ignore,no_run
8418 /// # use google_cloud_build_v1::model::BuildTrigger;
8419 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8420 /// let x = BuildTrigger::new().set_repository_event_config(RepositoryEventConfig::default()/* use setters */);
8421 /// ```
8422 pub fn set_repository_event_config<T>(mut self, v: T) -> Self
8423 where
8424 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8425 {
8426 self.repository_event_config = std::option::Option::Some(v.into());
8427 self
8428 }
8429
8430 /// Sets or clears the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8431 ///
8432 /// # Example
8433 /// ```ignore,no_run
8434 /// # use google_cloud_build_v1::model::BuildTrigger;
8435 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8436 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(Some(RepositoryEventConfig::default()/* use setters */));
8437 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(None::<RepositoryEventConfig>);
8438 /// ```
8439 pub fn set_or_clear_repository_event_config<T>(mut self, v: std::option::Option<T>) -> Self
8440 where
8441 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8442 {
8443 self.repository_event_config = v.map(|x| x.into());
8444 self
8445 }
8446
8447 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template].
8448 ///
8449 /// Note that all the setters affecting `build_template` are mutually
8450 /// exclusive.
8451 ///
8452 /// # Example
8453 /// ```ignore,no_run
8454 /// # use google_cloud_build_v1::model::BuildTrigger;
8455 /// use google_cloud_build_v1::model::build_trigger::BuildTemplate;
8456 /// let x = BuildTrigger::new().set_build_template(Some(BuildTemplate::Autodetect(true)));
8457 /// ```
8458 pub fn set_build_template<
8459 T: std::convert::Into<std::option::Option<crate::model::build_trigger::BuildTemplate>>,
8460 >(
8461 mut self,
8462 v: T,
8463 ) -> Self {
8464 self.build_template = v.into();
8465 self
8466 }
8467
8468 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8469 /// if it holds a `Autodetect`, `None` if the field is not set or
8470 /// holds a different branch.
8471 pub fn autodetect(&self) -> std::option::Option<&bool> {
8472 #[allow(unreachable_patterns)]
8473 self.build_template.as_ref().and_then(|v| match v {
8474 crate::model::build_trigger::BuildTemplate::Autodetect(v) => {
8475 std::option::Option::Some(v)
8476 }
8477 _ => std::option::Option::None,
8478 })
8479 }
8480
8481 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8482 /// to hold a `Autodetect`.
8483 ///
8484 /// Note that all the setters affecting `build_template` are
8485 /// mutually exclusive.
8486 ///
8487 /// # Example
8488 /// ```ignore,no_run
8489 /// # use google_cloud_build_v1::model::BuildTrigger;
8490 /// let x = BuildTrigger::new().set_autodetect(true);
8491 /// assert!(x.autodetect().is_some());
8492 /// assert!(x.build().is_none());
8493 /// assert!(x.filename().is_none());
8494 /// assert!(x.git_file_source().is_none());
8495 /// ```
8496 pub fn set_autodetect<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8497 self.build_template = std::option::Option::Some(
8498 crate::model::build_trigger::BuildTemplate::Autodetect(v.into()),
8499 );
8500 self
8501 }
8502
8503 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8504 /// if it holds a `Build`, `None` if the field is not set or
8505 /// holds a different branch.
8506 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::Build>> {
8507 #[allow(unreachable_patterns)]
8508 self.build_template.as_ref().and_then(|v| match v {
8509 crate::model::build_trigger::BuildTemplate::Build(v) => std::option::Option::Some(v),
8510 _ => std::option::Option::None,
8511 })
8512 }
8513
8514 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8515 /// to hold a `Build`.
8516 ///
8517 /// Note that all the setters affecting `build_template` are
8518 /// mutually exclusive.
8519 ///
8520 /// # Example
8521 /// ```ignore,no_run
8522 /// # use google_cloud_build_v1::model::BuildTrigger;
8523 /// use google_cloud_build_v1::model::Build;
8524 /// let x = BuildTrigger::new().set_build(Build::default()/* use setters */);
8525 /// assert!(x.build().is_some());
8526 /// assert!(x.autodetect().is_none());
8527 /// assert!(x.filename().is_none());
8528 /// assert!(x.git_file_source().is_none());
8529 /// ```
8530 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::Build>>>(
8531 mut self,
8532 v: T,
8533 ) -> Self {
8534 self.build_template =
8535 std::option::Option::Some(crate::model::build_trigger::BuildTemplate::Build(v.into()));
8536 self
8537 }
8538
8539 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8540 /// if it holds a `Filename`, `None` if the field is not set or
8541 /// holds a different branch.
8542 pub fn filename(&self) -> std::option::Option<&std::string::String> {
8543 #[allow(unreachable_patterns)]
8544 self.build_template.as_ref().and_then(|v| match v {
8545 crate::model::build_trigger::BuildTemplate::Filename(v) => std::option::Option::Some(v),
8546 _ => std::option::Option::None,
8547 })
8548 }
8549
8550 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8551 /// to hold a `Filename`.
8552 ///
8553 /// Note that all the setters affecting `build_template` are
8554 /// mutually exclusive.
8555 ///
8556 /// # Example
8557 /// ```ignore,no_run
8558 /// # use google_cloud_build_v1::model::BuildTrigger;
8559 /// let x = BuildTrigger::new().set_filename("example");
8560 /// assert!(x.filename().is_some());
8561 /// assert!(x.autodetect().is_none());
8562 /// assert!(x.build().is_none());
8563 /// assert!(x.git_file_source().is_none());
8564 /// ```
8565 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8566 self.build_template = std::option::Option::Some(
8567 crate::model::build_trigger::BuildTemplate::Filename(v.into()),
8568 );
8569 self
8570 }
8571
8572 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8573 /// if it holds a `GitFileSource`, `None` if the field is not set or
8574 /// holds a different branch.
8575 pub fn git_file_source(
8576 &self,
8577 ) -> std::option::Option<&std::boxed::Box<crate::model::GitFileSource>> {
8578 #[allow(unreachable_patterns)]
8579 self.build_template.as_ref().and_then(|v| match v {
8580 crate::model::build_trigger::BuildTemplate::GitFileSource(v) => {
8581 std::option::Option::Some(v)
8582 }
8583 _ => std::option::Option::None,
8584 })
8585 }
8586
8587 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8588 /// to hold a `GitFileSource`.
8589 ///
8590 /// Note that all the setters affecting `build_template` are
8591 /// mutually exclusive.
8592 ///
8593 /// # Example
8594 /// ```ignore,no_run
8595 /// # use google_cloud_build_v1::model::BuildTrigger;
8596 /// use google_cloud_build_v1::model::GitFileSource;
8597 /// let x = BuildTrigger::new().set_git_file_source(GitFileSource::default()/* use setters */);
8598 /// assert!(x.git_file_source().is_some());
8599 /// assert!(x.autodetect().is_none());
8600 /// assert!(x.build().is_none());
8601 /// assert!(x.filename().is_none());
8602 /// ```
8603 pub fn set_git_file_source<
8604 T: std::convert::Into<std::boxed::Box<crate::model::GitFileSource>>,
8605 >(
8606 mut self,
8607 v: T,
8608 ) -> Self {
8609 self.build_template = std::option::Option::Some(
8610 crate::model::build_trigger::BuildTemplate::GitFileSource(v.into()),
8611 );
8612 self
8613 }
8614}
8615
8616impl wkt::message::Message for BuildTrigger {
8617 fn typename() -> &'static str {
8618 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildTrigger"
8619 }
8620}
8621
8622/// Defines additional types related to [BuildTrigger].
8623pub mod build_trigger {
8624 #[allow(unused_imports)]
8625 use super::*;
8626
8627 /// Template describing the Build request to make when the trigger is matched.
8628 /// At least one of the template fields must be provided.
8629 #[derive(Clone, Debug, PartialEq)]
8630 #[non_exhaustive]
8631 pub enum BuildTemplate {
8632 /// Autodetect build configuration. The following precedence is used (case
8633 /// insensitive):
8634 ///
8635 /// 1. cloudbuild.yaml
8636 /// 1. cloudbuild.yml
8637 /// 1. cloudbuild.json
8638 /// 1. Dockerfile
8639 ///
8640 /// Currently only available for GitHub App Triggers.
8641 Autodetect(bool),
8642 /// Contents of the build template.
8643 Build(std::boxed::Box<crate::model::Build>),
8644 /// Path, from the source root, to the build configuration file
8645 /// (i.e. cloudbuild.yaml).
8646 Filename(std::string::String),
8647 /// The file source describing the local or remote Build template.
8648 GitFileSource(std::boxed::Box<crate::model::GitFileSource>),
8649 }
8650}
8651
8652/// The configuration of a trigger that creates a build whenever an event from
8653/// Repo API is received.
8654#[derive(Clone, Default, PartialEq)]
8655#[non_exhaustive]
8656pub struct RepositoryEventConfig {
8657 /// The resource name of the Repo API resource.
8658 pub repository: std::string::String,
8659
8660 /// Output only. The type of the SCM vendor the repository points to.
8661 pub repository_type: crate::model::repository_event_config::RepositoryType,
8662
8663 /// The types of filter to trigger a build.
8664 pub filter: std::option::Option<crate::model::repository_event_config::Filter>,
8665
8666 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8667}
8668
8669impl RepositoryEventConfig {
8670 pub fn new() -> Self {
8671 std::default::Default::default()
8672 }
8673
8674 /// Sets the value of [repository][crate::model::RepositoryEventConfig::repository].
8675 ///
8676 /// # Example
8677 /// ```ignore,no_run
8678 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8679 /// let x = RepositoryEventConfig::new().set_repository("example");
8680 /// ```
8681 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8682 self.repository = v.into();
8683 self
8684 }
8685
8686 /// Sets the value of [repository_type][crate::model::RepositoryEventConfig::repository_type].
8687 ///
8688 /// # Example
8689 /// ```ignore,no_run
8690 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8691 /// use google_cloud_build_v1::model::repository_event_config::RepositoryType;
8692 /// let x0 = RepositoryEventConfig::new().set_repository_type(RepositoryType::Github);
8693 /// let x1 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GithubEnterprise);
8694 /// let x2 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GitlabEnterprise);
8695 /// ```
8696 pub fn set_repository_type<
8697 T: std::convert::Into<crate::model::repository_event_config::RepositoryType>,
8698 >(
8699 mut self,
8700 v: T,
8701 ) -> Self {
8702 self.repository_type = v.into();
8703 self
8704 }
8705
8706 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter].
8707 ///
8708 /// Note that all the setters affecting `filter` are mutually
8709 /// exclusive.
8710 ///
8711 /// # Example
8712 /// ```ignore,no_run
8713 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8714 /// use google_cloud_build_v1::model::PullRequestFilter;
8715 /// let x = RepositoryEventConfig::new().set_filter(Some(
8716 /// google_cloud_build_v1::model::repository_event_config::Filter::PullRequest(PullRequestFilter::default().into())));
8717 /// ```
8718 pub fn set_filter<
8719 T: std::convert::Into<std::option::Option<crate::model::repository_event_config::Filter>>,
8720 >(
8721 mut self,
8722 v: T,
8723 ) -> Self {
8724 self.filter = v.into();
8725 self
8726 }
8727
8728 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8729 /// if it holds a `PullRequest`, `None` if the field is not set or
8730 /// holds a different branch.
8731 pub fn pull_request(
8732 &self,
8733 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
8734 #[allow(unreachable_patterns)]
8735 self.filter.as_ref().and_then(|v| match v {
8736 crate::model::repository_event_config::Filter::PullRequest(v) => {
8737 std::option::Option::Some(v)
8738 }
8739 _ => std::option::Option::None,
8740 })
8741 }
8742
8743 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8744 /// to hold a `PullRequest`.
8745 ///
8746 /// Note that all the setters affecting `filter` are
8747 /// mutually exclusive.
8748 ///
8749 /// # Example
8750 /// ```ignore,no_run
8751 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8752 /// use google_cloud_build_v1::model::PullRequestFilter;
8753 /// let x = RepositoryEventConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
8754 /// assert!(x.pull_request().is_some());
8755 /// assert!(x.push().is_none());
8756 /// ```
8757 pub fn set_pull_request<
8758 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
8759 >(
8760 mut self,
8761 v: T,
8762 ) -> Self {
8763 self.filter = std::option::Option::Some(
8764 crate::model::repository_event_config::Filter::PullRequest(v.into()),
8765 );
8766 self
8767 }
8768
8769 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8770 /// if it holds a `Push`, `None` if the field is not set or
8771 /// holds a different branch.
8772 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
8773 #[allow(unreachable_patterns)]
8774 self.filter.as_ref().and_then(|v| match v {
8775 crate::model::repository_event_config::Filter::Push(v) => std::option::Option::Some(v),
8776 _ => std::option::Option::None,
8777 })
8778 }
8779
8780 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8781 /// to hold a `Push`.
8782 ///
8783 /// Note that all the setters affecting `filter` are
8784 /// mutually exclusive.
8785 ///
8786 /// # Example
8787 /// ```ignore,no_run
8788 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8789 /// use google_cloud_build_v1::model::PushFilter;
8790 /// let x = RepositoryEventConfig::new().set_push(PushFilter::default()/* use setters */);
8791 /// assert!(x.push().is_some());
8792 /// assert!(x.pull_request().is_none());
8793 /// ```
8794 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
8795 mut self,
8796 v: T,
8797 ) -> Self {
8798 self.filter = std::option::Option::Some(
8799 crate::model::repository_event_config::Filter::Push(v.into()),
8800 );
8801 self
8802 }
8803}
8804
8805impl wkt::message::Message for RepositoryEventConfig {
8806 fn typename() -> &'static str {
8807 "type.googleapis.com/google.devtools.cloudbuild.v1.RepositoryEventConfig"
8808 }
8809}
8810
8811/// Defines additional types related to [RepositoryEventConfig].
8812pub mod repository_event_config {
8813 #[allow(unused_imports)]
8814 use super::*;
8815
8816 /// All possible SCM repo types from Repo API.
8817 ///
8818 /// # Working with unknown values
8819 ///
8820 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8821 /// additional enum variants at any time. Adding new variants is not considered
8822 /// a breaking change. Applications should write their code in anticipation of:
8823 ///
8824 /// - New values appearing in future releases of the client library, **and**
8825 /// - New values received dynamically, without application changes.
8826 ///
8827 /// Please consult the [Working with enums] section in the user guide for some
8828 /// guidelines.
8829 ///
8830 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8831 #[derive(Clone, Debug, PartialEq)]
8832 #[non_exhaustive]
8833 pub enum RepositoryType {
8834 /// If unspecified, RepositoryType defaults to GITHUB.
8835 Unspecified,
8836 /// The SCM repo is GITHUB.
8837 Github,
8838 /// The SCM repo is GITHUB Enterprise.
8839 GithubEnterprise,
8840 /// The SCM repo is GITLAB Enterprise.
8841 GitlabEnterprise,
8842 /// If set, the enum was initialized with an unknown value.
8843 ///
8844 /// Applications can examine the value using [RepositoryType::value] or
8845 /// [RepositoryType::name].
8846 UnknownValue(repository_type::UnknownValue),
8847 }
8848
8849 #[doc(hidden)]
8850 pub mod repository_type {
8851 #[allow(unused_imports)]
8852 use super::*;
8853 #[derive(Clone, Debug, PartialEq)]
8854 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8855 }
8856
8857 impl RepositoryType {
8858 /// Gets the enum value.
8859 ///
8860 /// Returns `None` if the enum contains an unknown value deserialized from
8861 /// the string representation of enums.
8862 pub fn value(&self) -> std::option::Option<i32> {
8863 match self {
8864 Self::Unspecified => std::option::Option::Some(0),
8865 Self::Github => std::option::Option::Some(1),
8866 Self::GithubEnterprise => std::option::Option::Some(2),
8867 Self::GitlabEnterprise => std::option::Option::Some(3),
8868 Self::UnknownValue(u) => u.0.value(),
8869 }
8870 }
8871
8872 /// Gets the enum value as a string.
8873 ///
8874 /// Returns `None` if the enum contains an unknown value deserialized from
8875 /// the integer representation of enums.
8876 pub fn name(&self) -> std::option::Option<&str> {
8877 match self {
8878 Self::Unspecified => std::option::Option::Some("REPOSITORY_TYPE_UNSPECIFIED"),
8879 Self::Github => std::option::Option::Some("GITHUB"),
8880 Self::GithubEnterprise => std::option::Option::Some("GITHUB_ENTERPRISE"),
8881 Self::GitlabEnterprise => std::option::Option::Some("GITLAB_ENTERPRISE"),
8882 Self::UnknownValue(u) => u.0.name(),
8883 }
8884 }
8885 }
8886
8887 impl std::default::Default for RepositoryType {
8888 fn default() -> Self {
8889 use std::convert::From;
8890 Self::from(0)
8891 }
8892 }
8893
8894 impl std::fmt::Display for RepositoryType {
8895 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8896 wkt::internal::display_enum(f, self.name(), self.value())
8897 }
8898 }
8899
8900 impl std::convert::From<i32> for RepositoryType {
8901 fn from(value: i32) -> Self {
8902 match value {
8903 0 => Self::Unspecified,
8904 1 => Self::Github,
8905 2 => Self::GithubEnterprise,
8906 3 => Self::GitlabEnterprise,
8907 _ => Self::UnknownValue(repository_type::UnknownValue(
8908 wkt::internal::UnknownEnumValue::Integer(value),
8909 )),
8910 }
8911 }
8912 }
8913
8914 impl std::convert::From<&str> for RepositoryType {
8915 fn from(value: &str) -> Self {
8916 use std::string::ToString;
8917 match value {
8918 "REPOSITORY_TYPE_UNSPECIFIED" => Self::Unspecified,
8919 "GITHUB" => Self::Github,
8920 "GITHUB_ENTERPRISE" => Self::GithubEnterprise,
8921 "GITLAB_ENTERPRISE" => Self::GitlabEnterprise,
8922 _ => Self::UnknownValue(repository_type::UnknownValue(
8923 wkt::internal::UnknownEnumValue::String(value.to_string()),
8924 )),
8925 }
8926 }
8927 }
8928
8929 impl serde::ser::Serialize for RepositoryType {
8930 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8931 where
8932 S: serde::Serializer,
8933 {
8934 match self {
8935 Self::Unspecified => serializer.serialize_i32(0),
8936 Self::Github => serializer.serialize_i32(1),
8937 Self::GithubEnterprise => serializer.serialize_i32(2),
8938 Self::GitlabEnterprise => serializer.serialize_i32(3),
8939 Self::UnknownValue(u) => u.0.serialize(serializer),
8940 }
8941 }
8942 }
8943
8944 impl<'de> serde::de::Deserialize<'de> for RepositoryType {
8945 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8946 where
8947 D: serde::Deserializer<'de>,
8948 {
8949 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepositoryType>::new(
8950 ".google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType",
8951 ))
8952 }
8953 }
8954
8955 /// The types of filter to trigger a build.
8956 #[derive(Clone, Debug, PartialEq)]
8957 #[non_exhaustive]
8958 pub enum Filter {
8959 /// Filter to match changes in pull requests.
8960 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
8961 /// Filter to match changes in refs like branches, tags.
8962 Push(std::boxed::Box<crate::model::PushFilter>),
8963 }
8964}
8965
8966/// GitHubEventsConfig describes the configuration of a trigger that creates a
8967/// build whenever a GitHub event is received.
8968#[derive(Clone, Default, PartialEq)]
8969#[non_exhaustive]
8970pub struct GitHubEventsConfig {
8971 /// The installationID that emits the GitHub event.
8972 #[deprecated]
8973 pub installation_id: i64,
8974
8975 /// Owner of the repository. For example: The owner for
8976 /// <https://github.com/googlecloudplatform/cloud-builders> is
8977 /// "googlecloudplatform".
8978 pub owner: std::string::String,
8979
8980 /// Name of the repository. For example: The name for
8981 /// <https://github.com/googlecloudplatform/cloud-builders> is "cloud-builders".
8982 pub name: std::string::String,
8983
8984 /// Filter describing the types of events to trigger a build.
8985 /// Currently supported event types: push, pull_request.
8986 pub event: std::option::Option<crate::model::git_hub_events_config::Event>,
8987
8988 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8989}
8990
8991impl GitHubEventsConfig {
8992 pub fn new() -> Self {
8993 std::default::Default::default()
8994 }
8995
8996 /// Sets the value of [installation_id][crate::model::GitHubEventsConfig::installation_id].
8997 ///
8998 /// # Example
8999 /// ```ignore,no_run
9000 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9001 /// let x = GitHubEventsConfig::new().set_installation_id(42);
9002 /// ```
9003 #[deprecated]
9004 pub fn set_installation_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9005 self.installation_id = v.into();
9006 self
9007 }
9008
9009 /// Sets the value of [owner][crate::model::GitHubEventsConfig::owner].
9010 ///
9011 /// # Example
9012 /// ```ignore,no_run
9013 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9014 /// let x = GitHubEventsConfig::new().set_owner("example");
9015 /// ```
9016 pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9017 self.owner = v.into();
9018 self
9019 }
9020
9021 /// Sets the value of [name][crate::model::GitHubEventsConfig::name].
9022 ///
9023 /// # Example
9024 /// ```ignore,no_run
9025 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9026 /// let x = GitHubEventsConfig::new().set_name("example");
9027 /// ```
9028 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9029 self.name = v.into();
9030 self
9031 }
9032
9033 /// Sets the value of [event][crate::model::GitHubEventsConfig::event].
9034 ///
9035 /// Note that all the setters affecting `event` are mutually
9036 /// exclusive.
9037 ///
9038 /// # Example
9039 /// ```ignore,no_run
9040 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9041 /// use google_cloud_build_v1::model::PullRequestFilter;
9042 /// let x = GitHubEventsConfig::new().set_event(Some(
9043 /// google_cloud_build_v1::model::git_hub_events_config::Event::PullRequest(PullRequestFilter::default().into())));
9044 /// ```
9045 pub fn set_event<
9046 T: std::convert::Into<std::option::Option<crate::model::git_hub_events_config::Event>>,
9047 >(
9048 mut self,
9049 v: T,
9050 ) -> Self {
9051 self.event = v.into();
9052 self
9053 }
9054
9055 /// The value of [event][crate::model::GitHubEventsConfig::event]
9056 /// if it holds a `PullRequest`, `None` if the field is not set or
9057 /// holds a different branch.
9058 pub fn pull_request(
9059 &self,
9060 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
9061 #[allow(unreachable_patterns)]
9062 self.event.as_ref().and_then(|v| match v {
9063 crate::model::git_hub_events_config::Event::PullRequest(v) => {
9064 std::option::Option::Some(v)
9065 }
9066 _ => std::option::Option::None,
9067 })
9068 }
9069
9070 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9071 /// to hold a `PullRequest`.
9072 ///
9073 /// Note that all the setters affecting `event` are
9074 /// mutually exclusive.
9075 ///
9076 /// # Example
9077 /// ```ignore,no_run
9078 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9079 /// use google_cloud_build_v1::model::PullRequestFilter;
9080 /// let x = GitHubEventsConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
9081 /// assert!(x.pull_request().is_some());
9082 /// assert!(x.push().is_none());
9083 /// ```
9084 pub fn set_pull_request<
9085 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
9086 >(
9087 mut self,
9088 v: T,
9089 ) -> Self {
9090 self.event = std::option::Option::Some(
9091 crate::model::git_hub_events_config::Event::PullRequest(v.into()),
9092 );
9093 self
9094 }
9095
9096 /// The value of [event][crate::model::GitHubEventsConfig::event]
9097 /// if it holds a `Push`, `None` if the field is not set or
9098 /// holds a different branch.
9099 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
9100 #[allow(unreachable_patterns)]
9101 self.event.as_ref().and_then(|v| match v {
9102 crate::model::git_hub_events_config::Event::Push(v) => std::option::Option::Some(v),
9103 _ => std::option::Option::None,
9104 })
9105 }
9106
9107 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9108 /// to hold a `Push`.
9109 ///
9110 /// Note that all the setters affecting `event` are
9111 /// mutually exclusive.
9112 ///
9113 /// # Example
9114 /// ```ignore,no_run
9115 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9116 /// use google_cloud_build_v1::model::PushFilter;
9117 /// let x = GitHubEventsConfig::new().set_push(PushFilter::default()/* use setters */);
9118 /// assert!(x.push().is_some());
9119 /// assert!(x.pull_request().is_none());
9120 /// ```
9121 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
9122 mut self,
9123 v: T,
9124 ) -> Self {
9125 self.event =
9126 std::option::Option::Some(crate::model::git_hub_events_config::Event::Push(v.into()));
9127 self
9128 }
9129}
9130
9131impl wkt::message::Message for GitHubEventsConfig {
9132 fn typename() -> &'static str {
9133 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEventsConfig"
9134 }
9135}
9136
9137/// Defines additional types related to [GitHubEventsConfig].
9138pub mod git_hub_events_config {
9139 #[allow(unused_imports)]
9140 use super::*;
9141
9142 /// Filter describing the types of events to trigger a build.
9143 /// Currently supported event types: push, pull_request.
9144 #[derive(Clone, Debug, PartialEq)]
9145 #[non_exhaustive]
9146 pub enum Event {
9147 /// filter to match changes in pull requests.
9148 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9149 /// filter to match changes in refs like branches, tags.
9150 Push(std::boxed::Box<crate::model::PushFilter>),
9151 }
9152}
9153
9154/// PubsubConfig describes the configuration of a trigger that
9155/// creates a build whenever a Pub/Sub message is published.
9156#[derive(Clone, Default, PartialEq)]
9157#[non_exhaustive]
9158pub struct PubsubConfig {
9159 /// Output only. Name of the subscription. Format is
9160 /// `projects/{project}/subscriptions/{subscription}`.
9161 pub subscription: std::string::String,
9162
9163 /// Optional. The name of the topic from which this subscription is receiving
9164 /// messages. Format is `projects/{project}/topics/{topic}`.
9165 pub topic: std::string::String,
9166
9167 /// Service account that will make the push request.
9168 pub service_account_email: std::string::String,
9169
9170 /// Potential issues with the underlying Pub/Sub subscription configuration.
9171 /// Only populated on get requests.
9172 pub state: crate::model::pubsub_config::State,
9173
9174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9175}
9176
9177impl PubsubConfig {
9178 pub fn new() -> Self {
9179 std::default::Default::default()
9180 }
9181
9182 /// Sets the value of [subscription][crate::model::PubsubConfig::subscription].
9183 ///
9184 /// # Example
9185 /// ```ignore,no_run
9186 /// # use google_cloud_build_v1::model::PubsubConfig;
9187 /// let x = PubsubConfig::new().set_subscription("example");
9188 /// ```
9189 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9190 self.subscription = v.into();
9191 self
9192 }
9193
9194 /// Sets the value of [topic][crate::model::PubsubConfig::topic].
9195 ///
9196 /// # Example
9197 /// ```ignore,no_run
9198 /// # use google_cloud_build_v1::model::PubsubConfig;
9199 /// let x = PubsubConfig::new().set_topic("example");
9200 /// ```
9201 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9202 self.topic = v.into();
9203 self
9204 }
9205
9206 /// Sets the value of [service_account_email][crate::model::PubsubConfig::service_account_email].
9207 ///
9208 /// # Example
9209 /// ```ignore,no_run
9210 /// # use google_cloud_build_v1::model::PubsubConfig;
9211 /// let x = PubsubConfig::new().set_service_account_email("example");
9212 /// ```
9213 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
9214 mut self,
9215 v: T,
9216 ) -> Self {
9217 self.service_account_email = v.into();
9218 self
9219 }
9220
9221 /// Sets the value of [state][crate::model::PubsubConfig::state].
9222 ///
9223 /// # Example
9224 /// ```ignore,no_run
9225 /// # use google_cloud_build_v1::model::PubsubConfig;
9226 /// use google_cloud_build_v1::model::pubsub_config::State;
9227 /// let x0 = PubsubConfig::new().set_state(State::Ok);
9228 /// let x1 = PubsubConfig::new().set_state(State::SubscriptionDeleted);
9229 /// let x2 = PubsubConfig::new().set_state(State::TopicDeleted);
9230 /// ```
9231 pub fn set_state<T: std::convert::Into<crate::model::pubsub_config::State>>(
9232 mut self,
9233 v: T,
9234 ) -> Self {
9235 self.state = v.into();
9236 self
9237 }
9238}
9239
9240impl wkt::message::Message for PubsubConfig {
9241 fn typename() -> &'static str {
9242 "type.googleapis.com/google.devtools.cloudbuild.v1.PubsubConfig"
9243 }
9244}
9245
9246/// Defines additional types related to [PubsubConfig].
9247pub mod pubsub_config {
9248 #[allow(unused_imports)]
9249 use super::*;
9250
9251 /// Enumerates potential issues with the underlying Pub/Sub subscription
9252 /// configuration.
9253 ///
9254 /// # Working with unknown values
9255 ///
9256 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9257 /// additional enum variants at any time. Adding new variants is not considered
9258 /// a breaking change. Applications should write their code in anticipation of:
9259 ///
9260 /// - New values appearing in future releases of the client library, **and**
9261 /// - New values received dynamically, without application changes.
9262 ///
9263 /// Please consult the [Working with enums] section in the user guide for some
9264 /// guidelines.
9265 ///
9266 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9267 #[derive(Clone, Debug, PartialEq)]
9268 #[non_exhaustive]
9269 pub enum State {
9270 /// The subscription configuration has not been checked.
9271 Unspecified,
9272 /// The Pub/Sub subscription is properly configured.
9273 Ok,
9274 /// The subscription has been deleted.
9275 SubscriptionDeleted,
9276 /// The topic has been deleted.
9277 TopicDeleted,
9278 /// Some of the subscription's field are misconfigured.
9279 SubscriptionMisconfigured,
9280 /// If set, the enum was initialized with an unknown value.
9281 ///
9282 /// Applications can examine the value using [State::value] or
9283 /// [State::name].
9284 UnknownValue(state::UnknownValue),
9285 }
9286
9287 #[doc(hidden)]
9288 pub mod state {
9289 #[allow(unused_imports)]
9290 use super::*;
9291 #[derive(Clone, Debug, PartialEq)]
9292 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9293 }
9294
9295 impl State {
9296 /// Gets the enum value.
9297 ///
9298 /// Returns `None` if the enum contains an unknown value deserialized from
9299 /// the string representation of enums.
9300 pub fn value(&self) -> std::option::Option<i32> {
9301 match self {
9302 Self::Unspecified => std::option::Option::Some(0),
9303 Self::Ok => std::option::Option::Some(1),
9304 Self::SubscriptionDeleted => std::option::Option::Some(2),
9305 Self::TopicDeleted => std::option::Option::Some(3),
9306 Self::SubscriptionMisconfigured => std::option::Option::Some(4),
9307 Self::UnknownValue(u) => u.0.value(),
9308 }
9309 }
9310
9311 /// Gets the enum value as a string.
9312 ///
9313 /// Returns `None` if the enum contains an unknown value deserialized from
9314 /// the integer representation of enums.
9315 pub fn name(&self) -> std::option::Option<&str> {
9316 match self {
9317 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9318 Self::Ok => std::option::Option::Some("OK"),
9319 Self::SubscriptionDeleted => std::option::Option::Some("SUBSCRIPTION_DELETED"),
9320 Self::TopicDeleted => std::option::Option::Some("TOPIC_DELETED"),
9321 Self::SubscriptionMisconfigured => {
9322 std::option::Option::Some("SUBSCRIPTION_MISCONFIGURED")
9323 }
9324 Self::UnknownValue(u) => u.0.name(),
9325 }
9326 }
9327 }
9328
9329 impl std::default::Default for State {
9330 fn default() -> Self {
9331 use std::convert::From;
9332 Self::from(0)
9333 }
9334 }
9335
9336 impl std::fmt::Display for State {
9337 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9338 wkt::internal::display_enum(f, self.name(), self.value())
9339 }
9340 }
9341
9342 impl std::convert::From<i32> for State {
9343 fn from(value: i32) -> Self {
9344 match value {
9345 0 => Self::Unspecified,
9346 1 => Self::Ok,
9347 2 => Self::SubscriptionDeleted,
9348 3 => Self::TopicDeleted,
9349 4 => Self::SubscriptionMisconfigured,
9350 _ => Self::UnknownValue(state::UnknownValue(
9351 wkt::internal::UnknownEnumValue::Integer(value),
9352 )),
9353 }
9354 }
9355 }
9356
9357 impl std::convert::From<&str> for State {
9358 fn from(value: &str) -> Self {
9359 use std::string::ToString;
9360 match value {
9361 "STATE_UNSPECIFIED" => Self::Unspecified,
9362 "OK" => Self::Ok,
9363 "SUBSCRIPTION_DELETED" => Self::SubscriptionDeleted,
9364 "TOPIC_DELETED" => Self::TopicDeleted,
9365 "SUBSCRIPTION_MISCONFIGURED" => Self::SubscriptionMisconfigured,
9366 _ => Self::UnknownValue(state::UnknownValue(
9367 wkt::internal::UnknownEnumValue::String(value.to_string()),
9368 )),
9369 }
9370 }
9371 }
9372
9373 impl serde::ser::Serialize for State {
9374 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9375 where
9376 S: serde::Serializer,
9377 {
9378 match self {
9379 Self::Unspecified => serializer.serialize_i32(0),
9380 Self::Ok => serializer.serialize_i32(1),
9381 Self::SubscriptionDeleted => serializer.serialize_i32(2),
9382 Self::TopicDeleted => serializer.serialize_i32(3),
9383 Self::SubscriptionMisconfigured => serializer.serialize_i32(4),
9384 Self::UnknownValue(u) => u.0.serialize(serializer),
9385 }
9386 }
9387 }
9388
9389 impl<'de> serde::de::Deserialize<'de> for State {
9390 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9391 where
9392 D: serde::Deserializer<'de>,
9393 {
9394 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9395 ".google.devtools.cloudbuild.v1.PubsubConfig.State",
9396 ))
9397 }
9398 }
9399}
9400
9401/// WebhookConfig describes the configuration of a trigger that
9402/// creates a build whenever a webhook is sent to a trigger's webhook URL.
9403#[derive(Clone, Default, PartialEq)]
9404#[non_exhaustive]
9405pub struct WebhookConfig {
9406 /// Potential issues with the underlying Pub/Sub subscription configuration.
9407 /// Only populated on get requests.
9408 pub state: crate::model::webhook_config::State,
9409
9410 /// Auth method specifies how the webhook authenticates with GCP.
9411 pub auth_method: std::option::Option<crate::model::webhook_config::AuthMethod>,
9412
9413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9414}
9415
9416impl WebhookConfig {
9417 pub fn new() -> Self {
9418 std::default::Default::default()
9419 }
9420
9421 /// Sets the value of [state][crate::model::WebhookConfig::state].
9422 ///
9423 /// # Example
9424 /// ```ignore,no_run
9425 /// # use google_cloud_build_v1::model::WebhookConfig;
9426 /// use google_cloud_build_v1::model::webhook_config::State;
9427 /// let x0 = WebhookConfig::new().set_state(State::Ok);
9428 /// let x1 = WebhookConfig::new().set_state(State::SecretDeleted);
9429 /// ```
9430 pub fn set_state<T: std::convert::Into<crate::model::webhook_config::State>>(
9431 mut self,
9432 v: T,
9433 ) -> Self {
9434 self.state = v.into();
9435 self
9436 }
9437
9438 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method].
9439 ///
9440 /// Note that all the setters affecting `auth_method` are mutually
9441 /// exclusive.
9442 ///
9443 /// # Example
9444 /// ```ignore,no_run
9445 /// # use google_cloud_build_v1::model::WebhookConfig;
9446 /// use google_cloud_build_v1::model::webhook_config::AuthMethod;
9447 /// let x = WebhookConfig::new().set_auth_method(Some(AuthMethod::Secret("example".to_string())));
9448 /// ```
9449 pub fn set_auth_method<
9450 T: std::convert::Into<std::option::Option<crate::model::webhook_config::AuthMethod>>,
9451 >(
9452 mut self,
9453 v: T,
9454 ) -> Self {
9455 self.auth_method = v.into();
9456 self
9457 }
9458
9459 /// The value of [auth_method][crate::model::WebhookConfig::auth_method]
9460 /// if it holds a `Secret`, `None` if the field is not set or
9461 /// holds a different branch.
9462 pub fn secret(&self) -> std::option::Option<&std::string::String> {
9463 #[allow(unreachable_patterns)]
9464 self.auth_method.as_ref().and_then(|v| match v {
9465 crate::model::webhook_config::AuthMethod::Secret(v) => std::option::Option::Some(v),
9466 _ => std::option::Option::None,
9467 })
9468 }
9469
9470 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method]
9471 /// to hold a `Secret`.
9472 ///
9473 /// Note that all the setters affecting `auth_method` are
9474 /// mutually exclusive.
9475 ///
9476 /// # Example
9477 /// ```ignore,no_run
9478 /// # use google_cloud_build_v1::model::WebhookConfig;
9479 /// let x = WebhookConfig::new().set_secret("example");
9480 /// assert!(x.secret().is_some());
9481 /// ```
9482 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9483 self.auth_method =
9484 std::option::Option::Some(crate::model::webhook_config::AuthMethod::Secret(v.into()));
9485 self
9486 }
9487}
9488
9489impl wkt::message::Message for WebhookConfig {
9490 fn typename() -> &'static str {
9491 "type.googleapis.com/google.devtools.cloudbuild.v1.WebhookConfig"
9492 }
9493}
9494
9495/// Defines additional types related to [WebhookConfig].
9496pub mod webhook_config {
9497 #[allow(unused_imports)]
9498 use super::*;
9499
9500 /// Enumerates potential issues with the Secret Manager secret provided by the
9501 /// user.
9502 ///
9503 /// # Working with unknown values
9504 ///
9505 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9506 /// additional enum variants at any time. Adding new variants is not considered
9507 /// a breaking change. Applications should write their code in anticipation of:
9508 ///
9509 /// - New values appearing in future releases of the client library, **and**
9510 /// - New values received dynamically, without application changes.
9511 ///
9512 /// Please consult the [Working with enums] section in the user guide for some
9513 /// guidelines.
9514 ///
9515 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9516 #[derive(Clone, Debug, PartialEq)]
9517 #[non_exhaustive]
9518 pub enum State {
9519 /// The webhook auth configuration not been checked.
9520 Unspecified,
9521 /// The auth configuration is properly setup.
9522 Ok,
9523 /// The secret provided in auth_method has been deleted.
9524 SecretDeleted,
9525 /// If set, the enum was initialized with an unknown value.
9526 ///
9527 /// Applications can examine the value using [State::value] or
9528 /// [State::name].
9529 UnknownValue(state::UnknownValue),
9530 }
9531
9532 #[doc(hidden)]
9533 pub mod state {
9534 #[allow(unused_imports)]
9535 use super::*;
9536 #[derive(Clone, Debug, PartialEq)]
9537 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9538 }
9539
9540 impl State {
9541 /// Gets the enum value.
9542 ///
9543 /// Returns `None` if the enum contains an unknown value deserialized from
9544 /// the string representation of enums.
9545 pub fn value(&self) -> std::option::Option<i32> {
9546 match self {
9547 Self::Unspecified => std::option::Option::Some(0),
9548 Self::Ok => std::option::Option::Some(1),
9549 Self::SecretDeleted => std::option::Option::Some(2),
9550 Self::UnknownValue(u) => u.0.value(),
9551 }
9552 }
9553
9554 /// Gets the enum value as a string.
9555 ///
9556 /// Returns `None` if the enum contains an unknown value deserialized from
9557 /// the integer representation of enums.
9558 pub fn name(&self) -> std::option::Option<&str> {
9559 match self {
9560 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9561 Self::Ok => std::option::Option::Some("OK"),
9562 Self::SecretDeleted => std::option::Option::Some("SECRET_DELETED"),
9563 Self::UnknownValue(u) => u.0.name(),
9564 }
9565 }
9566 }
9567
9568 impl std::default::Default for State {
9569 fn default() -> Self {
9570 use std::convert::From;
9571 Self::from(0)
9572 }
9573 }
9574
9575 impl std::fmt::Display for State {
9576 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9577 wkt::internal::display_enum(f, self.name(), self.value())
9578 }
9579 }
9580
9581 impl std::convert::From<i32> for State {
9582 fn from(value: i32) -> Self {
9583 match value {
9584 0 => Self::Unspecified,
9585 1 => Self::Ok,
9586 2 => Self::SecretDeleted,
9587 _ => Self::UnknownValue(state::UnknownValue(
9588 wkt::internal::UnknownEnumValue::Integer(value),
9589 )),
9590 }
9591 }
9592 }
9593
9594 impl std::convert::From<&str> for State {
9595 fn from(value: &str) -> Self {
9596 use std::string::ToString;
9597 match value {
9598 "STATE_UNSPECIFIED" => Self::Unspecified,
9599 "OK" => Self::Ok,
9600 "SECRET_DELETED" => Self::SecretDeleted,
9601 _ => Self::UnknownValue(state::UnknownValue(
9602 wkt::internal::UnknownEnumValue::String(value.to_string()),
9603 )),
9604 }
9605 }
9606 }
9607
9608 impl serde::ser::Serialize for State {
9609 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9610 where
9611 S: serde::Serializer,
9612 {
9613 match self {
9614 Self::Unspecified => serializer.serialize_i32(0),
9615 Self::Ok => serializer.serialize_i32(1),
9616 Self::SecretDeleted => serializer.serialize_i32(2),
9617 Self::UnknownValue(u) => u.0.serialize(serializer),
9618 }
9619 }
9620 }
9621
9622 impl<'de> serde::de::Deserialize<'de> for State {
9623 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9624 where
9625 D: serde::Deserializer<'de>,
9626 {
9627 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9628 ".google.devtools.cloudbuild.v1.WebhookConfig.State",
9629 ))
9630 }
9631 }
9632
9633 /// Auth method specifies how the webhook authenticates with GCP.
9634 #[derive(Clone, Debug, PartialEq)]
9635 #[non_exhaustive]
9636 pub enum AuthMethod {
9637 /// Required. Resource name for the secret required as a URL parameter.
9638 Secret(std::string::String),
9639 }
9640}
9641
9642/// PullRequestFilter contains filter properties for matching GitHub Pull
9643/// Requests.
9644#[derive(Clone, Default, PartialEq)]
9645#[non_exhaustive]
9646pub struct PullRequestFilter {
9647 /// If CommentControl is enabled, depending on the setting, builds may not
9648 /// fire until a repository writer comments `/gcbrun` on a pull
9649 /// request or `/gcbrun` is in the pull request description.
9650 /// Only PR comments that contain `/gcbrun` will trigger builds.
9651 ///
9652 /// If CommentControl is set to disabled, comments with `/gcbrun` from a user
9653 /// with repository write permission or above will
9654 /// still trigger builds to run.
9655 pub comment_control: crate::model::pull_request_filter::CommentControl,
9656
9657 /// If true, branches that do NOT match the git_ref will trigger a build.
9658 pub invert_regex: bool,
9659
9660 /// Target refs to match.
9661 /// A target ref is the git reference where the pull request will be applied.
9662 pub git_ref: std::option::Option<crate::model::pull_request_filter::GitRef>,
9663
9664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9665}
9666
9667impl PullRequestFilter {
9668 pub fn new() -> Self {
9669 std::default::Default::default()
9670 }
9671
9672 /// Sets the value of [comment_control][crate::model::PullRequestFilter::comment_control].
9673 ///
9674 /// # Example
9675 /// ```ignore,no_run
9676 /// # use google_cloud_build_v1::model::PullRequestFilter;
9677 /// use google_cloud_build_v1::model::pull_request_filter::CommentControl;
9678 /// let x0 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabled);
9679 /// let x1 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabledForExternalContributorsOnly);
9680 /// ```
9681 pub fn set_comment_control<
9682 T: std::convert::Into<crate::model::pull_request_filter::CommentControl>,
9683 >(
9684 mut self,
9685 v: T,
9686 ) -> Self {
9687 self.comment_control = v.into();
9688 self
9689 }
9690
9691 /// Sets the value of [invert_regex][crate::model::PullRequestFilter::invert_regex].
9692 ///
9693 /// # Example
9694 /// ```ignore,no_run
9695 /// # use google_cloud_build_v1::model::PullRequestFilter;
9696 /// let x = PullRequestFilter::new().set_invert_regex(true);
9697 /// ```
9698 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9699 self.invert_regex = v.into();
9700 self
9701 }
9702
9703 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref].
9704 ///
9705 /// Note that all the setters affecting `git_ref` are mutually
9706 /// exclusive.
9707 ///
9708 /// # Example
9709 /// ```ignore,no_run
9710 /// # use google_cloud_build_v1::model::PullRequestFilter;
9711 /// use google_cloud_build_v1::model::pull_request_filter::GitRef;
9712 /// let x = PullRequestFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9713 /// ```
9714 pub fn set_git_ref<
9715 T: std::convert::Into<std::option::Option<crate::model::pull_request_filter::GitRef>>,
9716 >(
9717 mut self,
9718 v: T,
9719 ) -> Self {
9720 self.git_ref = v.into();
9721 self
9722 }
9723
9724 /// The value of [git_ref][crate::model::PullRequestFilter::git_ref]
9725 /// if it holds a `Branch`, `None` if the field is not set or
9726 /// holds a different branch.
9727 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9728 #[allow(unreachable_patterns)]
9729 self.git_ref.as_ref().and_then(|v| match v {
9730 crate::model::pull_request_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9731 _ => std::option::Option::None,
9732 })
9733 }
9734
9735 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref]
9736 /// to hold a `Branch`.
9737 ///
9738 /// Note that all the setters affecting `git_ref` are
9739 /// mutually exclusive.
9740 ///
9741 /// # Example
9742 /// ```ignore,no_run
9743 /// # use google_cloud_build_v1::model::PullRequestFilter;
9744 /// let x = PullRequestFilter::new().set_branch("example");
9745 /// assert!(x.branch().is_some());
9746 /// ```
9747 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9748 self.git_ref =
9749 std::option::Option::Some(crate::model::pull_request_filter::GitRef::Branch(v.into()));
9750 self
9751 }
9752}
9753
9754impl wkt::message::Message for PullRequestFilter {
9755 fn typename() -> &'static str {
9756 "type.googleapis.com/google.devtools.cloudbuild.v1.PullRequestFilter"
9757 }
9758}
9759
9760/// Defines additional types related to [PullRequestFilter].
9761pub mod pull_request_filter {
9762 #[allow(unused_imports)]
9763 use super::*;
9764
9765 /// Controls whether or not a `/gcbrun` comment is required from a user with
9766 /// repository write permission or above in order to
9767 /// trigger Build runs for pull requests. Pull Request update events differ
9768 /// between repo types.
9769 /// Check repo specific guides
9770 /// ([GitHub](https://cloud.google.com/build/docs/automating-builds/github/build-repos-from-github-enterprise#creating_a_github_enterprise_trigger),
9771 /// [Bitbucket](https://cloud.google.com/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-server#creating_a_bitbucket_server_trigger),
9772 /// [GitLab](https://cloud.google.com/build/docs/automating-builds/gitlab/build-repos-from-gitlab#creating_a_gitlab_trigger)
9773 /// for details.
9774 ///
9775 /// # Working with unknown values
9776 ///
9777 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9778 /// additional enum variants at any time. Adding new variants is not considered
9779 /// a breaking change. Applications should write their code in anticipation of:
9780 ///
9781 /// - New values appearing in future releases of the client library, **and**
9782 /// - New values received dynamically, without application changes.
9783 ///
9784 /// Please consult the [Working with enums] section in the user guide for some
9785 /// guidelines.
9786 ///
9787 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9788 #[derive(Clone, Debug, PartialEq)]
9789 #[non_exhaustive]
9790 pub enum CommentControl {
9791 /// Do not require `/gcbrun` comments from a user with repository write
9792 /// permission or above on pull requests before builds are triggered.
9793 /// Comments that contain `/gcbrun` will still fire builds so this should
9794 /// be thought of as comments not required.
9795 CommentsDisabled,
9796 /// Builds will only fire in response to pull requests if:
9797 ///
9798 /// 1. The pull request author has repository write permission or above and
9799 /// `/gcbrun` is in the PR description.
9800 /// 1. A user with repository writer permissions or above comments `/gcbrun`
9801 /// on a pull request authored by any user.
9802 CommentsEnabled,
9803 /// Builds will only fire in response to pull requests if:
9804 ///
9805 /// 1. The pull request author is a repository writer or above.
9806 /// 1. If the author does not have write permissions, a user with write
9807 /// permissions or above must comment `/gcbrun` in order to fire a build.
9808 CommentsEnabledForExternalContributorsOnly,
9809 /// If set, the enum was initialized with an unknown value.
9810 ///
9811 /// Applications can examine the value using [CommentControl::value] or
9812 /// [CommentControl::name].
9813 UnknownValue(comment_control::UnknownValue),
9814 }
9815
9816 #[doc(hidden)]
9817 pub mod comment_control {
9818 #[allow(unused_imports)]
9819 use super::*;
9820 #[derive(Clone, Debug, PartialEq)]
9821 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9822 }
9823
9824 impl CommentControl {
9825 /// Gets the enum value.
9826 ///
9827 /// Returns `None` if the enum contains an unknown value deserialized from
9828 /// the string representation of enums.
9829 pub fn value(&self) -> std::option::Option<i32> {
9830 match self {
9831 Self::CommentsDisabled => std::option::Option::Some(0),
9832 Self::CommentsEnabled => std::option::Option::Some(1),
9833 Self::CommentsEnabledForExternalContributorsOnly => std::option::Option::Some(2),
9834 Self::UnknownValue(u) => u.0.value(),
9835 }
9836 }
9837
9838 /// Gets the enum value as a string.
9839 ///
9840 /// Returns `None` if the enum contains an unknown value deserialized from
9841 /// the integer representation of enums.
9842 pub fn name(&self) -> std::option::Option<&str> {
9843 match self {
9844 Self::CommentsDisabled => std::option::Option::Some("COMMENTS_DISABLED"),
9845 Self::CommentsEnabled => std::option::Option::Some("COMMENTS_ENABLED"),
9846 Self::CommentsEnabledForExternalContributorsOnly => {
9847 std::option::Option::Some("COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY")
9848 }
9849 Self::UnknownValue(u) => u.0.name(),
9850 }
9851 }
9852 }
9853
9854 impl std::default::Default for CommentControl {
9855 fn default() -> Self {
9856 use std::convert::From;
9857 Self::from(0)
9858 }
9859 }
9860
9861 impl std::fmt::Display for CommentControl {
9862 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9863 wkt::internal::display_enum(f, self.name(), self.value())
9864 }
9865 }
9866
9867 impl std::convert::From<i32> for CommentControl {
9868 fn from(value: i32) -> Self {
9869 match value {
9870 0 => Self::CommentsDisabled,
9871 1 => Self::CommentsEnabled,
9872 2 => Self::CommentsEnabledForExternalContributorsOnly,
9873 _ => Self::UnknownValue(comment_control::UnknownValue(
9874 wkt::internal::UnknownEnumValue::Integer(value),
9875 )),
9876 }
9877 }
9878 }
9879
9880 impl std::convert::From<&str> for CommentControl {
9881 fn from(value: &str) -> Self {
9882 use std::string::ToString;
9883 match value {
9884 "COMMENTS_DISABLED" => Self::CommentsDisabled,
9885 "COMMENTS_ENABLED" => Self::CommentsEnabled,
9886 "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" => {
9887 Self::CommentsEnabledForExternalContributorsOnly
9888 }
9889 _ => Self::UnknownValue(comment_control::UnknownValue(
9890 wkt::internal::UnknownEnumValue::String(value.to_string()),
9891 )),
9892 }
9893 }
9894 }
9895
9896 impl serde::ser::Serialize for CommentControl {
9897 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9898 where
9899 S: serde::Serializer,
9900 {
9901 match self {
9902 Self::CommentsDisabled => serializer.serialize_i32(0),
9903 Self::CommentsEnabled => serializer.serialize_i32(1),
9904 Self::CommentsEnabledForExternalContributorsOnly => serializer.serialize_i32(2),
9905 Self::UnknownValue(u) => u.0.serialize(serializer),
9906 }
9907 }
9908 }
9909
9910 impl<'de> serde::de::Deserialize<'de> for CommentControl {
9911 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9912 where
9913 D: serde::Deserializer<'de>,
9914 {
9915 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommentControl>::new(
9916 ".google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl",
9917 ))
9918 }
9919 }
9920
9921 /// Target refs to match.
9922 /// A target ref is the git reference where the pull request will be applied.
9923 #[derive(Clone, Debug, PartialEq)]
9924 #[non_exhaustive]
9925 pub enum GitRef {
9926 /// Regex of branches to match.
9927 ///
9928 /// The syntax of the regular expressions accepted is the syntax accepted by
9929 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
9930 Branch(std::string::String),
9931 }
9932}
9933
9934/// Push contains filter properties for matching GitHub git pushes.
9935#[derive(Clone, Default, PartialEq)]
9936#[non_exhaustive]
9937pub struct PushFilter {
9938 /// When true, only trigger a build if the revision regex does NOT match the
9939 /// git_ref regex.
9940 pub invert_regex: bool,
9941
9942 /// Modified refs to match.
9943 /// A modified refs are the refs modified by a git push operation.
9944 pub git_ref: std::option::Option<crate::model::push_filter::GitRef>,
9945
9946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9947}
9948
9949impl PushFilter {
9950 pub fn new() -> Self {
9951 std::default::Default::default()
9952 }
9953
9954 /// Sets the value of [invert_regex][crate::model::PushFilter::invert_regex].
9955 ///
9956 /// # Example
9957 /// ```ignore,no_run
9958 /// # use google_cloud_build_v1::model::PushFilter;
9959 /// let x = PushFilter::new().set_invert_regex(true);
9960 /// ```
9961 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9962 self.invert_regex = v.into();
9963 self
9964 }
9965
9966 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref].
9967 ///
9968 /// Note that all the setters affecting `git_ref` are mutually
9969 /// exclusive.
9970 ///
9971 /// # Example
9972 /// ```ignore,no_run
9973 /// # use google_cloud_build_v1::model::PushFilter;
9974 /// use google_cloud_build_v1::model::push_filter::GitRef;
9975 /// let x = PushFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9976 /// ```
9977 pub fn set_git_ref<
9978 T: std::convert::Into<std::option::Option<crate::model::push_filter::GitRef>>,
9979 >(
9980 mut self,
9981 v: T,
9982 ) -> Self {
9983 self.git_ref = v.into();
9984 self
9985 }
9986
9987 /// The value of [git_ref][crate::model::PushFilter::git_ref]
9988 /// if it holds a `Branch`, `None` if the field is not set or
9989 /// holds a different branch.
9990 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9991 #[allow(unreachable_patterns)]
9992 self.git_ref.as_ref().and_then(|v| match v {
9993 crate::model::push_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9994 _ => std::option::Option::None,
9995 })
9996 }
9997
9998 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
9999 /// to hold a `Branch`.
10000 ///
10001 /// Note that all the setters affecting `git_ref` are
10002 /// mutually exclusive.
10003 ///
10004 /// # Example
10005 /// ```ignore,no_run
10006 /// # use google_cloud_build_v1::model::PushFilter;
10007 /// let x = PushFilter::new().set_branch("example");
10008 /// assert!(x.branch().is_some());
10009 /// assert!(x.tag().is_none());
10010 /// ```
10011 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10012 self.git_ref =
10013 std::option::Option::Some(crate::model::push_filter::GitRef::Branch(v.into()));
10014 self
10015 }
10016
10017 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10018 /// if it holds a `Tag`, `None` if the field is not set or
10019 /// holds a different branch.
10020 pub fn tag(&self) -> std::option::Option<&std::string::String> {
10021 #[allow(unreachable_patterns)]
10022 self.git_ref.as_ref().and_then(|v| match v {
10023 crate::model::push_filter::GitRef::Tag(v) => std::option::Option::Some(v),
10024 _ => std::option::Option::None,
10025 })
10026 }
10027
10028 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10029 /// to hold a `Tag`.
10030 ///
10031 /// Note that all the setters affecting `git_ref` are
10032 /// mutually exclusive.
10033 ///
10034 /// # Example
10035 /// ```ignore,no_run
10036 /// # use google_cloud_build_v1::model::PushFilter;
10037 /// let x = PushFilter::new().set_tag("example");
10038 /// assert!(x.tag().is_some());
10039 /// assert!(x.branch().is_none());
10040 /// ```
10041 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10042 self.git_ref = std::option::Option::Some(crate::model::push_filter::GitRef::Tag(v.into()));
10043 self
10044 }
10045}
10046
10047impl wkt::message::Message for PushFilter {
10048 fn typename() -> &'static str {
10049 "type.googleapis.com/google.devtools.cloudbuild.v1.PushFilter"
10050 }
10051}
10052
10053/// Defines additional types related to [PushFilter].
10054pub mod push_filter {
10055 #[allow(unused_imports)]
10056 use super::*;
10057
10058 /// Modified refs to match.
10059 /// A modified refs are the refs modified by a git push operation.
10060 #[derive(Clone, Debug, PartialEq)]
10061 #[non_exhaustive]
10062 pub enum GitRef {
10063 /// Regexes matching branches to build.
10064 ///
10065 /// The syntax of the regular expressions accepted is the syntax accepted by
10066 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10067 Branch(std::string::String),
10068 /// Regexes matching tags to build.
10069 ///
10070 /// The syntax of the regular expressions accepted is the syntax accepted by
10071 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10072 Tag(std::string::String),
10073 }
10074}
10075
10076/// Request to create a new `BuildTrigger`.
10077#[derive(Clone, Default, PartialEq)]
10078#[non_exhaustive]
10079pub struct CreateBuildTriggerRequest {
10080 /// The parent resource where this trigger will be created.
10081 /// Format: `projects/{project}/locations/{location}`
10082 pub parent: std::string::String,
10083
10084 /// Required. ID of the project for which to configure automatic builds.
10085 pub project_id: std::string::String,
10086
10087 /// Required. `BuildTrigger` to create.
10088 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10089
10090 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10091}
10092
10093impl CreateBuildTriggerRequest {
10094 pub fn new() -> Self {
10095 std::default::Default::default()
10096 }
10097
10098 /// Sets the value of [parent][crate::model::CreateBuildTriggerRequest::parent].
10099 ///
10100 /// # Example
10101 /// ```ignore,no_run
10102 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10103 /// let x = CreateBuildTriggerRequest::new().set_parent("example");
10104 /// ```
10105 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10106 self.parent = v.into();
10107 self
10108 }
10109
10110 /// Sets the value of [project_id][crate::model::CreateBuildTriggerRequest::project_id].
10111 ///
10112 /// # Example
10113 /// ```ignore,no_run
10114 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10115 /// let x = CreateBuildTriggerRequest::new().set_project_id("example");
10116 /// ```
10117 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10118 self.project_id = v.into();
10119 self
10120 }
10121
10122 /// Sets the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10123 ///
10124 /// # Example
10125 /// ```ignore,no_run
10126 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10127 /// use google_cloud_build_v1::model::BuildTrigger;
10128 /// let x = CreateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10129 /// ```
10130 pub fn set_trigger<T>(mut self, v: T) -> Self
10131 where
10132 T: std::convert::Into<crate::model::BuildTrigger>,
10133 {
10134 self.trigger = std::option::Option::Some(v.into());
10135 self
10136 }
10137
10138 /// Sets or clears the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10139 ///
10140 /// # Example
10141 /// ```ignore,no_run
10142 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10143 /// use google_cloud_build_v1::model::BuildTrigger;
10144 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10145 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10146 /// ```
10147 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10148 where
10149 T: std::convert::Into<crate::model::BuildTrigger>,
10150 {
10151 self.trigger = v.map(|x| x.into());
10152 self
10153 }
10154}
10155
10156impl wkt::message::Message for CreateBuildTriggerRequest {
10157 fn typename() -> &'static str {
10158 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildTriggerRequest"
10159 }
10160}
10161
10162/// Returns the `BuildTrigger` with the specified ID.
10163#[derive(Clone, Default, PartialEq)]
10164#[non_exhaustive]
10165pub struct GetBuildTriggerRequest {
10166 /// The name of the `Trigger` to retrieve.
10167 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10168 pub name: std::string::String,
10169
10170 /// Required. ID of the project that owns the trigger.
10171 pub project_id: std::string::String,
10172
10173 /// Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
10174 pub trigger_id: std::string::String,
10175
10176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10177}
10178
10179impl GetBuildTriggerRequest {
10180 pub fn new() -> Self {
10181 std::default::Default::default()
10182 }
10183
10184 /// Sets the value of [name][crate::model::GetBuildTriggerRequest::name].
10185 ///
10186 /// # Example
10187 /// ```ignore,no_run
10188 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10189 /// let x = GetBuildTriggerRequest::new().set_name("example");
10190 /// ```
10191 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10192 self.name = v.into();
10193 self
10194 }
10195
10196 /// Sets the value of [project_id][crate::model::GetBuildTriggerRequest::project_id].
10197 ///
10198 /// # Example
10199 /// ```ignore,no_run
10200 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10201 /// let x = GetBuildTriggerRequest::new().set_project_id("example");
10202 /// ```
10203 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10204 self.project_id = v.into();
10205 self
10206 }
10207
10208 /// Sets the value of [trigger_id][crate::model::GetBuildTriggerRequest::trigger_id].
10209 ///
10210 /// # Example
10211 /// ```ignore,no_run
10212 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10213 /// let x = GetBuildTriggerRequest::new().set_trigger_id("example");
10214 /// ```
10215 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10216 self.trigger_id = v.into();
10217 self
10218 }
10219}
10220
10221impl wkt::message::Message for GetBuildTriggerRequest {
10222 fn typename() -> &'static str {
10223 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildTriggerRequest"
10224 }
10225}
10226
10227/// Request to list existing `BuildTriggers`.
10228#[derive(Clone, Default, PartialEq)]
10229#[non_exhaustive]
10230pub struct ListBuildTriggersRequest {
10231 /// The parent of the collection of `Triggers`.
10232 /// Format: `projects/{project}/locations/{location}`
10233 pub parent: std::string::String,
10234
10235 /// Required. ID of the project for which to list BuildTriggers.
10236 pub project_id: std::string::String,
10237
10238 /// Number of results to return in the list.
10239 pub page_size: i32,
10240
10241 /// Token to provide to skip to a particular spot in the list.
10242 pub page_token: std::string::String,
10243
10244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10245}
10246
10247impl ListBuildTriggersRequest {
10248 pub fn new() -> Self {
10249 std::default::Default::default()
10250 }
10251
10252 /// Sets the value of [parent][crate::model::ListBuildTriggersRequest::parent].
10253 ///
10254 /// # Example
10255 /// ```ignore,no_run
10256 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10257 /// let x = ListBuildTriggersRequest::new().set_parent("example");
10258 /// ```
10259 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10260 self.parent = v.into();
10261 self
10262 }
10263
10264 /// Sets the value of [project_id][crate::model::ListBuildTriggersRequest::project_id].
10265 ///
10266 /// # Example
10267 /// ```ignore,no_run
10268 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10269 /// let x = ListBuildTriggersRequest::new().set_project_id("example");
10270 /// ```
10271 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10272 self.project_id = v.into();
10273 self
10274 }
10275
10276 /// Sets the value of [page_size][crate::model::ListBuildTriggersRequest::page_size].
10277 ///
10278 /// # Example
10279 /// ```ignore,no_run
10280 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10281 /// let x = ListBuildTriggersRequest::new().set_page_size(42);
10282 /// ```
10283 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10284 self.page_size = v.into();
10285 self
10286 }
10287
10288 /// Sets the value of [page_token][crate::model::ListBuildTriggersRequest::page_token].
10289 ///
10290 /// # Example
10291 /// ```ignore,no_run
10292 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10293 /// let x = ListBuildTriggersRequest::new().set_page_token("example");
10294 /// ```
10295 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10296 self.page_token = v.into();
10297 self
10298 }
10299}
10300
10301impl wkt::message::Message for ListBuildTriggersRequest {
10302 fn typename() -> &'static str {
10303 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersRequest"
10304 }
10305}
10306
10307/// Response containing existing `BuildTriggers`.
10308#[derive(Clone, Default, PartialEq)]
10309#[non_exhaustive]
10310pub struct ListBuildTriggersResponse {
10311 /// `BuildTriggers` for the project, sorted by `create_time` descending.
10312 pub triggers: std::vec::Vec<crate::model::BuildTrigger>,
10313
10314 /// Token to receive the next page of results.
10315 pub next_page_token: std::string::String,
10316
10317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10318}
10319
10320impl ListBuildTriggersResponse {
10321 pub fn new() -> Self {
10322 std::default::Default::default()
10323 }
10324
10325 /// Sets the value of [triggers][crate::model::ListBuildTriggersResponse::triggers].
10326 ///
10327 /// # Example
10328 /// ```ignore,no_run
10329 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10330 /// use google_cloud_build_v1::model::BuildTrigger;
10331 /// let x = ListBuildTriggersResponse::new()
10332 /// .set_triggers([
10333 /// BuildTrigger::default()/* use setters */,
10334 /// BuildTrigger::default()/* use (different) setters */,
10335 /// ]);
10336 /// ```
10337 pub fn set_triggers<T, V>(mut self, v: T) -> Self
10338 where
10339 T: std::iter::IntoIterator<Item = V>,
10340 V: std::convert::Into<crate::model::BuildTrigger>,
10341 {
10342 use std::iter::Iterator;
10343 self.triggers = v.into_iter().map(|i| i.into()).collect();
10344 self
10345 }
10346
10347 /// Sets the value of [next_page_token][crate::model::ListBuildTriggersResponse::next_page_token].
10348 ///
10349 /// # Example
10350 /// ```ignore,no_run
10351 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10352 /// let x = ListBuildTriggersResponse::new().set_next_page_token("example");
10353 /// ```
10354 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10355 self.next_page_token = v.into();
10356 self
10357 }
10358}
10359
10360impl wkt::message::Message for ListBuildTriggersResponse {
10361 fn typename() -> &'static str {
10362 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersResponse"
10363 }
10364}
10365
10366#[doc(hidden)]
10367impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildTriggersResponse {
10368 type PageItem = crate::model::BuildTrigger;
10369
10370 fn items(self) -> std::vec::Vec<Self::PageItem> {
10371 self.triggers
10372 }
10373
10374 fn next_page_token(&self) -> std::string::String {
10375 use std::clone::Clone;
10376 self.next_page_token.clone()
10377 }
10378}
10379
10380/// Request to delete a `BuildTrigger`.
10381#[derive(Clone, Default, PartialEq)]
10382#[non_exhaustive]
10383pub struct DeleteBuildTriggerRequest {
10384 /// The name of the `Trigger` to delete.
10385 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10386 pub name: std::string::String,
10387
10388 /// Required. ID of the project that owns the trigger.
10389 pub project_id: std::string::String,
10390
10391 /// Required. ID of the `BuildTrigger` to delete.
10392 pub trigger_id: std::string::String,
10393
10394 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10395}
10396
10397impl DeleteBuildTriggerRequest {
10398 pub fn new() -> Self {
10399 std::default::Default::default()
10400 }
10401
10402 /// Sets the value of [name][crate::model::DeleteBuildTriggerRequest::name].
10403 ///
10404 /// # Example
10405 /// ```ignore,no_run
10406 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10407 /// let x = DeleteBuildTriggerRequest::new().set_name("example");
10408 /// ```
10409 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10410 self.name = v.into();
10411 self
10412 }
10413
10414 /// Sets the value of [project_id][crate::model::DeleteBuildTriggerRequest::project_id].
10415 ///
10416 /// # Example
10417 /// ```ignore,no_run
10418 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10419 /// let x = DeleteBuildTriggerRequest::new().set_project_id("example");
10420 /// ```
10421 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10422 self.project_id = v.into();
10423 self
10424 }
10425
10426 /// Sets the value of [trigger_id][crate::model::DeleteBuildTriggerRequest::trigger_id].
10427 ///
10428 /// # Example
10429 /// ```ignore,no_run
10430 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10431 /// let x = DeleteBuildTriggerRequest::new().set_trigger_id("example");
10432 /// ```
10433 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10434 self.trigger_id = v.into();
10435 self
10436 }
10437}
10438
10439impl wkt::message::Message for DeleteBuildTriggerRequest {
10440 fn typename() -> &'static str {
10441 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest"
10442 }
10443}
10444
10445/// Request to update an existing `BuildTrigger`.
10446#[derive(Clone, Default, PartialEq)]
10447#[non_exhaustive]
10448pub struct UpdateBuildTriggerRequest {
10449 /// Required. ID of the project that owns the trigger.
10450 pub project_id: std::string::String,
10451
10452 /// Required. ID of the `BuildTrigger` to update.
10453 pub trigger_id: std::string::String,
10454
10455 /// Required. `BuildTrigger` to update.
10456 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10457
10458 /// Update mask for the resource. If this is set,
10459 /// the server will only update the fields specified in the field mask.
10460 /// Otherwise, a full update of the mutable resource fields will be performed.
10461 pub update_mask: std::option::Option<wkt::FieldMask>,
10462
10463 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10464}
10465
10466impl UpdateBuildTriggerRequest {
10467 pub fn new() -> Self {
10468 std::default::Default::default()
10469 }
10470
10471 /// Sets the value of [project_id][crate::model::UpdateBuildTriggerRequest::project_id].
10472 ///
10473 /// # Example
10474 /// ```ignore,no_run
10475 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10476 /// let x = UpdateBuildTriggerRequest::new().set_project_id("example");
10477 /// ```
10478 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10479 self.project_id = v.into();
10480 self
10481 }
10482
10483 /// Sets the value of [trigger_id][crate::model::UpdateBuildTriggerRequest::trigger_id].
10484 ///
10485 /// # Example
10486 /// ```ignore,no_run
10487 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10488 /// let x = UpdateBuildTriggerRequest::new().set_trigger_id("example");
10489 /// ```
10490 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10491 self.trigger_id = v.into();
10492 self
10493 }
10494
10495 /// Sets the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10496 ///
10497 /// # Example
10498 /// ```ignore,no_run
10499 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10500 /// use google_cloud_build_v1::model::BuildTrigger;
10501 /// let x = UpdateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10502 /// ```
10503 pub fn set_trigger<T>(mut self, v: T) -> Self
10504 where
10505 T: std::convert::Into<crate::model::BuildTrigger>,
10506 {
10507 self.trigger = std::option::Option::Some(v.into());
10508 self
10509 }
10510
10511 /// Sets or clears the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10512 ///
10513 /// # Example
10514 /// ```ignore,no_run
10515 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10516 /// use google_cloud_build_v1::model::BuildTrigger;
10517 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10518 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10519 /// ```
10520 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10521 where
10522 T: std::convert::Into<crate::model::BuildTrigger>,
10523 {
10524 self.trigger = v.map(|x| x.into());
10525 self
10526 }
10527
10528 /// Sets the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10529 ///
10530 /// # Example
10531 /// ```ignore,no_run
10532 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10533 /// use wkt::FieldMask;
10534 /// let x = UpdateBuildTriggerRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10535 /// ```
10536 pub fn set_update_mask<T>(mut self, v: T) -> Self
10537 where
10538 T: std::convert::Into<wkt::FieldMask>,
10539 {
10540 self.update_mask = std::option::Option::Some(v.into());
10541 self
10542 }
10543
10544 /// Sets or clears the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10545 ///
10546 /// # Example
10547 /// ```ignore,no_run
10548 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10549 /// use wkt::FieldMask;
10550 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10551 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10552 /// ```
10553 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10554 where
10555 T: std::convert::Into<wkt::FieldMask>,
10556 {
10557 self.update_mask = v.map(|x| x.into());
10558 self
10559 }
10560}
10561
10562impl wkt::message::Message for UpdateBuildTriggerRequest {
10563 fn typename() -> &'static str {
10564 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest"
10565 }
10566}
10567
10568/// Optional arguments to enable specific features of builds.
10569#[derive(Clone, Default, PartialEq)]
10570#[non_exhaustive]
10571pub struct BuildOptions {
10572 /// Requested hash for SourceProvenance.
10573 pub source_provenance_hash: std::vec::Vec<crate::model::hash::HashType>,
10574
10575 /// Requested verifiability options.
10576 pub requested_verify_option: crate::model::build_options::VerifyOption,
10577
10578 /// Compute Engine machine type on which to run the build.
10579 pub machine_type: crate::model::build_options::MachineType,
10580
10581 /// Requested disk size for the VM that runs the build. Note that this is *NOT*
10582 /// "disk free"; some of the space will be used by the operating system and
10583 /// build utilities. Also note that this is the minimum disk size that will be
10584 /// allocated for the build -- the build may run with a larger disk than
10585 /// requested. At present, the maximum disk size is 4000GB; builds that request
10586 /// more than the maximum are rejected with an error.
10587 pub disk_size_gb: i64,
10588
10589 /// Option to specify behavior when there is an error in the substitution
10590 /// checks.
10591 ///
10592 /// NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot
10593 /// be overridden in the build configuration file.
10594 pub substitution_option: crate::model::build_options::SubstitutionOption,
10595
10596 /// Option to specify whether or not to apply bash style string
10597 /// operations to the substitutions.
10598 ///
10599 /// NOTE: this is always enabled for triggered builds and cannot be
10600 /// overridden in the build configuration file.
10601 pub dynamic_substitutions: bool,
10602
10603 /// Option to include built-in and custom substitutions as env variables
10604 /// for all build steps.
10605 pub automap_substitutions: bool,
10606
10607 /// Option to define build log streaming behavior to Cloud
10608 /// Storage.
10609 pub log_streaming_option: crate::model::build_options::LogStreamingOption,
10610
10611 /// This field deprecated; please use `pool.name` instead.
10612 #[deprecated]
10613 pub worker_pool: std::string::String,
10614
10615 /// Optional. Specification for execution on a `WorkerPool`.
10616 ///
10617 /// See [running builds in a private
10618 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10619 /// for more information.
10620 pub pool: std::option::Option<crate::model::build_options::PoolOption>,
10621
10622 /// Option to specify the logging mode, which determines if and where build
10623 /// logs are stored.
10624 pub logging: crate::model::build_options::LoggingMode,
10625
10626 /// A list of global environment variable definitions that will exist for all
10627 /// build steps in this build. If a variable is defined in both globally and in
10628 /// a build step, the variable will use the build step value.
10629 ///
10630 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
10631 /// being given the value "VALUE".
10632 pub env: std::vec::Vec<std::string::String>,
10633
10634 /// A list of global environment variables, which are encrypted using a Cloud
10635 /// Key Management Service crypto key. These values must be specified in the
10636 /// build's `Secret`. These variables will be available to all build steps
10637 /// in this build.
10638 pub secret_env: std::vec::Vec<std::string::String>,
10639
10640 /// Global list of volumes to mount for ALL build steps
10641 ///
10642 /// Each volume is created as an empty volume prior to starting the build
10643 /// process. Upon completion of the build, volumes and their contents are
10644 /// discarded. Global volume names and paths cannot conflict with the volumes
10645 /// defined a build step.
10646 ///
10647 /// Using a global volume in a build with only one step is not valid as
10648 /// it is indicative of a build request with an incorrect configuration.
10649 pub volumes: std::vec::Vec<crate::model::Volume>,
10650
10651 /// Optional. Option to specify how default logs buckets are setup.
10652 pub default_logs_bucket_behavior: crate::model::build_options::DefaultLogsBucketBehavior,
10653
10654 /// Optional. Option to specify whether structured logging is enabled.
10655 ///
10656 /// If true, JSON-formatted logs are parsed as structured logs.
10657 pub enable_structured_logging: bool,
10658
10659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10660}
10661
10662impl BuildOptions {
10663 pub fn new() -> Self {
10664 std::default::Default::default()
10665 }
10666
10667 /// Sets the value of [source_provenance_hash][crate::model::BuildOptions::source_provenance_hash].
10668 ///
10669 /// # Example
10670 /// ```ignore,no_run
10671 /// # use google_cloud_build_v1::model::BuildOptions;
10672 /// use google_cloud_build_v1::model::hash::HashType;
10673 /// let x = BuildOptions::new().set_source_provenance_hash([
10674 /// HashType::Sha256,
10675 /// HashType::Md5,
10676 /// HashType::GoModuleH1,
10677 /// ]);
10678 /// ```
10679 pub fn set_source_provenance_hash<T, V>(mut self, v: T) -> Self
10680 where
10681 T: std::iter::IntoIterator<Item = V>,
10682 V: std::convert::Into<crate::model::hash::HashType>,
10683 {
10684 use std::iter::Iterator;
10685 self.source_provenance_hash = v.into_iter().map(|i| i.into()).collect();
10686 self
10687 }
10688
10689 /// Sets the value of [requested_verify_option][crate::model::BuildOptions::requested_verify_option].
10690 ///
10691 /// # Example
10692 /// ```ignore,no_run
10693 /// # use google_cloud_build_v1::model::BuildOptions;
10694 /// use google_cloud_build_v1::model::build_options::VerifyOption;
10695 /// let x0 = BuildOptions::new().set_requested_verify_option(VerifyOption::Verified);
10696 /// ```
10697 pub fn set_requested_verify_option<
10698 T: std::convert::Into<crate::model::build_options::VerifyOption>,
10699 >(
10700 mut self,
10701 v: T,
10702 ) -> Self {
10703 self.requested_verify_option = v.into();
10704 self
10705 }
10706
10707 /// Sets the value of [machine_type][crate::model::BuildOptions::machine_type].
10708 ///
10709 /// # Example
10710 /// ```ignore,no_run
10711 /// # use google_cloud_build_v1::model::BuildOptions;
10712 /// use google_cloud_build_v1::model::build_options::MachineType;
10713 /// let x0 = BuildOptions::new().set_machine_type(MachineType::N1Highcpu8);
10714 /// let x1 = BuildOptions::new().set_machine_type(MachineType::N1Highcpu32);
10715 /// let x2 = BuildOptions::new().set_machine_type(MachineType::E2Highcpu8);
10716 /// ```
10717 pub fn set_machine_type<T: std::convert::Into<crate::model::build_options::MachineType>>(
10718 mut self,
10719 v: T,
10720 ) -> Self {
10721 self.machine_type = v.into();
10722 self
10723 }
10724
10725 /// Sets the value of [disk_size_gb][crate::model::BuildOptions::disk_size_gb].
10726 ///
10727 /// # Example
10728 /// ```ignore,no_run
10729 /// # use google_cloud_build_v1::model::BuildOptions;
10730 /// let x = BuildOptions::new().set_disk_size_gb(42);
10731 /// ```
10732 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10733 self.disk_size_gb = v.into();
10734 self
10735 }
10736
10737 /// Sets the value of [substitution_option][crate::model::BuildOptions::substitution_option].
10738 ///
10739 /// # Example
10740 /// ```ignore,no_run
10741 /// # use google_cloud_build_v1::model::BuildOptions;
10742 /// use google_cloud_build_v1::model::build_options::SubstitutionOption;
10743 /// let x0 = BuildOptions::new().set_substitution_option(SubstitutionOption::AllowLoose);
10744 /// ```
10745 pub fn set_substitution_option<
10746 T: std::convert::Into<crate::model::build_options::SubstitutionOption>,
10747 >(
10748 mut self,
10749 v: T,
10750 ) -> Self {
10751 self.substitution_option = v.into();
10752 self
10753 }
10754
10755 /// Sets the value of [dynamic_substitutions][crate::model::BuildOptions::dynamic_substitutions].
10756 ///
10757 /// # Example
10758 /// ```ignore,no_run
10759 /// # use google_cloud_build_v1::model::BuildOptions;
10760 /// let x = BuildOptions::new().set_dynamic_substitutions(true);
10761 /// ```
10762 pub fn set_dynamic_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10763 self.dynamic_substitutions = v.into();
10764 self
10765 }
10766
10767 /// Sets the value of [automap_substitutions][crate::model::BuildOptions::automap_substitutions].
10768 ///
10769 /// # Example
10770 /// ```ignore,no_run
10771 /// # use google_cloud_build_v1::model::BuildOptions;
10772 /// let x = BuildOptions::new().set_automap_substitutions(true);
10773 /// ```
10774 pub fn set_automap_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10775 self.automap_substitutions = v.into();
10776 self
10777 }
10778
10779 /// Sets the value of [log_streaming_option][crate::model::BuildOptions::log_streaming_option].
10780 ///
10781 /// # Example
10782 /// ```ignore,no_run
10783 /// # use google_cloud_build_v1::model::BuildOptions;
10784 /// use google_cloud_build_v1::model::build_options::LogStreamingOption;
10785 /// let x0 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOn);
10786 /// let x1 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOff);
10787 /// ```
10788 pub fn set_log_streaming_option<
10789 T: std::convert::Into<crate::model::build_options::LogStreamingOption>,
10790 >(
10791 mut self,
10792 v: T,
10793 ) -> Self {
10794 self.log_streaming_option = v.into();
10795 self
10796 }
10797
10798 /// Sets the value of [worker_pool][crate::model::BuildOptions::worker_pool].
10799 ///
10800 /// # Example
10801 /// ```ignore,no_run
10802 /// # use google_cloud_build_v1::model::BuildOptions;
10803 /// let x = BuildOptions::new().set_worker_pool("example");
10804 /// ```
10805 #[deprecated]
10806 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10807 self.worker_pool = v.into();
10808 self
10809 }
10810
10811 /// Sets the value of [pool][crate::model::BuildOptions::pool].
10812 ///
10813 /// # Example
10814 /// ```ignore,no_run
10815 /// # use google_cloud_build_v1::model::BuildOptions;
10816 /// use google_cloud_build_v1::model::build_options::PoolOption;
10817 /// let x = BuildOptions::new().set_pool(PoolOption::default()/* use setters */);
10818 /// ```
10819 pub fn set_pool<T>(mut self, v: T) -> Self
10820 where
10821 T: std::convert::Into<crate::model::build_options::PoolOption>,
10822 {
10823 self.pool = std::option::Option::Some(v.into());
10824 self
10825 }
10826
10827 /// Sets or clears the value of [pool][crate::model::BuildOptions::pool].
10828 ///
10829 /// # Example
10830 /// ```ignore,no_run
10831 /// # use google_cloud_build_v1::model::BuildOptions;
10832 /// use google_cloud_build_v1::model::build_options::PoolOption;
10833 /// let x = BuildOptions::new().set_or_clear_pool(Some(PoolOption::default()/* use setters */));
10834 /// let x = BuildOptions::new().set_or_clear_pool(None::<PoolOption>);
10835 /// ```
10836 pub fn set_or_clear_pool<T>(mut self, v: std::option::Option<T>) -> Self
10837 where
10838 T: std::convert::Into<crate::model::build_options::PoolOption>,
10839 {
10840 self.pool = v.map(|x| x.into());
10841 self
10842 }
10843
10844 /// Sets the value of [logging][crate::model::BuildOptions::logging].
10845 ///
10846 /// # Example
10847 /// ```ignore,no_run
10848 /// # use google_cloud_build_v1::model::BuildOptions;
10849 /// use google_cloud_build_v1::model::build_options::LoggingMode;
10850 /// let x0 = BuildOptions::new().set_logging(LoggingMode::Legacy);
10851 /// let x1 = BuildOptions::new().set_logging(LoggingMode::GcsOnly);
10852 /// let x2 = BuildOptions::new().set_logging(LoggingMode::CloudLoggingOnly);
10853 /// ```
10854 pub fn set_logging<T: std::convert::Into<crate::model::build_options::LoggingMode>>(
10855 mut self,
10856 v: T,
10857 ) -> Self {
10858 self.logging = v.into();
10859 self
10860 }
10861
10862 /// Sets the value of [env][crate::model::BuildOptions::env].
10863 ///
10864 /// # Example
10865 /// ```ignore,no_run
10866 /// # use google_cloud_build_v1::model::BuildOptions;
10867 /// let x = BuildOptions::new().set_env(["a", "b", "c"]);
10868 /// ```
10869 pub fn set_env<T, V>(mut self, v: T) -> Self
10870 where
10871 T: std::iter::IntoIterator<Item = V>,
10872 V: std::convert::Into<std::string::String>,
10873 {
10874 use std::iter::Iterator;
10875 self.env = v.into_iter().map(|i| i.into()).collect();
10876 self
10877 }
10878
10879 /// Sets the value of [secret_env][crate::model::BuildOptions::secret_env].
10880 ///
10881 /// # Example
10882 /// ```ignore,no_run
10883 /// # use google_cloud_build_v1::model::BuildOptions;
10884 /// let x = BuildOptions::new().set_secret_env(["a", "b", "c"]);
10885 /// ```
10886 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
10887 where
10888 T: std::iter::IntoIterator<Item = V>,
10889 V: std::convert::Into<std::string::String>,
10890 {
10891 use std::iter::Iterator;
10892 self.secret_env = v.into_iter().map(|i| i.into()).collect();
10893 self
10894 }
10895
10896 /// Sets the value of [volumes][crate::model::BuildOptions::volumes].
10897 ///
10898 /// # Example
10899 /// ```ignore,no_run
10900 /// # use google_cloud_build_v1::model::BuildOptions;
10901 /// use google_cloud_build_v1::model::Volume;
10902 /// let x = BuildOptions::new()
10903 /// .set_volumes([
10904 /// Volume::default()/* use setters */,
10905 /// Volume::default()/* use (different) setters */,
10906 /// ]);
10907 /// ```
10908 pub fn set_volumes<T, V>(mut self, v: T) -> Self
10909 where
10910 T: std::iter::IntoIterator<Item = V>,
10911 V: std::convert::Into<crate::model::Volume>,
10912 {
10913 use std::iter::Iterator;
10914 self.volumes = v.into_iter().map(|i| i.into()).collect();
10915 self
10916 }
10917
10918 /// Sets the value of [default_logs_bucket_behavior][crate::model::BuildOptions::default_logs_bucket_behavior].
10919 ///
10920 /// # Example
10921 /// ```ignore,no_run
10922 /// # use google_cloud_build_v1::model::BuildOptions;
10923 /// use google_cloud_build_v1::model::build_options::DefaultLogsBucketBehavior;
10924 /// let x0 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::RegionalUserOwnedBucket);
10925 /// let x1 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::LegacyBucket);
10926 /// ```
10927 pub fn set_default_logs_bucket_behavior<
10928 T: std::convert::Into<crate::model::build_options::DefaultLogsBucketBehavior>,
10929 >(
10930 mut self,
10931 v: T,
10932 ) -> Self {
10933 self.default_logs_bucket_behavior = v.into();
10934 self
10935 }
10936
10937 /// Sets the value of [enable_structured_logging][crate::model::BuildOptions::enable_structured_logging].
10938 ///
10939 /// # Example
10940 /// ```ignore,no_run
10941 /// # use google_cloud_build_v1::model::BuildOptions;
10942 /// let x = BuildOptions::new().set_enable_structured_logging(true);
10943 /// ```
10944 pub fn set_enable_structured_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10945 self.enable_structured_logging = v.into();
10946 self
10947 }
10948}
10949
10950impl wkt::message::Message for BuildOptions {
10951 fn typename() -> &'static str {
10952 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions"
10953 }
10954}
10955
10956/// Defines additional types related to [BuildOptions].
10957pub mod build_options {
10958 #[allow(unused_imports)]
10959 use super::*;
10960
10961 /// Details about how a build should be executed on a `WorkerPool`.
10962 ///
10963 /// See [running builds in a private
10964 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10965 /// for more information.
10966 #[derive(Clone, Default, PartialEq)]
10967 #[non_exhaustive]
10968 pub struct PoolOption {
10969 /// The `WorkerPool` resource to execute the build on.
10970 /// You must have `cloudbuild.workerpools.use` on the project hosting the
10971 /// WorkerPool.
10972 ///
10973 /// Format projects/{project}/locations/{location}/workerPools/{workerPoolId}
10974 pub name: std::string::String,
10975
10976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10977 }
10978
10979 impl PoolOption {
10980 pub fn new() -> Self {
10981 std::default::Default::default()
10982 }
10983
10984 /// Sets the value of [name][crate::model::build_options::PoolOption::name].
10985 ///
10986 /// # Example
10987 /// ```ignore,no_run
10988 /// # use google_cloud_build_v1::model::build_options::PoolOption;
10989 /// let x = PoolOption::new().set_name("example");
10990 /// ```
10991 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10992 self.name = v.into();
10993 self
10994 }
10995 }
10996
10997 impl wkt::message::Message for PoolOption {
10998 fn typename() -> &'static str {
10999 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions.PoolOption"
11000 }
11001 }
11002
11003 /// Specifies the manner in which the build should be verified, if at all.
11004 ///
11005 /// If a verified build is requested, and any part of the process to generate
11006 /// and upload provenance fails, the build will also fail.
11007 ///
11008 /// If the build does not request verification then that process may occur, but
11009 /// is not guaranteed to. If it does occur and fails, the build will not fail.
11010 ///
11011 /// For more information, see [Viewing Build
11012 /// Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance).
11013 ///
11014 /// # Working with unknown values
11015 ///
11016 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11017 /// additional enum variants at any time. Adding new variants is not considered
11018 /// a breaking change. Applications should write their code in anticipation of:
11019 ///
11020 /// - New values appearing in future releases of the client library, **and**
11021 /// - New values received dynamically, without application changes.
11022 ///
11023 /// Please consult the [Working with enums] section in the user guide for some
11024 /// guidelines.
11025 ///
11026 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11027 #[derive(Clone, Debug, PartialEq)]
11028 #[non_exhaustive]
11029 pub enum VerifyOption {
11030 /// Not a verifiable build (the default).
11031 NotVerified,
11032 /// Build must be verified.
11033 Verified,
11034 /// If set, the enum was initialized with an unknown value.
11035 ///
11036 /// Applications can examine the value using [VerifyOption::value] or
11037 /// [VerifyOption::name].
11038 UnknownValue(verify_option::UnknownValue),
11039 }
11040
11041 #[doc(hidden)]
11042 pub mod verify_option {
11043 #[allow(unused_imports)]
11044 use super::*;
11045 #[derive(Clone, Debug, PartialEq)]
11046 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11047 }
11048
11049 impl VerifyOption {
11050 /// Gets the enum value.
11051 ///
11052 /// Returns `None` if the enum contains an unknown value deserialized from
11053 /// the string representation of enums.
11054 pub fn value(&self) -> std::option::Option<i32> {
11055 match self {
11056 Self::NotVerified => std::option::Option::Some(0),
11057 Self::Verified => std::option::Option::Some(1),
11058 Self::UnknownValue(u) => u.0.value(),
11059 }
11060 }
11061
11062 /// Gets the enum value as a string.
11063 ///
11064 /// Returns `None` if the enum contains an unknown value deserialized from
11065 /// the integer representation of enums.
11066 pub fn name(&self) -> std::option::Option<&str> {
11067 match self {
11068 Self::NotVerified => std::option::Option::Some("NOT_VERIFIED"),
11069 Self::Verified => std::option::Option::Some("VERIFIED"),
11070 Self::UnknownValue(u) => u.0.name(),
11071 }
11072 }
11073 }
11074
11075 impl std::default::Default for VerifyOption {
11076 fn default() -> Self {
11077 use std::convert::From;
11078 Self::from(0)
11079 }
11080 }
11081
11082 impl std::fmt::Display for VerifyOption {
11083 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11084 wkt::internal::display_enum(f, self.name(), self.value())
11085 }
11086 }
11087
11088 impl std::convert::From<i32> for VerifyOption {
11089 fn from(value: i32) -> Self {
11090 match value {
11091 0 => Self::NotVerified,
11092 1 => Self::Verified,
11093 _ => Self::UnknownValue(verify_option::UnknownValue(
11094 wkt::internal::UnknownEnumValue::Integer(value),
11095 )),
11096 }
11097 }
11098 }
11099
11100 impl std::convert::From<&str> for VerifyOption {
11101 fn from(value: &str) -> Self {
11102 use std::string::ToString;
11103 match value {
11104 "NOT_VERIFIED" => Self::NotVerified,
11105 "VERIFIED" => Self::Verified,
11106 _ => Self::UnknownValue(verify_option::UnknownValue(
11107 wkt::internal::UnknownEnumValue::String(value.to_string()),
11108 )),
11109 }
11110 }
11111 }
11112
11113 impl serde::ser::Serialize for VerifyOption {
11114 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11115 where
11116 S: serde::Serializer,
11117 {
11118 match self {
11119 Self::NotVerified => serializer.serialize_i32(0),
11120 Self::Verified => serializer.serialize_i32(1),
11121 Self::UnknownValue(u) => u.0.serialize(serializer),
11122 }
11123 }
11124 }
11125
11126 impl<'de> serde::de::Deserialize<'de> for VerifyOption {
11127 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11128 where
11129 D: serde::Deserializer<'de>,
11130 {
11131 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerifyOption>::new(
11132 ".google.devtools.cloudbuild.v1.BuildOptions.VerifyOption",
11133 ))
11134 }
11135 }
11136
11137 /// Supported Compute Engine machine types.
11138 /// For more information, see [Machine
11139 /// types](https://cloud.google.com/compute/docs/machine-types).
11140 ///
11141 /// # Working with unknown values
11142 ///
11143 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11144 /// additional enum variants at any time. Adding new variants is not considered
11145 /// a breaking change. Applications should write their code in anticipation of:
11146 ///
11147 /// - New values appearing in future releases of the client library, **and**
11148 /// - New values received dynamically, without application changes.
11149 ///
11150 /// Please consult the [Working with enums] section in the user guide for some
11151 /// guidelines.
11152 ///
11153 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11154 #[derive(Clone, Debug, PartialEq)]
11155 #[non_exhaustive]
11156 pub enum MachineType {
11157 /// Standard machine type.
11158 Unspecified,
11159 /// Highcpu machine with 8 CPUs.
11160 N1Highcpu8,
11161 /// Highcpu machine with 32 CPUs.
11162 N1Highcpu32,
11163 /// Highcpu e2 machine with 8 CPUs.
11164 E2Highcpu8,
11165 /// Highcpu e2 machine with 32 CPUs.
11166 E2Highcpu32,
11167 /// E2 machine with 1 CPU.
11168 E2Medium,
11169 /// If set, the enum was initialized with an unknown value.
11170 ///
11171 /// Applications can examine the value using [MachineType::value] or
11172 /// [MachineType::name].
11173 UnknownValue(machine_type::UnknownValue),
11174 }
11175
11176 #[doc(hidden)]
11177 pub mod machine_type {
11178 #[allow(unused_imports)]
11179 use super::*;
11180 #[derive(Clone, Debug, PartialEq)]
11181 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11182 }
11183
11184 impl MachineType {
11185 /// Gets the enum value.
11186 ///
11187 /// Returns `None` if the enum contains an unknown value deserialized from
11188 /// the string representation of enums.
11189 pub fn value(&self) -> std::option::Option<i32> {
11190 match self {
11191 Self::Unspecified => std::option::Option::Some(0),
11192 Self::N1Highcpu8 => std::option::Option::Some(1),
11193 Self::N1Highcpu32 => std::option::Option::Some(2),
11194 Self::E2Highcpu8 => std::option::Option::Some(5),
11195 Self::E2Highcpu32 => std::option::Option::Some(6),
11196 Self::E2Medium => std::option::Option::Some(7),
11197 Self::UnknownValue(u) => u.0.value(),
11198 }
11199 }
11200
11201 /// Gets the enum value as a string.
11202 ///
11203 /// Returns `None` if the enum contains an unknown value deserialized from
11204 /// the integer representation of enums.
11205 pub fn name(&self) -> std::option::Option<&str> {
11206 match self {
11207 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
11208 Self::N1Highcpu8 => std::option::Option::Some("N1_HIGHCPU_8"),
11209 Self::N1Highcpu32 => std::option::Option::Some("N1_HIGHCPU_32"),
11210 Self::E2Highcpu8 => std::option::Option::Some("E2_HIGHCPU_8"),
11211 Self::E2Highcpu32 => std::option::Option::Some("E2_HIGHCPU_32"),
11212 Self::E2Medium => std::option::Option::Some("E2_MEDIUM"),
11213 Self::UnknownValue(u) => u.0.name(),
11214 }
11215 }
11216 }
11217
11218 impl std::default::Default for MachineType {
11219 fn default() -> Self {
11220 use std::convert::From;
11221 Self::from(0)
11222 }
11223 }
11224
11225 impl std::fmt::Display for MachineType {
11226 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11227 wkt::internal::display_enum(f, self.name(), self.value())
11228 }
11229 }
11230
11231 impl std::convert::From<i32> for MachineType {
11232 fn from(value: i32) -> Self {
11233 match value {
11234 0 => Self::Unspecified,
11235 1 => Self::N1Highcpu8,
11236 2 => Self::N1Highcpu32,
11237 5 => Self::E2Highcpu8,
11238 6 => Self::E2Highcpu32,
11239 7 => Self::E2Medium,
11240 _ => Self::UnknownValue(machine_type::UnknownValue(
11241 wkt::internal::UnknownEnumValue::Integer(value),
11242 )),
11243 }
11244 }
11245 }
11246
11247 impl std::convert::From<&str> for MachineType {
11248 fn from(value: &str) -> Self {
11249 use std::string::ToString;
11250 match value {
11251 "UNSPECIFIED" => Self::Unspecified,
11252 "N1_HIGHCPU_8" => Self::N1Highcpu8,
11253 "N1_HIGHCPU_32" => Self::N1Highcpu32,
11254 "E2_HIGHCPU_8" => Self::E2Highcpu8,
11255 "E2_HIGHCPU_32" => Self::E2Highcpu32,
11256 "E2_MEDIUM" => Self::E2Medium,
11257 _ => Self::UnknownValue(machine_type::UnknownValue(
11258 wkt::internal::UnknownEnumValue::String(value.to_string()),
11259 )),
11260 }
11261 }
11262 }
11263
11264 impl serde::ser::Serialize for MachineType {
11265 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11266 where
11267 S: serde::Serializer,
11268 {
11269 match self {
11270 Self::Unspecified => serializer.serialize_i32(0),
11271 Self::N1Highcpu8 => serializer.serialize_i32(1),
11272 Self::N1Highcpu32 => serializer.serialize_i32(2),
11273 Self::E2Highcpu8 => serializer.serialize_i32(5),
11274 Self::E2Highcpu32 => serializer.serialize_i32(6),
11275 Self::E2Medium => serializer.serialize_i32(7),
11276 Self::UnknownValue(u) => u.0.serialize(serializer),
11277 }
11278 }
11279 }
11280
11281 impl<'de> serde::de::Deserialize<'de> for MachineType {
11282 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11283 where
11284 D: serde::Deserializer<'de>,
11285 {
11286 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MachineType>::new(
11287 ".google.devtools.cloudbuild.v1.BuildOptions.MachineType",
11288 ))
11289 }
11290 }
11291
11292 /// Specifies the behavior when there is an error in the substitution checks.
11293 ///
11294 /// # Working with unknown values
11295 ///
11296 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11297 /// additional enum variants at any time. Adding new variants is not considered
11298 /// a breaking change. Applications should write their code in anticipation of:
11299 ///
11300 /// - New values appearing in future releases of the client library, **and**
11301 /// - New values received dynamically, without application changes.
11302 ///
11303 /// Please consult the [Working with enums] section in the user guide for some
11304 /// guidelines.
11305 ///
11306 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11307 #[derive(Clone, Debug, PartialEq)]
11308 #[non_exhaustive]
11309 pub enum SubstitutionOption {
11310 /// Fails the build if error in substitutions checks, like missing
11311 /// a substitution in the template or in the map.
11312 MustMatch,
11313 /// Do not fail the build if error in substitutions checks.
11314 AllowLoose,
11315 /// If set, the enum was initialized with an unknown value.
11316 ///
11317 /// Applications can examine the value using [SubstitutionOption::value] or
11318 /// [SubstitutionOption::name].
11319 UnknownValue(substitution_option::UnknownValue),
11320 }
11321
11322 #[doc(hidden)]
11323 pub mod substitution_option {
11324 #[allow(unused_imports)]
11325 use super::*;
11326 #[derive(Clone, Debug, PartialEq)]
11327 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11328 }
11329
11330 impl SubstitutionOption {
11331 /// Gets the enum value.
11332 ///
11333 /// Returns `None` if the enum contains an unknown value deserialized from
11334 /// the string representation of enums.
11335 pub fn value(&self) -> std::option::Option<i32> {
11336 match self {
11337 Self::MustMatch => std::option::Option::Some(0),
11338 Self::AllowLoose => std::option::Option::Some(1),
11339 Self::UnknownValue(u) => u.0.value(),
11340 }
11341 }
11342
11343 /// Gets the enum value as a string.
11344 ///
11345 /// Returns `None` if the enum contains an unknown value deserialized from
11346 /// the integer representation of enums.
11347 pub fn name(&self) -> std::option::Option<&str> {
11348 match self {
11349 Self::MustMatch => std::option::Option::Some("MUST_MATCH"),
11350 Self::AllowLoose => std::option::Option::Some("ALLOW_LOOSE"),
11351 Self::UnknownValue(u) => u.0.name(),
11352 }
11353 }
11354 }
11355
11356 impl std::default::Default for SubstitutionOption {
11357 fn default() -> Self {
11358 use std::convert::From;
11359 Self::from(0)
11360 }
11361 }
11362
11363 impl std::fmt::Display for SubstitutionOption {
11364 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11365 wkt::internal::display_enum(f, self.name(), self.value())
11366 }
11367 }
11368
11369 impl std::convert::From<i32> for SubstitutionOption {
11370 fn from(value: i32) -> Self {
11371 match value {
11372 0 => Self::MustMatch,
11373 1 => Self::AllowLoose,
11374 _ => Self::UnknownValue(substitution_option::UnknownValue(
11375 wkt::internal::UnknownEnumValue::Integer(value),
11376 )),
11377 }
11378 }
11379 }
11380
11381 impl std::convert::From<&str> for SubstitutionOption {
11382 fn from(value: &str) -> Self {
11383 use std::string::ToString;
11384 match value {
11385 "MUST_MATCH" => Self::MustMatch,
11386 "ALLOW_LOOSE" => Self::AllowLoose,
11387 _ => Self::UnknownValue(substitution_option::UnknownValue(
11388 wkt::internal::UnknownEnumValue::String(value.to_string()),
11389 )),
11390 }
11391 }
11392 }
11393
11394 impl serde::ser::Serialize for SubstitutionOption {
11395 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11396 where
11397 S: serde::Serializer,
11398 {
11399 match self {
11400 Self::MustMatch => serializer.serialize_i32(0),
11401 Self::AllowLoose => serializer.serialize_i32(1),
11402 Self::UnknownValue(u) => u.0.serialize(serializer),
11403 }
11404 }
11405 }
11406
11407 impl<'de> serde::de::Deserialize<'de> for SubstitutionOption {
11408 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11409 where
11410 D: serde::Deserializer<'de>,
11411 {
11412 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SubstitutionOption>::new(
11413 ".google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption",
11414 ))
11415 }
11416 }
11417
11418 /// Specifies the behavior when writing build logs to Cloud Storage.
11419 ///
11420 /// # Working with unknown values
11421 ///
11422 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11423 /// additional enum variants at any time. Adding new variants is not considered
11424 /// a breaking change. Applications should write their code in anticipation of:
11425 ///
11426 /// - New values appearing in future releases of the client library, **and**
11427 /// - New values received dynamically, without application changes.
11428 ///
11429 /// Please consult the [Working with enums] section in the user guide for some
11430 /// guidelines.
11431 ///
11432 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11433 #[derive(Clone, Debug, PartialEq)]
11434 #[non_exhaustive]
11435 pub enum LogStreamingOption {
11436 /// Service may automatically determine build log streaming behavior.
11437 StreamDefault,
11438 /// Build logs should be streamed to Cloud Storage.
11439 StreamOn,
11440 /// Build logs should not be streamed to Cloud Storage; they will be
11441 /// written when the build is completed.
11442 StreamOff,
11443 /// If set, the enum was initialized with an unknown value.
11444 ///
11445 /// Applications can examine the value using [LogStreamingOption::value] or
11446 /// [LogStreamingOption::name].
11447 UnknownValue(log_streaming_option::UnknownValue),
11448 }
11449
11450 #[doc(hidden)]
11451 pub mod log_streaming_option {
11452 #[allow(unused_imports)]
11453 use super::*;
11454 #[derive(Clone, Debug, PartialEq)]
11455 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11456 }
11457
11458 impl LogStreamingOption {
11459 /// Gets the enum value.
11460 ///
11461 /// Returns `None` if the enum contains an unknown value deserialized from
11462 /// the string representation of enums.
11463 pub fn value(&self) -> std::option::Option<i32> {
11464 match self {
11465 Self::StreamDefault => std::option::Option::Some(0),
11466 Self::StreamOn => std::option::Option::Some(1),
11467 Self::StreamOff => std::option::Option::Some(2),
11468 Self::UnknownValue(u) => u.0.value(),
11469 }
11470 }
11471
11472 /// Gets the enum value as a string.
11473 ///
11474 /// Returns `None` if the enum contains an unknown value deserialized from
11475 /// the integer representation of enums.
11476 pub fn name(&self) -> std::option::Option<&str> {
11477 match self {
11478 Self::StreamDefault => std::option::Option::Some("STREAM_DEFAULT"),
11479 Self::StreamOn => std::option::Option::Some("STREAM_ON"),
11480 Self::StreamOff => std::option::Option::Some("STREAM_OFF"),
11481 Self::UnknownValue(u) => u.0.name(),
11482 }
11483 }
11484 }
11485
11486 impl std::default::Default for LogStreamingOption {
11487 fn default() -> Self {
11488 use std::convert::From;
11489 Self::from(0)
11490 }
11491 }
11492
11493 impl std::fmt::Display for LogStreamingOption {
11494 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11495 wkt::internal::display_enum(f, self.name(), self.value())
11496 }
11497 }
11498
11499 impl std::convert::From<i32> for LogStreamingOption {
11500 fn from(value: i32) -> Self {
11501 match value {
11502 0 => Self::StreamDefault,
11503 1 => Self::StreamOn,
11504 2 => Self::StreamOff,
11505 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11506 wkt::internal::UnknownEnumValue::Integer(value),
11507 )),
11508 }
11509 }
11510 }
11511
11512 impl std::convert::From<&str> for LogStreamingOption {
11513 fn from(value: &str) -> Self {
11514 use std::string::ToString;
11515 match value {
11516 "STREAM_DEFAULT" => Self::StreamDefault,
11517 "STREAM_ON" => Self::StreamOn,
11518 "STREAM_OFF" => Self::StreamOff,
11519 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11520 wkt::internal::UnknownEnumValue::String(value.to_string()),
11521 )),
11522 }
11523 }
11524 }
11525
11526 impl serde::ser::Serialize for LogStreamingOption {
11527 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11528 where
11529 S: serde::Serializer,
11530 {
11531 match self {
11532 Self::StreamDefault => serializer.serialize_i32(0),
11533 Self::StreamOn => serializer.serialize_i32(1),
11534 Self::StreamOff => serializer.serialize_i32(2),
11535 Self::UnknownValue(u) => u.0.serialize(serializer),
11536 }
11537 }
11538 }
11539
11540 impl<'de> serde::de::Deserialize<'de> for LogStreamingOption {
11541 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11542 where
11543 D: serde::Deserializer<'de>,
11544 {
11545 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogStreamingOption>::new(
11546 ".google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption",
11547 ))
11548 }
11549 }
11550
11551 /// Specifies the logging mode.
11552 ///
11553 /// # Working with unknown values
11554 ///
11555 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11556 /// additional enum variants at any time. Adding new variants is not considered
11557 /// a breaking change. Applications should write their code in anticipation of:
11558 ///
11559 /// - New values appearing in future releases of the client library, **and**
11560 /// - New values received dynamically, without application changes.
11561 ///
11562 /// Please consult the [Working with enums] section in the user guide for some
11563 /// guidelines.
11564 ///
11565 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11566 #[derive(Clone, Debug, PartialEq)]
11567 #[non_exhaustive]
11568 pub enum LoggingMode {
11569 /// The service determines the logging mode. The default is `LEGACY`. Do not
11570 /// rely on the default logging behavior as it may change in the future.
11571 LoggingUnspecified,
11572 /// Build logs are stored in Cloud Logging and Cloud Storage.
11573 Legacy,
11574 /// Build logs are stored in Cloud Storage.
11575 GcsOnly,
11576 /// This option is the same as CLOUD_LOGGING_ONLY.
11577 #[deprecated]
11578 StackdriverOnly,
11579 /// Build logs are stored in Cloud Logging. Selecting this option will not
11580 /// allow [logs
11581 /// streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log).
11582 CloudLoggingOnly,
11583 /// Turn off all logging. No build logs will be captured.
11584 None,
11585 /// If set, the enum was initialized with an unknown value.
11586 ///
11587 /// Applications can examine the value using [LoggingMode::value] or
11588 /// [LoggingMode::name].
11589 UnknownValue(logging_mode::UnknownValue),
11590 }
11591
11592 #[doc(hidden)]
11593 pub mod logging_mode {
11594 #[allow(unused_imports)]
11595 use super::*;
11596 #[derive(Clone, Debug, PartialEq)]
11597 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11598 }
11599
11600 impl LoggingMode {
11601 /// Gets the enum value.
11602 ///
11603 /// Returns `None` if the enum contains an unknown value deserialized from
11604 /// the string representation of enums.
11605 pub fn value(&self) -> std::option::Option<i32> {
11606 match self {
11607 Self::LoggingUnspecified => std::option::Option::Some(0),
11608 Self::Legacy => std::option::Option::Some(1),
11609 Self::GcsOnly => std::option::Option::Some(2),
11610 Self::StackdriverOnly => std::option::Option::Some(3),
11611 Self::CloudLoggingOnly => std::option::Option::Some(5),
11612 Self::None => std::option::Option::Some(4),
11613 Self::UnknownValue(u) => u.0.value(),
11614 }
11615 }
11616
11617 /// Gets the enum value as a string.
11618 ///
11619 /// Returns `None` if the enum contains an unknown value deserialized from
11620 /// the integer representation of enums.
11621 pub fn name(&self) -> std::option::Option<&str> {
11622 match self {
11623 Self::LoggingUnspecified => std::option::Option::Some("LOGGING_UNSPECIFIED"),
11624 Self::Legacy => std::option::Option::Some("LEGACY"),
11625 Self::GcsOnly => std::option::Option::Some("GCS_ONLY"),
11626 Self::StackdriverOnly => std::option::Option::Some("STACKDRIVER_ONLY"),
11627 Self::CloudLoggingOnly => std::option::Option::Some("CLOUD_LOGGING_ONLY"),
11628 Self::None => std::option::Option::Some("NONE"),
11629 Self::UnknownValue(u) => u.0.name(),
11630 }
11631 }
11632 }
11633
11634 impl std::default::Default for LoggingMode {
11635 fn default() -> Self {
11636 use std::convert::From;
11637 Self::from(0)
11638 }
11639 }
11640
11641 impl std::fmt::Display for LoggingMode {
11642 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11643 wkt::internal::display_enum(f, self.name(), self.value())
11644 }
11645 }
11646
11647 impl std::convert::From<i32> for LoggingMode {
11648 fn from(value: i32) -> Self {
11649 match value {
11650 0 => Self::LoggingUnspecified,
11651 1 => Self::Legacy,
11652 2 => Self::GcsOnly,
11653 3 => Self::StackdriverOnly,
11654 4 => Self::None,
11655 5 => Self::CloudLoggingOnly,
11656 _ => Self::UnknownValue(logging_mode::UnknownValue(
11657 wkt::internal::UnknownEnumValue::Integer(value),
11658 )),
11659 }
11660 }
11661 }
11662
11663 impl std::convert::From<&str> for LoggingMode {
11664 fn from(value: &str) -> Self {
11665 use std::string::ToString;
11666 match value {
11667 "LOGGING_UNSPECIFIED" => Self::LoggingUnspecified,
11668 "LEGACY" => Self::Legacy,
11669 "GCS_ONLY" => Self::GcsOnly,
11670 "STACKDRIVER_ONLY" => Self::StackdriverOnly,
11671 "CLOUD_LOGGING_ONLY" => Self::CloudLoggingOnly,
11672 "NONE" => Self::None,
11673 _ => Self::UnknownValue(logging_mode::UnknownValue(
11674 wkt::internal::UnknownEnumValue::String(value.to_string()),
11675 )),
11676 }
11677 }
11678 }
11679
11680 impl serde::ser::Serialize for LoggingMode {
11681 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11682 where
11683 S: serde::Serializer,
11684 {
11685 match self {
11686 Self::LoggingUnspecified => serializer.serialize_i32(0),
11687 Self::Legacy => serializer.serialize_i32(1),
11688 Self::GcsOnly => serializer.serialize_i32(2),
11689 Self::StackdriverOnly => serializer.serialize_i32(3),
11690 Self::CloudLoggingOnly => serializer.serialize_i32(5),
11691 Self::None => serializer.serialize_i32(4),
11692 Self::UnknownValue(u) => u.0.serialize(serializer),
11693 }
11694 }
11695 }
11696
11697 impl<'de> serde::de::Deserialize<'de> for LoggingMode {
11698 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11699 where
11700 D: serde::Deserializer<'de>,
11701 {
11702 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggingMode>::new(
11703 ".google.devtools.cloudbuild.v1.BuildOptions.LoggingMode",
11704 ))
11705 }
11706 }
11707
11708 /// Default Cloud Storage log bucket behavior options.
11709 ///
11710 /// # Working with unknown values
11711 ///
11712 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11713 /// additional enum variants at any time. Adding new variants is not considered
11714 /// a breaking change. Applications should write their code in anticipation of:
11715 ///
11716 /// - New values appearing in future releases of the client library, **and**
11717 /// - New values received dynamically, without application changes.
11718 ///
11719 /// Please consult the [Working with enums] section in the user guide for some
11720 /// guidelines.
11721 ///
11722 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11723 #[derive(Clone, Debug, PartialEq)]
11724 #[non_exhaustive]
11725 pub enum DefaultLogsBucketBehavior {
11726 /// Unspecified.
11727 Unspecified,
11728 /// Bucket is located in user-owned project in the same region as the
11729 /// build. The builder service account must have access to create and write
11730 /// to Cloud Storage buckets in the build project.
11731 RegionalUserOwnedBucket,
11732 /// Bucket is located in a Google-owned project and is not regionalized.
11733 LegacyBucket,
11734 /// If set, the enum was initialized with an unknown value.
11735 ///
11736 /// Applications can examine the value using [DefaultLogsBucketBehavior::value] or
11737 /// [DefaultLogsBucketBehavior::name].
11738 UnknownValue(default_logs_bucket_behavior::UnknownValue),
11739 }
11740
11741 #[doc(hidden)]
11742 pub mod default_logs_bucket_behavior {
11743 #[allow(unused_imports)]
11744 use super::*;
11745 #[derive(Clone, Debug, PartialEq)]
11746 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11747 }
11748
11749 impl DefaultLogsBucketBehavior {
11750 /// Gets the enum value.
11751 ///
11752 /// Returns `None` if the enum contains an unknown value deserialized from
11753 /// the string representation of enums.
11754 pub fn value(&self) -> std::option::Option<i32> {
11755 match self {
11756 Self::Unspecified => std::option::Option::Some(0),
11757 Self::RegionalUserOwnedBucket => std::option::Option::Some(1),
11758 Self::LegacyBucket => std::option::Option::Some(2),
11759 Self::UnknownValue(u) => u.0.value(),
11760 }
11761 }
11762
11763 /// Gets the enum value as a string.
11764 ///
11765 /// Returns `None` if the enum contains an unknown value deserialized from
11766 /// the integer representation of enums.
11767 pub fn name(&self) -> std::option::Option<&str> {
11768 match self {
11769 Self::Unspecified => {
11770 std::option::Option::Some("DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED")
11771 }
11772 Self::RegionalUserOwnedBucket => {
11773 std::option::Option::Some("REGIONAL_USER_OWNED_BUCKET")
11774 }
11775 Self::LegacyBucket => std::option::Option::Some("LEGACY_BUCKET"),
11776 Self::UnknownValue(u) => u.0.name(),
11777 }
11778 }
11779 }
11780
11781 impl std::default::Default for DefaultLogsBucketBehavior {
11782 fn default() -> Self {
11783 use std::convert::From;
11784 Self::from(0)
11785 }
11786 }
11787
11788 impl std::fmt::Display for DefaultLogsBucketBehavior {
11789 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11790 wkt::internal::display_enum(f, self.name(), self.value())
11791 }
11792 }
11793
11794 impl std::convert::From<i32> for DefaultLogsBucketBehavior {
11795 fn from(value: i32) -> Self {
11796 match value {
11797 0 => Self::Unspecified,
11798 1 => Self::RegionalUserOwnedBucket,
11799 2 => Self::LegacyBucket,
11800 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11801 wkt::internal::UnknownEnumValue::Integer(value),
11802 )),
11803 }
11804 }
11805 }
11806
11807 impl std::convert::From<&str> for DefaultLogsBucketBehavior {
11808 fn from(value: &str) -> Self {
11809 use std::string::ToString;
11810 match value {
11811 "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11812 "REGIONAL_USER_OWNED_BUCKET" => Self::RegionalUserOwnedBucket,
11813 "LEGACY_BUCKET" => Self::LegacyBucket,
11814 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11815 wkt::internal::UnknownEnumValue::String(value.to_string()),
11816 )),
11817 }
11818 }
11819 }
11820
11821 impl serde::ser::Serialize for DefaultLogsBucketBehavior {
11822 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11823 where
11824 S: serde::Serializer,
11825 {
11826 match self {
11827 Self::Unspecified => serializer.serialize_i32(0),
11828 Self::RegionalUserOwnedBucket => serializer.serialize_i32(1),
11829 Self::LegacyBucket => serializer.serialize_i32(2),
11830 Self::UnknownValue(u) => u.0.serialize(serializer),
11831 }
11832 }
11833 }
11834
11835 impl<'de> serde::de::Deserialize<'de> for DefaultLogsBucketBehavior {
11836 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11837 where
11838 D: serde::Deserializer<'de>,
11839 {
11840 deserializer.deserialize_any(
11841 wkt::internal::EnumVisitor::<DefaultLogsBucketBehavior>::new(
11842 ".google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior",
11843 ),
11844 )
11845 }
11846 }
11847}
11848
11849/// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by
11850/// the ReceiveTriggerWebhook method.
11851#[derive(Clone, Default, PartialEq)]
11852#[non_exhaustive]
11853pub struct ReceiveTriggerWebhookRequest {
11854 /// The name of the `ReceiveTriggerWebhook` to retrieve.
11855 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
11856 pub name: std::string::String,
11857
11858 /// HTTP request body.
11859 pub body: std::option::Option<google_cloud_api::model::HttpBody>,
11860
11861 /// Project in which the specified trigger lives
11862 pub project_id: std::string::String,
11863
11864 /// Name of the trigger to run the payload against
11865 pub trigger: std::string::String,
11866
11867 /// Secret token used for authorization if an OAuth token isn't provided.
11868 pub secret: std::string::String,
11869
11870 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11871}
11872
11873impl ReceiveTriggerWebhookRequest {
11874 pub fn new() -> Self {
11875 std::default::Default::default()
11876 }
11877
11878 /// Sets the value of [name][crate::model::ReceiveTriggerWebhookRequest::name].
11879 ///
11880 /// # Example
11881 /// ```ignore,no_run
11882 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11883 /// let x = ReceiveTriggerWebhookRequest::new().set_name("example");
11884 /// ```
11885 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11886 self.name = v.into();
11887 self
11888 }
11889
11890 /// Sets the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
11891 ///
11892 /// # Example
11893 /// ```ignore,no_run
11894 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11895 /// use google_cloud_api::model::HttpBody;
11896 /// let x = ReceiveTriggerWebhookRequest::new().set_body(HttpBody::default()/* use setters */);
11897 /// ```
11898 pub fn set_body<T>(mut self, v: T) -> Self
11899 where
11900 T: std::convert::Into<google_cloud_api::model::HttpBody>,
11901 {
11902 self.body = std::option::Option::Some(v.into());
11903 self
11904 }
11905
11906 /// Sets or clears the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
11907 ///
11908 /// # Example
11909 /// ```ignore,no_run
11910 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11911 /// use google_cloud_api::model::HttpBody;
11912 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(Some(HttpBody::default()/* use setters */));
11913 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(None::<HttpBody>);
11914 /// ```
11915 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
11916 where
11917 T: std::convert::Into<google_cloud_api::model::HttpBody>,
11918 {
11919 self.body = v.map(|x| x.into());
11920 self
11921 }
11922
11923 /// Sets the value of [project_id][crate::model::ReceiveTriggerWebhookRequest::project_id].
11924 ///
11925 /// # Example
11926 /// ```ignore,no_run
11927 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11928 /// let x = ReceiveTriggerWebhookRequest::new().set_project_id("example");
11929 /// ```
11930 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11931 self.project_id = v.into();
11932 self
11933 }
11934
11935 /// Sets the value of [trigger][crate::model::ReceiveTriggerWebhookRequest::trigger].
11936 ///
11937 /// # Example
11938 /// ```ignore,no_run
11939 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11940 /// let x = ReceiveTriggerWebhookRequest::new().set_trigger("example");
11941 /// ```
11942 pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11943 self.trigger = v.into();
11944 self
11945 }
11946
11947 /// Sets the value of [secret][crate::model::ReceiveTriggerWebhookRequest::secret].
11948 ///
11949 /// # Example
11950 /// ```ignore,no_run
11951 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11952 /// let x = ReceiveTriggerWebhookRequest::new().set_secret("example");
11953 /// ```
11954 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11955 self.secret = v.into();
11956 self
11957 }
11958}
11959
11960impl wkt::message::Message for ReceiveTriggerWebhookRequest {
11961 fn typename() -> &'static str {
11962 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest"
11963 }
11964}
11965
11966/// ReceiveTriggerWebhookResponse [Experimental] is the response object for the
11967/// ReceiveTriggerWebhook method.
11968#[derive(Clone, Default, PartialEq)]
11969#[non_exhaustive]
11970pub struct ReceiveTriggerWebhookResponse {
11971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11972}
11973
11974impl ReceiveTriggerWebhookResponse {
11975 pub fn new() -> Self {
11976 std::default::Default::default()
11977 }
11978}
11979
11980impl wkt::message::Message for ReceiveTriggerWebhookResponse {
11981 fn typename() -> &'static str {
11982 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse"
11983 }
11984}
11985
11986/// GitHubEnterpriseConfig represents a configuration for a GitHub Enterprise
11987/// server.
11988#[derive(Clone, Default, PartialEq)]
11989#[non_exhaustive]
11990pub struct GitHubEnterpriseConfig {
11991 /// The full resource name for the GitHubEnterpriseConfig
11992 /// For example:
11993 /// "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}"
11994 pub name: std::string::String,
11995
11996 /// The URL of the github enterprise host the configuration is for.
11997 pub host_url: std::string::String,
11998
11999 /// Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise
12000 /// server.
12001 pub app_id: i64,
12002
12003 /// Output only. Time when the installation was associated with the project.
12004 pub create_time: std::option::Option<wkt::Timestamp>,
12005
12006 /// The key that should be attached to webhook calls to the ReceiveWebhook
12007 /// endpoint.
12008 pub webhook_key: std::string::String,
12009
12010 /// Optional. The network to be used when reaching out to the GitHub
12011 /// Enterprise server. The VPC network must be enabled for private
12012 /// service connection. This should be set if the GitHub Enterprise server is
12013 /// hosted on-premises and not reachable by public internet.
12014 /// If this field is left empty, no network peering will occur and calls to
12015 /// the GitHub Enterprise server will be made over the public internet.
12016 /// Must be in the format
12017 /// `projects/{project}/global/networks/{network}`, where {project}
12018 /// is a project number or id and {network} is the name of a
12019 /// VPC network in the project.
12020 pub peered_network: std::string::String,
12021
12022 /// Optional. Names of secrets in Secret Manager.
12023 pub secrets: std::option::Option<crate::model::GitHubEnterpriseSecrets>,
12024
12025 /// Optional. Name to display for this config.
12026 pub display_name: std::string::String,
12027
12028 /// Optional. SSL certificate to use for requests to GitHub Enterprise.
12029 pub ssl_ca: std::string::String,
12030
12031 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12032}
12033
12034impl GitHubEnterpriseConfig {
12035 pub fn new() -> Self {
12036 std::default::Default::default()
12037 }
12038
12039 /// Sets the value of [name][crate::model::GitHubEnterpriseConfig::name].
12040 ///
12041 /// # Example
12042 /// ```ignore,no_run
12043 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12044 /// let x = GitHubEnterpriseConfig::new().set_name("example");
12045 /// ```
12046 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12047 self.name = v.into();
12048 self
12049 }
12050
12051 /// Sets the value of [host_url][crate::model::GitHubEnterpriseConfig::host_url].
12052 ///
12053 /// # Example
12054 /// ```ignore,no_run
12055 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12056 /// let x = GitHubEnterpriseConfig::new().set_host_url("example");
12057 /// ```
12058 pub fn set_host_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12059 self.host_url = v.into();
12060 self
12061 }
12062
12063 /// Sets the value of [app_id][crate::model::GitHubEnterpriseConfig::app_id].
12064 ///
12065 /// # Example
12066 /// ```ignore,no_run
12067 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12068 /// let x = GitHubEnterpriseConfig::new().set_app_id(42);
12069 /// ```
12070 pub fn set_app_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12071 self.app_id = v.into();
12072 self
12073 }
12074
12075 /// Sets the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12076 ///
12077 /// # Example
12078 /// ```ignore,no_run
12079 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12080 /// use wkt::Timestamp;
12081 /// let x = GitHubEnterpriseConfig::new().set_create_time(Timestamp::default()/* use setters */);
12082 /// ```
12083 pub fn set_create_time<T>(mut self, v: T) -> Self
12084 where
12085 T: std::convert::Into<wkt::Timestamp>,
12086 {
12087 self.create_time = std::option::Option::Some(v.into());
12088 self
12089 }
12090
12091 /// Sets or clears the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12092 ///
12093 /// # Example
12094 /// ```ignore,no_run
12095 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12096 /// use wkt::Timestamp;
12097 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12098 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(None::<Timestamp>);
12099 /// ```
12100 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12101 where
12102 T: std::convert::Into<wkt::Timestamp>,
12103 {
12104 self.create_time = v.map(|x| x.into());
12105 self
12106 }
12107
12108 /// Sets the value of [webhook_key][crate::model::GitHubEnterpriseConfig::webhook_key].
12109 ///
12110 /// # Example
12111 /// ```ignore,no_run
12112 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12113 /// let x = GitHubEnterpriseConfig::new().set_webhook_key("example");
12114 /// ```
12115 pub fn set_webhook_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12116 self.webhook_key = v.into();
12117 self
12118 }
12119
12120 /// Sets the value of [peered_network][crate::model::GitHubEnterpriseConfig::peered_network].
12121 ///
12122 /// # Example
12123 /// ```ignore,no_run
12124 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12125 /// let x = GitHubEnterpriseConfig::new().set_peered_network("example");
12126 /// ```
12127 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12128 self.peered_network = v.into();
12129 self
12130 }
12131
12132 /// Sets the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12133 ///
12134 /// # Example
12135 /// ```ignore,no_run
12136 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12137 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12138 /// let x = GitHubEnterpriseConfig::new().set_secrets(GitHubEnterpriseSecrets::default()/* use setters */);
12139 /// ```
12140 pub fn set_secrets<T>(mut self, v: T) -> Self
12141 where
12142 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12143 {
12144 self.secrets = std::option::Option::Some(v.into());
12145 self
12146 }
12147
12148 /// Sets or clears the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12149 ///
12150 /// # Example
12151 /// ```ignore,no_run
12152 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12153 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12154 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(Some(GitHubEnterpriseSecrets::default()/* use setters */));
12155 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(None::<GitHubEnterpriseSecrets>);
12156 /// ```
12157 pub fn set_or_clear_secrets<T>(mut self, v: std::option::Option<T>) -> Self
12158 where
12159 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12160 {
12161 self.secrets = v.map(|x| x.into());
12162 self
12163 }
12164
12165 /// Sets the value of [display_name][crate::model::GitHubEnterpriseConfig::display_name].
12166 ///
12167 /// # Example
12168 /// ```ignore,no_run
12169 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12170 /// let x = GitHubEnterpriseConfig::new().set_display_name("example");
12171 /// ```
12172 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12173 self.display_name = v.into();
12174 self
12175 }
12176
12177 /// Sets the value of [ssl_ca][crate::model::GitHubEnterpriseConfig::ssl_ca].
12178 ///
12179 /// # Example
12180 /// ```ignore,no_run
12181 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12182 /// let x = GitHubEnterpriseConfig::new().set_ssl_ca("example");
12183 /// ```
12184 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12185 self.ssl_ca = v.into();
12186 self
12187 }
12188}
12189
12190impl wkt::message::Message for GitHubEnterpriseConfig {
12191 fn typename() -> &'static str {
12192 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseConfig"
12193 }
12194}
12195
12196/// GitHubEnterpriseSecrets represents the names of all necessary secrets in
12197/// Secret Manager for a GitHub Enterprise server.
12198/// Format is: projects/\<project number\>/secrets/\<secret name\>.
12199#[derive(Clone, Default, PartialEq)]
12200#[non_exhaustive]
12201pub struct GitHubEnterpriseSecrets {
12202 /// The resource name for the private key secret version.
12203 pub private_key_version_name: std::string::String,
12204
12205 /// The resource name for the webhook secret secret version in Secret Manager.
12206 pub webhook_secret_version_name: std::string::String,
12207
12208 /// The resource name for the OAuth secret secret version in Secret Manager.
12209 pub oauth_secret_version_name: std::string::String,
12210
12211 /// The resource name for the OAuth client ID secret version in Secret Manager.
12212 pub oauth_client_id_version_name: std::string::String,
12213
12214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12215}
12216
12217impl GitHubEnterpriseSecrets {
12218 pub fn new() -> Self {
12219 std::default::Default::default()
12220 }
12221
12222 /// Sets the value of [private_key_version_name][crate::model::GitHubEnterpriseSecrets::private_key_version_name].
12223 ///
12224 /// # Example
12225 /// ```ignore,no_run
12226 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12227 /// let x = GitHubEnterpriseSecrets::new().set_private_key_version_name("example");
12228 /// ```
12229 pub fn set_private_key_version_name<T: std::convert::Into<std::string::String>>(
12230 mut self,
12231 v: T,
12232 ) -> Self {
12233 self.private_key_version_name = v.into();
12234 self
12235 }
12236
12237 /// Sets the value of [webhook_secret_version_name][crate::model::GitHubEnterpriseSecrets::webhook_secret_version_name].
12238 ///
12239 /// # Example
12240 /// ```ignore,no_run
12241 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12242 /// let x = GitHubEnterpriseSecrets::new().set_webhook_secret_version_name("example");
12243 /// ```
12244 pub fn set_webhook_secret_version_name<T: std::convert::Into<std::string::String>>(
12245 mut self,
12246 v: T,
12247 ) -> Self {
12248 self.webhook_secret_version_name = v.into();
12249 self
12250 }
12251
12252 /// Sets the value of [oauth_secret_version_name][crate::model::GitHubEnterpriseSecrets::oauth_secret_version_name].
12253 ///
12254 /// # Example
12255 /// ```ignore,no_run
12256 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12257 /// let x = GitHubEnterpriseSecrets::new().set_oauth_secret_version_name("example");
12258 /// ```
12259 pub fn set_oauth_secret_version_name<T: std::convert::Into<std::string::String>>(
12260 mut self,
12261 v: T,
12262 ) -> Self {
12263 self.oauth_secret_version_name = v.into();
12264 self
12265 }
12266
12267 /// Sets the value of [oauth_client_id_version_name][crate::model::GitHubEnterpriseSecrets::oauth_client_id_version_name].
12268 ///
12269 /// # Example
12270 /// ```ignore,no_run
12271 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12272 /// let x = GitHubEnterpriseSecrets::new().set_oauth_client_id_version_name("example");
12273 /// ```
12274 pub fn set_oauth_client_id_version_name<T: std::convert::Into<std::string::String>>(
12275 mut self,
12276 v: T,
12277 ) -> Self {
12278 self.oauth_client_id_version_name = v.into();
12279 self
12280 }
12281}
12282
12283impl wkt::message::Message for GitHubEnterpriseSecrets {
12284 fn typename() -> &'static str {
12285 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets"
12286 }
12287}
12288
12289/// Configuration for a `WorkerPool`.
12290///
12291/// Cloud Build owns and maintains a pool of workers for general use and have no
12292/// access to a project's private network. By default, builds submitted to
12293/// Cloud Build will use a worker from this pool.
12294///
12295/// If your build needs access to resources on a private network,
12296/// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give
12297/// your builds access to any single VPC network that you
12298/// administer, including any on-prem resources connected to that VPC
12299/// network. For an overview of private pools, see
12300/// [Private pools
12301/// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview).
12302#[derive(Clone, Default, PartialEq)]
12303#[non_exhaustive]
12304pub struct WorkerPool {
12305 /// Output only. The resource name of the `WorkerPool`, with format
12306 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
12307 /// The value of `{worker_pool}` is provided by `worker_pool_id` in
12308 /// `CreateWorkerPool` request and the value of `{location}` is determined by
12309 /// the endpoint accessed.
12310 pub name: std::string::String,
12311
12312 /// A user-specified, human-readable name for the `WorkerPool`. If provided,
12313 /// this value must be 1-63 characters.
12314 pub display_name: std::string::String,
12315
12316 /// Output only. A unique identifier for the `WorkerPool`.
12317 pub uid: std::string::String,
12318
12319 /// User specified annotations. See <https://google.aip.dev/128#annotations>
12320 /// for more details such as format and size limitations.
12321 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12322
12323 /// Output only. Time at which the request to create the `WorkerPool` was
12324 /// received.
12325 pub create_time: std::option::Option<wkt::Timestamp>,
12326
12327 /// Output only. Time at which the request to update the `WorkerPool` was
12328 /// received.
12329 pub update_time: std::option::Option<wkt::Timestamp>,
12330
12331 /// Output only. Time at which the request to delete the `WorkerPool` was
12332 /// received.
12333 pub delete_time: std::option::Option<wkt::Timestamp>,
12334
12335 /// Output only. `WorkerPool` state.
12336 pub state: crate::model::worker_pool::State,
12337
12338 /// Output only. Checksum computed by the server. May be sent on update and
12339 /// delete requests to ensure that the client has an up-to-date value before
12340 /// proceeding.
12341 pub etag: std::string::String,
12342
12343 /// Configuration for the `WorkerPool`.
12344 pub config: std::option::Option<crate::model::worker_pool::Config>,
12345
12346 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12347}
12348
12349impl WorkerPool {
12350 pub fn new() -> Self {
12351 std::default::Default::default()
12352 }
12353
12354 /// Sets the value of [name][crate::model::WorkerPool::name].
12355 ///
12356 /// # Example
12357 /// ```ignore,no_run
12358 /// # use google_cloud_build_v1::model::WorkerPool;
12359 /// let x = WorkerPool::new().set_name("example");
12360 /// ```
12361 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12362 self.name = v.into();
12363 self
12364 }
12365
12366 /// Sets the value of [display_name][crate::model::WorkerPool::display_name].
12367 ///
12368 /// # Example
12369 /// ```ignore,no_run
12370 /// # use google_cloud_build_v1::model::WorkerPool;
12371 /// let x = WorkerPool::new().set_display_name("example");
12372 /// ```
12373 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12374 self.display_name = v.into();
12375 self
12376 }
12377
12378 /// Sets the value of [uid][crate::model::WorkerPool::uid].
12379 ///
12380 /// # Example
12381 /// ```ignore,no_run
12382 /// # use google_cloud_build_v1::model::WorkerPool;
12383 /// let x = WorkerPool::new().set_uid("example");
12384 /// ```
12385 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12386 self.uid = v.into();
12387 self
12388 }
12389
12390 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
12391 ///
12392 /// # Example
12393 /// ```ignore,no_run
12394 /// # use google_cloud_build_v1::model::WorkerPool;
12395 /// let x = WorkerPool::new().set_annotations([
12396 /// ("key0", "abc"),
12397 /// ("key1", "xyz"),
12398 /// ]);
12399 /// ```
12400 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12401 where
12402 T: std::iter::IntoIterator<Item = (K, V)>,
12403 K: std::convert::Into<std::string::String>,
12404 V: std::convert::Into<std::string::String>,
12405 {
12406 use std::iter::Iterator;
12407 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12408 self
12409 }
12410
12411 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
12412 ///
12413 /// # Example
12414 /// ```ignore,no_run
12415 /// # use google_cloud_build_v1::model::WorkerPool;
12416 /// use wkt::Timestamp;
12417 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
12418 /// ```
12419 pub fn set_create_time<T>(mut self, v: T) -> Self
12420 where
12421 T: std::convert::Into<wkt::Timestamp>,
12422 {
12423 self.create_time = std::option::Option::Some(v.into());
12424 self
12425 }
12426
12427 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
12428 ///
12429 /// # Example
12430 /// ```ignore,no_run
12431 /// # use google_cloud_build_v1::model::WorkerPool;
12432 /// use wkt::Timestamp;
12433 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12434 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
12435 /// ```
12436 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12437 where
12438 T: std::convert::Into<wkt::Timestamp>,
12439 {
12440 self.create_time = v.map(|x| x.into());
12441 self
12442 }
12443
12444 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
12445 ///
12446 /// # Example
12447 /// ```ignore,no_run
12448 /// # use google_cloud_build_v1::model::WorkerPool;
12449 /// use wkt::Timestamp;
12450 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
12451 /// ```
12452 pub fn set_update_time<T>(mut self, v: T) -> Self
12453 where
12454 T: std::convert::Into<wkt::Timestamp>,
12455 {
12456 self.update_time = std::option::Option::Some(v.into());
12457 self
12458 }
12459
12460 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
12461 ///
12462 /// # Example
12463 /// ```ignore,no_run
12464 /// # use google_cloud_build_v1::model::WorkerPool;
12465 /// use wkt::Timestamp;
12466 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12467 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
12468 /// ```
12469 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12470 where
12471 T: std::convert::Into<wkt::Timestamp>,
12472 {
12473 self.update_time = v.map(|x| x.into());
12474 self
12475 }
12476
12477 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
12478 ///
12479 /// # Example
12480 /// ```ignore,no_run
12481 /// # use google_cloud_build_v1::model::WorkerPool;
12482 /// use wkt::Timestamp;
12483 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
12484 /// ```
12485 pub fn set_delete_time<T>(mut self, v: T) -> Self
12486 where
12487 T: std::convert::Into<wkt::Timestamp>,
12488 {
12489 self.delete_time = std::option::Option::Some(v.into());
12490 self
12491 }
12492
12493 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
12494 ///
12495 /// # Example
12496 /// ```ignore,no_run
12497 /// # use google_cloud_build_v1::model::WorkerPool;
12498 /// use wkt::Timestamp;
12499 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12500 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
12501 /// ```
12502 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12503 where
12504 T: std::convert::Into<wkt::Timestamp>,
12505 {
12506 self.delete_time = v.map(|x| x.into());
12507 self
12508 }
12509
12510 /// Sets the value of [state][crate::model::WorkerPool::state].
12511 ///
12512 /// # Example
12513 /// ```ignore,no_run
12514 /// # use google_cloud_build_v1::model::WorkerPool;
12515 /// use google_cloud_build_v1::model::worker_pool::State;
12516 /// let x0 = WorkerPool::new().set_state(State::Creating);
12517 /// let x1 = WorkerPool::new().set_state(State::Running);
12518 /// let x2 = WorkerPool::new().set_state(State::Deleting);
12519 /// ```
12520 pub fn set_state<T: std::convert::Into<crate::model::worker_pool::State>>(
12521 mut self,
12522 v: T,
12523 ) -> Self {
12524 self.state = v.into();
12525 self
12526 }
12527
12528 /// Sets the value of [etag][crate::model::WorkerPool::etag].
12529 ///
12530 /// # Example
12531 /// ```ignore,no_run
12532 /// # use google_cloud_build_v1::model::WorkerPool;
12533 /// let x = WorkerPool::new().set_etag("example");
12534 /// ```
12535 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12536 self.etag = v.into();
12537 self
12538 }
12539
12540 /// Sets the value of [config][crate::model::WorkerPool::config].
12541 ///
12542 /// Note that all the setters affecting `config` are mutually
12543 /// exclusive.
12544 ///
12545 /// # Example
12546 /// ```ignore,no_run
12547 /// # use google_cloud_build_v1::model::WorkerPool;
12548 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12549 /// let x = WorkerPool::new().set_config(Some(
12550 /// google_cloud_build_v1::model::worker_pool::Config::PrivatePoolV1Config(PrivatePoolV1Config::default().into())));
12551 /// ```
12552 pub fn set_config<
12553 T: std::convert::Into<std::option::Option<crate::model::worker_pool::Config>>,
12554 >(
12555 mut self,
12556 v: T,
12557 ) -> Self {
12558 self.config = v.into();
12559 self
12560 }
12561
12562 /// The value of [config][crate::model::WorkerPool::config]
12563 /// if it holds a `PrivatePoolV1Config`, `None` if the field is not set or
12564 /// holds a different branch.
12565 pub fn private_pool_v1_config(
12566 &self,
12567 ) -> std::option::Option<&std::boxed::Box<crate::model::PrivatePoolV1Config>> {
12568 #[allow(unreachable_patterns)]
12569 self.config.as_ref().and_then(|v| match v {
12570 crate::model::worker_pool::Config::PrivatePoolV1Config(v) => {
12571 std::option::Option::Some(v)
12572 }
12573 _ => std::option::Option::None,
12574 })
12575 }
12576
12577 /// Sets the value of [config][crate::model::WorkerPool::config]
12578 /// to hold a `PrivatePoolV1Config`.
12579 ///
12580 /// Note that all the setters affecting `config` are
12581 /// mutually exclusive.
12582 ///
12583 /// # Example
12584 /// ```ignore,no_run
12585 /// # use google_cloud_build_v1::model::WorkerPool;
12586 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12587 /// let x = WorkerPool::new().set_private_pool_v1_config(PrivatePoolV1Config::default()/* use setters */);
12588 /// assert!(x.private_pool_v1_config().is_some());
12589 /// ```
12590 pub fn set_private_pool_v1_config<
12591 T: std::convert::Into<std::boxed::Box<crate::model::PrivatePoolV1Config>>,
12592 >(
12593 mut self,
12594 v: T,
12595 ) -> Self {
12596 self.config = std::option::Option::Some(
12597 crate::model::worker_pool::Config::PrivatePoolV1Config(v.into()),
12598 );
12599 self
12600 }
12601}
12602
12603impl wkt::message::Message for WorkerPool {
12604 fn typename() -> &'static str {
12605 "type.googleapis.com/google.devtools.cloudbuild.v1.WorkerPool"
12606 }
12607}
12608
12609/// Defines additional types related to [WorkerPool].
12610pub mod worker_pool {
12611 #[allow(unused_imports)]
12612 use super::*;
12613
12614 /// State of the `WorkerPool`.
12615 ///
12616 /// # Working with unknown values
12617 ///
12618 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12619 /// additional enum variants at any time. Adding new variants is not considered
12620 /// a breaking change. Applications should write their code in anticipation of:
12621 ///
12622 /// - New values appearing in future releases of the client library, **and**
12623 /// - New values received dynamically, without application changes.
12624 ///
12625 /// Please consult the [Working with enums] section in the user guide for some
12626 /// guidelines.
12627 ///
12628 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12629 #[derive(Clone, Debug, PartialEq)]
12630 #[non_exhaustive]
12631 pub enum State {
12632 /// State of the `WorkerPool` is unknown.
12633 Unspecified,
12634 /// `WorkerPool` is being created.
12635 Creating,
12636 /// `WorkerPool` is running.
12637 Running,
12638 /// `WorkerPool` is being deleted: cancelling builds and draining workers.
12639 Deleting,
12640 /// `WorkerPool` is deleted.
12641 Deleted,
12642 /// `WorkerPool` is being updated; new builds cannot be run.
12643 Updating,
12644 /// If set, the enum was initialized with an unknown value.
12645 ///
12646 /// Applications can examine the value using [State::value] or
12647 /// [State::name].
12648 UnknownValue(state::UnknownValue),
12649 }
12650
12651 #[doc(hidden)]
12652 pub mod state {
12653 #[allow(unused_imports)]
12654 use super::*;
12655 #[derive(Clone, Debug, PartialEq)]
12656 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12657 }
12658
12659 impl State {
12660 /// Gets the enum value.
12661 ///
12662 /// Returns `None` if the enum contains an unknown value deserialized from
12663 /// the string representation of enums.
12664 pub fn value(&self) -> std::option::Option<i32> {
12665 match self {
12666 Self::Unspecified => std::option::Option::Some(0),
12667 Self::Creating => std::option::Option::Some(1),
12668 Self::Running => std::option::Option::Some(2),
12669 Self::Deleting => std::option::Option::Some(3),
12670 Self::Deleted => std::option::Option::Some(4),
12671 Self::Updating => std::option::Option::Some(5),
12672 Self::UnknownValue(u) => u.0.value(),
12673 }
12674 }
12675
12676 /// Gets the enum value as a string.
12677 ///
12678 /// Returns `None` if the enum contains an unknown value deserialized from
12679 /// the integer representation of enums.
12680 pub fn name(&self) -> std::option::Option<&str> {
12681 match self {
12682 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12683 Self::Creating => std::option::Option::Some("CREATING"),
12684 Self::Running => std::option::Option::Some("RUNNING"),
12685 Self::Deleting => std::option::Option::Some("DELETING"),
12686 Self::Deleted => std::option::Option::Some("DELETED"),
12687 Self::Updating => std::option::Option::Some("UPDATING"),
12688 Self::UnknownValue(u) => u.0.name(),
12689 }
12690 }
12691 }
12692
12693 impl std::default::Default for State {
12694 fn default() -> Self {
12695 use std::convert::From;
12696 Self::from(0)
12697 }
12698 }
12699
12700 impl std::fmt::Display for State {
12701 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12702 wkt::internal::display_enum(f, self.name(), self.value())
12703 }
12704 }
12705
12706 impl std::convert::From<i32> for State {
12707 fn from(value: i32) -> Self {
12708 match value {
12709 0 => Self::Unspecified,
12710 1 => Self::Creating,
12711 2 => Self::Running,
12712 3 => Self::Deleting,
12713 4 => Self::Deleted,
12714 5 => Self::Updating,
12715 _ => Self::UnknownValue(state::UnknownValue(
12716 wkt::internal::UnknownEnumValue::Integer(value),
12717 )),
12718 }
12719 }
12720 }
12721
12722 impl std::convert::From<&str> for State {
12723 fn from(value: &str) -> Self {
12724 use std::string::ToString;
12725 match value {
12726 "STATE_UNSPECIFIED" => Self::Unspecified,
12727 "CREATING" => Self::Creating,
12728 "RUNNING" => Self::Running,
12729 "DELETING" => Self::Deleting,
12730 "DELETED" => Self::Deleted,
12731 "UPDATING" => Self::Updating,
12732 _ => Self::UnknownValue(state::UnknownValue(
12733 wkt::internal::UnknownEnumValue::String(value.to_string()),
12734 )),
12735 }
12736 }
12737 }
12738
12739 impl serde::ser::Serialize for State {
12740 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12741 where
12742 S: serde::Serializer,
12743 {
12744 match self {
12745 Self::Unspecified => serializer.serialize_i32(0),
12746 Self::Creating => serializer.serialize_i32(1),
12747 Self::Running => serializer.serialize_i32(2),
12748 Self::Deleting => serializer.serialize_i32(3),
12749 Self::Deleted => serializer.serialize_i32(4),
12750 Self::Updating => serializer.serialize_i32(5),
12751 Self::UnknownValue(u) => u.0.serialize(serializer),
12752 }
12753 }
12754 }
12755
12756 impl<'de> serde::de::Deserialize<'de> for State {
12757 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12758 where
12759 D: serde::Deserializer<'de>,
12760 {
12761 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12762 ".google.devtools.cloudbuild.v1.WorkerPool.State",
12763 ))
12764 }
12765 }
12766
12767 /// Configuration for the `WorkerPool`.
12768 #[derive(Clone, Debug, PartialEq)]
12769 #[non_exhaustive]
12770 pub enum Config {
12771 /// Private Pool configuration.
12772 PrivatePoolV1Config(std::boxed::Box<crate::model::PrivatePoolV1Config>),
12773 }
12774}
12775
12776/// Configuration for a V1 `PrivatePool`.
12777#[derive(Clone, Default, PartialEq)]
12778#[non_exhaustive]
12779pub struct PrivatePoolV1Config {
12780 /// Machine configuration for the workers in the pool.
12781 pub worker_config: std::option::Option<crate::model::private_pool_v_1_config::WorkerConfig>,
12782
12783 /// Network configuration for the pool.
12784 pub network_config: std::option::Option<crate::model::private_pool_v_1_config::NetworkConfig>,
12785
12786 /// Immutable. Private Service Connect(PSC) Network configuration for the pool.
12787 pub private_service_connect:
12788 std::option::Option<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12789
12790 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12791}
12792
12793impl PrivatePoolV1Config {
12794 pub fn new() -> Self {
12795 std::default::Default::default()
12796 }
12797
12798 /// Sets the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12799 ///
12800 /// # Example
12801 /// ```ignore,no_run
12802 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12803 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12804 /// let x = PrivatePoolV1Config::new().set_worker_config(WorkerConfig::default()/* use setters */);
12805 /// ```
12806 pub fn set_worker_config<T>(mut self, v: T) -> Self
12807 where
12808 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12809 {
12810 self.worker_config = std::option::Option::Some(v.into());
12811 self
12812 }
12813
12814 /// Sets or clears the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12815 ///
12816 /// # Example
12817 /// ```ignore,no_run
12818 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12819 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12820 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(Some(WorkerConfig::default()/* use setters */));
12821 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(None::<WorkerConfig>);
12822 /// ```
12823 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
12824 where
12825 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12826 {
12827 self.worker_config = v.map(|x| x.into());
12828 self
12829 }
12830
12831 /// Sets the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12832 ///
12833 /// # Example
12834 /// ```ignore,no_run
12835 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12836 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12837 /// let x = PrivatePoolV1Config::new().set_network_config(NetworkConfig::default()/* use setters */);
12838 /// ```
12839 pub fn set_network_config<T>(mut self, v: T) -> Self
12840 where
12841 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12842 {
12843 self.network_config = std::option::Option::Some(v.into());
12844 self
12845 }
12846
12847 /// Sets or clears the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12848 ///
12849 /// # Example
12850 /// ```ignore,no_run
12851 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12852 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12853 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(Some(NetworkConfig::default()/* use setters */));
12854 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(None::<NetworkConfig>);
12855 /// ```
12856 pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
12857 where
12858 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12859 {
12860 self.network_config = v.map(|x| x.into());
12861 self
12862 }
12863
12864 /// Sets the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12865 ///
12866 /// # Example
12867 /// ```ignore,no_run
12868 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12869 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12870 /// let x = PrivatePoolV1Config::new().set_private_service_connect(PrivateServiceConnect::default()/* use setters */);
12871 /// ```
12872 pub fn set_private_service_connect<T>(mut self, v: T) -> Self
12873 where
12874 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12875 {
12876 self.private_service_connect = std::option::Option::Some(v.into());
12877 self
12878 }
12879
12880 /// Sets or clears the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12881 ///
12882 /// # Example
12883 /// ```ignore,no_run
12884 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12885 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12886 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(Some(PrivateServiceConnect::default()/* use setters */));
12887 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(None::<PrivateServiceConnect>);
12888 /// ```
12889 pub fn set_or_clear_private_service_connect<T>(mut self, v: std::option::Option<T>) -> Self
12890 where
12891 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12892 {
12893 self.private_service_connect = v.map(|x| x.into());
12894 self
12895 }
12896}
12897
12898impl wkt::message::Message for PrivatePoolV1Config {
12899 fn typename() -> &'static str {
12900 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config"
12901 }
12902}
12903
12904/// Defines additional types related to [PrivatePoolV1Config].
12905pub mod private_pool_v_1_config {
12906 #[allow(unused_imports)]
12907 use super::*;
12908
12909 /// Defines the configuration to be used for creating workers in
12910 /// the pool.
12911 #[derive(Clone, Default, PartialEq)]
12912 #[non_exhaustive]
12913 pub struct WorkerConfig {
12914 /// Optional. Machine type of a worker, such as `e2-medium`.
12915 /// See [Worker pool config
12916 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
12917 /// If left blank, Cloud Build will use a sensible default.
12918 pub machine_type: std::string::String,
12919
12920 /// Size of the disk attached to the worker, in GB.
12921 /// See [Worker pool config
12922 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
12923 /// Specify a value of up to 4000. If `0` is specified, Cloud Build will use
12924 /// a standard disk size.
12925 pub disk_size_gb: i64,
12926
12927 /// Optional. Enable nested virtualization on the worker, if supported by the
12928 /// machine type. By default, nested virtualization is disabled.
12929 pub enable_nested_virtualization: std::option::Option<bool>,
12930
12931 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12932 }
12933
12934 impl WorkerConfig {
12935 pub fn new() -> Self {
12936 std::default::Default::default()
12937 }
12938
12939 /// Sets the value of [machine_type][crate::model::private_pool_v_1_config::WorkerConfig::machine_type].
12940 ///
12941 /// # Example
12942 /// ```ignore,no_run
12943 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12944 /// let x = WorkerConfig::new().set_machine_type("example");
12945 /// ```
12946 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
12947 mut self,
12948 v: T,
12949 ) -> Self {
12950 self.machine_type = v.into();
12951 self
12952 }
12953
12954 /// Sets the value of [disk_size_gb][crate::model::private_pool_v_1_config::WorkerConfig::disk_size_gb].
12955 ///
12956 /// # Example
12957 /// ```ignore,no_run
12958 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12959 /// let x = WorkerConfig::new().set_disk_size_gb(42);
12960 /// ```
12961 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12962 self.disk_size_gb = v.into();
12963 self
12964 }
12965
12966 /// Sets the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
12967 ///
12968 /// # Example
12969 /// ```ignore,no_run
12970 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12971 /// let x = WorkerConfig::new().set_enable_nested_virtualization(true);
12972 /// ```
12973 pub fn set_enable_nested_virtualization<T>(mut self, v: T) -> Self
12974 where
12975 T: std::convert::Into<bool>,
12976 {
12977 self.enable_nested_virtualization = std::option::Option::Some(v.into());
12978 self
12979 }
12980
12981 /// Sets or clears the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
12982 ///
12983 /// # Example
12984 /// ```ignore,no_run
12985 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12986 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(Some(false));
12987 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(None::<bool>);
12988 /// ```
12989 pub fn set_or_clear_enable_nested_virtualization<T>(
12990 mut self,
12991 v: std::option::Option<T>,
12992 ) -> Self
12993 where
12994 T: std::convert::Into<bool>,
12995 {
12996 self.enable_nested_virtualization = v.map(|x| x.into());
12997 self
12998 }
12999 }
13000
13001 impl wkt::message::Message for WorkerConfig {
13002 fn typename() -> &'static str {
13003 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.WorkerConfig"
13004 }
13005 }
13006
13007 /// Defines the network configuration for the pool.
13008 #[derive(Clone, Default, PartialEq)]
13009 #[non_exhaustive]
13010 pub struct NetworkConfig {
13011 /// Required. Immutable. The network definition that the workers are peered
13012 /// to. If this section is left empty, the workers will be peered to
13013 /// `WorkerPool.project_id` on the service producer network. Must be in the
13014 /// format `projects/{project}/global/networks/{network}`, where `{project}`
13015 /// is a project number, such as `12345`, and `{network}` is the name of a
13016 /// VPC network in the project. See
13017 /// [Understanding network configuration
13018 /// options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment)
13019 pub peered_network: std::string::String,
13020
13021 /// Option to configure network egress for the workers.
13022 pub egress_option: crate::model::private_pool_v_1_config::network_config::EgressOption,
13023
13024 /// Immutable. Subnet IP range within the peered network. This is specified
13025 /// in CIDR notation with a slash and the subnet prefix size. You can
13026 /// optionally specify an IP address before the subnet prefix value. e.g.
13027 /// `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a
13028 /// prefix size of 29 bits.
13029 /// `/16` would specify a prefix size of 16 bits, with an automatically
13030 /// determined IP within the peered VPC.
13031 /// If unspecified, a value of `/24` will be used.
13032 pub peered_network_ip_range: std::string::String,
13033
13034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13035 }
13036
13037 impl NetworkConfig {
13038 pub fn new() -> Self {
13039 std::default::Default::default()
13040 }
13041
13042 /// Sets the value of [peered_network][crate::model::private_pool_v_1_config::NetworkConfig::peered_network].
13043 ///
13044 /// # Example
13045 /// ```ignore,no_run
13046 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13047 /// let x = NetworkConfig::new().set_peered_network("example");
13048 /// ```
13049 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(
13050 mut self,
13051 v: T,
13052 ) -> Self {
13053 self.peered_network = v.into();
13054 self
13055 }
13056
13057 /// Sets the value of [egress_option][crate::model::private_pool_v_1_config::NetworkConfig::egress_option].
13058 ///
13059 /// # Example
13060 /// ```ignore,no_run
13061 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13062 /// use google_cloud_build_v1::model::private_pool_v_1_config::network_config::EgressOption;
13063 /// let x0 = NetworkConfig::new().set_egress_option(EgressOption::NoPublicEgress);
13064 /// let x1 = NetworkConfig::new().set_egress_option(EgressOption::PublicEgress);
13065 /// ```
13066 pub fn set_egress_option<
13067 T: std::convert::Into<crate::model::private_pool_v_1_config::network_config::EgressOption>,
13068 >(
13069 mut self,
13070 v: T,
13071 ) -> Self {
13072 self.egress_option = v.into();
13073 self
13074 }
13075
13076 /// Sets the value of [peered_network_ip_range][crate::model::private_pool_v_1_config::NetworkConfig::peered_network_ip_range].
13077 ///
13078 /// # Example
13079 /// ```ignore,no_run
13080 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13081 /// let x = NetworkConfig::new().set_peered_network_ip_range("example");
13082 /// ```
13083 pub fn set_peered_network_ip_range<T: std::convert::Into<std::string::String>>(
13084 mut self,
13085 v: T,
13086 ) -> Self {
13087 self.peered_network_ip_range = v.into();
13088 self
13089 }
13090 }
13091
13092 impl wkt::message::Message for NetworkConfig {
13093 fn typename() -> &'static str {
13094 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig"
13095 }
13096 }
13097
13098 /// Defines additional types related to [NetworkConfig].
13099 pub mod network_config {
13100 #[allow(unused_imports)]
13101 use super::*;
13102
13103 /// Defines the egress option for the pool.
13104 ///
13105 /// # Working with unknown values
13106 ///
13107 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13108 /// additional enum variants at any time. Adding new variants is not considered
13109 /// a breaking change. Applications should write their code in anticipation of:
13110 ///
13111 /// - New values appearing in future releases of the client library, **and**
13112 /// - New values received dynamically, without application changes.
13113 ///
13114 /// Please consult the [Working with enums] section in the user guide for some
13115 /// guidelines.
13116 ///
13117 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13118 #[derive(Clone, Debug, PartialEq)]
13119 #[non_exhaustive]
13120 pub enum EgressOption {
13121 /// If set, defaults to PUBLIC_EGRESS.
13122 Unspecified,
13123 /// If set, workers are created without any public address, which prevents
13124 /// network egress to public IPs unless a network proxy is configured.
13125 NoPublicEgress,
13126 /// If set, workers are created with a public address which allows for
13127 /// public internet egress.
13128 PublicEgress,
13129 /// If set, the enum was initialized with an unknown value.
13130 ///
13131 /// Applications can examine the value using [EgressOption::value] or
13132 /// [EgressOption::name].
13133 UnknownValue(egress_option::UnknownValue),
13134 }
13135
13136 #[doc(hidden)]
13137 pub mod egress_option {
13138 #[allow(unused_imports)]
13139 use super::*;
13140 #[derive(Clone, Debug, PartialEq)]
13141 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13142 }
13143
13144 impl EgressOption {
13145 /// Gets the enum value.
13146 ///
13147 /// Returns `None` if the enum contains an unknown value deserialized from
13148 /// the string representation of enums.
13149 pub fn value(&self) -> std::option::Option<i32> {
13150 match self {
13151 Self::Unspecified => std::option::Option::Some(0),
13152 Self::NoPublicEgress => std::option::Option::Some(1),
13153 Self::PublicEgress => std::option::Option::Some(2),
13154 Self::UnknownValue(u) => u.0.value(),
13155 }
13156 }
13157
13158 /// Gets the enum value as a string.
13159 ///
13160 /// Returns `None` if the enum contains an unknown value deserialized from
13161 /// the integer representation of enums.
13162 pub fn name(&self) -> std::option::Option<&str> {
13163 match self {
13164 Self::Unspecified => std::option::Option::Some("EGRESS_OPTION_UNSPECIFIED"),
13165 Self::NoPublicEgress => std::option::Option::Some("NO_PUBLIC_EGRESS"),
13166 Self::PublicEgress => std::option::Option::Some("PUBLIC_EGRESS"),
13167 Self::UnknownValue(u) => u.0.name(),
13168 }
13169 }
13170 }
13171
13172 impl std::default::Default for EgressOption {
13173 fn default() -> Self {
13174 use std::convert::From;
13175 Self::from(0)
13176 }
13177 }
13178
13179 impl std::fmt::Display for EgressOption {
13180 fn fmt(
13181 &self,
13182 f: &mut std::fmt::Formatter<'_>,
13183 ) -> std::result::Result<(), std::fmt::Error> {
13184 wkt::internal::display_enum(f, self.name(), self.value())
13185 }
13186 }
13187
13188 impl std::convert::From<i32> for EgressOption {
13189 fn from(value: i32) -> Self {
13190 match value {
13191 0 => Self::Unspecified,
13192 1 => Self::NoPublicEgress,
13193 2 => Self::PublicEgress,
13194 _ => Self::UnknownValue(egress_option::UnknownValue(
13195 wkt::internal::UnknownEnumValue::Integer(value),
13196 )),
13197 }
13198 }
13199 }
13200
13201 impl std::convert::From<&str> for EgressOption {
13202 fn from(value: &str) -> Self {
13203 use std::string::ToString;
13204 match value {
13205 "EGRESS_OPTION_UNSPECIFIED" => Self::Unspecified,
13206 "NO_PUBLIC_EGRESS" => Self::NoPublicEgress,
13207 "PUBLIC_EGRESS" => Self::PublicEgress,
13208 _ => Self::UnknownValue(egress_option::UnknownValue(
13209 wkt::internal::UnknownEnumValue::String(value.to_string()),
13210 )),
13211 }
13212 }
13213 }
13214
13215 impl serde::ser::Serialize for EgressOption {
13216 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13217 where
13218 S: serde::Serializer,
13219 {
13220 match self {
13221 Self::Unspecified => serializer.serialize_i32(0),
13222 Self::NoPublicEgress => serializer.serialize_i32(1),
13223 Self::PublicEgress => serializer.serialize_i32(2),
13224 Self::UnknownValue(u) => u.0.serialize(serializer),
13225 }
13226 }
13227 }
13228
13229 impl<'de> serde::de::Deserialize<'de> for EgressOption {
13230 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13231 where
13232 D: serde::Deserializer<'de>,
13233 {
13234 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EgressOption>::new(
13235 ".google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig.EgressOption",
13236 ))
13237 }
13238 }
13239 }
13240
13241 /// Defines the Private Service Connect network configuration for the pool.
13242 #[derive(Clone, Default, PartialEq)]
13243 #[non_exhaustive]
13244 pub struct PrivateServiceConnect {
13245 /// Required. Immutable. The network attachment that the worker network
13246 /// interface is peered to. Must be in the format
13247 /// `projects/{project}/regions/{region}/networkAttachments/{networkAttachment}`.
13248 /// The region of network attachment must be the same as the worker pool.
13249 /// See [Network
13250 /// Attachments](https://cloud.google.com/vpc/docs/about-network-attachments)
13251 pub network_attachment: std::string::String,
13252
13253 /// Required. Immutable. Disable public IP on the primary network interface.
13254 ///
13255 /// If true, workers are created without any public address, which prevents
13256 /// network egress to public IPs unless a network proxy is configured.
13257 /// If false, workers are created with a public address which allows for
13258 /// public internet egress. The public address only applies to traffic
13259 /// through the primary network interface.
13260 /// If `route_all_traffic` is set to true, all traffic will go through the
13261 /// non-primary network interface, this boolean has no effect.
13262 pub public_ip_address_disabled: bool,
13263
13264 /// Immutable. Route all traffic through PSC interface. Enable this if you
13265 /// want full control of traffic in the private pool. Configure Cloud NAT for
13266 /// the subnet of network attachment if you need to access public Internet.
13267 ///
13268 /// If false, Only route RFC 1918 (10.0.0.0/8, 172.16.0.0/12, and
13269 /// 192.168.0.0/16) and RFC 6598 (100.64.0.0/10) through PSC interface.
13270 pub route_all_traffic: bool,
13271
13272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13273 }
13274
13275 impl PrivateServiceConnect {
13276 pub fn new() -> Self {
13277 std::default::Default::default()
13278 }
13279
13280 /// Sets the value of [network_attachment][crate::model::private_pool_v_1_config::PrivateServiceConnect::network_attachment].
13281 ///
13282 /// # Example
13283 /// ```ignore,no_run
13284 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13285 /// let x = PrivateServiceConnect::new().set_network_attachment("example");
13286 /// ```
13287 pub fn set_network_attachment<T: std::convert::Into<std::string::String>>(
13288 mut self,
13289 v: T,
13290 ) -> Self {
13291 self.network_attachment = v.into();
13292 self
13293 }
13294
13295 /// Sets the value of [public_ip_address_disabled][crate::model::private_pool_v_1_config::PrivateServiceConnect::public_ip_address_disabled].
13296 ///
13297 /// # Example
13298 /// ```ignore,no_run
13299 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13300 /// let x = PrivateServiceConnect::new().set_public_ip_address_disabled(true);
13301 /// ```
13302 pub fn set_public_ip_address_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13303 self.public_ip_address_disabled = v.into();
13304 self
13305 }
13306
13307 /// Sets the value of [route_all_traffic][crate::model::private_pool_v_1_config::PrivateServiceConnect::route_all_traffic].
13308 ///
13309 /// # Example
13310 /// ```ignore,no_run
13311 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13312 /// let x = PrivateServiceConnect::new().set_route_all_traffic(true);
13313 /// ```
13314 pub fn set_route_all_traffic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13315 self.route_all_traffic = v.into();
13316 self
13317 }
13318 }
13319
13320 impl wkt::message::Message for PrivateServiceConnect {
13321 fn typename() -> &'static str {
13322 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.PrivateServiceConnect"
13323 }
13324 }
13325}
13326
13327/// Request to create a new `WorkerPool`.
13328#[derive(Clone, Default, PartialEq)]
13329#[non_exhaustive]
13330pub struct CreateWorkerPoolRequest {
13331 /// Required. The parent resource where this worker pool will be created.
13332 /// Format: `projects/{project}/locations/{location}`.
13333 pub parent: std::string::String,
13334
13335 /// Required. `WorkerPool` resource to create.
13336 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13337
13338 /// Required. Immutable. The ID to use for the `WorkerPool`, which will become
13339 /// the final component of the resource name.
13340 ///
13341 /// This value should be 1-63 characters, and valid characters
13342 /// are /[a-z][0-9]-/.
13343 pub worker_pool_id: std::string::String,
13344
13345 /// If set, validate the request and preview the response, but do not actually
13346 /// post it.
13347 pub validate_only: bool,
13348
13349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13350}
13351
13352impl CreateWorkerPoolRequest {
13353 pub fn new() -> Self {
13354 std::default::Default::default()
13355 }
13356
13357 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
13358 ///
13359 /// # Example
13360 /// ```ignore,no_run
13361 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13362 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
13363 /// ```
13364 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13365 self.parent = v.into();
13366 self
13367 }
13368
13369 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13370 ///
13371 /// # Example
13372 /// ```ignore,no_run
13373 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13374 /// use google_cloud_build_v1::model::WorkerPool;
13375 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13376 /// ```
13377 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13378 where
13379 T: std::convert::Into<crate::model::WorkerPool>,
13380 {
13381 self.worker_pool = std::option::Option::Some(v.into());
13382 self
13383 }
13384
13385 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13386 ///
13387 /// # Example
13388 /// ```ignore,no_run
13389 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13390 /// use google_cloud_build_v1::model::WorkerPool;
13391 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13392 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13393 /// ```
13394 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13395 where
13396 T: std::convert::Into<crate::model::WorkerPool>,
13397 {
13398 self.worker_pool = v.map(|x| x.into());
13399 self
13400 }
13401
13402 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
13403 ///
13404 /// # Example
13405 /// ```ignore,no_run
13406 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13407 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
13408 /// ```
13409 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13410 self.worker_pool_id = v.into();
13411 self
13412 }
13413
13414 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
13415 ///
13416 /// # Example
13417 /// ```ignore,no_run
13418 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13419 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
13420 /// ```
13421 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13422 self.validate_only = v.into();
13423 self
13424 }
13425}
13426
13427impl wkt::message::Message for CreateWorkerPoolRequest {
13428 fn typename() -> &'static str {
13429 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolRequest"
13430 }
13431}
13432
13433/// Request to get a `WorkerPool` with the specified name.
13434#[derive(Clone, Default, PartialEq)]
13435#[non_exhaustive]
13436pub struct GetWorkerPoolRequest {
13437 /// Required. The name of the `WorkerPool` to retrieve.
13438 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13439 pub name: std::string::String,
13440
13441 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13442}
13443
13444impl GetWorkerPoolRequest {
13445 pub fn new() -> Self {
13446 std::default::Default::default()
13447 }
13448
13449 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
13450 ///
13451 /// # Example
13452 /// ```ignore,no_run
13453 /// # use google_cloud_build_v1::model::GetWorkerPoolRequest;
13454 /// let x = GetWorkerPoolRequest::new().set_name("example");
13455 /// ```
13456 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13457 self.name = v.into();
13458 self
13459 }
13460}
13461
13462impl wkt::message::Message for GetWorkerPoolRequest {
13463 fn typename() -> &'static str {
13464 "type.googleapis.com/google.devtools.cloudbuild.v1.GetWorkerPoolRequest"
13465 }
13466}
13467
13468/// Request to delete a `WorkerPool`.
13469#[derive(Clone, Default, PartialEq)]
13470#[non_exhaustive]
13471pub struct DeleteWorkerPoolRequest {
13472 /// Required. The name of the `WorkerPool` to delete.
13473 /// Format:
13474 /// `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13475 pub name: std::string::String,
13476
13477 /// Optional. If provided, it must match the server's etag on the workerpool
13478 /// for the request to be processed.
13479 pub etag: std::string::String,
13480
13481 /// If set to true, and the `WorkerPool` is not found, the request will succeed
13482 /// but no action will be taken on the server.
13483 pub allow_missing: bool,
13484
13485 /// If set, validate the request and preview the response, but do not actually
13486 /// post it.
13487 pub validate_only: bool,
13488
13489 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13490}
13491
13492impl DeleteWorkerPoolRequest {
13493 pub fn new() -> Self {
13494 std::default::Default::default()
13495 }
13496
13497 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
13498 ///
13499 /// # Example
13500 /// ```ignore,no_run
13501 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13502 /// let x = DeleteWorkerPoolRequest::new().set_name("example");
13503 /// ```
13504 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13505 self.name = v.into();
13506 self
13507 }
13508
13509 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
13510 ///
13511 /// # Example
13512 /// ```ignore,no_run
13513 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13514 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
13515 /// ```
13516 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13517 self.etag = v.into();
13518 self
13519 }
13520
13521 /// Sets the value of [allow_missing][crate::model::DeleteWorkerPoolRequest::allow_missing].
13522 ///
13523 /// # Example
13524 /// ```ignore,no_run
13525 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13526 /// let x = DeleteWorkerPoolRequest::new().set_allow_missing(true);
13527 /// ```
13528 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13529 self.allow_missing = v.into();
13530 self
13531 }
13532
13533 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
13534 ///
13535 /// # Example
13536 /// ```ignore,no_run
13537 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13538 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
13539 /// ```
13540 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13541 self.validate_only = v.into();
13542 self
13543 }
13544}
13545
13546impl wkt::message::Message for DeleteWorkerPoolRequest {
13547 fn typename() -> &'static str {
13548 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest"
13549 }
13550}
13551
13552/// Request to update a `WorkerPool`.
13553#[derive(Clone, Default, PartialEq)]
13554#[non_exhaustive]
13555pub struct UpdateWorkerPoolRequest {
13556 /// Required. The `WorkerPool` to update.
13557 ///
13558 /// The `name` field is used to identify the `WorkerPool` to update.
13559 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13560 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13561
13562 /// Optional. A mask specifying which fields in `worker_pool` to update.
13563 pub update_mask: std::option::Option<wkt::FieldMask>,
13564
13565 /// If set, validate the request and preview the response, but do not actually
13566 /// post it.
13567 pub validate_only: bool,
13568
13569 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13570}
13571
13572impl UpdateWorkerPoolRequest {
13573 pub fn new() -> Self {
13574 std::default::Default::default()
13575 }
13576
13577 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13578 ///
13579 /// # Example
13580 /// ```ignore,no_run
13581 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13582 /// use google_cloud_build_v1::model::WorkerPool;
13583 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13584 /// ```
13585 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13586 where
13587 T: std::convert::Into<crate::model::WorkerPool>,
13588 {
13589 self.worker_pool = std::option::Option::Some(v.into());
13590 self
13591 }
13592
13593 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13594 ///
13595 /// # Example
13596 /// ```ignore,no_run
13597 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13598 /// use google_cloud_build_v1::model::WorkerPool;
13599 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13600 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13601 /// ```
13602 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13603 where
13604 T: std::convert::Into<crate::model::WorkerPool>,
13605 {
13606 self.worker_pool = v.map(|x| x.into());
13607 self
13608 }
13609
13610 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13611 ///
13612 /// # Example
13613 /// ```ignore,no_run
13614 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13615 /// use wkt::FieldMask;
13616 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13617 /// ```
13618 pub fn set_update_mask<T>(mut self, v: T) -> Self
13619 where
13620 T: std::convert::Into<wkt::FieldMask>,
13621 {
13622 self.update_mask = std::option::Option::Some(v.into());
13623 self
13624 }
13625
13626 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13627 ///
13628 /// # Example
13629 /// ```ignore,no_run
13630 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13631 /// use wkt::FieldMask;
13632 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13633 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13634 /// ```
13635 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13636 where
13637 T: std::convert::Into<wkt::FieldMask>,
13638 {
13639 self.update_mask = v.map(|x| x.into());
13640 self
13641 }
13642
13643 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
13644 ///
13645 /// # Example
13646 /// ```ignore,no_run
13647 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13648 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
13649 /// ```
13650 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13651 self.validate_only = v.into();
13652 self
13653 }
13654}
13655
13656impl wkt::message::Message for UpdateWorkerPoolRequest {
13657 fn typename() -> &'static str {
13658 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest"
13659 }
13660}
13661
13662/// Request to list `WorkerPool`s.
13663#[derive(Clone, Default, PartialEq)]
13664#[non_exhaustive]
13665pub struct ListWorkerPoolsRequest {
13666 /// Required. The parent of the collection of `WorkerPools`.
13667 /// Format: `projects/{project}/locations/{location}`.
13668 pub parent: std::string::String,
13669
13670 /// The maximum number of `WorkerPool`s to return. The service may return
13671 /// fewer than this value. If omitted, the server will use a sensible default.
13672 pub page_size: i32,
13673
13674 /// A page token, received from a previous `ListWorkerPools` call. Provide this
13675 /// to retrieve the subsequent page.
13676 pub page_token: std::string::String,
13677
13678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13679}
13680
13681impl ListWorkerPoolsRequest {
13682 pub fn new() -> Self {
13683 std::default::Default::default()
13684 }
13685
13686 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
13687 ///
13688 /// # Example
13689 /// ```ignore,no_run
13690 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13691 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
13692 /// ```
13693 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13694 self.parent = v.into();
13695 self
13696 }
13697
13698 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
13699 ///
13700 /// # Example
13701 /// ```ignore,no_run
13702 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13703 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
13704 /// ```
13705 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13706 self.page_size = v.into();
13707 self
13708 }
13709
13710 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
13711 ///
13712 /// # Example
13713 /// ```ignore,no_run
13714 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13715 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
13716 /// ```
13717 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13718 self.page_token = v.into();
13719 self
13720 }
13721}
13722
13723impl wkt::message::Message for ListWorkerPoolsRequest {
13724 fn typename() -> &'static str {
13725 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsRequest"
13726 }
13727}
13728
13729/// Response containing existing `WorkerPools`.
13730#[derive(Clone, Default, PartialEq)]
13731#[non_exhaustive]
13732pub struct ListWorkerPoolsResponse {
13733 /// `WorkerPools` for the specified project.
13734 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
13735
13736 /// Continuation token used to page through large result sets. Provide this
13737 /// value in a subsequent ListWorkerPoolsRequest to return the next page of
13738 /// results.
13739 pub next_page_token: std::string::String,
13740
13741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13742}
13743
13744impl ListWorkerPoolsResponse {
13745 pub fn new() -> Self {
13746 std::default::Default::default()
13747 }
13748
13749 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
13750 ///
13751 /// # Example
13752 /// ```ignore,no_run
13753 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13754 /// use google_cloud_build_v1::model::WorkerPool;
13755 /// let x = ListWorkerPoolsResponse::new()
13756 /// .set_worker_pools([
13757 /// WorkerPool::default()/* use setters */,
13758 /// WorkerPool::default()/* use (different) setters */,
13759 /// ]);
13760 /// ```
13761 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
13762 where
13763 T: std::iter::IntoIterator<Item = V>,
13764 V: std::convert::Into<crate::model::WorkerPool>,
13765 {
13766 use std::iter::Iterator;
13767 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
13768 self
13769 }
13770
13771 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
13772 ///
13773 /// # Example
13774 /// ```ignore,no_run
13775 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13776 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
13777 /// ```
13778 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13779 self.next_page_token = v.into();
13780 self
13781 }
13782}
13783
13784impl wkt::message::Message for ListWorkerPoolsResponse {
13785 fn typename() -> &'static str {
13786 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsResponse"
13787 }
13788}
13789
13790#[doc(hidden)]
13791impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
13792 type PageItem = crate::model::WorkerPool;
13793
13794 fn items(self) -> std::vec::Vec<Self::PageItem> {
13795 self.worker_pools
13796 }
13797
13798 fn next_page_token(&self) -> std::string::String {
13799 use std::clone::Clone;
13800 self.next_page_token.clone()
13801 }
13802}
13803
13804/// Metadata for the `CreateWorkerPool` operation.
13805#[derive(Clone, Default, PartialEq)]
13806#[non_exhaustive]
13807pub struct CreateWorkerPoolOperationMetadata {
13808 /// The resource name of the `WorkerPool` to create.
13809 /// Format:
13810 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13811 pub worker_pool: std::string::String,
13812
13813 /// Time the operation was created.
13814 pub create_time: std::option::Option<wkt::Timestamp>,
13815
13816 /// Time the operation was completed.
13817 pub complete_time: std::option::Option<wkt::Timestamp>,
13818
13819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13820}
13821
13822impl CreateWorkerPoolOperationMetadata {
13823 pub fn new() -> Self {
13824 std::default::Default::default()
13825 }
13826
13827 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolOperationMetadata::worker_pool].
13828 ///
13829 /// # Example
13830 /// ```ignore,no_run
13831 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13832 /// let x = CreateWorkerPoolOperationMetadata::new().set_worker_pool("example");
13833 /// ```
13834 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13835 self.worker_pool = v.into();
13836 self
13837 }
13838
13839 /// Sets the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13840 ///
13841 /// # Example
13842 /// ```ignore,no_run
13843 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13844 /// use wkt::Timestamp;
13845 /// let x = CreateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
13846 /// ```
13847 pub fn set_create_time<T>(mut self, v: T) -> Self
13848 where
13849 T: std::convert::Into<wkt::Timestamp>,
13850 {
13851 self.create_time = std::option::Option::Some(v.into());
13852 self
13853 }
13854
13855 /// Sets or clears the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13856 ///
13857 /// # Example
13858 /// ```ignore,no_run
13859 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13860 /// use wkt::Timestamp;
13861 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13862 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
13863 /// ```
13864 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13865 where
13866 T: std::convert::Into<wkt::Timestamp>,
13867 {
13868 self.create_time = v.map(|x| x.into());
13869 self
13870 }
13871
13872 /// Sets the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
13873 ///
13874 /// # Example
13875 /// ```ignore,no_run
13876 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13877 /// use wkt::Timestamp;
13878 /// let x = CreateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
13879 /// ```
13880 pub fn set_complete_time<T>(mut self, v: T) -> Self
13881 where
13882 T: std::convert::Into<wkt::Timestamp>,
13883 {
13884 self.complete_time = std::option::Option::Some(v.into());
13885 self
13886 }
13887
13888 /// Sets or clears the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
13889 ///
13890 /// # Example
13891 /// ```ignore,no_run
13892 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13893 /// use wkt::Timestamp;
13894 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
13895 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
13896 /// ```
13897 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
13898 where
13899 T: std::convert::Into<wkt::Timestamp>,
13900 {
13901 self.complete_time = v.map(|x| x.into());
13902 self
13903 }
13904}
13905
13906impl wkt::message::Message for CreateWorkerPoolOperationMetadata {
13907 fn typename() -> &'static str {
13908 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata"
13909 }
13910}
13911
13912/// Metadata for the `UpdateWorkerPool` operation.
13913#[derive(Clone, Default, PartialEq)]
13914#[non_exhaustive]
13915pub struct UpdateWorkerPoolOperationMetadata {
13916 /// The resource name of the `WorkerPool` being updated.
13917 /// Format:
13918 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13919 pub worker_pool: std::string::String,
13920
13921 /// Time the operation was created.
13922 pub create_time: std::option::Option<wkt::Timestamp>,
13923
13924 /// Time the operation was completed.
13925 pub complete_time: std::option::Option<wkt::Timestamp>,
13926
13927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13928}
13929
13930impl UpdateWorkerPoolOperationMetadata {
13931 pub fn new() -> Self {
13932 std::default::Default::default()
13933 }
13934
13935 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolOperationMetadata::worker_pool].
13936 ///
13937 /// # Example
13938 /// ```ignore,no_run
13939 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13940 /// let x = UpdateWorkerPoolOperationMetadata::new().set_worker_pool("example");
13941 /// ```
13942 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13943 self.worker_pool = v.into();
13944 self
13945 }
13946
13947 /// Sets the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
13948 ///
13949 /// # Example
13950 /// ```ignore,no_run
13951 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13952 /// use wkt::Timestamp;
13953 /// let x = UpdateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
13954 /// ```
13955 pub fn set_create_time<T>(mut self, v: T) -> Self
13956 where
13957 T: std::convert::Into<wkt::Timestamp>,
13958 {
13959 self.create_time = std::option::Option::Some(v.into());
13960 self
13961 }
13962
13963 /// Sets or clears the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
13964 ///
13965 /// # Example
13966 /// ```ignore,no_run
13967 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13968 /// use wkt::Timestamp;
13969 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13970 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
13971 /// ```
13972 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13973 where
13974 T: std::convert::Into<wkt::Timestamp>,
13975 {
13976 self.create_time = v.map(|x| x.into());
13977 self
13978 }
13979
13980 /// Sets the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
13981 ///
13982 /// # Example
13983 /// ```ignore,no_run
13984 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
13985 /// use wkt::Timestamp;
13986 /// let x = UpdateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
13987 /// ```
13988 pub fn set_complete_time<T>(mut self, v: T) -> Self
13989 where
13990 T: std::convert::Into<wkt::Timestamp>,
13991 {
13992 self.complete_time = std::option::Option::Some(v.into());
13993 self
13994 }
13995
13996 /// Sets or clears the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
13997 ///
13998 /// # Example
13999 /// ```ignore,no_run
14000 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14001 /// use wkt::Timestamp;
14002 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14003 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14004 /// ```
14005 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14006 where
14007 T: std::convert::Into<wkt::Timestamp>,
14008 {
14009 self.complete_time = v.map(|x| x.into());
14010 self
14011 }
14012}
14013
14014impl wkt::message::Message for UpdateWorkerPoolOperationMetadata {
14015 fn typename() -> &'static str {
14016 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata"
14017 }
14018}
14019
14020/// Metadata for the `DeleteWorkerPool` operation.
14021#[derive(Clone, Default, PartialEq)]
14022#[non_exhaustive]
14023pub struct DeleteWorkerPoolOperationMetadata {
14024 /// The resource name of the `WorkerPool` being deleted.
14025 /// Format:
14026 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14027 pub worker_pool: std::string::String,
14028
14029 /// Time the operation was created.
14030 pub create_time: std::option::Option<wkt::Timestamp>,
14031
14032 /// Time the operation was completed.
14033 pub complete_time: std::option::Option<wkt::Timestamp>,
14034
14035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14036}
14037
14038impl DeleteWorkerPoolOperationMetadata {
14039 pub fn new() -> Self {
14040 std::default::Default::default()
14041 }
14042
14043 /// Sets the value of [worker_pool][crate::model::DeleteWorkerPoolOperationMetadata::worker_pool].
14044 ///
14045 /// # Example
14046 /// ```ignore,no_run
14047 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14048 /// let x = DeleteWorkerPoolOperationMetadata::new().set_worker_pool("example");
14049 /// ```
14050 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14051 self.worker_pool = v.into();
14052 self
14053 }
14054
14055 /// Sets the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14056 ///
14057 /// # Example
14058 /// ```ignore,no_run
14059 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14060 /// use wkt::Timestamp;
14061 /// let x = DeleteWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14062 /// ```
14063 pub fn set_create_time<T>(mut self, v: T) -> Self
14064 where
14065 T: std::convert::Into<wkt::Timestamp>,
14066 {
14067 self.create_time = std::option::Option::Some(v.into());
14068 self
14069 }
14070
14071 /// Sets or clears the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14072 ///
14073 /// # Example
14074 /// ```ignore,no_run
14075 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14076 /// use wkt::Timestamp;
14077 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14078 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14079 /// ```
14080 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14081 where
14082 T: std::convert::Into<wkt::Timestamp>,
14083 {
14084 self.create_time = v.map(|x| x.into());
14085 self
14086 }
14087
14088 /// Sets the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14089 ///
14090 /// # Example
14091 /// ```ignore,no_run
14092 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14093 /// use wkt::Timestamp;
14094 /// let x = DeleteWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14095 /// ```
14096 pub fn set_complete_time<T>(mut self, v: T) -> Self
14097 where
14098 T: std::convert::Into<wkt::Timestamp>,
14099 {
14100 self.complete_time = std::option::Option::Some(v.into());
14101 self
14102 }
14103
14104 /// Sets or clears the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14105 ///
14106 /// # Example
14107 /// ```ignore,no_run
14108 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14109 /// use wkt::Timestamp;
14110 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14111 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14112 /// ```
14113 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14114 where
14115 T: std::convert::Into<wkt::Timestamp>,
14116 {
14117 self.complete_time = v.map(|x| x.into());
14118 self
14119 }
14120}
14121
14122impl wkt::message::Message for DeleteWorkerPoolOperationMetadata {
14123 fn typename() -> &'static str {
14124 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata"
14125 }
14126}