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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_api;
26extern crate google_cloud_gax;
27extern crate google_cloud_longrunning;
28extern crate google_cloud_lro;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Returns the default service account that will be used for `Builds`.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct GetDefaultServiceAccountRequest {
44 /// Required. The name of the `DefaultServiceAccount` to retrieve.
45 /// Format:
46 /// `projects/{project}/locations/{location}/defaultServiceAccount`
47 pub name: std::string::String,
48
49 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
50}
51
52impl GetDefaultServiceAccountRequest {
53 /// Creates a new default instance.
54 pub fn new() -> Self {
55 std::default::Default::default()
56 }
57
58 /// Sets the value of [name][crate::model::GetDefaultServiceAccountRequest::name].
59 ///
60 /// # Example
61 /// ```ignore,no_run
62 /// # use google_cloud_build_v1::model::GetDefaultServiceAccountRequest;
63 /// # let project_id = "project_id";
64 /// # let location_id = "location_id";
65 /// let x = GetDefaultServiceAccountRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/defaultServiceAccount"));
66 /// ```
67 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
68 self.name = v.into();
69 self
70 }
71}
72
73impl wkt::message::Message for GetDefaultServiceAccountRequest {
74 fn typename() -> &'static str {
75 "type.googleapis.com/google.devtools.cloudbuild.v1.GetDefaultServiceAccountRequest"
76 }
77}
78
79/// The default service account used for `Builds`.
80#[derive(Clone, Default, PartialEq)]
81#[non_exhaustive]
82pub struct DefaultServiceAccount {
83 /// Identifier. Format:
84 /// `projects/{project}/locations/{location}/defaultServiceAccount`
85 pub name: std::string::String,
86
87 /// Output only. The email address of the service account identity that will be
88 /// used for a build by default.
89 ///
90 /// This is returned in the format
91 /// `projects/{project}/serviceAccounts/{service_account}` where
92 /// `{service_account}` could be the legacy Cloud Build SA, in the format
93 /// [PROJECT_NUMBER]@cloudbuild.gserviceaccount.com or the Compute SA, in the
94 /// format [PROJECT_NUMBER]-compute@developer.gserviceaccount.com.
95 ///
96 /// If no service account will be used by default, this will be empty.
97 pub service_account_email: std::string::String,
98
99 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
100}
101
102impl DefaultServiceAccount {
103 /// Creates a new default instance.
104 pub fn new() -> Self {
105 std::default::Default::default()
106 }
107
108 /// Sets the value of [name][crate::model::DefaultServiceAccount::name].
109 ///
110 /// # Example
111 /// ```ignore,no_run
112 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
113 /// # let project_id = "project_id";
114 /// # let location_id = "location_id";
115 /// let x = DefaultServiceAccount::new().set_name(format!("projects/{project_id}/locations/{location_id}/defaultServiceAccount"));
116 /// ```
117 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
118 self.name = v.into();
119 self
120 }
121
122 /// Sets the value of [service_account_email][crate::model::DefaultServiceAccount::service_account_email].
123 ///
124 /// # Example
125 /// ```ignore,no_run
126 /// # use google_cloud_build_v1::model::DefaultServiceAccount;
127 /// let x = DefaultServiceAccount::new().set_service_account_email("example");
128 /// ```
129 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
130 mut self,
131 v: T,
132 ) -> Self {
133 self.service_account_email = v.into();
134 self
135 }
136}
137
138impl wkt::message::Message for DefaultServiceAccount {
139 fn typename() -> &'static str {
140 "type.googleapis.com/google.devtools.cloudbuild.v1.DefaultServiceAccount"
141 }
142}
143
144/// Specifies a build to retry.
145#[derive(Clone, Default, PartialEq)]
146#[non_exhaustive]
147pub struct RetryBuildRequest {
148 /// The name of the `Build` to retry.
149 /// Format: `projects/{project}/locations/{location}/builds/{build}`
150 pub name: std::string::String,
151
152 /// Required. ID of the project.
153 pub project_id: std::string::String,
154
155 /// Required. Build ID of the original build.
156 pub id: std::string::String,
157
158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
159}
160
161impl RetryBuildRequest {
162 /// Creates a new default instance.
163 pub fn new() -> Self {
164 std::default::Default::default()
165 }
166
167 /// Sets the value of [name][crate::model::RetryBuildRequest::name].
168 ///
169 /// # Example
170 /// ```ignore,no_run
171 /// # use google_cloud_build_v1::model::RetryBuildRequest;
172 /// # let project_id = "project_id";
173 /// # let build_id = "build_id";
174 /// let x = RetryBuildRequest::new().set_name(format!("projects/{project_id}/builds/{build_id}"));
175 /// ```
176 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
177 self.name = v.into();
178 self
179 }
180
181 /// Sets the value of [project_id][crate::model::RetryBuildRequest::project_id].
182 ///
183 /// # Example
184 /// ```ignore,no_run
185 /// # use google_cloud_build_v1::model::RetryBuildRequest;
186 /// let x = RetryBuildRequest::new().set_project_id("example");
187 /// ```
188 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
189 self.project_id = v.into();
190 self
191 }
192
193 /// Sets the value of [id][crate::model::RetryBuildRequest::id].
194 ///
195 /// # Example
196 /// ```ignore,no_run
197 /// # use google_cloud_build_v1::model::RetryBuildRequest;
198 /// let x = RetryBuildRequest::new().set_id("example");
199 /// ```
200 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
201 self.id = v.into();
202 self
203 }
204}
205
206impl wkt::message::Message for RetryBuildRequest {
207 fn typename() -> &'static str {
208 "type.googleapis.com/google.devtools.cloudbuild.v1.RetryBuildRequest"
209 }
210}
211
212/// Specifies a build trigger to run and the source to use.
213#[derive(Clone, Default, PartialEq)]
214#[non_exhaustive]
215pub struct RunBuildTriggerRequest {
216 /// The name of the `Trigger` to run.
217 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
218 pub name: std::string::String,
219
220 /// Required. ID of the project.
221 pub project_id: std::string::String,
222
223 /// Required. ID of the trigger.
224 pub trigger_id: std::string::String,
225
226 /// Source to build against this trigger.
227 /// Branch and tag names cannot consist of regular expressions.
228 pub source: std::option::Option<crate::model::RepoSource>,
229
230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
231}
232
233impl RunBuildTriggerRequest {
234 /// Creates a new default instance.
235 pub fn new() -> Self {
236 std::default::Default::default()
237 }
238
239 /// Sets the value of [name][crate::model::RunBuildTriggerRequest::name].
240 ///
241 /// # Example
242 /// ```ignore,no_run
243 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
244 /// # let project_id = "project_id";
245 /// # let trigger_id = "trigger_id";
246 /// let x = RunBuildTriggerRequest::new().set_name(format!("projects/{project_id}/triggers/{trigger_id}"));
247 /// ```
248 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
249 self.name = v.into();
250 self
251 }
252
253 /// Sets the value of [project_id][crate::model::RunBuildTriggerRequest::project_id].
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
258 /// let x = RunBuildTriggerRequest::new().set_project_id("example");
259 /// ```
260 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
261 self.project_id = v.into();
262 self
263 }
264
265 /// Sets the value of [trigger_id][crate::model::RunBuildTriggerRequest::trigger_id].
266 ///
267 /// # Example
268 /// ```ignore,no_run
269 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
270 /// let x = RunBuildTriggerRequest::new().set_trigger_id("example");
271 /// ```
272 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
273 self.trigger_id = v.into();
274 self
275 }
276
277 /// Sets the value of [source][crate::model::RunBuildTriggerRequest::source].
278 ///
279 /// # Example
280 /// ```ignore,no_run
281 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
282 /// use google_cloud_build_v1::model::RepoSource;
283 /// let x = RunBuildTriggerRequest::new().set_source(RepoSource::default()/* use setters */);
284 /// ```
285 pub fn set_source<T>(mut self, v: T) -> Self
286 where
287 T: std::convert::Into<crate::model::RepoSource>,
288 {
289 self.source = std::option::Option::Some(v.into());
290 self
291 }
292
293 /// Sets or clears the value of [source][crate::model::RunBuildTriggerRequest::source].
294 ///
295 /// # Example
296 /// ```ignore,no_run
297 /// # use google_cloud_build_v1::model::RunBuildTriggerRequest;
298 /// use google_cloud_build_v1::model::RepoSource;
299 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(Some(RepoSource::default()/* use setters */));
300 /// let x = RunBuildTriggerRequest::new().set_or_clear_source(None::<RepoSource>);
301 /// ```
302 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
303 where
304 T: std::convert::Into<crate::model::RepoSource>,
305 {
306 self.source = v.map(|x| x.into());
307 self
308 }
309}
310
311impl wkt::message::Message for RunBuildTriggerRequest {
312 fn typename() -> &'static str {
313 "type.googleapis.com/google.devtools.cloudbuild.v1.RunBuildTriggerRequest"
314 }
315}
316
317/// Location of the source in an archive file in Cloud Storage.
318#[derive(Clone, Default, PartialEq)]
319#[non_exhaustive]
320pub struct StorageSource {
321 /// Cloud Storage bucket containing the source (see
322 /// [Bucket Name
323 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
324 pub bucket: std::string::String,
325
326 /// Required. Cloud Storage object containing the source.
327 ///
328 /// This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`)
329 /// containing source to build.
330 pub object: std::string::String,
331
332 /// Optional. Cloud Storage generation for the object. If the generation is
333 /// omitted, the latest generation will be used.
334 pub generation: i64,
335
336 /// Optional. Option to specify the tool to fetch the source file for the
337 /// build.
338 pub source_fetcher: crate::model::storage_source::SourceFetcher,
339
340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
341}
342
343impl StorageSource {
344 /// Creates a new default instance.
345 pub fn new() -> Self {
346 std::default::Default::default()
347 }
348
349 /// Sets the value of [bucket][crate::model::StorageSource::bucket].
350 ///
351 /// # Example
352 /// ```ignore,no_run
353 /// # use google_cloud_build_v1::model::StorageSource;
354 /// let x = StorageSource::new().set_bucket("example");
355 /// ```
356 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
357 self.bucket = v.into();
358 self
359 }
360
361 /// Sets the value of [object][crate::model::StorageSource::object].
362 ///
363 /// # Example
364 /// ```ignore,no_run
365 /// # use google_cloud_build_v1::model::StorageSource;
366 /// let x = StorageSource::new().set_object("example");
367 /// ```
368 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
369 self.object = v.into();
370 self
371 }
372
373 /// Sets the value of [generation][crate::model::StorageSource::generation].
374 ///
375 /// # Example
376 /// ```ignore,no_run
377 /// # use google_cloud_build_v1::model::StorageSource;
378 /// let x = StorageSource::new().set_generation(42);
379 /// ```
380 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
381 self.generation = v.into();
382 self
383 }
384
385 /// Sets the value of [source_fetcher][crate::model::StorageSource::source_fetcher].
386 ///
387 /// # Example
388 /// ```ignore,no_run
389 /// # use google_cloud_build_v1::model::StorageSource;
390 /// use google_cloud_build_v1::model::storage_source::SourceFetcher;
391 /// let x0 = StorageSource::new().set_source_fetcher(SourceFetcher::Gsutil);
392 /// let x1 = StorageSource::new().set_source_fetcher(SourceFetcher::GcsFetcher);
393 /// ```
394 pub fn set_source_fetcher<
395 T: std::convert::Into<crate::model::storage_source::SourceFetcher>,
396 >(
397 mut self,
398 v: T,
399 ) -> Self {
400 self.source_fetcher = v.into();
401 self
402 }
403}
404
405impl wkt::message::Message for StorageSource {
406 fn typename() -> &'static str {
407 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSource"
408 }
409}
410
411/// Defines additional types related to [StorageSource].
412pub mod storage_source {
413 #[allow(unused_imports)]
414 use super::*;
415
416 /// Specifies the tool to fetch the source file for the build.
417 ///
418 /// # Working with unknown values
419 ///
420 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
421 /// additional enum variants at any time. Adding new variants is not considered
422 /// a breaking change. Applications should write their code in anticipation of:
423 ///
424 /// - New values appearing in future releases of the client library, **and**
425 /// - New values received dynamically, without application changes.
426 ///
427 /// Please consult the [Working with enums] section in the user guide for some
428 /// guidelines.
429 ///
430 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
431 #[derive(Clone, Debug, PartialEq)]
432 #[non_exhaustive]
433 pub enum SourceFetcher {
434 /// Unspecified defaults to GSUTIL.
435 Unspecified,
436 /// Use the "gsutil" tool to download the source file.
437 Gsutil,
438 /// Use the Cloud Storage Fetcher tool to download the source file.
439 GcsFetcher,
440 /// If set, the enum was initialized with an unknown value.
441 ///
442 /// Applications can examine the value using [SourceFetcher::value] or
443 /// [SourceFetcher::name].
444 UnknownValue(source_fetcher::UnknownValue),
445 }
446
447 #[doc(hidden)]
448 pub mod source_fetcher {
449 #[allow(unused_imports)]
450 use super::*;
451 #[derive(Clone, Debug, PartialEq)]
452 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
453 }
454
455 impl SourceFetcher {
456 /// Gets the enum value.
457 ///
458 /// Returns `None` if the enum contains an unknown value deserialized from
459 /// the string representation of enums.
460 pub fn value(&self) -> std::option::Option<i32> {
461 match self {
462 Self::Unspecified => std::option::Option::Some(0),
463 Self::Gsutil => std::option::Option::Some(1),
464 Self::GcsFetcher => std::option::Option::Some(2),
465 Self::UnknownValue(u) => u.0.value(),
466 }
467 }
468
469 /// Gets the enum value as a string.
470 ///
471 /// Returns `None` if the enum contains an unknown value deserialized from
472 /// the integer representation of enums.
473 pub fn name(&self) -> std::option::Option<&str> {
474 match self {
475 Self::Unspecified => std::option::Option::Some("SOURCE_FETCHER_UNSPECIFIED"),
476 Self::Gsutil => std::option::Option::Some("GSUTIL"),
477 Self::GcsFetcher => std::option::Option::Some("GCS_FETCHER"),
478 Self::UnknownValue(u) => u.0.name(),
479 }
480 }
481 }
482
483 impl std::default::Default for SourceFetcher {
484 fn default() -> Self {
485 use std::convert::From;
486 Self::from(0)
487 }
488 }
489
490 impl std::fmt::Display for SourceFetcher {
491 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
492 wkt::internal::display_enum(f, self.name(), self.value())
493 }
494 }
495
496 impl std::convert::From<i32> for SourceFetcher {
497 fn from(value: i32) -> Self {
498 match value {
499 0 => Self::Unspecified,
500 1 => Self::Gsutil,
501 2 => Self::GcsFetcher,
502 _ => Self::UnknownValue(source_fetcher::UnknownValue(
503 wkt::internal::UnknownEnumValue::Integer(value),
504 )),
505 }
506 }
507 }
508
509 impl std::convert::From<&str> for SourceFetcher {
510 fn from(value: &str) -> Self {
511 use std::string::ToString;
512 match value {
513 "SOURCE_FETCHER_UNSPECIFIED" => Self::Unspecified,
514 "GSUTIL" => Self::Gsutil,
515 "GCS_FETCHER" => Self::GcsFetcher,
516 _ => Self::UnknownValue(source_fetcher::UnknownValue(
517 wkt::internal::UnknownEnumValue::String(value.to_string()),
518 )),
519 }
520 }
521 }
522
523 impl serde::ser::Serialize for SourceFetcher {
524 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
525 where
526 S: serde::Serializer,
527 {
528 match self {
529 Self::Unspecified => serializer.serialize_i32(0),
530 Self::Gsutil => serializer.serialize_i32(1),
531 Self::GcsFetcher => serializer.serialize_i32(2),
532 Self::UnknownValue(u) => u.0.serialize(serializer),
533 }
534 }
535 }
536
537 impl<'de> serde::de::Deserialize<'de> for SourceFetcher {
538 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
539 where
540 D: serde::Deserializer<'de>,
541 {
542 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SourceFetcher>::new(
543 ".google.devtools.cloudbuild.v1.StorageSource.SourceFetcher",
544 ))
545 }
546 }
547}
548
549/// Location of the source in any accessible Git repository.
550#[derive(Clone, Default, PartialEq)]
551#[non_exhaustive]
552pub struct GitSource {
553 /// Required. Location of the Git repo to build.
554 ///
555 /// This will be used as a `git remote`, see
556 /// <https://git-scm.com/docs/git-remote>.
557 pub url: std::string::String,
558
559 /// Optional. Directory, relative to the source root, in which to run the
560 /// build.
561 ///
562 /// This must be a relative path. If a step's `dir` is specified and is an
563 /// absolute path, this value is ignored for that step's execution.
564 pub dir: std::string::String,
565
566 /// Optional. The revision to fetch from the Git repository such as a branch, a
567 /// tag, a commit SHA, or any Git ref.
568 ///
569 /// Cloud Build uses `git fetch` to fetch the revision from the Git
570 /// repository; therefore make sure that the string you provide for `revision`
571 /// is parsable by the command. For information on string values accepted by
572 /// `git fetch`, see
573 /// <https://git-scm.com/docs/gitrevisions#_specifying_revisions>. For
574 /// information on `git fetch`, see <https://git-scm.com/docs/git-fetch>.
575 pub revision: std::string::String,
576
577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
578}
579
580impl GitSource {
581 /// Creates a new default instance.
582 pub fn new() -> Self {
583 std::default::Default::default()
584 }
585
586 /// Sets the value of [url][crate::model::GitSource::url].
587 ///
588 /// # Example
589 /// ```ignore,no_run
590 /// # use google_cloud_build_v1::model::GitSource;
591 /// let x = GitSource::new().set_url("example");
592 /// ```
593 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
594 self.url = v.into();
595 self
596 }
597
598 /// Sets the value of [dir][crate::model::GitSource::dir].
599 ///
600 /// # Example
601 /// ```ignore,no_run
602 /// # use google_cloud_build_v1::model::GitSource;
603 /// let x = GitSource::new().set_dir("example");
604 /// ```
605 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
606 self.dir = v.into();
607 self
608 }
609
610 /// Sets the value of [revision][crate::model::GitSource::revision].
611 ///
612 /// # Example
613 /// ```ignore,no_run
614 /// # use google_cloud_build_v1::model::GitSource;
615 /// let x = GitSource::new().set_revision("example");
616 /// ```
617 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
618 self.revision = v.into();
619 self
620 }
621}
622
623impl wkt::message::Message for GitSource {
624 fn typename() -> &'static str {
625 "type.googleapis.com/google.devtools.cloudbuild.v1.GitSource"
626 }
627}
628
629/// Location of the source in a Google Cloud Source Repository.
630#[derive(Clone, Default, PartialEq)]
631#[non_exhaustive]
632pub struct RepoSource {
633 /// Optional. ID of the project that owns the Cloud Source Repository. If
634 /// omitted, the project ID requesting the build is assumed.
635 pub project_id: std::string::String,
636
637 /// Required. Name of the Cloud Source Repository.
638 pub repo_name: std::string::String,
639
640 /// Optional. Directory, relative to the source root, in which to run the
641 /// build.
642 ///
643 /// This must be a relative path. If a step's `dir` is specified and is an
644 /// absolute path, this value is ignored for that step's execution.
645 pub dir: std::string::String,
646
647 /// Optional. Only trigger a build if the revision regex does NOT match the
648 /// revision regex.
649 pub invert_regex: bool,
650
651 /// Optional. Substitutions to use in a triggered build.
652 /// Should only be used with RunBuildTrigger
653 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
654
655 /// A revision within the Cloud Source Repository must be specified in
656 /// one of these ways.
657 pub revision: std::option::Option<crate::model::repo_source::Revision>,
658
659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
660}
661
662impl RepoSource {
663 /// Creates a new default instance.
664 pub fn new() -> Self {
665 std::default::Default::default()
666 }
667
668 /// Sets the value of [project_id][crate::model::RepoSource::project_id].
669 ///
670 /// # Example
671 /// ```ignore,no_run
672 /// # use google_cloud_build_v1::model::RepoSource;
673 /// let x = RepoSource::new().set_project_id("example");
674 /// ```
675 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
676 self.project_id = v.into();
677 self
678 }
679
680 /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
681 ///
682 /// # Example
683 /// ```ignore,no_run
684 /// # use google_cloud_build_v1::model::RepoSource;
685 /// let x = RepoSource::new().set_repo_name("example");
686 /// ```
687 pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
688 self.repo_name = v.into();
689 self
690 }
691
692 /// Sets the value of [dir][crate::model::RepoSource::dir].
693 ///
694 /// # Example
695 /// ```ignore,no_run
696 /// # use google_cloud_build_v1::model::RepoSource;
697 /// let x = RepoSource::new().set_dir("example");
698 /// ```
699 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
700 self.dir = v.into();
701 self
702 }
703
704 /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
705 ///
706 /// # Example
707 /// ```ignore,no_run
708 /// # use google_cloud_build_v1::model::RepoSource;
709 /// let x = RepoSource::new().set_invert_regex(true);
710 /// ```
711 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
712 self.invert_regex = v.into();
713 self
714 }
715
716 /// Sets the value of [substitutions][crate::model::RepoSource::substitutions].
717 ///
718 /// # Example
719 /// ```ignore,no_run
720 /// # use google_cloud_build_v1::model::RepoSource;
721 /// let x = RepoSource::new().set_substitutions([
722 /// ("key0", "abc"),
723 /// ("key1", "xyz"),
724 /// ]);
725 /// ```
726 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
727 where
728 T: std::iter::IntoIterator<Item = (K, V)>,
729 K: std::convert::Into<std::string::String>,
730 V: std::convert::Into<std::string::String>,
731 {
732 use std::iter::Iterator;
733 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
734 self
735 }
736
737 /// Sets the value of [revision][crate::model::RepoSource::revision].
738 ///
739 /// Note that all the setters affecting `revision` are mutually
740 /// exclusive.
741 ///
742 /// # Example
743 /// ```ignore,no_run
744 /// # use google_cloud_build_v1::model::RepoSource;
745 /// use google_cloud_build_v1::model::repo_source::Revision;
746 /// let x = RepoSource::new().set_revision(Some(Revision::BranchName("example".to_string())));
747 /// ```
748 pub fn set_revision<
749 T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
750 >(
751 mut self,
752 v: T,
753 ) -> Self {
754 self.revision = v.into();
755 self
756 }
757
758 /// The value of [revision][crate::model::RepoSource::revision]
759 /// if it holds a `BranchName`, `None` if the field is not set or
760 /// holds a different branch.
761 pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
762 #[allow(unreachable_patterns)]
763 self.revision.as_ref().and_then(|v| match v {
764 crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
765 _ => std::option::Option::None,
766 })
767 }
768
769 /// Sets the value of [revision][crate::model::RepoSource::revision]
770 /// to hold a `BranchName`.
771 ///
772 /// Note that all the setters affecting `revision` are
773 /// mutually exclusive.
774 ///
775 /// # Example
776 /// ```ignore,no_run
777 /// # use google_cloud_build_v1::model::RepoSource;
778 /// let x = RepoSource::new().set_branch_name("example");
779 /// assert!(x.branch_name().is_some());
780 /// assert!(x.tag_name().is_none());
781 /// assert!(x.commit_sha().is_none());
782 /// ```
783 pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
784 self.revision =
785 std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
786 self
787 }
788
789 /// The value of [revision][crate::model::RepoSource::revision]
790 /// if it holds a `TagName`, `None` if the field is not set or
791 /// holds a different branch.
792 pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
793 #[allow(unreachable_patterns)]
794 self.revision.as_ref().and_then(|v| match v {
795 crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
796 _ => std::option::Option::None,
797 })
798 }
799
800 /// Sets the value of [revision][crate::model::RepoSource::revision]
801 /// to hold a `TagName`.
802 ///
803 /// Note that all the setters affecting `revision` are
804 /// mutually exclusive.
805 ///
806 /// # Example
807 /// ```ignore,no_run
808 /// # use google_cloud_build_v1::model::RepoSource;
809 /// let x = RepoSource::new().set_tag_name("example");
810 /// assert!(x.tag_name().is_some());
811 /// assert!(x.branch_name().is_none());
812 /// assert!(x.commit_sha().is_none());
813 /// ```
814 pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
815 self.revision =
816 std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
817 self
818 }
819
820 /// The value of [revision][crate::model::RepoSource::revision]
821 /// if it holds a `CommitSha`, `None` if the field is not set or
822 /// holds a different branch.
823 pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
824 #[allow(unreachable_patterns)]
825 self.revision.as_ref().and_then(|v| match v {
826 crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
827 _ => std::option::Option::None,
828 })
829 }
830
831 /// Sets the value of [revision][crate::model::RepoSource::revision]
832 /// to hold a `CommitSha`.
833 ///
834 /// Note that all the setters affecting `revision` are
835 /// mutually exclusive.
836 ///
837 /// # Example
838 /// ```ignore,no_run
839 /// # use google_cloud_build_v1::model::RepoSource;
840 /// let x = RepoSource::new().set_commit_sha("example");
841 /// assert!(x.commit_sha().is_some());
842 /// assert!(x.branch_name().is_none());
843 /// assert!(x.tag_name().is_none());
844 /// ```
845 pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
846 self.revision =
847 std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
848 self
849 }
850}
851
852impl wkt::message::Message for RepoSource {
853 fn typename() -> &'static str {
854 "type.googleapis.com/google.devtools.cloudbuild.v1.RepoSource"
855 }
856}
857
858/// Defines additional types related to [RepoSource].
859pub mod repo_source {
860 #[allow(unused_imports)]
861 use super::*;
862
863 /// A revision within the Cloud Source Repository must be specified in
864 /// one of these ways.
865 #[derive(Clone, Debug, PartialEq)]
866 #[non_exhaustive]
867 pub enum Revision {
868 /// Regex matching branches to build.
869 ///
870 /// The syntax of the regular expressions accepted is the syntax accepted by
871 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
872 BranchName(std::string::String),
873 /// Regex matching tags to build.
874 ///
875 /// The syntax of the regular expressions accepted is the syntax accepted by
876 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
877 TagName(std::string::String),
878 /// Explicit commit SHA to build.
879 CommitSha(std::string::String),
880 }
881}
882
883/// Location of the source manifest in Cloud Storage.
884/// This feature is in Preview; see description
885/// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
886#[derive(Clone, Default, PartialEq)]
887#[non_exhaustive]
888pub struct StorageSourceManifest {
889 /// Required. Cloud Storage bucket containing the source manifest (see [Bucket
890 /// Name
891 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
892 pub bucket: std::string::String,
893
894 /// Required. Cloud Storage object containing the source manifest.
895 ///
896 /// This object must be a JSON file.
897 pub object: std::string::String,
898
899 /// Cloud Storage generation for the object. If the generation is
900 /// omitted, the latest generation will be used.
901 pub generation: i64,
902
903 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
904}
905
906impl StorageSourceManifest {
907 /// Creates a new default instance.
908 pub fn new() -> Self {
909 std::default::Default::default()
910 }
911
912 /// Sets the value of [bucket][crate::model::StorageSourceManifest::bucket].
913 ///
914 /// # Example
915 /// ```ignore,no_run
916 /// # use google_cloud_build_v1::model::StorageSourceManifest;
917 /// let x = StorageSourceManifest::new().set_bucket("example");
918 /// ```
919 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
920 self.bucket = v.into();
921 self
922 }
923
924 /// Sets the value of [object][crate::model::StorageSourceManifest::object].
925 ///
926 /// # Example
927 /// ```ignore,no_run
928 /// # use google_cloud_build_v1::model::StorageSourceManifest;
929 /// let x = StorageSourceManifest::new().set_object("example");
930 /// ```
931 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
932 self.object = v.into();
933 self
934 }
935
936 /// Sets the value of [generation][crate::model::StorageSourceManifest::generation].
937 ///
938 /// # Example
939 /// ```ignore,no_run
940 /// # use google_cloud_build_v1::model::StorageSourceManifest;
941 /// let x = StorageSourceManifest::new().set_generation(42);
942 /// ```
943 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
944 self.generation = v.into();
945 self
946 }
947}
948
949impl wkt::message::Message for StorageSourceManifest {
950 fn typename() -> &'static str {
951 "type.googleapis.com/google.devtools.cloudbuild.v1.StorageSourceManifest"
952 }
953}
954
955/// Location of the source in a 2nd-gen Google Cloud Build repository resource.
956#[derive(Clone, Default, PartialEq)]
957#[non_exhaustive]
958pub struct ConnectedRepository {
959 /// Required. Name of the Google Cloud Build repository, formatted as
960 /// `projects/*/locations/*/connections/*/repositories/*`.
961 pub repository: std::string::String,
962
963 /// Optional. Directory, relative to the source root, in which to run the
964 /// build.
965 pub dir: std::string::String,
966
967 /// Required. The revision to fetch from the Git repository such as a branch, a
968 /// tag, a commit SHA, or any Git ref.
969 pub revision: std::string::String,
970
971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
972}
973
974impl ConnectedRepository {
975 /// Creates a new default instance.
976 pub fn new() -> Self {
977 std::default::Default::default()
978 }
979
980 /// Sets the value of [repository][crate::model::ConnectedRepository::repository].
981 ///
982 /// # Example
983 /// ```ignore,no_run
984 /// # use google_cloud_build_v1::model::ConnectedRepository;
985 /// let x = ConnectedRepository::new().set_repository("example");
986 /// ```
987 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
988 self.repository = v.into();
989 self
990 }
991
992 /// Sets the value of [dir][crate::model::ConnectedRepository::dir].
993 ///
994 /// # Example
995 /// ```ignore,no_run
996 /// # use google_cloud_build_v1::model::ConnectedRepository;
997 /// let x = ConnectedRepository::new().set_dir("example");
998 /// ```
999 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1000 self.dir = v.into();
1001 self
1002 }
1003
1004 /// Sets the value of [revision][crate::model::ConnectedRepository::revision].
1005 ///
1006 /// # Example
1007 /// ```ignore,no_run
1008 /// # use google_cloud_build_v1::model::ConnectedRepository;
1009 /// let x = ConnectedRepository::new().set_revision("example");
1010 /// ```
1011 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1012 self.revision = v.into();
1013 self
1014 }
1015}
1016
1017impl wkt::message::Message for ConnectedRepository {
1018 fn typename() -> &'static str {
1019 "type.googleapis.com/google.devtools.cloudbuild.v1.ConnectedRepository"
1020 }
1021}
1022
1023/// Location of the source in a supported storage service.
1024#[derive(Clone, Default, PartialEq)]
1025#[non_exhaustive]
1026pub struct Source {
1027 /// Location of source.
1028 pub source: std::option::Option<crate::model::source::Source>,
1029
1030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1031}
1032
1033impl Source {
1034 /// Creates a new default instance.
1035 pub fn new() -> Self {
1036 std::default::Default::default()
1037 }
1038
1039 /// Sets the value of [source][crate::model::Source::source].
1040 ///
1041 /// Note that all the setters affecting `source` are mutually
1042 /// exclusive.
1043 ///
1044 /// # Example
1045 /// ```ignore,no_run
1046 /// # use google_cloud_build_v1::model::Source;
1047 /// use google_cloud_build_v1::model::StorageSource;
1048 /// let x = Source::new().set_source(Some(
1049 /// google_cloud_build_v1::model::source::Source::StorageSource(StorageSource::default().into())));
1050 /// ```
1051 pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
1052 mut self,
1053 v: T,
1054 ) -> Self {
1055 self.source = v.into();
1056 self
1057 }
1058
1059 /// The value of [source][crate::model::Source::source]
1060 /// if it holds a `StorageSource`, `None` if the field is not set or
1061 /// holds a different branch.
1062 pub fn storage_source(
1063 &self,
1064 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
1065 #[allow(unreachable_patterns)]
1066 self.source.as_ref().and_then(|v| match v {
1067 crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
1068 _ => std::option::Option::None,
1069 })
1070 }
1071
1072 /// Sets the value of [source][crate::model::Source::source]
1073 /// to hold a `StorageSource`.
1074 ///
1075 /// Note that all the setters affecting `source` are
1076 /// mutually exclusive.
1077 ///
1078 /// # Example
1079 /// ```ignore,no_run
1080 /// # use google_cloud_build_v1::model::Source;
1081 /// use google_cloud_build_v1::model::StorageSource;
1082 /// let x = Source::new().set_storage_source(StorageSource::default()/* use setters */);
1083 /// assert!(x.storage_source().is_some());
1084 /// assert!(x.repo_source().is_none());
1085 /// assert!(x.git_source().is_none());
1086 /// assert!(x.storage_source_manifest().is_none());
1087 /// assert!(x.connected_repository().is_none());
1088 /// ```
1089 pub fn set_storage_source<
1090 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
1091 >(
1092 mut self,
1093 v: T,
1094 ) -> Self {
1095 self.source =
1096 std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
1097 self
1098 }
1099
1100 /// The value of [source][crate::model::Source::source]
1101 /// if it holds a `RepoSource`, `None` if the field is not set or
1102 /// holds a different branch.
1103 pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
1104 #[allow(unreachable_patterns)]
1105 self.source.as_ref().and_then(|v| match v {
1106 crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
1107 _ => std::option::Option::None,
1108 })
1109 }
1110
1111 /// Sets the value of [source][crate::model::Source::source]
1112 /// to hold a `RepoSource`.
1113 ///
1114 /// Note that all the setters affecting `source` are
1115 /// mutually exclusive.
1116 ///
1117 /// # Example
1118 /// ```ignore,no_run
1119 /// # use google_cloud_build_v1::model::Source;
1120 /// use google_cloud_build_v1::model::RepoSource;
1121 /// let x = Source::new().set_repo_source(RepoSource::default()/* use setters */);
1122 /// assert!(x.repo_source().is_some());
1123 /// assert!(x.storage_source().is_none());
1124 /// assert!(x.git_source().is_none());
1125 /// assert!(x.storage_source_manifest().is_none());
1126 /// assert!(x.connected_repository().is_none());
1127 /// ```
1128 pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
1129 mut self,
1130 v: T,
1131 ) -> Self {
1132 self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
1133 self
1134 }
1135
1136 /// The value of [source][crate::model::Source::source]
1137 /// if it holds a `GitSource`, `None` if the field is not set or
1138 /// holds a different branch.
1139 pub fn git_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSource>> {
1140 #[allow(unreachable_patterns)]
1141 self.source.as_ref().and_then(|v| match v {
1142 crate::model::source::Source::GitSource(v) => std::option::Option::Some(v),
1143 _ => std::option::Option::None,
1144 })
1145 }
1146
1147 /// Sets the value of [source][crate::model::Source::source]
1148 /// to hold a `GitSource`.
1149 ///
1150 /// Note that all the setters affecting `source` are
1151 /// mutually exclusive.
1152 ///
1153 /// # Example
1154 /// ```ignore,no_run
1155 /// # use google_cloud_build_v1::model::Source;
1156 /// use google_cloud_build_v1::model::GitSource;
1157 /// let x = Source::new().set_git_source(GitSource::default()/* use setters */);
1158 /// assert!(x.git_source().is_some());
1159 /// assert!(x.storage_source().is_none());
1160 /// assert!(x.repo_source().is_none());
1161 /// assert!(x.storage_source_manifest().is_none());
1162 /// assert!(x.connected_repository().is_none());
1163 /// ```
1164 pub fn set_git_source<T: std::convert::Into<std::boxed::Box<crate::model::GitSource>>>(
1165 mut self,
1166 v: T,
1167 ) -> Self {
1168 self.source = std::option::Option::Some(crate::model::source::Source::GitSource(v.into()));
1169 self
1170 }
1171
1172 /// The value of [source][crate::model::Source::source]
1173 /// if it holds a `StorageSourceManifest`, `None` if the field is not set or
1174 /// holds a different branch.
1175 pub fn storage_source_manifest(
1176 &self,
1177 ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSourceManifest>> {
1178 #[allow(unreachable_patterns)]
1179 self.source.as_ref().and_then(|v| match v {
1180 crate::model::source::Source::StorageSourceManifest(v) => std::option::Option::Some(v),
1181 _ => std::option::Option::None,
1182 })
1183 }
1184
1185 /// Sets the value of [source][crate::model::Source::source]
1186 /// to hold a `StorageSourceManifest`.
1187 ///
1188 /// Note that all the setters affecting `source` are
1189 /// mutually exclusive.
1190 ///
1191 /// # Example
1192 /// ```ignore,no_run
1193 /// # use google_cloud_build_v1::model::Source;
1194 /// use google_cloud_build_v1::model::StorageSourceManifest;
1195 /// let x = Source::new().set_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
1196 /// assert!(x.storage_source_manifest().is_some());
1197 /// assert!(x.storage_source().is_none());
1198 /// assert!(x.repo_source().is_none());
1199 /// assert!(x.git_source().is_none());
1200 /// assert!(x.connected_repository().is_none());
1201 /// ```
1202 pub fn set_storage_source_manifest<
1203 T: std::convert::Into<std::boxed::Box<crate::model::StorageSourceManifest>>,
1204 >(
1205 mut self,
1206 v: T,
1207 ) -> Self {
1208 self.source = std::option::Option::Some(
1209 crate::model::source::Source::StorageSourceManifest(v.into()),
1210 );
1211 self
1212 }
1213
1214 /// The value of [source][crate::model::Source::source]
1215 /// if it holds a `ConnectedRepository`, `None` if the field is not set or
1216 /// holds a different branch.
1217 pub fn connected_repository(
1218 &self,
1219 ) -> std::option::Option<&std::boxed::Box<crate::model::ConnectedRepository>> {
1220 #[allow(unreachable_patterns)]
1221 self.source.as_ref().and_then(|v| match v {
1222 crate::model::source::Source::ConnectedRepository(v) => std::option::Option::Some(v),
1223 _ => std::option::Option::None,
1224 })
1225 }
1226
1227 /// Sets the value of [source][crate::model::Source::source]
1228 /// to hold a `ConnectedRepository`.
1229 ///
1230 /// Note that all the setters affecting `source` are
1231 /// mutually exclusive.
1232 ///
1233 /// # Example
1234 /// ```ignore,no_run
1235 /// # use google_cloud_build_v1::model::Source;
1236 /// use google_cloud_build_v1::model::ConnectedRepository;
1237 /// let x = Source::new().set_connected_repository(ConnectedRepository::default()/* use setters */);
1238 /// assert!(x.connected_repository().is_some());
1239 /// assert!(x.storage_source().is_none());
1240 /// assert!(x.repo_source().is_none());
1241 /// assert!(x.git_source().is_none());
1242 /// assert!(x.storage_source_manifest().is_none());
1243 /// ```
1244 pub fn set_connected_repository<
1245 T: std::convert::Into<std::boxed::Box<crate::model::ConnectedRepository>>,
1246 >(
1247 mut self,
1248 v: T,
1249 ) -> Self {
1250 self.source =
1251 std::option::Option::Some(crate::model::source::Source::ConnectedRepository(v.into()));
1252 self
1253 }
1254}
1255
1256impl wkt::message::Message for Source {
1257 fn typename() -> &'static str {
1258 "type.googleapis.com/google.devtools.cloudbuild.v1.Source"
1259 }
1260}
1261
1262/// Defines additional types related to [Source].
1263pub mod source {
1264 #[allow(unused_imports)]
1265 use super::*;
1266
1267 /// Location of source.
1268 #[derive(Clone, Debug, PartialEq)]
1269 #[non_exhaustive]
1270 pub enum Source {
1271 /// If provided, get the source from this location in Cloud Storage.
1272 StorageSource(std::boxed::Box<crate::model::StorageSource>),
1273 /// If provided, get the source from this location in a Cloud Source
1274 /// Repository.
1275 RepoSource(std::boxed::Box<crate::model::RepoSource>),
1276 /// If provided, get the source from this Git repository.
1277 GitSource(std::boxed::Box<crate::model::GitSource>),
1278 /// If provided, get the source from this manifest in Cloud Storage.
1279 /// This feature is in Preview; see description
1280 /// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher).
1281 StorageSourceManifest(std::boxed::Box<crate::model::StorageSourceManifest>),
1282 /// Optional. If provided, get the source from this 2nd-gen Google Cloud
1283 /// Build repository resource.
1284 ConnectedRepository(std::boxed::Box<crate::model::ConnectedRepository>),
1285 }
1286}
1287
1288/// An image built by the pipeline.
1289#[derive(Clone, Default, PartialEq)]
1290#[non_exhaustive]
1291pub struct BuiltImage {
1292 /// Name used to push the container image to Google Container Registry, as
1293 /// presented to `docker push`.
1294 pub name: std::string::String,
1295
1296 /// Docker Registry 2.0 digest.
1297 pub digest: std::string::String,
1298
1299 /// Output only. Stores timing information for pushing the specified image.
1300 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1301
1302 /// Output only. Path to the artifact in Artifact Registry.
1303 pub artifact_registry_package: std::string::String,
1304
1305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1306}
1307
1308impl BuiltImage {
1309 /// Creates a new default instance.
1310 pub fn new() -> Self {
1311 std::default::Default::default()
1312 }
1313
1314 /// Sets the value of [name][crate::model::BuiltImage::name].
1315 ///
1316 /// # Example
1317 /// ```ignore,no_run
1318 /// # use google_cloud_build_v1::model::BuiltImage;
1319 /// let x = BuiltImage::new().set_name("example");
1320 /// ```
1321 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1322 self.name = v.into();
1323 self
1324 }
1325
1326 /// Sets the value of [digest][crate::model::BuiltImage::digest].
1327 ///
1328 /// # Example
1329 /// ```ignore,no_run
1330 /// # use google_cloud_build_v1::model::BuiltImage;
1331 /// let x = BuiltImage::new().set_digest("example");
1332 /// ```
1333 pub fn set_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1334 self.digest = v.into();
1335 self
1336 }
1337
1338 /// Sets the value of [push_timing][crate::model::BuiltImage::push_timing].
1339 ///
1340 /// # Example
1341 /// ```ignore,no_run
1342 /// # use google_cloud_build_v1::model::BuiltImage;
1343 /// use google_cloud_build_v1::model::TimeSpan;
1344 /// let x = BuiltImage::new().set_push_timing(TimeSpan::default()/* use setters */);
1345 /// ```
1346 pub fn set_push_timing<T>(mut self, v: T) -> Self
1347 where
1348 T: std::convert::Into<crate::model::TimeSpan>,
1349 {
1350 self.push_timing = std::option::Option::Some(v.into());
1351 self
1352 }
1353
1354 /// Sets or clears the value of [push_timing][crate::model::BuiltImage::push_timing].
1355 ///
1356 /// # Example
1357 /// ```ignore,no_run
1358 /// # use google_cloud_build_v1::model::BuiltImage;
1359 /// use google_cloud_build_v1::model::TimeSpan;
1360 /// let x = BuiltImage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1361 /// let x = BuiltImage::new().set_or_clear_push_timing(None::<TimeSpan>);
1362 /// ```
1363 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1364 where
1365 T: std::convert::Into<crate::model::TimeSpan>,
1366 {
1367 self.push_timing = v.map(|x| x.into());
1368 self
1369 }
1370
1371 /// Sets the value of [artifact_registry_package][crate::model::BuiltImage::artifact_registry_package].
1372 ///
1373 /// # Example
1374 /// ```ignore,no_run
1375 /// # use google_cloud_build_v1::model::BuiltImage;
1376 /// let x = BuiltImage::new().set_artifact_registry_package("example");
1377 /// ```
1378 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1379 mut self,
1380 v: T,
1381 ) -> Self {
1382 self.artifact_registry_package = v.into();
1383 self
1384 }
1385}
1386
1387impl wkt::message::Message for BuiltImage {
1388 fn typename() -> &'static str {
1389 "type.googleapis.com/google.devtools.cloudbuild.v1.BuiltImage"
1390 }
1391}
1392
1393/// Artifact uploaded using the PythonPackage directive.
1394#[derive(Clone, Default, PartialEq)]
1395#[non_exhaustive]
1396pub struct UploadedPythonPackage {
1397 /// URI of the uploaded artifact.
1398 pub uri: std::string::String,
1399
1400 /// Hash types and values of the Python Artifact.
1401 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1402
1403 /// Output only. Stores timing information for pushing the specified artifact.
1404 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1405
1406 /// Output only. Path to the artifact in Artifact Registry.
1407 pub artifact_registry_package: std::string::String,
1408
1409 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1410}
1411
1412impl UploadedPythonPackage {
1413 /// Creates a new default instance.
1414 pub fn new() -> Self {
1415 std::default::Default::default()
1416 }
1417
1418 /// Sets the value of [uri][crate::model::UploadedPythonPackage::uri].
1419 ///
1420 /// # Example
1421 /// ```ignore,no_run
1422 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1423 /// let x = UploadedPythonPackage::new().set_uri("example");
1424 /// ```
1425 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1426 self.uri = v.into();
1427 self
1428 }
1429
1430 /// Sets the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1431 ///
1432 /// # Example
1433 /// ```ignore,no_run
1434 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1435 /// use google_cloud_build_v1::model::FileHashes;
1436 /// let x = UploadedPythonPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1437 /// ```
1438 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1439 where
1440 T: std::convert::Into<crate::model::FileHashes>,
1441 {
1442 self.file_hashes = std::option::Option::Some(v.into());
1443 self
1444 }
1445
1446 /// Sets or clears the value of [file_hashes][crate::model::UploadedPythonPackage::file_hashes].
1447 ///
1448 /// # Example
1449 /// ```ignore,no_run
1450 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1451 /// use google_cloud_build_v1::model::FileHashes;
1452 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1453 /// let x = UploadedPythonPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1454 /// ```
1455 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1456 where
1457 T: std::convert::Into<crate::model::FileHashes>,
1458 {
1459 self.file_hashes = v.map(|x| x.into());
1460 self
1461 }
1462
1463 /// Sets the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1464 ///
1465 /// # Example
1466 /// ```ignore,no_run
1467 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1468 /// use google_cloud_build_v1::model::TimeSpan;
1469 /// let x = UploadedPythonPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1470 /// ```
1471 pub fn set_push_timing<T>(mut self, v: T) -> Self
1472 where
1473 T: std::convert::Into<crate::model::TimeSpan>,
1474 {
1475 self.push_timing = std::option::Option::Some(v.into());
1476 self
1477 }
1478
1479 /// Sets or clears the value of [push_timing][crate::model::UploadedPythonPackage::push_timing].
1480 ///
1481 /// # Example
1482 /// ```ignore,no_run
1483 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1484 /// use google_cloud_build_v1::model::TimeSpan;
1485 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1486 /// let x = UploadedPythonPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1487 /// ```
1488 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1489 where
1490 T: std::convert::Into<crate::model::TimeSpan>,
1491 {
1492 self.push_timing = v.map(|x| x.into());
1493 self
1494 }
1495
1496 /// Sets the value of [artifact_registry_package][crate::model::UploadedPythonPackage::artifact_registry_package].
1497 ///
1498 /// # Example
1499 /// ```ignore,no_run
1500 /// # use google_cloud_build_v1::model::UploadedPythonPackage;
1501 /// let x = UploadedPythonPackage::new().set_artifact_registry_package("example");
1502 /// ```
1503 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1504 mut self,
1505 v: T,
1506 ) -> Self {
1507 self.artifact_registry_package = v.into();
1508 self
1509 }
1510}
1511
1512impl wkt::message::Message for UploadedPythonPackage {
1513 fn typename() -> &'static str {
1514 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedPythonPackage"
1515 }
1516}
1517
1518/// A Maven artifact uploaded using the MavenArtifact directive.
1519#[derive(Clone, Default, PartialEq)]
1520#[non_exhaustive]
1521pub struct UploadedMavenArtifact {
1522 /// URI of the uploaded artifact.
1523 pub uri: std::string::String,
1524
1525 /// Hash types and values of the Maven Artifact.
1526 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1527
1528 /// Output only. Stores timing information for pushing the specified artifact.
1529 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1530
1531 /// Output only. Path to the artifact in Artifact Registry.
1532 pub artifact_registry_package: std::string::String,
1533
1534 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1535}
1536
1537impl UploadedMavenArtifact {
1538 /// Creates a new default instance.
1539 pub fn new() -> Self {
1540 std::default::Default::default()
1541 }
1542
1543 /// Sets the value of [uri][crate::model::UploadedMavenArtifact::uri].
1544 ///
1545 /// # Example
1546 /// ```ignore,no_run
1547 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1548 /// let x = UploadedMavenArtifact::new().set_uri("example");
1549 /// ```
1550 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1551 self.uri = v.into();
1552 self
1553 }
1554
1555 /// Sets the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1556 ///
1557 /// # Example
1558 /// ```ignore,no_run
1559 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1560 /// use google_cloud_build_v1::model::FileHashes;
1561 /// let x = UploadedMavenArtifact::new().set_file_hashes(FileHashes::default()/* use setters */);
1562 /// ```
1563 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1564 where
1565 T: std::convert::Into<crate::model::FileHashes>,
1566 {
1567 self.file_hashes = std::option::Option::Some(v.into());
1568 self
1569 }
1570
1571 /// Sets or clears the value of [file_hashes][crate::model::UploadedMavenArtifact::file_hashes].
1572 ///
1573 /// # Example
1574 /// ```ignore,no_run
1575 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1576 /// use google_cloud_build_v1::model::FileHashes;
1577 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1578 /// let x = UploadedMavenArtifact::new().set_or_clear_file_hashes(None::<FileHashes>);
1579 /// ```
1580 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1581 where
1582 T: std::convert::Into<crate::model::FileHashes>,
1583 {
1584 self.file_hashes = v.map(|x| x.into());
1585 self
1586 }
1587
1588 /// Sets the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1589 ///
1590 /// # Example
1591 /// ```ignore,no_run
1592 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1593 /// use google_cloud_build_v1::model::TimeSpan;
1594 /// let x = UploadedMavenArtifact::new().set_push_timing(TimeSpan::default()/* use setters */);
1595 /// ```
1596 pub fn set_push_timing<T>(mut self, v: T) -> Self
1597 where
1598 T: std::convert::Into<crate::model::TimeSpan>,
1599 {
1600 self.push_timing = std::option::Option::Some(v.into());
1601 self
1602 }
1603
1604 /// Sets or clears the value of [push_timing][crate::model::UploadedMavenArtifact::push_timing].
1605 ///
1606 /// # Example
1607 /// ```ignore,no_run
1608 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1609 /// use google_cloud_build_v1::model::TimeSpan;
1610 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1611 /// let x = UploadedMavenArtifact::new().set_or_clear_push_timing(None::<TimeSpan>);
1612 /// ```
1613 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1614 where
1615 T: std::convert::Into<crate::model::TimeSpan>,
1616 {
1617 self.push_timing = v.map(|x| x.into());
1618 self
1619 }
1620
1621 /// Sets the value of [artifact_registry_package][crate::model::UploadedMavenArtifact::artifact_registry_package].
1622 ///
1623 /// # Example
1624 /// ```ignore,no_run
1625 /// # use google_cloud_build_v1::model::UploadedMavenArtifact;
1626 /// let x = UploadedMavenArtifact::new().set_artifact_registry_package("example");
1627 /// ```
1628 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1629 mut self,
1630 v: T,
1631 ) -> Self {
1632 self.artifact_registry_package = v.into();
1633 self
1634 }
1635}
1636
1637impl wkt::message::Message for UploadedMavenArtifact {
1638 fn typename() -> &'static str {
1639 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedMavenArtifact"
1640 }
1641}
1642
1643/// A Go module artifact uploaded to Artifact Registry using the GoModule
1644/// directive.
1645#[derive(Clone, Default, PartialEq)]
1646#[non_exhaustive]
1647pub struct UploadedGoModule {
1648 /// URI of the uploaded artifact.
1649 pub uri: std::string::String,
1650
1651 /// Hash types and values of the Go Module Artifact.
1652 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1653
1654 /// Output only. Stores timing information for pushing the specified artifact.
1655 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1656
1657 /// Output only. Path to the artifact in Artifact Registry.
1658 pub artifact_registry_package: std::string::String,
1659
1660 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1661}
1662
1663impl UploadedGoModule {
1664 /// Creates a new default instance.
1665 pub fn new() -> Self {
1666 std::default::Default::default()
1667 }
1668
1669 /// Sets the value of [uri][crate::model::UploadedGoModule::uri].
1670 ///
1671 /// # Example
1672 /// ```ignore,no_run
1673 /// # use google_cloud_build_v1::model::UploadedGoModule;
1674 /// let x = UploadedGoModule::new().set_uri("example");
1675 /// ```
1676 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1677 self.uri = v.into();
1678 self
1679 }
1680
1681 /// Sets the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1682 ///
1683 /// # Example
1684 /// ```ignore,no_run
1685 /// # use google_cloud_build_v1::model::UploadedGoModule;
1686 /// use google_cloud_build_v1::model::FileHashes;
1687 /// let x = UploadedGoModule::new().set_file_hashes(FileHashes::default()/* use setters */);
1688 /// ```
1689 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1690 where
1691 T: std::convert::Into<crate::model::FileHashes>,
1692 {
1693 self.file_hashes = std::option::Option::Some(v.into());
1694 self
1695 }
1696
1697 /// Sets or clears the value of [file_hashes][crate::model::UploadedGoModule::file_hashes].
1698 ///
1699 /// # Example
1700 /// ```ignore,no_run
1701 /// # use google_cloud_build_v1::model::UploadedGoModule;
1702 /// use google_cloud_build_v1::model::FileHashes;
1703 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1704 /// let x = UploadedGoModule::new().set_or_clear_file_hashes(None::<FileHashes>);
1705 /// ```
1706 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1707 where
1708 T: std::convert::Into<crate::model::FileHashes>,
1709 {
1710 self.file_hashes = v.map(|x| x.into());
1711 self
1712 }
1713
1714 /// Sets the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1715 ///
1716 /// # Example
1717 /// ```ignore,no_run
1718 /// # use google_cloud_build_v1::model::UploadedGoModule;
1719 /// use google_cloud_build_v1::model::TimeSpan;
1720 /// let x = UploadedGoModule::new().set_push_timing(TimeSpan::default()/* use setters */);
1721 /// ```
1722 pub fn set_push_timing<T>(mut self, v: T) -> Self
1723 where
1724 T: std::convert::Into<crate::model::TimeSpan>,
1725 {
1726 self.push_timing = std::option::Option::Some(v.into());
1727 self
1728 }
1729
1730 /// Sets or clears the value of [push_timing][crate::model::UploadedGoModule::push_timing].
1731 ///
1732 /// # Example
1733 /// ```ignore,no_run
1734 /// # use google_cloud_build_v1::model::UploadedGoModule;
1735 /// use google_cloud_build_v1::model::TimeSpan;
1736 /// let x = UploadedGoModule::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1737 /// let x = UploadedGoModule::new().set_or_clear_push_timing(None::<TimeSpan>);
1738 /// ```
1739 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1740 where
1741 T: std::convert::Into<crate::model::TimeSpan>,
1742 {
1743 self.push_timing = v.map(|x| x.into());
1744 self
1745 }
1746
1747 /// Sets the value of [artifact_registry_package][crate::model::UploadedGoModule::artifact_registry_package].
1748 ///
1749 /// # Example
1750 /// ```ignore,no_run
1751 /// # use google_cloud_build_v1::model::UploadedGoModule;
1752 /// let x = UploadedGoModule::new().set_artifact_registry_package("example");
1753 /// ```
1754 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1755 mut self,
1756 v: T,
1757 ) -> Self {
1758 self.artifact_registry_package = v.into();
1759 self
1760 }
1761}
1762
1763impl wkt::message::Message for UploadedGoModule {
1764 fn typename() -> &'static str {
1765 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedGoModule"
1766 }
1767}
1768
1769/// An npm package uploaded to Artifact Registry using the NpmPackage
1770/// directive.
1771#[derive(Clone, Default, PartialEq)]
1772#[non_exhaustive]
1773pub struct UploadedNpmPackage {
1774 /// URI of the uploaded npm package.
1775 pub uri: std::string::String,
1776
1777 /// Hash types and values of the npm package.
1778 pub file_hashes: std::option::Option<crate::model::FileHashes>,
1779
1780 /// Output only. Stores timing information for pushing the specified artifact.
1781 pub push_timing: std::option::Option<crate::model::TimeSpan>,
1782
1783 /// Output only. Path to the artifact in Artifact Registry.
1784 pub artifact_registry_package: std::string::String,
1785
1786 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1787}
1788
1789impl UploadedNpmPackage {
1790 /// Creates a new default instance.
1791 pub fn new() -> Self {
1792 std::default::Default::default()
1793 }
1794
1795 /// Sets the value of [uri][crate::model::UploadedNpmPackage::uri].
1796 ///
1797 /// # Example
1798 /// ```ignore,no_run
1799 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1800 /// let x = UploadedNpmPackage::new().set_uri("example");
1801 /// ```
1802 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1803 self.uri = v.into();
1804 self
1805 }
1806
1807 /// Sets the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1808 ///
1809 /// # Example
1810 /// ```ignore,no_run
1811 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1812 /// use google_cloud_build_v1::model::FileHashes;
1813 /// let x = UploadedNpmPackage::new().set_file_hashes(FileHashes::default()/* use setters */);
1814 /// ```
1815 pub fn set_file_hashes<T>(mut self, v: T) -> Self
1816 where
1817 T: std::convert::Into<crate::model::FileHashes>,
1818 {
1819 self.file_hashes = std::option::Option::Some(v.into());
1820 self
1821 }
1822
1823 /// Sets or clears the value of [file_hashes][crate::model::UploadedNpmPackage::file_hashes].
1824 ///
1825 /// # Example
1826 /// ```ignore,no_run
1827 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1828 /// use google_cloud_build_v1::model::FileHashes;
1829 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(Some(FileHashes::default()/* use setters */));
1830 /// let x = UploadedNpmPackage::new().set_or_clear_file_hashes(None::<FileHashes>);
1831 /// ```
1832 pub fn set_or_clear_file_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1833 where
1834 T: std::convert::Into<crate::model::FileHashes>,
1835 {
1836 self.file_hashes = v.map(|x| x.into());
1837 self
1838 }
1839
1840 /// Sets the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1841 ///
1842 /// # Example
1843 /// ```ignore,no_run
1844 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1845 /// use google_cloud_build_v1::model::TimeSpan;
1846 /// let x = UploadedNpmPackage::new().set_push_timing(TimeSpan::default()/* use setters */);
1847 /// ```
1848 pub fn set_push_timing<T>(mut self, v: T) -> Self
1849 where
1850 T: std::convert::Into<crate::model::TimeSpan>,
1851 {
1852 self.push_timing = std::option::Option::Some(v.into());
1853 self
1854 }
1855
1856 /// Sets or clears the value of [push_timing][crate::model::UploadedNpmPackage::push_timing].
1857 ///
1858 /// # Example
1859 /// ```ignore,no_run
1860 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1861 /// use google_cloud_build_v1::model::TimeSpan;
1862 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(Some(TimeSpan::default()/* use setters */));
1863 /// let x = UploadedNpmPackage::new().set_or_clear_push_timing(None::<TimeSpan>);
1864 /// ```
1865 pub fn set_or_clear_push_timing<T>(mut self, v: std::option::Option<T>) -> Self
1866 where
1867 T: std::convert::Into<crate::model::TimeSpan>,
1868 {
1869 self.push_timing = v.map(|x| x.into());
1870 self
1871 }
1872
1873 /// Sets the value of [artifact_registry_package][crate::model::UploadedNpmPackage::artifact_registry_package].
1874 ///
1875 /// # Example
1876 /// ```ignore,no_run
1877 /// # use google_cloud_build_v1::model::UploadedNpmPackage;
1878 /// let x = UploadedNpmPackage::new().set_artifact_registry_package("example");
1879 /// ```
1880 pub fn set_artifact_registry_package<T: std::convert::Into<std::string::String>>(
1881 mut self,
1882 v: T,
1883 ) -> Self {
1884 self.artifact_registry_package = v.into();
1885 self
1886 }
1887}
1888
1889impl wkt::message::Message for UploadedNpmPackage {
1890 fn typename() -> &'static str {
1891 "type.googleapis.com/google.devtools.cloudbuild.v1.UploadedNpmPackage"
1892 }
1893}
1894
1895/// A step in the build pipeline.
1896#[derive(Clone, Default, PartialEq)]
1897#[non_exhaustive]
1898pub struct BuildStep {
1899 /// Required. The name of the container image that will run this particular
1900 /// build step.
1901 ///
1902 /// If the image is available in the host's Docker daemon's cache, it
1903 /// will be run directly. If not, the host will attempt to pull the image
1904 /// first, using the builder service account's credentials if necessary.
1905 ///
1906 /// The Docker daemon's cache will already have the latest versions of all of
1907 /// the officially supported build steps
1908 /// ([<https://github.com/GoogleCloudPlatform/cloud-builders>](https://github.com/GoogleCloudPlatform/cloud-builders)).
1909 /// The Docker daemon will also have cached many of the layers for some popular
1910 /// images, like "ubuntu", "debian", but they will be refreshed at the time you
1911 /// attempt to use them.
1912 ///
1913 /// If you built an image in a previous build step, it will be stored in the
1914 /// host's Docker daemon's cache and is available to use as the name for a
1915 /// later build step.
1916 pub name: std::string::String,
1917
1918 /// A list of environment variable definitions to be used when running a step.
1919 ///
1920 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
1921 /// being given the value "VALUE".
1922 pub env: std::vec::Vec<std::string::String>,
1923
1924 /// A list of arguments that will be presented to the step when it is started.
1925 ///
1926 /// If the image used to run the step's container has an entrypoint, the `args`
1927 /// are used as arguments to that entrypoint. If the image does not define
1928 /// an entrypoint, the first element in args is used as the entrypoint,
1929 /// and the remainder will be used as arguments.
1930 pub args: std::vec::Vec<std::string::String>,
1931
1932 /// Working directory to use when running this step's container.
1933 ///
1934 /// If this value is a relative path, it is relative to the build's working
1935 /// directory. If this value is absolute, it may be outside the build's working
1936 /// directory, in which case the contents of the path may not be persisted
1937 /// across build step executions, unless a `volume` for that path is specified.
1938 ///
1939 /// If the build specifies a `RepoSource` with `dir` and a step with a `dir`,
1940 /// which specifies an absolute path, the `RepoSource` `dir` is ignored for
1941 /// the step's execution.
1942 pub dir: std::string::String,
1943
1944 /// Unique identifier for this build step, used in `wait_for` to
1945 /// reference this build step as a dependency.
1946 pub id: std::string::String,
1947
1948 /// The ID(s) of the step(s) that this build step depends on.
1949 /// This build step will not start until all the build steps in `wait_for`
1950 /// have completed successfully. If `wait_for` is empty, this build step will
1951 /// start when all previous build steps in the `Build.Steps` list have
1952 /// completed successfully.
1953 pub wait_for: std::vec::Vec<std::string::String>,
1954
1955 /// Entrypoint to be used instead of the build step image's default entrypoint.
1956 /// If unset, the image's default entrypoint is used.
1957 pub entrypoint: std::string::String,
1958
1959 /// A list of environment variables which are encrypted using a Cloud Key
1960 /// Management Service crypto key. These values must be specified in the
1961 /// build's `Secret`.
1962 pub secret_env: std::vec::Vec<std::string::String>,
1963
1964 /// List of volumes to mount into the build step.
1965 ///
1966 /// Each volume is created as an empty volume prior to execution of the
1967 /// build step. Upon completion of the build, volumes and their contents are
1968 /// discarded.
1969 ///
1970 /// Using a named volume in only one step is not valid as it is indicative
1971 /// of a build request with an incorrect configuration.
1972 pub volumes: std::vec::Vec<crate::model::Volume>,
1973
1974 /// Output only. Stores timing information for executing this build step.
1975 pub timing: std::option::Option<crate::model::TimeSpan>,
1976
1977 /// Output only. Stores timing information for pulling this build step's
1978 /// builder image only.
1979 pub pull_timing: std::option::Option<crate::model::TimeSpan>,
1980
1981 /// Time limit for executing this build step. If not defined, the step has no
1982 /// time limit and will be allowed to continue to run until either it completes
1983 /// or the build itself times out.
1984 pub timeout: std::option::Option<wkt::Duration>,
1985
1986 /// Output only. Status of the build step. At this time, build step status is
1987 /// only updated on build completion; step status is not updated in real-time
1988 /// as the build progresses.
1989 pub status: crate::model::build::Status,
1990
1991 /// Allow this build step to fail without failing the entire build.
1992 ///
1993 /// If false, the entire build will fail if this step fails. Otherwise, the
1994 /// build will succeed, but this step will still have a failure status.
1995 /// Error information will be reported in the failure_detail field.
1996 pub allow_failure: bool,
1997
1998 /// Output only. Return code from running the step.
1999 pub exit_code: i32,
2000
2001 /// Allow this build step to fail without failing the entire build if and
2002 /// only if the exit code is one of the specified codes. If allow_failure
2003 /// is also specified, this field will take precedence.
2004 pub allow_exit_codes: std::vec::Vec<i32>,
2005
2006 /// A shell script to be executed in the step.
2007 ///
2008 /// When script is provided, the user cannot specify the entrypoint or args.
2009 pub script: std::string::String,
2010
2011 /// Option to include built-in and custom substitutions as env variables
2012 /// for this build step. This option will override the global option
2013 /// in BuildOption.
2014 pub automap_substitutions: std::option::Option<bool>,
2015
2016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2017}
2018
2019impl BuildStep {
2020 /// Creates a new default instance.
2021 pub fn new() -> Self {
2022 std::default::Default::default()
2023 }
2024
2025 /// Sets the value of [name][crate::model::BuildStep::name].
2026 ///
2027 /// # Example
2028 /// ```ignore,no_run
2029 /// # use google_cloud_build_v1::model::BuildStep;
2030 /// let x = BuildStep::new().set_name("example");
2031 /// ```
2032 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2033 self.name = v.into();
2034 self
2035 }
2036
2037 /// Sets the value of [env][crate::model::BuildStep::env].
2038 ///
2039 /// # Example
2040 /// ```ignore,no_run
2041 /// # use google_cloud_build_v1::model::BuildStep;
2042 /// let x = BuildStep::new().set_env(["a", "b", "c"]);
2043 /// ```
2044 pub fn set_env<T, V>(mut self, v: T) -> Self
2045 where
2046 T: std::iter::IntoIterator<Item = V>,
2047 V: std::convert::Into<std::string::String>,
2048 {
2049 use std::iter::Iterator;
2050 self.env = v.into_iter().map(|i| i.into()).collect();
2051 self
2052 }
2053
2054 /// Sets the value of [args][crate::model::BuildStep::args].
2055 ///
2056 /// # Example
2057 /// ```ignore,no_run
2058 /// # use google_cloud_build_v1::model::BuildStep;
2059 /// let x = BuildStep::new().set_args(["a", "b", "c"]);
2060 /// ```
2061 pub fn set_args<T, V>(mut self, v: T) -> Self
2062 where
2063 T: std::iter::IntoIterator<Item = V>,
2064 V: std::convert::Into<std::string::String>,
2065 {
2066 use std::iter::Iterator;
2067 self.args = v.into_iter().map(|i| i.into()).collect();
2068 self
2069 }
2070
2071 /// Sets the value of [dir][crate::model::BuildStep::dir].
2072 ///
2073 /// # Example
2074 /// ```ignore,no_run
2075 /// # use google_cloud_build_v1::model::BuildStep;
2076 /// let x = BuildStep::new().set_dir("example");
2077 /// ```
2078 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2079 self.dir = v.into();
2080 self
2081 }
2082
2083 /// Sets the value of [id][crate::model::BuildStep::id].
2084 ///
2085 /// # Example
2086 /// ```ignore,no_run
2087 /// # use google_cloud_build_v1::model::BuildStep;
2088 /// let x = BuildStep::new().set_id("example");
2089 /// ```
2090 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2091 self.id = v.into();
2092 self
2093 }
2094
2095 /// Sets the value of [wait_for][crate::model::BuildStep::wait_for].
2096 ///
2097 /// # Example
2098 /// ```ignore,no_run
2099 /// # use google_cloud_build_v1::model::BuildStep;
2100 /// let x = BuildStep::new().set_wait_for(["a", "b", "c"]);
2101 /// ```
2102 pub fn set_wait_for<T, V>(mut self, v: T) -> Self
2103 where
2104 T: std::iter::IntoIterator<Item = V>,
2105 V: std::convert::Into<std::string::String>,
2106 {
2107 use std::iter::Iterator;
2108 self.wait_for = v.into_iter().map(|i| i.into()).collect();
2109 self
2110 }
2111
2112 /// Sets the value of [entrypoint][crate::model::BuildStep::entrypoint].
2113 ///
2114 /// # Example
2115 /// ```ignore,no_run
2116 /// # use google_cloud_build_v1::model::BuildStep;
2117 /// let x = BuildStep::new().set_entrypoint("example");
2118 /// ```
2119 pub fn set_entrypoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2120 self.entrypoint = v.into();
2121 self
2122 }
2123
2124 /// Sets the value of [secret_env][crate::model::BuildStep::secret_env].
2125 ///
2126 /// # Example
2127 /// ```ignore,no_run
2128 /// # use google_cloud_build_v1::model::BuildStep;
2129 /// let x = BuildStep::new().set_secret_env(["a", "b", "c"]);
2130 /// ```
2131 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
2132 where
2133 T: std::iter::IntoIterator<Item = V>,
2134 V: std::convert::Into<std::string::String>,
2135 {
2136 use std::iter::Iterator;
2137 self.secret_env = v.into_iter().map(|i| i.into()).collect();
2138 self
2139 }
2140
2141 /// Sets the value of [volumes][crate::model::BuildStep::volumes].
2142 ///
2143 /// # Example
2144 /// ```ignore,no_run
2145 /// # use google_cloud_build_v1::model::BuildStep;
2146 /// use google_cloud_build_v1::model::Volume;
2147 /// let x = BuildStep::new()
2148 /// .set_volumes([
2149 /// Volume::default()/* use setters */,
2150 /// Volume::default()/* use (different) setters */,
2151 /// ]);
2152 /// ```
2153 pub fn set_volumes<T, V>(mut self, v: T) -> Self
2154 where
2155 T: std::iter::IntoIterator<Item = V>,
2156 V: std::convert::Into<crate::model::Volume>,
2157 {
2158 use std::iter::Iterator;
2159 self.volumes = v.into_iter().map(|i| i.into()).collect();
2160 self
2161 }
2162
2163 /// Sets the value of [timing][crate::model::BuildStep::timing].
2164 ///
2165 /// # Example
2166 /// ```ignore,no_run
2167 /// # use google_cloud_build_v1::model::BuildStep;
2168 /// use google_cloud_build_v1::model::TimeSpan;
2169 /// let x = BuildStep::new().set_timing(TimeSpan::default()/* use setters */);
2170 /// ```
2171 pub fn set_timing<T>(mut self, v: T) -> Self
2172 where
2173 T: std::convert::Into<crate::model::TimeSpan>,
2174 {
2175 self.timing = std::option::Option::Some(v.into());
2176 self
2177 }
2178
2179 /// Sets or clears the value of [timing][crate::model::BuildStep::timing].
2180 ///
2181 /// # Example
2182 /// ```ignore,no_run
2183 /// # use google_cloud_build_v1::model::BuildStep;
2184 /// use google_cloud_build_v1::model::TimeSpan;
2185 /// let x = BuildStep::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
2186 /// let x = BuildStep::new().set_or_clear_timing(None::<TimeSpan>);
2187 /// ```
2188 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
2189 where
2190 T: std::convert::Into<crate::model::TimeSpan>,
2191 {
2192 self.timing = v.map(|x| x.into());
2193 self
2194 }
2195
2196 /// Sets the value of [pull_timing][crate::model::BuildStep::pull_timing].
2197 ///
2198 /// # Example
2199 /// ```ignore,no_run
2200 /// # use google_cloud_build_v1::model::BuildStep;
2201 /// use google_cloud_build_v1::model::TimeSpan;
2202 /// let x = BuildStep::new().set_pull_timing(TimeSpan::default()/* use setters */);
2203 /// ```
2204 pub fn set_pull_timing<T>(mut self, v: T) -> Self
2205 where
2206 T: std::convert::Into<crate::model::TimeSpan>,
2207 {
2208 self.pull_timing = std::option::Option::Some(v.into());
2209 self
2210 }
2211
2212 /// Sets or clears the value of [pull_timing][crate::model::BuildStep::pull_timing].
2213 ///
2214 /// # Example
2215 /// ```ignore,no_run
2216 /// # use google_cloud_build_v1::model::BuildStep;
2217 /// use google_cloud_build_v1::model::TimeSpan;
2218 /// let x = BuildStep::new().set_or_clear_pull_timing(Some(TimeSpan::default()/* use setters */));
2219 /// let x = BuildStep::new().set_or_clear_pull_timing(None::<TimeSpan>);
2220 /// ```
2221 pub fn set_or_clear_pull_timing<T>(mut self, v: std::option::Option<T>) -> Self
2222 where
2223 T: std::convert::Into<crate::model::TimeSpan>,
2224 {
2225 self.pull_timing = v.map(|x| x.into());
2226 self
2227 }
2228
2229 /// Sets the value of [timeout][crate::model::BuildStep::timeout].
2230 ///
2231 /// # Example
2232 /// ```ignore,no_run
2233 /// # use google_cloud_build_v1::model::BuildStep;
2234 /// use wkt::Duration;
2235 /// let x = BuildStep::new().set_timeout(Duration::default()/* use setters */);
2236 /// ```
2237 pub fn set_timeout<T>(mut self, v: T) -> Self
2238 where
2239 T: std::convert::Into<wkt::Duration>,
2240 {
2241 self.timeout = std::option::Option::Some(v.into());
2242 self
2243 }
2244
2245 /// Sets or clears the value of [timeout][crate::model::BuildStep::timeout].
2246 ///
2247 /// # Example
2248 /// ```ignore,no_run
2249 /// # use google_cloud_build_v1::model::BuildStep;
2250 /// use wkt::Duration;
2251 /// let x = BuildStep::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
2252 /// let x = BuildStep::new().set_or_clear_timeout(None::<Duration>);
2253 /// ```
2254 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2255 where
2256 T: std::convert::Into<wkt::Duration>,
2257 {
2258 self.timeout = v.map(|x| x.into());
2259 self
2260 }
2261
2262 /// Sets the value of [status][crate::model::BuildStep::status].
2263 ///
2264 /// # Example
2265 /// ```ignore,no_run
2266 /// # use google_cloud_build_v1::model::BuildStep;
2267 /// use google_cloud_build_v1::model::build::Status;
2268 /// let x0 = BuildStep::new().set_status(Status::Pending);
2269 /// let x1 = BuildStep::new().set_status(Status::Queued);
2270 /// let x2 = BuildStep::new().set_status(Status::Working);
2271 /// ```
2272 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2273 self.status = v.into();
2274 self
2275 }
2276
2277 /// Sets the value of [allow_failure][crate::model::BuildStep::allow_failure].
2278 ///
2279 /// # Example
2280 /// ```ignore,no_run
2281 /// # use google_cloud_build_v1::model::BuildStep;
2282 /// let x = BuildStep::new().set_allow_failure(true);
2283 /// ```
2284 pub fn set_allow_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2285 self.allow_failure = v.into();
2286 self
2287 }
2288
2289 /// Sets the value of [exit_code][crate::model::BuildStep::exit_code].
2290 ///
2291 /// # Example
2292 /// ```ignore,no_run
2293 /// # use google_cloud_build_v1::model::BuildStep;
2294 /// let x = BuildStep::new().set_exit_code(42);
2295 /// ```
2296 pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2297 self.exit_code = v.into();
2298 self
2299 }
2300
2301 /// Sets the value of [allow_exit_codes][crate::model::BuildStep::allow_exit_codes].
2302 ///
2303 /// # Example
2304 /// ```ignore,no_run
2305 /// # use google_cloud_build_v1::model::BuildStep;
2306 /// let x = BuildStep::new().set_allow_exit_codes([1, 2, 3]);
2307 /// ```
2308 pub fn set_allow_exit_codes<T, V>(mut self, v: T) -> Self
2309 where
2310 T: std::iter::IntoIterator<Item = V>,
2311 V: std::convert::Into<i32>,
2312 {
2313 use std::iter::Iterator;
2314 self.allow_exit_codes = v.into_iter().map(|i| i.into()).collect();
2315 self
2316 }
2317
2318 /// Sets the value of [script][crate::model::BuildStep::script].
2319 ///
2320 /// # Example
2321 /// ```ignore,no_run
2322 /// # use google_cloud_build_v1::model::BuildStep;
2323 /// let x = BuildStep::new().set_script("example");
2324 /// ```
2325 pub fn set_script<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2326 self.script = v.into();
2327 self
2328 }
2329
2330 /// Sets the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2331 ///
2332 /// # Example
2333 /// ```ignore,no_run
2334 /// # use google_cloud_build_v1::model::BuildStep;
2335 /// let x = BuildStep::new().set_automap_substitutions(true);
2336 /// ```
2337 pub fn set_automap_substitutions<T>(mut self, v: T) -> Self
2338 where
2339 T: std::convert::Into<bool>,
2340 {
2341 self.automap_substitutions = std::option::Option::Some(v.into());
2342 self
2343 }
2344
2345 /// Sets or clears the value of [automap_substitutions][crate::model::BuildStep::automap_substitutions].
2346 ///
2347 /// # Example
2348 /// ```ignore,no_run
2349 /// # use google_cloud_build_v1::model::BuildStep;
2350 /// let x = BuildStep::new().set_or_clear_automap_substitutions(Some(false));
2351 /// let x = BuildStep::new().set_or_clear_automap_substitutions(None::<bool>);
2352 /// ```
2353 pub fn set_or_clear_automap_substitutions<T>(mut self, v: std::option::Option<T>) -> Self
2354 where
2355 T: std::convert::Into<bool>,
2356 {
2357 self.automap_substitutions = v.map(|x| x.into());
2358 self
2359 }
2360}
2361
2362impl wkt::message::Message for BuildStep {
2363 fn typename() -> &'static str {
2364 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildStep"
2365 }
2366}
2367
2368/// Volume describes a Docker container volume which is mounted into build steps
2369/// in order to persist files across build step execution.
2370#[derive(Clone, Default, PartialEq)]
2371#[non_exhaustive]
2372pub struct Volume {
2373 /// Name of the volume to mount.
2374 ///
2375 /// Volume names must be unique per build step and must be valid names for
2376 /// Docker volumes. Each named volume must be used by at least two build steps.
2377 pub name: std::string::String,
2378
2379 /// Path at which to mount the volume.
2380 ///
2381 /// Paths must be absolute and cannot conflict with other volume paths on the
2382 /// same build step or with certain reserved volume paths.
2383 pub path: std::string::String,
2384
2385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2386}
2387
2388impl Volume {
2389 /// Creates a new default instance.
2390 pub fn new() -> Self {
2391 std::default::Default::default()
2392 }
2393
2394 /// Sets the value of [name][crate::model::Volume::name].
2395 ///
2396 /// # Example
2397 /// ```ignore,no_run
2398 /// # use google_cloud_build_v1::model::Volume;
2399 /// let x = Volume::new().set_name("example");
2400 /// ```
2401 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2402 self.name = v.into();
2403 self
2404 }
2405
2406 /// Sets the value of [path][crate::model::Volume::path].
2407 ///
2408 /// # Example
2409 /// ```ignore,no_run
2410 /// # use google_cloud_build_v1::model::Volume;
2411 /// let x = Volume::new().set_path("example");
2412 /// ```
2413 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2414 self.path = v.into();
2415 self
2416 }
2417}
2418
2419impl wkt::message::Message for Volume {
2420 fn typename() -> &'static str {
2421 "type.googleapis.com/google.devtools.cloudbuild.v1.Volume"
2422 }
2423}
2424
2425/// Artifacts created by the build pipeline.
2426#[derive(Clone, Default, PartialEq)]
2427#[non_exhaustive]
2428pub struct Results {
2429 /// Container images that were built as a part of the build.
2430 pub images: std::vec::Vec<crate::model::BuiltImage>,
2431
2432 /// List of build step digests, in the order corresponding to build step
2433 /// indices.
2434 pub build_step_images: std::vec::Vec<std::string::String>,
2435
2436 /// Path to the artifact manifest for non-container artifacts uploaded to Cloud
2437 /// Storage. Only populated when artifacts are uploaded to Cloud Storage.
2438 pub artifact_manifest: std::string::String,
2439
2440 /// Number of non-container artifacts uploaded to Cloud Storage. Only populated
2441 /// when artifacts are uploaded to Cloud Storage.
2442 pub num_artifacts: i64,
2443
2444 /// List of build step outputs, produced by builder images, in the order
2445 /// corresponding to build step indices.
2446 ///
2447 /// [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders)
2448 /// can produce this output by writing to `$BUILDER_OUTPUT/output`. Only the
2449 /// first 50KB of data is stored. Note that the `$BUILDER_OUTPUT` variable is
2450 /// read-only and can't be substituted.
2451 pub build_step_outputs: std::vec::Vec<::bytes::Bytes>,
2452
2453 /// Time to push all non-container artifacts to Cloud Storage.
2454 pub artifact_timing: std::option::Option<crate::model::TimeSpan>,
2455
2456 /// Python artifacts uploaded to Artifact Registry at the end of the build.
2457 pub python_packages: std::vec::Vec<crate::model::UploadedPythonPackage>,
2458
2459 /// Maven artifacts uploaded to Artifact Registry at the end of the build.
2460 pub maven_artifacts: std::vec::Vec<crate::model::UploadedMavenArtifact>,
2461
2462 /// Optional. Go module artifacts uploaded to Artifact Registry at the end of
2463 /// the build.
2464 pub go_modules: std::vec::Vec<crate::model::UploadedGoModule>,
2465
2466 /// Npm packages uploaded to Artifact Registry at the end of the build.
2467 pub npm_packages: std::vec::Vec<crate::model::UploadedNpmPackage>,
2468
2469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2470}
2471
2472impl Results {
2473 /// Creates a new default instance.
2474 pub fn new() -> Self {
2475 std::default::Default::default()
2476 }
2477
2478 /// Sets the value of [images][crate::model::Results::images].
2479 ///
2480 /// # Example
2481 /// ```ignore,no_run
2482 /// # use google_cloud_build_v1::model::Results;
2483 /// use google_cloud_build_v1::model::BuiltImage;
2484 /// let x = Results::new()
2485 /// .set_images([
2486 /// BuiltImage::default()/* use setters */,
2487 /// BuiltImage::default()/* use (different) setters */,
2488 /// ]);
2489 /// ```
2490 pub fn set_images<T, V>(mut self, v: T) -> Self
2491 where
2492 T: std::iter::IntoIterator<Item = V>,
2493 V: std::convert::Into<crate::model::BuiltImage>,
2494 {
2495 use std::iter::Iterator;
2496 self.images = v.into_iter().map(|i| i.into()).collect();
2497 self
2498 }
2499
2500 /// Sets the value of [build_step_images][crate::model::Results::build_step_images].
2501 ///
2502 /// # Example
2503 /// ```ignore,no_run
2504 /// # use google_cloud_build_v1::model::Results;
2505 /// let x = Results::new().set_build_step_images(["a", "b", "c"]);
2506 /// ```
2507 pub fn set_build_step_images<T, V>(mut self, v: T) -> Self
2508 where
2509 T: std::iter::IntoIterator<Item = V>,
2510 V: std::convert::Into<std::string::String>,
2511 {
2512 use std::iter::Iterator;
2513 self.build_step_images = v.into_iter().map(|i| i.into()).collect();
2514 self
2515 }
2516
2517 /// Sets the value of [artifact_manifest][crate::model::Results::artifact_manifest].
2518 ///
2519 /// # Example
2520 /// ```ignore,no_run
2521 /// # use google_cloud_build_v1::model::Results;
2522 /// let x = Results::new().set_artifact_manifest("example");
2523 /// ```
2524 pub fn set_artifact_manifest<T: std::convert::Into<std::string::String>>(
2525 mut self,
2526 v: T,
2527 ) -> Self {
2528 self.artifact_manifest = v.into();
2529 self
2530 }
2531
2532 /// Sets the value of [num_artifacts][crate::model::Results::num_artifacts].
2533 ///
2534 /// # Example
2535 /// ```ignore,no_run
2536 /// # use google_cloud_build_v1::model::Results;
2537 /// let x = Results::new().set_num_artifacts(42);
2538 /// ```
2539 pub fn set_num_artifacts<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2540 self.num_artifacts = v.into();
2541 self
2542 }
2543
2544 /// Sets the value of [build_step_outputs][crate::model::Results::build_step_outputs].
2545 ///
2546 /// # Example
2547 /// ```ignore,no_run
2548 /// # use google_cloud_build_v1::model::Results;
2549 /// let b1 = bytes::Bytes::from_static(b"abc");
2550 /// let b2 = bytes::Bytes::from_static(b"xyz");
2551 /// let x = Results::new().set_build_step_outputs([b1, b2]);
2552 /// ```
2553 pub fn set_build_step_outputs<T, V>(mut self, v: T) -> Self
2554 where
2555 T: std::iter::IntoIterator<Item = V>,
2556 V: std::convert::Into<::bytes::Bytes>,
2557 {
2558 use std::iter::Iterator;
2559 self.build_step_outputs = v.into_iter().map(|i| i.into()).collect();
2560 self
2561 }
2562
2563 /// Sets the value of [artifact_timing][crate::model::Results::artifact_timing].
2564 ///
2565 /// # Example
2566 /// ```ignore,no_run
2567 /// # use google_cloud_build_v1::model::Results;
2568 /// use google_cloud_build_v1::model::TimeSpan;
2569 /// let x = Results::new().set_artifact_timing(TimeSpan::default()/* use setters */);
2570 /// ```
2571 pub fn set_artifact_timing<T>(mut self, v: T) -> Self
2572 where
2573 T: std::convert::Into<crate::model::TimeSpan>,
2574 {
2575 self.artifact_timing = std::option::Option::Some(v.into());
2576 self
2577 }
2578
2579 /// Sets or clears the value of [artifact_timing][crate::model::Results::artifact_timing].
2580 ///
2581 /// # Example
2582 /// ```ignore,no_run
2583 /// # use google_cloud_build_v1::model::Results;
2584 /// use google_cloud_build_v1::model::TimeSpan;
2585 /// let x = Results::new().set_or_clear_artifact_timing(Some(TimeSpan::default()/* use setters */));
2586 /// let x = Results::new().set_or_clear_artifact_timing(None::<TimeSpan>);
2587 /// ```
2588 pub fn set_or_clear_artifact_timing<T>(mut self, v: std::option::Option<T>) -> Self
2589 where
2590 T: std::convert::Into<crate::model::TimeSpan>,
2591 {
2592 self.artifact_timing = v.map(|x| x.into());
2593 self
2594 }
2595
2596 /// Sets the value of [python_packages][crate::model::Results::python_packages].
2597 ///
2598 /// # Example
2599 /// ```ignore,no_run
2600 /// # use google_cloud_build_v1::model::Results;
2601 /// use google_cloud_build_v1::model::UploadedPythonPackage;
2602 /// let x = Results::new()
2603 /// .set_python_packages([
2604 /// UploadedPythonPackage::default()/* use setters */,
2605 /// UploadedPythonPackage::default()/* use (different) setters */,
2606 /// ]);
2607 /// ```
2608 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
2609 where
2610 T: std::iter::IntoIterator<Item = V>,
2611 V: std::convert::Into<crate::model::UploadedPythonPackage>,
2612 {
2613 use std::iter::Iterator;
2614 self.python_packages = v.into_iter().map(|i| i.into()).collect();
2615 self
2616 }
2617
2618 /// Sets the value of [maven_artifacts][crate::model::Results::maven_artifacts].
2619 ///
2620 /// # Example
2621 /// ```ignore,no_run
2622 /// # use google_cloud_build_v1::model::Results;
2623 /// use google_cloud_build_v1::model::UploadedMavenArtifact;
2624 /// let x = Results::new()
2625 /// .set_maven_artifacts([
2626 /// UploadedMavenArtifact::default()/* use setters */,
2627 /// UploadedMavenArtifact::default()/* use (different) setters */,
2628 /// ]);
2629 /// ```
2630 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
2631 where
2632 T: std::iter::IntoIterator<Item = V>,
2633 V: std::convert::Into<crate::model::UploadedMavenArtifact>,
2634 {
2635 use std::iter::Iterator;
2636 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
2637 self
2638 }
2639
2640 /// Sets the value of [go_modules][crate::model::Results::go_modules].
2641 ///
2642 /// # Example
2643 /// ```ignore,no_run
2644 /// # use google_cloud_build_v1::model::Results;
2645 /// use google_cloud_build_v1::model::UploadedGoModule;
2646 /// let x = Results::new()
2647 /// .set_go_modules([
2648 /// UploadedGoModule::default()/* use setters */,
2649 /// UploadedGoModule::default()/* use (different) setters */,
2650 /// ]);
2651 /// ```
2652 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
2653 where
2654 T: std::iter::IntoIterator<Item = V>,
2655 V: std::convert::Into<crate::model::UploadedGoModule>,
2656 {
2657 use std::iter::Iterator;
2658 self.go_modules = v.into_iter().map(|i| i.into()).collect();
2659 self
2660 }
2661
2662 /// Sets the value of [npm_packages][crate::model::Results::npm_packages].
2663 ///
2664 /// # Example
2665 /// ```ignore,no_run
2666 /// # use google_cloud_build_v1::model::Results;
2667 /// use google_cloud_build_v1::model::UploadedNpmPackage;
2668 /// let x = Results::new()
2669 /// .set_npm_packages([
2670 /// UploadedNpmPackage::default()/* use setters */,
2671 /// UploadedNpmPackage::default()/* use (different) setters */,
2672 /// ]);
2673 /// ```
2674 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
2675 where
2676 T: std::iter::IntoIterator<Item = V>,
2677 V: std::convert::Into<crate::model::UploadedNpmPackage>,
2678 {
2679 use std::iter::Iterator;
2680 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
2681 self
2682 }
2683}
2684
2685impl wkt::message::Message for Results {
2686 fn typename() -> &'static str {
2687 "type.googleapis.com/google.devtools.cloudbuild.v1.Results"
2688 }
2689}
2690
2691/// An artifact that was uploaded during a build. This
2692/// is a single record in the artifact manifest JSON file.
2693#[derive(Clone, Default, PartialEq)]
2694#[non_exhaustive]
2695pub struct ArtifactResult {
2696 /// The path of an artifact in a Cloud Storage bucket, with the
2697 /// generation number. For example,
2698 /// `gs://mybucket/path/to/output.jar#generation`.
2699 pub location: std::string::String,
2700
2701 /// The file hash of the artifact.
2702 pub file_hash: std::vec::Vec<crate::model::FileHashes>,
2703
2704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2705}
2706
2707impl ArtifactResult {
2708 /// Creates a new default instance.
2709 pub fn new() -> Self {
2710 std::default::Default::default()
2711 }
2712
2713 /// Sets the value of [location][crate::model::ArtifactResult::location].
2714 ///
2715 /// # Example
2716 /// ```ignore,no_run
2717 /// # use google_cloud_build_v1::model::ArtifactResult;
2718 /// let x = ArtifactResult::new().set_location("example");
2719 /// ```
2720 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2721 self.location = v.into();
2722 self
2723 }
2724
2725 /// Sets the value of [file_hash][crate::model::ArtifactResult::file_hash].
2726 ///
2727 /// # Example
2728 /// ```ignore,no_run
2729 /// # use google_cloud_build_v1::model::ArtifactResult;
2730 /// use google_cloud_build_v1::model::FileHashes;
2731 /// let x = ArtifactResult::new()
2732 /// .set_file_hash([
2733 /// FileHashes::default()/* use setters */,
2734 /// FileHashes::default()/* use (different) setters */,
2735 /// ]);
2736 /// ```
2737 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
2738 where
2739 T: std::iter::IntoIterator<Item = V>,
2740 V: std::convert::Into<crate::model::FileHashes>,
2741 {
2742 use std::iter::Iterator;
2743 self.file_hash = v.into_iter().map(|i| i.into()).collect();
2744 self
2745 }
2746}
2747
2748impl wkt::message::Message for ArtifactResult {
2749 fn typename() -> &'static str {
2750 "type.googleapis.com/google.devtools.cloudbuild.v1.ArtifactResult"
2751 }
2752}
2753
2754/// A build resource in the Cloud Build API.
2755///
2756/// At a high level, a `Build` describes where to find source code, how to build
2757/// it (for example, the builder image to run on the source), and where to store
2758/// the built artifacts.
2759///
2760/// Fields can include the following variables, which will be expanded when the
2761/// build is created:
2762///
2763/// - $PROJECT_ID: the project ID of the build.
2764/// - $PROJECT_NUMBER: the project number of the build.
2765/// - $LOCATION: the location/region of the build.
2766/// - $BUILD_ID: the autogenerated ID of the build.
2767/// - $REPO_NAME: the source repository name specified by RepoSource.
2768/// - $BRANCH_NAME: the branch name specified by RepoSource.
2769/// - $TAG_NAME: the tag name specified by RepoSource.
2770/// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or
2771/// resolved from the specified branch or tag.
2772/// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA.
2773#[derive(Clone, Default, PartialEq)]
2774#[non_exhaustive]
2775pub struct Build {
2776 /// Output only. The 'Build' name with format:
2777 /// `projects/{project}/locations/{location}/builds/{build}`, where {build}
2778 /// is a unique identifier generated by the service.
2779 pub name: std::string::String,
2780
2781 /// Output only. Unique identifier of the build.
2782 pub id: std::string::String,
2783
2784 /// Output only. ID of the project.
2785 pub project_id: std::string::String,
2786
2787 /// Output only. Status of the build.
2788 pub status: crate::model::build::Status,
2789
2790 /// Output only. Customer-readable message about the current status.
2791 pub status_detail: std::string::String,
2792
2793 /// Optional. The location of the source files to build.
2794 pub source: std::option::Option<crate::model::Source>,
2795
2796 /// Required. The operations to be performed on the workspace.
2797 pub steps: std::vec::Vec<crate::model::BuildStep>,
2798
2799 /// Output only. Results of the build.
2800 pub results: std::option::Option<crate::model::Results>,
2801
2802 /// Output only. Time at which the request to create the build was received.
2803 pub create_time: std::option::Option<wkt::Timestamp>,
2804
2805 /// Output only. Time at which execution of the build was started.
2806 pub start_time: std::option::Option<wkt::Timestamp>,
2807
2808 /// Output only. Time at which execution of the build was finished.
2809 ///
2810 /// The difference between finish_time and start_time is the duration of the
2811 /// build's execution.
2812 pub finish_time: std::option::Option<wkt::Timestamp>,
2813
2814 /// Amount of time that this build should be allowed to run, to second
2815 /// granularity. If this amount of time elapses, work on the build will cease
2816 /// and the build status will be `TIMEOUT`.
2817 ///
2818 /// `timeout` starts ticking from `startTime`.
2819 ///
2820 /// Default time is 60 minutes.
2821 pub timeout: std::option::Option<wkt::Duration>,
2822
2823 /// A list of images to be pushed upon the successful completion of all build
2824 /// steps.
2825 ///
2826 /// The images are pushed using the builder service account's credentials.
2827 ///
2828 /// The digests of the pushed images will be stored in the `Build` resource's
2829 /// results field.
2830 ///
2831 /// If any of the images fail to be pushed, the build status is marked
2832 /// `FAILURE`.
2833 pub images: std::vec::Vec<std::string::String>,
2834
2835 /// TTL in queue for this build. If provided and the build is enqueued longer
2836 /// than this value, the build will expire and the build status will be
2837 /// `EXPIRED`.
2838 ///
2839 /// The TTL starts ticking from create_time.
2840 pub queue_ttl: std::option::Option<wkt::Duration>,
2841
2842 /// Artifacts produced by the build that should be uploaded upon
2843 /// successful completion of all build steps.
2844 pub artifacts: std::option::Option<crate::model::Artifacts>,
2845
2846 /// Cloud Storage bucket where logs should be written (see
2847 /// [Bucket Name
2848 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
2849 /// Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`.
2850 pub logs_bucket: std::string::String,
2851
2852 /// Output only. A permanent fixed identifier for source.
2853 pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
2854
2855 /// Output only. The ID of the `BuildTrigger` that triggered this build, if it
2856 /// was triggered automatically.
2857 pub build_trigger_id: std::string::String,
2858
2859 /// Special options for this build.
2860 pub options: std::option::Option<crate::model::BuildOptions>,
2861
2862 /// Output only. URL to logs for this build in Google Cloud Console.
2863 pub log_url: std::string::String,
2864
2865 /// Substitutions data for `Build` resource.
2866 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
2867
2868 /// Tags for annotation of a `Build`. These are not docker tags.
2869 pub tags: std::vec::Vec<std::string::String>,
2870
2871 /// Secrets to decrypt using Cloud Key Management Service.
2872 /// Note: Secret Manager is the recommended technique
2873 /// for managing sensitive data with Cloud Build. Use `available_secrets` to
2874 /// configure builds to access secrets from Secret Manager. For instructions,
2875 /// see: <https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets>
2876 pub secrets: std::vec::Vec<crate::model::Secret>,
2877
2878 /// Output only. Stores timing information for phases of the build. Valid keys
2879 /// are:
2880 ///
2881 /// * BUILD: time to execute all build steps.
2882 /// * PUSH: time to push all artifacts including docker images and non docker
2883 /// artifacts.
2884 /// * FETCHSOURCE: time to fetch source.
2885 /// * SETUPBUILD: time to set up build.
2886 ///
2887 /// If the build does not specify source or images,
2888 /// these keys will not be included.
2889 pub timing: std::collections::HashMap<std::string::String, crate::model::TimeSpan>,
2890
2891 /// Output only. Describes this build's approval configuration, status,
2892 /// and result.
2893 pub approval: std::option::Option<crate::model::BuildApproval>,
2894
2895 /// IAM service account whose credentials will be used at build runtime.
2896 /// Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
2897 /// ACCOUNT can be email address or uniqueId of the service account.
2898 pub service_account: std::string::String,
2899
2900 /// Secrets and secret environment variables.
2901 pub available_secrets: std::option::Option<crate::model::Secrets>,
2902
2903 /// Output only. Non-fatal problems encountered during the execution of the
2904 /// build.
2905 pub warnings: std::vec::Vec<crate::model::build::Warning>,
2906
2907 /// Optional. Configuration for git operations.
2908 pub git_config: std::option::Option<crate::model::GitConfig>,
2909
2910 /// Output only. Contains information about the build when status=FAILURE.
2911 pub failure_info: std::option::Option<crate::model::build::FailureInfo>,
2912
2913 /// Optional. Dependencies that the Cloud Build worker will fetch before
2914 /// executing user steps.
2915 pub dependencies: std::vec::Vec<crate::model::Dependency>,
2916
2917 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2918}
2919
2920impl Build {
2921 /// Creates a new default instance.
2922 pub fn new() -> Self {
2923 std::default::Default::default()
2924 }
2925
2926 /// Sets the value of [name][crate::model::Build::name].
2927 ///
2928 /// # Example
2929 /// ```ignore,no_run
2930 /// # use google_cloud_build_v1::model::Build;
2931 /// # let project_id = "project_id";
2932 /// # let build_id = "build_id";
2933 /// let x = Build::new().set_name(format!("projects/{project_id}/builds/{build_id}"));
2934 /// ```
2935 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2936 self.name = v.into();
2937 self
2938 }
2939
2940 /// Sets the value of [id][crate::model::Build::id].
2941 ///
2942 /// # Example
2943 /// ```ignore,no_run
2944 /// # use google_cloud_build_v1::model::Build;
2945 /// let x = Build::new().set_id("example");
2946 /// ```
2947 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2948 self.id = v.into();
2949 self
2950 }
2951
2952 /// Sets the value of [project_id][crate::model::Build::project_id].
2953 ///
2954 /// # Example
2955 /// ```ignore,no_run
2956 /// # use google_cloud_build_v1::model::Build;
2957 /// let x = Build::new().set_project_id("example");
2958 /// ```
2959 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2960 self.project_id = v.into();
2961 self
2962 }
2963
2964 /// Sets the value of [status][crate::model::Build::status].
2965 ///
2966 /// # Example
2967 /// ```ignore,no_run
2968 /// # use google_cloud_build_v1::model::Build;
2969 /// use google_cloud_build_v1::model::build::Status;
2970 /// let x0 = Build::new().set_status(Status::Pending);
2971 /// let x1 = Build::new().set_status(Status::Queued);
2972 /// let x2 = Build::new().set_status(Status::Working);
2973 /// ```
2974 pub fn set_status<T: std::convert::Into<crate::model::build::Status>>(mut self, v: T) -> Self {
2975 self.status = v.into();
2976 self
2977 }
2978
2979 /// Sets the value of [status_detail][crate::model::Build::status_detail].
2980 ///
2981 /// # Example
2982 /// ```ignore,no_run
2983 /// # use google_cloud_build_v1::model::Build;
2984 /// let x = Build::new().set_status_detail("example");
2985 /// ```
2986 pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2987 self.status_detail = v.into();
2988 self
2989 }
2990
2991 /// Sets the value of [source][crate::model::Build::source].
2992 ///
2993 /// # Example
2994 /// ```ignore,no_run
2995 /// # use google_cloud_build_v1::model::Build;
2996 /// use google_cloud_build_v1::model::Source;
2997 /// let x = Build::new().set_source(Source::default()/* use setters */);
2998 /// ```
2999 pub fn set_source<T>(mut self, v: T) -> Self
3000 where
3001 T: std::convert::Into<crate::model::Source>,
3002 {
3003 self.source = std::option::Option::Some(v.into());
3004 self
3005 }
3006
3007 /// Sets or clears the value of [source][crate::model::Build::source].
3008 ///
3009 /// # Example
3010 /// ```ignore,no_run
3011 /// # use google_cloud_build_v1::model::Build;
3012 /// use google_cloud_build_v1::model::Source;
3013 /// let x = Build::new().set_or_clear_source(Some(Source::default()/* use setters */));
3014 /// let x = Build::new().set_or_clear_source(None::<Source>);
3015 /// ```
3016 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
3017 where
3018 T: std::convert::Into<crate::model::Source>,
3019 {
3020 self.source = v.map(|x| x.into());
3021 self
3022 }
3023
3024 /// Sets the value of [steps][crate::model::Build::steps].
3025 ///
3026 /// # Example
3027 /// ```ignore,no_run
3028 /// # use google_cloud_build_v1::model::Build;
3029 /// use google_cloud_build_v1::model::BuildStep;
3030 /// let x = Build::new()
3031 /// .set_steps([
3032 /// BuildStep::default()/* use setters */,
3033 /// BuildStep::default()/* use (different) setters */,
3034 /// ]);
3035 /// ```
3036 pub fn set_steps<T, V>(mut self, v: T) -> Self
3037 where
3038 T: std::iter::IntoIterator<Item = V>,
3039 V: std::convert::Into<crate::model::BuildStep>,
3040 {
3041 use std::iter::Iterator;
3042 self.steps = v.into_iter().map(|i| i.into()).collect();
3043 self
3044 }
3045
3046 /// Sets the value of [results][crate::model::Build::results].
3047 ///
3048 /// # Example
3049 /// ```ignore,no_run
3050 /// # use google_cloud_build_v1::model::Build;
3051 /// use google_cloud_build_v1::model::Results;
3052 /// let x = Build::new().set_results(Results::default()/* use setters */);
3053 /// ```
3054 pub fn set_results<T>(mut self, v: T) -> Self
3055 where
3056 T: std::convert::Into<crate::model::Results>,
3057 {
3058 self.results = std::option::Option::Some(v.into());
3059 self
3060 }
3061
3062 /// Sets or clears the value of [results][crate::model::Build::results].
3063 ///
3064 /// # Example
3065 /// ```ignore,no_run
3066 /// # use google_cloud_build_v1::model::Build;
3067 /// use google_cloud_build_v1::model::Results;
3068 /// let x = Build::new().set_or_clear_results(Some(Results::default()/* use setters */));
3069 /// let x = Build::new().set_or_clear_results(None::<Results>);
3070 /// ```
3071 pub fn set_or_clear_results<T>(mut self, v: std::option::Option<T>) -> Self
3072 where
3073 T: std::convert::Into<crate::model::Results>,
3074 {
3075 self.results = v.map(|x| x.into());
3076 self
3077 }
3078
3079 /// Sets the value of [create_time][crate::model::Build::create_time].
3080 ///
3081 /// # Example
3082 /// ```ignore,no_run
3083 /// # use google_cloud_build_v1::model::Build;
3084 /// use wkt::Timestamp;
3085 /// let x = Build::new().set_create_time(Timestamp::default()/* use setters */);
3086 /// ```
3087 pub fn set_create_time<T>(mut self, v: T) -> Self
3088 where
3089 T: std::convert::Into<wkt::Timestamp>,
3090 {
3091 self.create_time = std::option::Option::Some(v.into());
3092 self
3093 }
3094
3095 /// Sets or clears the value of [create_time][crate::model::Build::create_time].
3096 ///
3097 /// # Example
3098 /// ```ignore,no_run
3099 /// # use google_cloud_build_v1::model::Build;
3100 /// use wkt::Timestamp;
3101 /// let x = Build::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3102 /// let x = Build::new().set_or_clear_create_time(None::<Timestamp>);
3103 /// ```
3104 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3105 where
3106 T: std::convert::Into<wkt::Timestamp>,
3107 {
3108 self.create_time = v.map(|x| x.into());
3109 self
3110 }
3111
3112 /// Sets the value of [start_time][crate::model::Build::start_time].
3113 ///
3114 /// # Example
3115 /// ```ignore,no_run
3116 /// # use google_cloud_build_v1::model::Build;
3117 /// use wkt::Timestamp;
3118 /// let x = Build::new().set_start_time(Timestamp::default()/* use setters */);
3119 /// ```
3120 pub fn set_start_time<T>(mut self, v: T) -> Self
3121 where
3122 T: std::convert::Into<wkt::Timestamp>,
3123 {
3124 self.start_time = std::option::Option::Some(v.into());
3125 self
3126 }
3127
3128 /// Sets or clears the value of [start_time][crate::model::Build::start_time].
3129 ///
3130 /// # Example
3131 /// ```ignore,no_run
3132 /// # use google_cloud_build_v1::model::Build;
3133 /// use wkt::Timestamp;
3134 /// let x = Build::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3135 /// let x = Build::new().set_or_clear_start_time(None::<Timestamp>);
3136 /// ```
3137 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3138 where
3139 T: std::convert::Into<wkt::Timestamp>,
3140 {
3141 self.start_time = v.map(|x| x.into());
3142 self
3143 }
3144
3145 /// Sets the value of [finish_time][crate::model::Build::finish_time].
3146 ///
3147 /// # Example
3148 /// ```ignore,no_run
3149 /// # use google_cloud_build_v1::model::Build;
3150 /// use wkt::Timestamp;
3151 /// let x = Build::new().set_finish_time(Timestamp::default()/* use setters */);
3152 /// ```
3153 pub fn set_finish_time<T>(mut self, v: T) -> Self
3154 where
3155 T: std::convert::Into<wkt::Timestamp>,
3156 {
3157 self.finish_time = std::option::Option::Some(v.into());
3158 self
3159 }
3160
3161 /// Sets or clears the value of [finish_time][crate::model::Build::finish_time].
3162 ///
3163 /// # Example
3164 /// ```ignore,no_run
3165 /// # use google_cloud_build_v1::model::Build;
3166 /// use wkt::Timestamp;
3167 /// let x = Build::new().set_or_clear_finish_time(Some(Timestamp::default()/* use setters */));
3168 /// let x = Build::new().set_or_clear_finish_time(None::<Timestamp>);
3169 /// ```
3170 pub fn set_or_clear_finish_time<T>(mut self, v: std::option::Option<T>) -> Self
3171 where
3172 T: std::convert::Into<wkt::Timestamp>,
3173 {
3174 self.finish_time = v.map(|x| x.into());
3175 self
3176 }
3177
3178 /// Sets the value of [timeout][crate::model::Build::timeout].
3179 ///
3180 /// # Example
3181 /// ```ignore,no_run
3182 /// # use google_cloud_build_v1::model::Build;
3183 /// use wkt::Duration;
3184 /// let x = Build::new().set_timeout(Duration::default()/* use setters */);
3185 /// ```
3186 pub fn set_timeout<T>(mut self, v: T) -> Self
3187 where
3188 T: std::convert::Into<wkt::Duration>,
3189 {
3190 self.timeout = std::option::Option::Some(v.into());
3191 self
3192 }
3193
3194 /// Sets or clears the value of [timeout][crate::model::Build::timeout].
3195 ///
3196 /// # Example
3197 /// ```ignore,no_run
3198 /// # use google_cloud_build_v1::model::Build;
3199 /// use wkt::Duration;
3200 /// let x = Build::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
3201 /// let x = Build::new().set_or_clear_timeout(None::<Duration>);
3202 /// ```
3203 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3204 where
3205 T: std::convert::Into<wkt::Duration>,
3206 {
3207 self.timeout = v.map(|x| x.into());
3208 self
3209 }
3210
3211 /// Sets the value of [images][crate::model::Build::images].
3212 ///
3213 /// # Example
3214 /// ```ignore,no_run
3215 /// # use google_cloud_build_v1::model::Build;
3216 /// let x = Build::new().set_images(["a", "b", "c"]);
3217 /// ```
3218 pub fn set_images<T, V>(mut self, v: T) -> Self
3219 where
3220 T: std::iter::IntoIterator<Item = V>,
3221 V: std::convert::Into<std::string::String>,
3222 {
3223 use std::iter::Iterator;
3224 self.images = v.into_iter().map(|i| i.into()).collect();
3225 self
3226 }
3227
3228 /// Sets the value of [queue_ttl][crate::model::Build::queue_ttl].
3229 ///
3230 /// # Example
3231 /// ```ignore,no_run
3232 /// # use google_cloud_build_v1::model::Build;
3233 /// use wkt::Duration;
3234 /// let x = Build::new().set_queue_ttl(Duration::default()/* use setters */);
3235 /// ```
3236 pub fn set_queue_ttl<T>(mut self, v: T) -> Self
3237 where
3238 T: std::convert::Into<wkt::Duration>,
3239 {
3240 self.queue_ttl = std::option::Option::Some(v.into());
3241 self
3242 }
3243
3244 /// Sets or clears the value of [queue_ttl][crate::model::Build::queue_ttl].
3245 ///
3246 /// # Example
3247 /// ```ignore,no_run
3248 /// # use google_cloud_build_v1::model::Build;
3249 /// use wkt::Duration;
3250 /// let x = Build::new().set_or_clear_queue_ttl(Some(Duration::default()/* use setters */));
3251 /// let x = Build::new().set_or_clear_queue_ttl(None::<Duration>);
3252 /// ```
3253 pub fn set_or_clear_queue_ttl<T>(mut self, v: std::option::Option<T>) -> Self
3254 where
3255 T: std::convert::Into<wkt::Duration>,
3256 {
3257 self.queue_ttl = v.map(|x| x.into());
3258 self
3259 }
3260
3261 /// Sets the value of [artifacts][crate::model::Build::artifacts].
3262 ///
3263 /// # Example
3264 /// ```ignore,no_run
3265 /// # use google_cloud_build_v1::model::Build;
3266 /// use google_cloud_build_v1::model::Artifacts;
3267 /// let x = Build::new().set_artifacts(Artifacts::default()/* use setters */);
3268 /// ```
3269 pub fn set_artifacts<T>(mut self, v: T) -> Self
3270 where
3271 T: std::convert::Into<crate::model::Artifacts>,
3272 {
3273 self.artifacts = std::option::Option::Some(v.into());
3274 self
3275 }
3276
3277 /// Sets or clears the value of [artifacts][crate::model::Build::artifacts].
3278 ///
3279 /// # Example
3280 /// ```ignore,no_run
3281 /// # use google_cloud_build_v1::model::Build;
3282 /// use google_cloud_build_v1::model::Artifacts;
3283 /// let x = Build::new().set_or_clear_artifacts(Some(Artifacts::default()/* use setters */));
3284 /// let x = Build::new().set_or_clear_artifacts(None::<Artifacts>);
3285 /// ```
3286 pub fn set_or_clear_artifacts<T>(mut self, v: std::option::Option<T>) -> Self
3287 where
3288 T: std::convert::Into<crate::model::Artifacts>,
3289 {
3290 self.artifacts = v.map(|x| x.into());
3291 self
3292 }
3293
3294 /// Sets the value of [logs_bucket][crate::model::Build::logs_bucket].
3295 ///
3296 /// # Example
3297 /// ```ignore,no_run
3298 /// # use google_cloud_build_v1::model::Build;
3299 /// let x = Build::new().set_logs_bucket("example");
3300 /// ```
3301 pub fn set_logs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3302 self.logs_bucket = v.into();
3303 self
3304 }
3305
3306 /// Sets the value of [source_provenance][crate::model::Build::source_provenance].
3307 ///
3308 /// # Example
3309 /// ```ignore,no_run
3310 /// # use google_cloud_build_v1::model::Build;
3311 /// use google_cloud_build_v1::model::SourceProvenance;
3312 /// let x = Build::new().set_source_provenance(SourceProvenance::default()/* use setters */);
3313 /// ```
3314 pub fn set_source_provenance<T>(mut self, v: T) -> Self
3315 where
3316 T: std::convert::Into<crate::model::SourceProvenance>,
3317 {
3318 self.source_provenance = std::option::Option::Some(v.into());
3319 self
3320 }
3321
3322 /// Sets or clears the value of [source_provenance][crate::model::Build::source_provenance].
3323 ///
3324 /// # Example
3325 /// ```ignore,no_run
3326 /// # use google_cloud_build_v1::model::Build;
3327 /// use google_cloud_build_v1::model::SourceProvenance;
3328 /// let x = Build::new().set_or_clear_source_provenance(Some(SourceProvenance::default()/* use setters */));
3329 /// let x = Build::new().set_or_clear_source_provenance(None::<SourceProvenance>);
3330 /// ```
3331 pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3332 where
3333 T: std::convert::Into<crate::model::SourceProvenance>,
3334 {
3335 self.source_provenance = v.map(|x| x.into());
3336 self
3337 }
3338
3339 /// Sets the value of [build_trigger_id][crate::model::Build::build_trigger_id].
3340 ///
3341 /// # Example
3342 /// ```ignore,no_run
3343 /// # use google_cloud_build_v1::model::Build;
3344 /// let x = Build::new().set_build_trigger_id("example");
3345 /// ```
3346 pub fn set_build_trigger_id<T: std::convert::Into<std::string::String>>(
3347 mut self,
3348 v: T,
3349 ) -> Self {
3350 self.build_trigger_id = v.into();
3351 self
3352 }
3353
3354 /// Sets the value of [options][crate::model::Build::options].
3355 ///
3356 /// # Example
3357 /// ```ignore,no_run
3358 /// # use google_cloud_build_v1::model::Build;
3359 /// use google_cloud_build_v1::model::BuildOptions;
3360 /// let x = Build::new().set_options(BuildOptions::default()/* use setters */);
3361 /// ```
3362 pub fn set_options<T>(mut self, v: T) -> Self
3363 where
3364 T: std::convert::Into<crate::model::BuildOptions>,
3365 {
3366 self.options = std::option::Option::Some(v.into());
3367 self
3368 }
3369
3370 /// Sets or clears the value of [options][crate::model::Build::options].
3371 ///
3372 /// # Example
3373 /// ```ignore,no_run
3374 /// # use google_cloud_build_v1::model::Build;
3375 /// use google_cloud_build_v1::model::BuildOptions;
3376 /// let x = Build::new().set_or_clear_options(Some(BuildOptions::default()/* use setters */));
3377 /// let x = Build::new().set_or_clear_options(None::<BuildOptions>);
3378 /// ```
3379 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3380 where
3381 T: std::convert::Into<crate::model::BuildOptions>,
3382 {
3383 self.options = v.map(|x| x.into());
3384 self
3385 }
3386
3387 /// Sets the value of [log_url][crate::model::Build::log_url].
3388 ///
3389 /// # Example
3390 /// ```ignore,no_run
3391 /// # use google_cloud_build_v1::model::Build;
3392 /// let x = Build::new().set_log_url("example");
3393 /// ```
3394 pub fn set_log_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3395 self.log_url = v.into();
3396 self
3397 }
3398
3399 /// Sets the value of [substitutions][crate::model::Build::substitutions].
3400 ///
3401 /// # Example
3402 /// ```ignore,no_run
3403 /// # use google_cloud_build_v1::model::Build;
3404 /// let x = Build::new().set_substitutions([
3405 /// ("key0", "abc"),
3406 /// ("key1", "xyz"),
3407 /// ]);
3408 /// ```
3409 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
3410 where
3411 T: std::iter::IntoIterator<Item = (K, V)>,
3412 K: std::convert::Into<std::string::String>,
3413 V: std::convert::Into<std::string::String>,
3414 {
3415 use std::iter::Iterator;
3416 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3417 self
3418 }
3419
3420 /// Sets the value of [tags][crate::model::Build::tags].
3421 ///
3422 /// # Example
3423 /// ```ignore,no_run
3424 /// # use google_cloud_build_v1::model::Build;
3425 /// let x = Build::new().set_tags(["a", "b", "c"]);
3426 /// ```
3427 pub fn set_tags<T, V>(mut self, v: T) -> Self
3428 where
3429 T: std::iter::IntoIterator<Item = V>,
3430 V: std::convert::Into<std::string::String>,
3431 {
3432 use std::iter::Iterator;
3433 self.tags = v.into_iter().map(|i| i.into()).collect();
3434 self
3435 }
3436
3437 /// Sets the value of [secrets][crate::model::Build::secrets].
3438 ///
3439 /// # Example
3440 /// ```ignore,no_run
3441 /// # use google_cloud_build_v1::model::Build;
3442 /// use google_cloud_build_v1::model::Secret;
3443 /// let x = Build::new()
3444 /// .set_secrets([
3445 /// Secret::default()/* use setters */,
3446 /// Secret::default()/* use (different) setters */,
3447 /// ]);
3448 /// ```
3449 pub fn set_secrets<T, V>(mut self, v: T) -> Self
3450 where
3451 T: std::iter::IntoIterator<Item = V>,
3452 V: std::convert::Into<crate::model::Secret>,
3453 {
3454 use std::iter::Iterator;
3455 self.secrets = v.into_iter().map(|i| i.into()).collect();
3456 self
3457 }
3458
3459 /// Sets the value of [timing][crate::model::Build::timing].
3460 ///
3461 /// # Example
3462 /// ```ignore,no_run
3463 /// # use google_cloud_build_v1::model::Build;
3464 /// use google_cloud_build_v1::model::TimeSpan;
3465 /// let x = Build::new().set_timing([
3466 /// ("key0", TimeSpan::default()/* use setters */),
3467 /// ("key1", TimeSpan::default()/* use (different) setters */),
3468 /// ]);
3469 /// ```
3470 pub fn set_timing<T, K, V>(mut self, v: T) -> Self
3471 where
3472 T: std::iter::IntoIterator<Item = (K, V)>,
3473 K: std::convert::Into<std::string::String>,
3474 V: std::convert::Into<crate::model::TimeSpan>,
3475 {
3476 use std::iter::Iterator;
3477 self.timing = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3478 self
3479 }
3480
3481 /// Sets the value of [approval][crate::model::Build::approval].
3482 ///
3483 /// # Example
3484 /// ```ignore,no_run
3485 /// # use google_cloud_build_v1::model::Build;
3486 /// use google_cloud_build_v1::model::BuildApproval;
3487 /// let x = Build::new().set_approval(BuildApproval::default()/* use setters */);
3488 /// ```
3489 pub fn set_approval<T>(mut self, v: T) -> Self
3490 where
3491 T: std::convert::Into<crate::model::BuildApproval>,
3492 {
3493 self.approval = std::option::Option::Some(v.into());
3494 self
3495 }
3496
3497 /// Sets or clears the value of [approval][crate::model::Build::approval].
3498 ///
3499 /// # Example
3500 /// ```ignore,no_run
3501 /// # use google_cloud_build_v1::model::Build;
3502 /// use google_cloud_build_v1::model::BuildApproval;
3503 /// let x = Build::new().set_or_clear_approval(Some(BuildApproval::default()/* use setters */));
3504 /// let x = Build::new().set_or_clear_approval(None::<BuildApproval>);
3505 /// ```
3506 pub fn set_or_clear_approval<T>(mut self, v: std::option::Option<T>) -> Self
3507 where
3508 T: std::convert::Into<crate::model::BuildApproval>,
3509 {
3510 self.approval = v.map(|x| x.into());
3511 self
3512 }
3513
3514 /// Sets the value of [service_account][crate::model::Build::service_account].
3515 ///
3516 /// # Example
3517 /// ```ignore,no_run
3518 /// # use google_cloud_build_v1::model::Build;
3519 /// let x = Build::new().set_service_account("example");
3520 /// ```
3521 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3522 self.service_account = v.into();
3523 self
3524 }
3525
3526 /// Sets the value of [available_secrets][crate::model::Build::available_secrets].
3527 ///
3528 /// # Example
3529 /// ```ignore,no_run
3530 /// # use google_cloud_build_v1::model::Build;
3531 /// use google_cloud_build_v1::model::Secrets;
3532 /// let x = Build::new().set_available_secrets(Secrets::default()/* use setters */);
3533 /// ```
3534 pub fn set_available_secrets<T>(mut self, v: T) -> Self
3535 where
3536 T: std::convert::Into<crate::model::Secrets>,
3537 {
3538 self.available_secrets = std::option::Option::Some(v.into());
3539 self
3540 }
3541
3542 /// Sets or clears the value of [available_secrets][crate::model::Build::available_secrets].
3543 ///
3544 /// # Example
3545 /// ```ignore,no_run
3546 /// # use google_cloud_build_v1::model::Build;
3547 /// use google_cloud_build_v1::model::Secrets;
3548 /// let x = Build::new().set_or_clear_available_secrets(Some(Secrets::default()/* use setters */));
3549 /// let x = Build::new().set_or_clear_available_secrets(None::<Secrets>);
3550 /// ```
3551 pub fn set_or_clear_available_secrets<T>(mut self, v: std::option::Option<T>) -> Self
3552 where
3553 T: std::convert::Into<crate::model::Secrets>,
3554 {
3555 self.available_secrets = v.map(|x| x.into());
3556 self
3557 }
3558
3559 /// Sets the value of [warnings][crate::model::Build::warnings].
3560 ///
3561 /// # Example
3562 /// ```ignore,no_run
3563 /// # use google_cloud_build_v1::model::Build;
3564 /// use google_cloud_build_v1::model::build::Warning;
3565 /// let x = Build::new()
3566 /// .set_warnings([
3567 /// Warning::default()/* use setters */,
3568 /// Warning::default()/* use (different) setters */,
3569 /// ]);
3570 /// ```
3571 pub fn set_warnings<T, V>(mut self, v: T) -> Self
3572 where
3573 T: std::iter::IntoIterator<Item = V>,
3574 V: std::convert::Into<crate::model::build::Warning>,
3575 {
3576 use std::iter::Iterator;
3577 self.warnings = v.into_iter().map(|i| i.into()).collect();
3578 self
3579 }
3580
3581 /// Sets the value of [git_config][crate::model::Build::git_config].
3582 ///
3583 /// # Example
3584 /// ```ignore,no_run
3585 /// # use google_cloud_build_v1::model::Build;
3586 /// use google_cloud_build_v1::model::GitConfig;
3587 /// let x = Build::new().set_git_config(GitConfig::default()/* use setters */);
3588 /// ```
3589 pub fn set_git_config<T>(mut self, v: T) -> Self
3590 where
3591 T: std::convert::Into<crate::model::GitConfig>,
3592 {
3593 self.git_config = std::option::Option::Some(v.into());
3594 self
3595 }
3596
3597 /// Sets or clears the value of [git_config][crate::model::Build::git_config].
3598 ///
3599 /// # Example
3600 /// ```ignore,no_run
3601 /// # use google_cloud_build_v1::model::Build;
3602 /// use google_cloud_build_v1::model::GitConfig;
3603 /// let x = Build::new().set_or_clear_git_config(Some(GitConfig::default()/* use setters */));
3604 /// let x = Build::new().set_or_clear_git_config(None::<GitConfig>);
3605 /// ```
3606 pub fn set_or_clear_git_config<T>(mut self, v: std::option::Option<T>) -> Self
3607 where
3608 T: std::convert::Into<crate::model::GitConfig>,
3609 {
3610 self.git_config = v.map(|x| x.into());
3611 self
3612 }
3613
3614 /// Sets the value of [failure_info][crate::model::Build::failure_info].
3615 ///
3616 /// # Example
3617 /// ```ignore,no_run
3618 /// # use google_cloud_build_v1::model::Build;
3619 /// use google_cloud_build_v1::model::build::FailureInfo;
3620 /// let x = Build::new().set_failure_info(FailureInfo::default()/* use setters */);
3621 /// ```
3622 pub fn set_failure_info<T>(mut self, v: T) -> Self
3623 where
3624 T: std::convert::Into<crate::model::build::FailureInfo>,
3625 {
3626 self.failure_info = std::option::Option::Some(v.into());
3627 self
3628 }
3629
3630 /// Sets or clears the value of [failure_info][crate::model::Build::failure_info].
3631 ///
3632 /// # Example
3633 /// ```ignore,no_run
3634 /// # use google_cloud_build_v1::model::Build;
3635 /// use google_cloud_build_v1::model::build::FailureInfo;
3636 /// let x = Build::new().set_or_clear_failure_info(Some(FailureInfo::default()/* use setters */));
3637 /// let x = Build::new().set_or_clear_failure_info(None::<FailureInfo>);
3638 /// ```
3639 pub fn set_or_clear_failure_info<T>(mut self, v: std::option::Option<T>) -> Self
3640 where
3641 T: std::convert::Into<crate::model::build::FailureInfo>,
3642 {
3643 self.failure_info = v.map(|x| x.into());
3644 self
3645 }
3646
3647 /// Sets the value of [dependencies][crate::model::Build::dependencies].
3648 ///
3649 /// # Example
3650 /// ```ignore,no_run
3651 /// # use google_cloud_build_v1::model::Build;
3652 /// use google_cloud_build_v1::model::Dependency;
3653 /// let x = Build::new()
3654 /// .set_dependencies([
3655 /// Dependency::default()/* use setters */,
3656 /// Dependency::default()/* use (different) setters */,
3657 /// ]);
3658 /// ```
3659 pub fn set_dependencies<T, V>(mut self, v: T) -> Self
3660 where
3661 T: std::iter::IntoIterator<Item = V>,
3662 V: std::convert::Into<crate::model::Dependency>,
3663 {
3664 use std::iter::Iterator;
3665 self.dependencies = v.into_iter().map(|i| i.into()).collect();
3666 self
3667 }
3668}
3669
3670impl wkt::message::Message for Build {
3671 fn typename() -> &'static str {
3672 "type.googleapis.com/google.devtools.cloudbuild.v1.Build"
3673 }
3674}
3675
3676/// Defines additional types related to [Build].
3677pub mod build {
3678 #[allow(unused_imports)]
3679 use super::*;
3680
3681 /// A non-fatal problem encountered during the execution of the build.
3682 #[derive(Clone, Default, PartialEq)]
3683 #[non_exhaustive]
3684 pub struct Warning {
3685 /// Explanation of the warning generated.
3686 pub text: std::string::String,
3687
3688 /// The priority for this warning.
3689 pub priority: crate::model::build::warning::Priority,
3690
3691 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3692 }
3693
3694 impl Warning {
3695 /// Creates a new default instance.
3696 pub fn new() -> Self {
3697 std::default::Default::default()
3698 }
3699
3700 /// Sets the value of [text][crate::model::build::Warning::text].
3701 ///
3702 /// # Example
3703 /// ```ignore,no_run
3704 /// # use google_cloud_build_v1::model::build::Warning;
3705 /// let x = Warning::new().set_text("example");
3706 /// ```
3707 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3708 self.text = v.into();
3709 self
3710 }
3711
3712 /// Sets the value of [priority][crate::model::build::Warning::priority].
3713 ///
3714 /// # Example
3715 /// ```ignore,no_run
3716 /// # use google_cloud_build_v1::model::build::Warning;
3717 /// use google_cloud_build_v1::model::build::warning::Priority;
3718 /// let x0 = Warning::new().set_priority(Priority::Info);
3719 /// let x1 = Warning::new().set_priority(Priority::Warning);
3720 /// let x2 = Warning::new().set_priority(Priority::Alert);
3721 /// ```
3722 pub fn set_priority<T: std::convert::Into<crate::model::build::warning::Priority>>(
3723 mut self,
3724 v: T,
3725 ) -> Self {
3726 self.priority = v.into();
3727 self
3728 }
3729 }
3730
3731 impl wkt::message::Message for Warning {
3732 fn typename() -> &'static str {
3733 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.Warning"
3734 }
3735 }
3736
3737 /// Defines additional types related to [Warning].
3738 pub mod warning {
3739 #[allow(unused_imports)]
3740 use super::*;
3741
3742 /// The relative importance of this warning.
3743 ///
3744 /// # Working with unknown values
3745 ///
3746 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3747 /// additional enum variants at any time. Adding new variants is not considered
3748 /// a breaking change. Applications should write their code in anticipation of:
3749 ///
3750 /// - New values appearing in future releases of the client library, **and**
3751 /// - New values received dynamically, without application changes.
3752 ///
3753 /// Please consult the [Working with enums] section in the user guide for some
3754 /// guidelines.
3755 ///
3756 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3757 #[derive(Clone, Debug, PartialEq)]
3758 #[non_exhaustive]
3759 pub enum Priority {
3760 /// Should not be used.
3761 Unspecified,
3762 /// e.g. deprecation warnings and alternative feature highlights.
3763 Info,
3764 /// e.g. automated detection of possible issues with the build.
3765 Warning,
3766 /// e.g. alerts that a feature used in the build is pending removal
3767 Alert,
3768 /// If set, the enum was initialized with an unknown value.
3769 ///
3770 /// Applications can examine the value using [Priority::value] or
3771 /// [Priority::name].
3772 UnknownValue(priority::UnknownValue),
3773 }
3774
3775 #[doc(hidden)]
3776 pub mod priority {
3777 #[allow(unused_imports)]
3778 use super::*;
3779 #[derive(Clone, Debug, PartialEq)]
3780 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3781 }
3782
3783 impl Priority {
3784 /// Gets the enum value.
3785 ///
3786 /// Returns `None` if the enum contains an unknown value deserialized from
3787 /// the string representation of enums.
3788 pub fn value(&self) -> std::option::Option<i32> {
3789 match self {
3790 Self::Unspecified => std::option::Option::Some(0),
3791 Self::Info => std::option::Option::Some(1),
3792 Self::Warning => std::option::Option::Some(2),
3793 Self::Alert => std::option::Option::Some(3),
3794 Self::UnknownValue(u) => u.0.value(),
3795 }
3796 }
3797
3798 /// Gets the enum value as a string.
3799 ///
3800 /// Returns `None` if the enum contains an unknown value deserialized from
3801 /// the integer representation of enums.
3802 pub fn name(&self) -> std::option::Option<&str> {
3803 match self {
3804 Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
3805 Self::Info => std::option::Option::Some("INFO"),
3806 Self::Warning => std::option::Option::Some("WARNING"),
3807 Self::Alert => std::option::Option::Some("ALERT"),
3808 Self::UnknownValue(u) => u.0.name(),
3809 }
3810 }
3811 }
3812
3813 impl std::default::Default for Priority {
3814 fn default() -> Self {
3815 use std::convert::From;
3816 Self::from(0)
3817 }
3818 }
3819
3820 impl std::fmt::Display for Priority {
3821 fn fmt(
3822 &self,
3823 f: &mut std::fmt::Formatter<'_>,
3824 ) -> std::result::Result<(), std::fmt::Error> {
3825 wkt::internal::display_enum(f, self.name(), self.value())
3826 }
3827 }
3828
3829 impl std::convert::From<i32> for Priority {
3830 fn from(value: i32) -> Self {
3831 match value {
3832 0 => Self::Unspecified,
3833 1 => Self::Info,
3834 2 => Self::Warning,
3835 3 => Self::Alert,
3836 _ => Self::UnknownValue(priority::UnknownValue(
3837 wkt::internal::UnknownEnumValue::Integer(value),
3838 )),
3839 }
3840 }
3841 }
3842
3843 impl std::convert::From<&str> for Priority {
3844 fn from(value: &str) -> Self {
3845 use std::string::ToString;
3846 match value {
3847 "PRIORITY_UNSPECIFIED" => Self::Unspecified,
3848 "INFO" => Self::Info,
3849 "WARNING" => Self::Warning,
3850 "ALERT" => Self::Alert,
3851 _ => Self::UnknownValue(priority::UnknownValue(
3852 wkt::internal::UnknownEnumValue::String(value.to_string()),
3853 )),
3854 }
3855 }
3856 }
3857
3858 impl serde::ser::Serialize for Priority {
3859 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3860 where
3861 S: serde::Serializer,
3862 {
3863 match self {
3864 Self::Unspecified => serializer.serialize_i32(0),
3865 Self::Info => serializer.serialize_i32(1),
3866 Self::Warning => serializer.serialize_i32(2),
3867 Self::Alert => serializer.serialize_i32(3),
3868 Self::UnknownValue(u) => u.0.serialize(serializer),
3869 }
3870 }
3871 }
3872
3873 impl<'de> serde::de::Deserialize<'de> for Priority {
3874 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3875 where
3876 D: serde::Deserializer<'de>,
3877 {
3878 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
3879 ".google.devtools.cloudbuild.v1.Build.Warning.Priority",
3880 ))
3881 }
3882 }
3883 }
3884
3885 /// A fatal problem encountered during the execution of the build.
3886 #[derive(Clone, Default, PartialEq)]
3887 #[non_exhaustive]
3888 pub struct FailureInfo {
3889 /// The name of the failure.
3890 pub r#type: crate::model::build::failure_info::FailureType,
3891
3892 /// Explains the failure issue in more detail using hard-coded text.
3893 pub detail: std::string::String,
3894
3895 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3896 }
3897
3898 impl FailureInfo {
3899 /// Creates a new default instance.
3900 pub fn new() -> Self {
3901 std::default::Default::default()
3902 }
3903
3904 /// Sets the value of [r#type][crate::model::build::FailureInfo::type].
3905 ///
3906 /// # Example
3907 /// ```ignore,no_run
3908 /// # use google_cloud_build_v1::model::build::FailureInfo;
3909 /// use google_cloud_build_v1::model::build::failure_info::FailureType;
3910 /// let x0 = FailureInfo::new().set_type(FailureType::PushFailed);
3911 /// let x1 = FailureInfo::new().set_type(FailureType::PushImageNotFound);
3912 /// let x2 = FailureInfo::new().set_type(FailureType::PushNotAuthorized);
3913 /// ```
3914 pub fn set_type<T: std::convert::Into<crate::model::build::failure_info::FailureType>>(
3915 mut self,
3916 v: T,
3917 ) -> Self {
3918 self.r#type = v.into();
3919 self
3920 }
3921
3922 /// Sets the value of [detail][crate::model::build::FailureInfo::detail].
3923 ///
3924 /// # Example
3925 /// ```ignore,no_run
3926 /// # use google_cloud_build_v1::model::build::FailureInfo;
3927 /// let x = FailureInfo::new().set_detail("example");
3928 /// ```
3929 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3930 self.detail = v.into();
3931 self
3932 }
3933 }
3934
3935 impl wkt::message::Message for FailureInfo {
3936 fn typename() -> &'static str {
3937 "type.googleapis.com/google.devtools.cloudbuild.v1.Build.FailureInfo"
3938 }
3939 }
3940
3941 /// Defines additional types related to [FailureInfo].
3942 pub mod failure_info {
3943 #[allow(unused_imports)]
3944 use super::*;
3945
3946 /// The name of a fatal problem encountered during the execution of the
3947 /// build.
3948 ///
3949 /// # Working with unknown values
3950 ///
3951 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3952 /// additional enum variants at any time. Adding new variants is not considered
3953 /// a breaking change. Applications should write their code in anticipation of:
3954 ///
3955 /// - New values appearing in future releases of the client library, **and**
3956 /// - New values received dynamically, without application changes.
3957 ///
3958 /// Please consult the [Working with enums] section in the user guide for some
3959 /// guidelines.
3960 ///
3961 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3962 #[derive(Clone, Debug, PartialEq)]
3963 #[non_exhaustive]
3964 pub enum FailureType {
3965 /// Type unspecified
3966 Unspecified,
3967 /// Unable to push the image to the repository.
3968 PushFailed,
3969 /// Final image not found.
3970 PushImageNotFound,
3971 /// Unauthorized push of the final image.
3972 PushNotAuthorized,
3973 /// Backend logging failures. Should retry.
3974 LoggingFailure,
3975 /// A build step has failed.
3976 UserBuildStep,
3977 /// The source fetching has failed.
3978 FetchSourceFailed,
3979 /// If set, the enum was initialized with an unknown value.
3980 ///
3981 /// Applications can examine the value using [FailureType::value] or
3982 /// [FailureType::name].
3983 UnknownValue(failure_type::UnknownValue),
3984 }
3985
3986 #[doc(hidden)]
3987 pub mod failure_type {
3988 #[allow(unused_imports)]
3989 use super::*;
3990 #[derive(Clone, Debug, PartialEq)]
3991 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3992 }
3993
3994 impl FailureType {
3995 /// Gets the enum value.
3996 ///
3997 /// Returns `None` if the enum contains an unknown value deserialized from
3998 /// the string representation of enums.
3999 pub fn value(&self) -> std::option::Option<i32> {
4000 match self {
4001 Self::Unspecified => std::option::Option::Some(0),
4002 Self::PushFailed => std::option::Option::Some(1),
4003 Self::PushImageNotFound => std::option::Option::Some(2),
4004 Self::PushNotAuthorized => std::option::Option::Some(3),
4005 Self::LoggingFailure => std::option::Option::Some(4),
4006 Self::UserBuildStep => std::option::Option::Some(5),
4007 Self::FetchSourceFailed => std::option::Option::Some(6),
4008 Self::UnknownValue(u) => u.0.value(),
4009 }
4010 }
4011
4012 /// Gets the enum value as a string.
4013 ///
4014 /// Returns `None` if the enum contains an unknown value deserialized from
4015 /// the integer representation of enums.
4016 pub fn name(&self) -> std::option::Option<&str> {
4017 match self {
4018 Self::Unspecified => std::option::Option::Some("FAILURE_TYPE_UNSPECIFIED"),
4019 Self::PushFailed => std::option::Option::Some("PUSH_FAILED"),
4020 Self::PushImageNotFound => std::option::Option::Some("PUSH_IMAGE_NOT_FOUND"),
4021 Self::PushNotAuthorized => std::option::Option::Some("PUSH_NOT_AUTHORIZED"),
4022 Self::LoggingFailure => std::option::Option::Some("LOGGING_FAILURE"),
4023 Self::UserBuildStep => std::option::Option::Some("USER_BUILD_STEP"),
4024 Self::FetchSourceFailed => std::option::Option::Some("FETCH_SOURCE_FAILED"),
4025 Self::UnknownValue(u) => u.0.name(),
4026 }
4027 }
4028 }
4029
4030 impl std::default::Default for FailureType {
4031 fn default() -> Self {
4032 use std::convert::From;
4033 Self::from(0)
4034 }
4035 }
4036
4037 impl std::fmt::Display for FailureType {
4038 fn fmt(
4039 &self,
4040 f: &mut std::fmt::Formatter<'_>,
4041 ) -> std::result::Result<(), std::fmt::Error> {
4042 wkt::internal::display_enum(f, self.name(), self.value())
4043 }
4044 }
4045
4046 impl std::convert::From<i32> for FailureType {
4047 fn from(value: i32) -> Self {
4048 match value {
4049 0 => Self::Unspecified,
4050 1 => Self::PushFailed,
4051 2 => Self::PushImageNotFound,
4052 3 => Self::PushNotAuthorized,
4053 4 => Self::LoggingFailure,
4054 5 => Self::UserBuildStep,
4055 6 => Self::FetchSourceFailed,
4056 _ => Self::UnknownValue(failure_type::UnknownValue(
4057 wkt::internal::UnknownEnumValue::Integer(value),
4058 )),
4059 }
4060 }
4061 }
4062
4063 impl std::convert::From<&str> for FailureType {
4064 fn from(value: &str) -> Self {
4065 use std::string::ToString;
4066 match value {
4067 "FAILURE_TYPE_UNSPECIFIED" => Self::Unspecified,
4068 "PUSH_FAILED" => Self::PushFailed,
4069 "PUSH_IMAGE_NOT_FOUND" => Self::PushImageNotFound,
4070 "PUSH_NOT_AUTHORIZED" => Self::PushNotAuthorized,
4071 "LOGGING_FAILURE" => Self::LoggingFailure,
4072 "USER_BUILD_STEP" => Self::UserBuildStep,
4073 "FETCH_SOURCE_FAILED" => Self::FetchSourceFailed,
4074 _ => Self::UnknownValue(failure_type::UnknownValue(
4075 wkt::internal::UnknownEnumValue::String(value.to_string()),
4076 )),
4077 }
4078 }
4079 }
4080
4081 impl serde::ser::Serialize for FailureType {
4082 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4083 where
4084 S: serde::Serializer,
4085 {
4086 match self {
4087 Self::Unspecified => serializer.serialize_i32(0),
4088 Self::PushFailed => serializer.serialize_i32(1),
4089 Self::PushImageNotFound => serializer.serialize_i32(2),
4090 Self::PushNotAuthorized => serializer.serialize_i32(3),
4091 Self::LoggingFailure => serializer.serialize_i32(4),
4092 Self::UserBuildStep => serializer.serialize_i32(5),
4093 Self::FetchSourceFailed => serializer.serialize_i32(6),
4094 Self::UnknownValue(u) => u.0.serialize(serializer),
4095 }
4096 }
4097 }
4098
4099 impl<'de> serde::de::Deserialize<'de> for FailureType {
4100 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4101 where
4102 D: serde::Deserializer<'de>,
4103 {
4104 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureType>::new(
4105 ".google.devtools.cloudbuild.v1.Build.FailureInfo.FailureType",
4106 ))
4107 }
4108 }
4109 }
4110
4111 /// Possible status of a build or build step.
4112 ///
4113 /// # Working with unknown values
4114 ///
4115 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4116 /// additional enum variants at any time. Adding new variants is not considered
4117 /// a breaking change. Applications should write their code in anticipation of:
4118 ///
4119 /// - New values appearing in future releases of the client library, **and**
4120 /// - New values received dynamically, without application changes.
4121 ///
4122 /// Please consult the [Working with enums] section in the user guide for some
4123 /// guidelines.
4124 ///
4125 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4126 #[derive(Clone, Debug, PartialEq)]
4127 #[non_exhaustive]
4128 pub enum Status {
4129 /// Status of the build is unknown.
4130 Unknown,
4131 /// Build has been created and is pending execution and queuing. It has not
4132 /// been queued.
4133 Pending,
4134 /// Build or step is queued; work has not yet begun.
4135 Queued,
4136 /// Build or step is being executed.
4137 Working,
4138 /// Build or step finished successfully.
4139 Success,
4140 /// Build or step failed to complete successfully.
4141 Failure,
4142 /// Build or step failed due to an internal cause.
4143 InternalError,
4144 /// Build or step took longer than was allowed.
4145 Timeout,
4146 /// Build or step was canceled by a user.
4147 Cancelled,
4148 /// Build was enqueued for longer than the value of `queue_ttl`.
4149 Expired,
4150 /// If set, the enum was initialized with an unknown value.
4151 ///
4152 /// Applications can examine the value using [Status::value] or
4153 /// [Status::name].
4154 UnknownValue(status::UnknownValue),
4155 }
4156
4157 #[doc(hidden)]
4158 pub mod status {
4159 #[allow(unused_imports)]
4160 use super::*;
4161 #[derive(Clone, Debug, PartialEq)]
4162 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4163 }
4164
4165 impl Status {
4166 /// Gets the enum value.
4167 ///
4168 /// Returns `None` if the enum contains an unknown value deserialized from
4169 /// the string representation of enums.
4170 pub fn value(&self) -> std::option::Option<i32> {
4171 match self {
4172 Self::Unknown => std::option::Option::Some(0),
4173 Self::Pending => std::option::Option::Some(10),
4174 Self::Queued => std::option::Option::Some(1),
4175 Self::Working => std::option::Option::Some(2),
4176 Self::Success => std::option::Option::Some(3),
4177 Self::Failure => std::option::Option::Some(4),
4178 Self::InternalError => std::option::Option::Some(5),
4179 Self::Timeout => std::option::Option::Some(6),
4180 Self::Cancelled => std::option::Option::Some(7),
4181 Self::Expired => std::option::Option::Some(9),
4182 Self::UnknownValue(u) => u.0.value(),
4183 }
4184 }
4185
4186 /// Gets the enum value as a string.
4187 ///
4188 /// Returns `None` if the enum contains an unknown value deserialized from
4189 /// the integer representation of enums.
4190 pub fn name(&self) -> std::option::Option<&str> {
4191 match self {
4192 Self::Unknown => std::option::Option::Some("STATUS_UNKNOWN"),
4193 Self::Pending => std::option::Option::Some("PENDING"),
4194 Self::Queued => std::option::Option::Some("QUEUED"),
4195 Self::Working => std::option::Option::Some("WORKING"),
4196 Self::Success => std::option::Option::Some("SUCCESS"),
4197 Self::Failure => std::option::Option::Some("FAILURE"),
4198 Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
4199 Self::Timeout => std::option::Option::Some("TIMEOUT"),
4200 Self::Cancelled => std::option::Option::Some("CANCELLED"),
4201 Self::Expired => std::option::Option::Some("EXPIRED"),
4202 Self::UnknownValue(u) => u.0.name(),
4203 }
4204 }
4205 }
4206
4207 impl std::default::Default for Status {
4208 fn default() -> Self {
4209 use std::convert::From;
4210 Self::from(0)
4211 }
4212 }
4213
4214 impl std::fmt::Display for Status {
4215 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4216 wkt::internal::display_enum(f, self.name(), self.value())
4217 }
4218 }
4219
4220 impl std::convert::From<i32> for Status {
4221 fn from(value: i32) -> Self {
4222 match value {
4223 0 => Self::Unknown,
4224 1 => Self::Queued,
4225 2 => Self::Working,
4226 3 => Self::Success,
4227 4 => Self::Failure,
4228 5 => Self::InternalError,
4229 6 => Self::Timeout,
4230 7 => Self::Cancelled,
4231 9 => Self::Expired,
4232 10 => Self::Pending,
4233 _ => Self::UnknownValue(status::UnknownValue(
4234 wkt::internal::UnknownEnumValue::Integer(value),
4235 )),
4236 }
4237 }
4238 }
4239
4240 impl std::convert::From<&str> for Status {
4241 fn from(value: &str) -> Self {
4242 use std::string::ToString;
4243 match value {
4244 "STATUS_UNKNOWN" => Self::Unknown,
4245 "PENDING" => Self::Pending,
4246 "QUEUED" => Self::Queued,
4247 "WORKING" => Self::Working,
4248 "SUCCESS" => Self::Success,
4249 "FAILURE" => Self::Failure,
4250 "INTERNAL_ERROR" => Self::InternalError,
4251 "TIMEOUT" => Self::Timeout,
4252 "CANCELLED" => Self::Cancelled,
4253 "EXPIRED" => Self::Expired,
4254 _ => Self::UnknownValue(status::UnknownValue(
4255 wkt::internal::UnknownEnumValue::String(value.to_string()),
4256 )),
4257 }
4258 }
4259 }
4260
4261 impl serde::ser::Serialize for Status {
4262 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4263 where
4264 S: serde::Serializer,
4265 {
4266 match self {
4267 Self::Unknown => serializer.serialize_i32(0),
4268 Self::Pending => serializer.serialize_i32(10),
4269 Self::Queued => serializer.serialize_i32(1),
4270 Self::Working => serializer.serialize_i32(2),
4271 Self::Success => serializer.serialize_i32(3),
4272 Self::Failure => serializer.serialize_i32(4),
4273 Self::InternalError => serializer.serialize_i32(5),
4274 Self::Timeout => serializer.serialize_i32(6),
4275 Self::Cancelled => serializer.serialize_i32(7),
4276 Self::Expired => serializer.serialize_i32(9),
4277 Self::UnknownValue(u) => u.0.serialize(serializer),
4278 }
4279 }
4280 }
4281
4282 impl<'de> serde::de::Deserialize<'de> for Status {
4283 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4284 where
4285 D: serde::Deserializer<'de>,
4286 {
4287 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
4288 ".google.devtools.cloudbuild.v1.Build.Status",
4289 ))
4290 }
4291 }
4292}
4293
4294/// A dependency that the Cloud Build worker will fetch before executing user
4295/// steps.
4296#[derive(Clone, Default, PartialEq)]
4297#[non_exhaustive]
4298pub struct Dependency {
4299 /// The type of dependency to fetch.
4300 pub dep: std::option::Option<crate::model::dependency::Dep>,
4301
4302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4303}
4304
4305impl Dependency {
4306 /// Creates a new default instance.
4307 pub fn new() -> Self {
4308 std::default::Default::default()
4309 }
4310
4311 /// Sets the value of [dep][crate::model::Dependency::dep].
4312 ///
4313 /// Note that all the setters affecting `dep` are mutually
4314 /// exclusive.
4315 ///
4316 /// # Example
4317 /// ```ignore,no_run
4318 /// # use google_cloud_build_v1::model::Dependency;
4319 /// use google_cloud_build_v1::model::dependency::Dep;
4320 /// let x = Dependency::new().set_dep(Some(Dep::Empty(true)));
4321 /// ```
4322 pub fn set_dep<T: std::convert::Into<std::option::Option<crate::model::dependency::Dep>>>(
4323 mut self,
4324 v: T,
4325 ) -> Self {
4326 self.dep = v.into();
4327 self
4328 }
4329
4330 /// The value of [dep][crate::model::Dependency::dep]
4331 /// if it holds a `Empty`, `None` if the field is not set or
4332 /// holds a different branch.
4333 pub fn empty(&self) -> std::option::Option<&bool> {
4334 #[allow(unreachable_patterns)]
4335 self.dep.as_ref().and_then(|v| match v {
4336 crate::model::dependency::Dep::Empty(v) => std::option::Option::Some(v),
4337 _ => std::option::Option::None,
4338 })
4339 }
4340
4341 /// Sets the value of [dep][crate::model::Dependency::dep]
4342 /// to hold a `Empty`.
4343 ///
4344 /// Note that all the setters affecting `dep` are
4345 /// mutually exclusive.
4346 ///
4347 /// # Example
4348 /// ```ignore,no_run
4349 /// # use google_cloud_build_v1::model::Dependency;
4350 /// let x = Dependency::new().set_empty(true);
4351 /// assert!(x.empty().is_some());
4352 /// assert!(x.git_source().is_none());
4353 /// ```
4354 pub fn set_empty<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4355 self.dep = std::option::Option::Some(crate::model::dependency::Dep::Empty(v.into()));
4356 self
4357 }
4358
4359 /// The value of [dep][crate::model::Dependency::dep]
4360 /// if it holds a `GitSource`, `None` if the field is not set or
4361 /// holds a different branch.
4362 pub fn git_source(
4363 &self,
4364 ) -> std::option::Option<&std::boxed::Box<crate::model::dependency::GitSourceDependency>> {
4365 #[allow(unreachable_patterns)]
4366 self.dep.as_ref().and_then(|v| match v {
4367 crate::model::dependency::Dep::GitSource(v) => std::option::Option::Some(v),
4368 _ => std::option::Option::None,
4369 })
4370 }
4371
4372 /// Sets the value of [dep][crate::model::Dependency::dep]
4373 /// to hold a `GitSource`.
4374 ///
4375 /// Note that all the setters affecting `dep` are
4376 /// mutually exclusive.
4377 ///
4378 /// # Example
4379 /// ```ignore,no_run
4380 /// # use google_cloud_build_v1::model::Dependency;
4381 /// use google_cloud_build_v1::model::dependency::GitSourceDependency;
4382 /// let x = Dependency::new().set_git_source(GitSourceDependency::default()/* use setters */);
4383 /// assert!(x.git_source().is_some());
4384 /// assert!(x.empty().is_none());
4385 /// ```
4386 pub fn set_git_source<
4387 T: std::convert::Into<std::boxed::Box<crate::model::dependency::GitSourceDependency>>,
4388 >(
4389 mut self,
4390 v: T,
4391 ) -> Self {
4392 self.dep = std::option::Option::Some(crate::model::dependency::Dep::GitSource(v.into()));
4393 self
4394 }
4395}
4396
4397impl wkt::message::Message for Dependency {
4398 fn typename() -> &'static str {
4399 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency"
4400 }
4401}
4402
4403/// Defines additional types related to [Dependency].
4404pub mod dependency {
4405 #[allow(unused_imports)]
4406 use super::*;
4407
4408 /// Represents a git repository as a build dependency.
4409 #[derive(Clone, Default, PartialEq)]
4410 #[non_exhaustive]
4411 pub struct GitSourceDependency {
4412 /// Required. The kind of repo (url or dev connect).
4413 pub repository: std::option::Option<crate::model::dependency::GitSourceRepository>,
4414
4415 /// Required. The revision that we will fetch the repo at.
4416 pub revision: std::string::String,
4417
4418 /// Optional. True if submodules should be fetched too (default false).
4419 pub recurse_submodules: bool,
4420
4421 /// Optional. How much history should be fetched for the build (default 1, -1
4422 /// for all history).
4423 pub depth: i64,
4424
4425 /// Required. Where should the files be placed on the worker.
4426 pub dest_path: std::string::String,
4427
4428 /// Optional. True if remote tags should be fetched too (default false).
4429 /// Note: when depth is 1 (default), git fetch only retrieves tags pointing
4430 /// to commits within the shallow boundary. Set depth to -1 to fetch all
4431 /// historical tags.
4432 pub fetch_tags: bool,
4433
4434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4435 }
4436
4437 impl GitSourceDependency {
4438 /// Creates a new default instance.
4439 pub fn new() -> Self {
4440 std::default::Default::default()
4441 }
4442
4443 /// Sets the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4444 ///
4445 /// # Example
4446 /// ```ignore,no_run
4447 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4448 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4449 /// let x = GitSourceDependency::new().set_repository(GitSourceRepository::default()/* use setters */);
4450 /// ```
4451 pub fn set_repository<T>(mut self, v: T) -> Self
4452 where
4453 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4454 {
4455 self.repository = std::option::Option::Some(v.into());
4456 self
4457 }
4458
4459 /// Sets or clears the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4460 ///
4461 /// # Example
4462 /// ```ignore,no_run
4463 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4464 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4465 /// let x = GitSourceDependency::new().set_or_clear_repository(Some(GitSourceRepository::default()/* use setters */));
4466 /// let x = GitSourceDependency::new().set_or_clear_repository(None::<GitSourceRepository>);
4467 /// ```
4468 pub fn set_or_clear_repository<T>(mut self, v: std::option::Option<T>) -> Self
4469 where
4470 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4471 {
4472 self.repository = v.map(|x| x.into());
4473 self
4474 }
4475
4476 /// Sets the value of [revision][crate::model::dependency::GitSourceDependency::revision].
4477 ///
4478 /// # Example
4479 /// ```ignore,no_run
4480 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4481 /// let x = GitSourceDependency::new().set_revision("example");
4482 /// ```
4483 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4484 self.revision = v.into();
4485 self
4486 }
4487
4488 /// Sets the value of [recurse_submodules][crate::model::dependency::GitSourceDependency::recurse_submodules].
4489 ///
4490 /// # Example
4491 /// ```ignore,no_run
4492 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4493 /// let x = GitSourceDependency::new().set_recurse_submodules(true);
4494 /// ```
4495 pub fn set_recurse_submodules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4496 self.recurse_submodules = v.into();
4497 self
4498 }
4499
4500 /// Sets the value of [depth][crate::model::dependency::GitSourceDependency::depth].
4501 ///
4502 /// # Example
4503 /// ```ignore,no_run
4504 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4505 /// let x = GitSourceDependency::new().set_depth(42);
4506 /// ```
4507 pub fn set_depth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4508 self.depth = v.into();
4509 self
4510 }
4511
4512 /// Sets the value of [dest_path][crate::model::dependency::GitSourceDependency::dest_path].
4513 ///
4514 /// # Example
4515 /// ```ignore,no_run
4516 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4517 /// let x = GitSourceDependency::new().set_dest_path("example");
4518 /// ```
4519 pub fn set_dest_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4520 self.dest_path = v.into();
4521 self
4522 }
4523
4524 /// Sets the value of [fetch_tags][crate::model::dependency::GitSourceDependency::fetch_tags].
4525 ///
4526 /// # Example
4527 /// ```ignore,no_run
4528 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4529 /// let x = GitSourceDependency::new().set_fetch_tags(true);
4530 /// ```
4531 pub fn set_fetch_tags<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4532 self.fetch_tags = v.into();
4533 self
4534 }
4535 }
4536
4537 impl wkt::message::Message for GitSourceDependency {
4538 fn typename() -> &'static str {
4539 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceDependency"
4540 }
4541 }
4542
4543 /// A repository for a git source.
4544 #[derive(Clone, Default, PartialEq)]
4545 #[non_exhaustive]
4546 pub struct GitSourceRepository {
4547 /// The type of git source repo (url or dev connect).
4548 pub repotype:
4549 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4550
4551 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4552 }
4553
4554 impl GitSourceRepository {
4555 /// Creates a new default instance.
4556 pub fn new() -> Self {
4557 std::default::Default::default()
4558 }
4559
4560 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype].
4561 ///
4562 /// Note that all the setters affecting `repotype` are mutually
4563 /// exclusive.
4564 ///
4565 /// # Example
4566 /// ```ignore,no_run
4567 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4568 /// use google_cloud_build_v1::model::dependency::git_source_repository::Repotype;
4569 /// let x = GitSourceRepository::new().set_repotype(Some(Repotype::Url("example".to_string())));
4570 /// ```
4571 pub fn set_repotype<
4572 T: std::convert::Into<
4573 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4574 >,
4575 >(
4576 mut self,
4577 v: T,
4578 ) -> Self {
4579 self.repotype = v.into();
4580 self
4581 }
4582
4583 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4584 /// if it holds a `Url`, `None` if the field is not set or
4585 /// holds a different branch.
4586 pub fn url(&self) -> std::option::Option<&std::string::String> {
4587 #[allow(unreachable_patterns)]
4588 self.repotype.as_ref().and_then(|v| match v {
4589 crate::model::dependency::git_source_repository::Repotype::Url(v) => {
4590 std::option::Option::Some(v)
4591 }
4592 _ => std::option::Option::None,
4593 })
4594 }
4595
4596 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4597 /// to hold a `Url`.
4598 ///
4599 /// Note that all the setters affecting `repotype` are
4600 /// mutually exclusive.
4601 ///
4602 /// # Example
4603 /// ```ignore,no_run
4604 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4605 /// let x = GitSourceRepository::new().set_url("example");
4606 /// assert!(x.url().is_some());
4607 /// assert!(x.developer_connect().is_none());
4608 /// ```
4609 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4610 self.repotype = std::option::Option::Some(
4611 crate::model::dependency::git_source_repository::Repotype::Url(v.into()),
4612 );
4613 self
4614 }
4615
4616 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4617 /// if it holds a `DeveloperConnect`, `None` if the field is not set or
4618 /// holds a different branch.
4619 pub fn developer_connect(&self) -> std::option::Option<&std::string::String> {
4620 #[allow(unreachable_patterns)]
4621 self.repotype.as_ref().and_then(|v| match v {
4622 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(v) => {
4623 std::option::Option::Some(v)
4624 }
4625 _ => std::option::Option::None,
4626 })
4627 }
4628
4629 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4630 /// to hold a `DeveloperConnect`.
4631 ///
4632 /// Note that all the setters affecting `repotype` are
4633 /// mutually exclusive.
4634 ///
4635 /// # Example
4636 /// ```ignore,no_run
4637 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4638 /// let x = GitSourceRepository::new().set_developer_connect("example");
4639 /// assert!(x.developer_connect().is_some());
4640 /// assert!(x.url().is_none());
4641 /// ```
4642 pub fn set_developer_connect<T: std::convert::Into<std::string::String>>(
4643 mut self,
4644 v: T,
4645 ) -> Self {
4646 self.repotype = std::option::Option::Some(
4647 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(
4648 v.into(),
4649 ),
4650 );
4651 self
4652 }
4653 }
4654
4655 impl wkt::message::Message for GitSourceRepository {
4656 fn typename() -> &'static str {
4657 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceRepository"
4658 }
4659 }
4660
4661 /// Defines additional types related to [GitSourceRepository].
4662 pub mod git_source_repository {
4663 #[allow(unused_imports)]
4664 use super::*;
4665
4666 /// The type of git source repo (url or dev connect).
4667 #[derive(Clone, Debug, PartialEq)]
4668 #[non_exhaustive]
4669 pub enum Repotype {
4670 /// Location of the Git repository.
4671 Url(std::string::String),
4672 /// The Developer Connect Git repository link formatted as
4673 /// `projects/*/locations/*/connections/*/gitRepositoryLink/*`
4674 DeveloperConnect(std::string::String),
4675 }
4676 }
4677
4678 /// The type of dependency to fetch.
4679 #[derive(Clone, Debug, PartialEq)]
4680 #[non_exhaustive]
4681 pub enum Dep {
4682 /// If set to true disable all dependency fetching (ignoring the default
4683 /// source as well).
4684 Empty(bool),
4685 /// Represents a git repository as a build dependency.
4686 GitSource(std::boxed::Box<crate::model::dependency::GitSourceDependency>),
4687 }
4688}
4689
4690/// GitConfig is a configuration for git operations.
4691#[derive(Clone, Default, PartialEq)]
4692#[non_exhaustive]
4693pub struct GitConfig {
4694 /// Configuration for HTTP related git operations.
4695 pub http: std::option::Option<crate::model::git_config::HttpConfig>,
4696
4697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4698}
4699
4700impl GitConfig {
4701 /// Creates a new default instance.
4702 pub fn new() -> Self {
4703 std::default::Default::default()
4704 }
4705
4706 /// Sets the value of [http][crate::model::GitConfig::http].
4707 ///
4708 /// # Example
4709 /// ```ignore,no_run
4710 /// # use google_cloud_build_v1::model::GitConfig;
4711 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4712 /// let x = GitConfig::new().set_http(HttpConfig::default()/* use setters */);
4713 /// ```
4714 pub fn set_http<T>(mut self, v: T) -> Self
4715 where
4716 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4717 {
4718 self.http = std::option::Option::Some(v.into());
4719 self
4720 }
4721
4722 /// Sets or clears the value of [http][crate::model::GitConfig::http].
4723 ///
4724 /// # Example
4725 /// ```ignore,no_run
4726 /// # use google_cloud_build_v1::model::GitConfig;
4727 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4728 /// let x = GitConfig::new().set_or_clear_http(Some(HttpConfig::default()/* use setters */));
4729 /// let x = GitConfig::new().set_or_clear_http(None::<HttpConfig>);
4730 /// ```
4731 pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
4732 where
4733 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4734 {
4735 self.http = v.map(|x| x.into());
4736 self
4737 }
4738}
4739
4740impl wkt::message::Message for GitConfig {
4741 fn typename() -> &'static str {
4742 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig"
4743 }
4744}
4745
4746/// Defines additional types related to [GitConfig].
4747pub mod git_config {
4748 #[allow(unused_imports)]
4749 use super::*;
4750
4751 /// HttpConfig is a configuration for HTTP related git operations.
4752 #[derive(Clone, Default, PartialEq)]
4753 #[non_exhaustive]
4754 pub struct HttpConfig {
4755 /// SecretVersion resource of the HTTP proxy URL. The Service Account used in
4756 /// the build (either the default Service Account or
4757 /// user-specified Service Account) should have
4758 /// `secretmanager.versions.access` permissions on this secret. The proxy URL
4759 /// should be in format `[protocol://][user[:password]@]proxyhost[:port]`.
4760 pub proxy_secret_version_name: std::string::String,
4761
4762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4763 }
4764
4765 impl HttpConfig {
4766 /// Creates a new default instance.
4767 pub fn new() -> Self {
4768 std::default::Default::default()
4769 }
4770
4771 /// Sets the value of [proxy_secret_version_name][crate::model::git_config::HttpConfig::proxy_secret_version_name].
4772 ///
4773 /// # Example
4774 /// ```ignore,no_run
4775 /// # use google_cloud_build_v1::model::git_config::HttpConfig;
4776 /// let x = HttpConfig::new().set_proxy_secret_version_name("example");
4777 /// ```
4778 pub fn set_proxy_secret_version_name<T: std::convert::Into<std::string::String>>(
4779 mut self,
4780 v: T,
4781 ) -> Self {
4782 self.proxy_secret_version_name = v.into();
4783 self
4784 }
4785 }
4786
4787 impl wkt::message::Message for HttpConfig {
4788 fn typename() -> &'static str {
4789 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig.HttpConfig"
4790 }
4791 }
4792}
4793
4794/// Artifacts produced by a build that should be uploaded upon
4795/// successful completion of all build steps.
4796#[derive(Clone, Default, PartialEq)]
4797#[non_exhaustive]
4798pub struct Artifacts {
4799 /// A list of images to be pushed upon the successful completion of all build
4800 /// steps.
4801 ///
4802 /// The images will be pushed using the builder service account's credentials.
4803 ///
4804 /// The digests of the pushed images will be stored in the Build resource's
4805 /// results field.
4806 ///
4807 /// If any of the images fail to be pushed, the build is marked FAILURE.
4808 pub images: std::vec::Vec<std::string::String>,
4809
4810 /// A list of objects to be uploaded to Cloud Storage upon successful
4811 /// completion of all build steps.
4812 ///
4813 /// Files in the workspace matching specified paths globs will be uploaded to
4814 /// the specified Cloud Storage location using the builder service account's
4815 /// credentials.
4816 ///
4817 /// The location and generation of the uploaded objects will be stored in the
4818 /// Build resource's results field.
4819 ///
4820 /// If any objects fail to be pushed, the build is marked FAILURE.
4821 pub objects: std::option::Option<crate::model::artifacts::ArtifactObjects>,
4822
4823 /// A list of Maven artifacts to be uploaded to Artifact Registry upon
4824 /// successful completion of all build steps.
4825 ///
4826 /// Artifacts in the workspace matching specified paths globs will be uploaded
4827 /// to the specified Artifact Registry repository using the builder service
4828 /// account's credentials.
4829 ///
4830 /// If any artifacts fail to be pushed, the build is marked FAILURE.
4831 pub maven_artifacts: std::vec::Vec<crate::model::artifacts::MavenArtifact>,
4832
4833 /// Optional. A list of Go modules to be uploaded to Artifact Registry upon
4834 /// successful completion of all build steps.
4835 ///
4836 /// If any objects fail to be pushed, the build is marked FAILURE.
4837 pub go_modules: std::vec::Vec<crate::model::artifacts::GoModule>,
4838
4839 /// A list of Python packages to be uploaded to Artifact Registry upon
4840 /// successful completion of all build steps.
4841 ///
4842 /// The build service account credentials will be used to perform the upload.
4843 ///
4844 /// If any objects fail to be pushed, the build is marked FAILURE.
4845 pub python_packages: std::vec::Vec<crate::model::artifacts::PythonPackage>,
4846
4847 /// A list of npm packages to be uploaded to Artifact Registry upon
4848 /// successful completion of all build steps.
4849 ///
4850 /// Npm packages in the specified paths will be uploaded
4851 /// to the specified Artifact Registry repository using the builder service
4852 /// account's credentials.
4853 ///
4854 /// If any packages fail to be pushed, the build is marked FAILURE.
4855 pub npm_packages: std::vec::Vec<crate::model::artifacts::NpmPackage>,
4856
4857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4858}
4859
4860impl Artifacts {
4861 /// Creates a new default instance.
4862 pub fn new() -> Self {
4863 std::default::Default::default()
4864 }
4865
4866 /// Sets the value of [images][crate::model::Artifacts::images].
4867 ///
4868 /// # Example
4869 /// ```ignore,no_run
4870 /// # use google_cloud_build_v1::model::Artifacts;
4871 /// let x = Artifacts::new().set_images(["a", "b", "c"]);
4872 /// ```
4873 pub fn set_images<T, V>(mut self, v: T) -> Self
4874 where
4875 T: std::iter::IntoIterator<Item = V>,
4876 V: std::convert::Into<std::string::String>,
4877 {
4878 use std::iter::Iterator;
4879 self.images = v.into_iter().map(|i| i.into()).collect();
4880 self
4881 }
4882
4883 /// Sets the value of [objects][crate::model::Artifacts::objects].
4884 ///
4885 /// # Example
4886 /// ```ignore,no_run
4887 /// # use google_cloud_build_v1::model::Artifacts;
4888 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4889 /// let x = Artifacts::new().set_objects(ArtifactObjects::default()/* use setters */);
4890 /// ```
4891 pub fn set_objects<T>(mut self, v: T) -> Self
4892 where
4893 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4894 {
4895 self.objects = std::option::Option::Some(v.into());
4896 self
4897 }
4898
4899 /// Sets or clears the value of [objects][crate::model::Artifacts::objects].
4900 ///
4901 /// # Example
4902 /// ```ignore,no_run
4903 /// # use google_cloud_build_v1::model::Artifacts;
4904 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4905 /// let x = Artifacts::new().set_or_clear_objects(Some(ArtifactObjects::default()/* use setters */));
4906 /// let x = Artifacts::new().set_or_clear_objects(None::<ArtifactObjects>);
4907 /// ```
4908 pub fn set_or_clear_objects<T>(mut self, v: std::option::Option<T>) -> Self
4909 where
4910 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4911 {
4912 self.objects = v.map(|x| x.into());
4913 self
4914 }
4915
4916 /// Sets the value of [maven_artifacts][crate::model::Artifacts::maven_artifacts].
4917 ///
4918 /// # Example
4919 /// ```ignore,no_run
4920 /// # use google_cloud_build_v1::model::Artifacts;
4921 /// use google_cloud_build_v1::model::artifacts::MavenArtifact;
4922 /// let x = Artifacts::new()
4923 /// .set_maven_artifacts([
4924 /// MavenArtifact::default()/* use setters */,
4925 /// MavenArtifact::default()/* use (different) setters */,
4926 /// ]);
4927 /// ```
4928 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
4929 where
4930 T: std::iter::IntoIterator<Item = V>,
4931 V: std::convert::Into<crate::model::artifacts::MavenArtifact>,
4932 {
4933 use std::iter::Iterator;
4934 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
4935 self
4936 }
4937
4938 /// Sets the value of [go_modules][crate::model::Artifacts::go_modules].
4939 ///
4940 /// # Example
4941 /// ```ignore,no_run
4942 /// # use google_cloud_build_v1::model::Artifacts;
4943 /// use google_cloud_build_v1::model::artifacts::GoModule;
4944 /// let x = Artifacts::new()
4945 /// .set_go_modules([
4946 /// GoModule::default()/* use setters */,
4947 /// GoModule::default()/* use (different) setters */,
4948 /// ]);
4949 /// ```
4950 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
4951 where
4952 T: std::iter::IntoIterator<Item = V>,
4953 V: std::convert::Into<crate::model::artifacts::GoModule>,
4954 {
4955 use std::iter::Iterator;
4956 self.go_modules = v.into_iter().map(|i| i.into()).collect();
4957 self
4958 }
4959
4960 /// Sets the value of [python_packages][crate::model::Artifacts::python_packages].
4961 ///
4962 /// # Example
4963 /// ```ignore,no_run
4964 /// # use google_cloud_build_v1::model::Artifacts;
4965 /// use google_cloud_build_v1::model::artifacts::PythonPackage;
4966 /// let x = Artifacts::new()
4967 /// .set_python_packages([
4968 /// PythonPackage::default()/* use setters */,
4969 /// PythonPackage::default()/* use (different) setters */,
4970 /// ]);
4971 /// ```
4972 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
4973 where
4974 T: std::iter::IntoIterator<Item = V>,
4975 V: std::convert::Into<crate::model::artifacts::PythonPackage>,
4976 {
4977 use std::iter::Iterator;
4978 self.python_packages = v.into_iter().map(|i| i.into()).collect();
4979 self
4980 }
4981
4982 /// Sets the value of [npm_packages][crate::model::Artifacts::npm_packages].
4983 ///
4984 /// # Example
4985 /// ```ignore,no_run
4986 /// # use google_cloud_build_v1::model::Artifacts;
4987 /// use google_cloud_build_v1::model::artifacts::NpmPackage;
4988 /// let x = Artifacts::new()
4989 /// .set_npm_packages([
4990 /// NpmPackage::default()/* use setters */,
4991 /// NpmPackage::default()/* use (different) setters */,
4992 /// ]);
4993 /// ```
4994 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
4995 where
4996 T: std::iter::IntoIterator<Item = V>,
4997 V: std::convert::Into<crate::model::artifacts::NpmPackage>,
4998 {
4999 use std::iter::Iterator;
5000 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
5001 self
5002 }
5003}
5004
5005impl wkt::message::Message for Artifacts {
5006 fn typename() -> &'static str {
5007 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts"
5008 }
5009}
5010
5011/// Defines additional types related to [Artifacts].
5012pub mod artifacts {
5013 #[allow(unused_imports)]
5014 use super::*;
5015
5016 /// Files in the workspace to upload to Cloud Storage upon successful
5017 /// completion of all build steps.
5018 #[derive(Clone, Default, PartialEq)]
5019 #[non_exhaustive]
5020 pub struct ArtifactObjects {
5021 /// Cloud Storage bucket and optional object path, in the form
5022 /// "gs://bucket/path/to/somewhere/". (see [Bucket Name
5023 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
5024 ///
5025 /// Files in the workspace matching any path pattern will be uploaded to
5026 /// Cloud Storage with this location as a prefix.
5027 pub location: std::string::String,
5028
5029 /// Path globs used to match files in the build's workspace.
5030 pub paths: std::vec::Vec<std::string::String>,
5031
5032 /// Output only. Stores timing information for pushing all artifact objects.
5033 pub timing: std::option::Option<crate::model::TimeSpan>,
5034
5035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5036 }
5037
5038 impl ArtifactObjects {
5039 /// Creates a new default instance.
5040 pub fn new() -> Self {
5041 std::default::Default::default()
5042 }
5043
5044 /// Sets the value of [location][crate::model::artifacts::ArtifactObjects::location].
5045 ///
5046 /// # Example
5047 /// ```ignore,no_run
5048 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5049 /// let x = ArtifactObjects::new().set_location("example");
5050 /// ```
5051 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5052 self.location = v.into();
5053 self
5054 }
5055
5056 /// Sets the value of [paths][crate::model::artifacts::ArtifactObjects::paths].
5057 ///
5058 /// # Example
5059 /// ```ignore,no_run
5060 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5061 /// let x = ArtifactObjects::new().set_paths(["a", "b", "c"]);
5062 /// ```
5063 pub fn set_paths<T, V>(mut self, v: T) -> Self
5064 where
5065 T: std::iter::IntoIterator<Item = V>,
5066 V: std::convert::Into<std::string::String>,
5067 {
5068 use std::iter::Iterator;
5069 self.paths = v.into_iter().map(|i| i.into()).collect();
5070 self
5071 }
5072
5073 /// Sets the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5074 ///
5075 /// # Example
5076 /// ```ignore,no_run
5077 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5078 /// use google_cloud_build_v1::model::TimeSpan;
5079 /// let x = ArtifactObjects::new().set_timing(TimeSpan::default()/* use setters */);
5080 /// ```
5081 pub fn set_timing<T>(mut self, v: T) -> Self
5082 where
5083 T: std::convert::Into<crate::model::TimeSpan>,
5084 {
5085 self.timing = std::option::Option::Some(v.into());
5086 self
5087 }
5088
5089 /// Sets or clears the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5090 ///
5091 /// # Example
5092 /// ```ignore,no_run
5093 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5094 /// use google_cloud_build_v1::model::TimeSpan;
5095 /// let x = ArtifactObjects::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
5096 /// let x = ArtifactObjects::new().set_or_clear_timing(None::<TimeSpan>);
5097 /// ```
5098 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
5099 where
5100 T: std::convert::Into<crate::model::TimeSpan>,
5101 {
5102 self.timing = v.map(|x| x.into());
5103 self
5104 }
5105 }
5106
5107 impl wkt::message::Message for ArtifactObjects {
5108 fn typename() -> &'static str {
5109 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects"
5110 }
5111 }
5112
5113 /// A Maven artifact to upload to Artifact Registry upon successful completion
5114 /// of all build steps.
5115 #[derive(Clone, Default, PartialEq)]
5116 #[non_exhaustive]
5117 pub struct MavenArtifact {
5118 /// Artifact Registry repository, in the form
5119 /// "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY"
5120 ///
5121 /// Artifact in the workspace specified by path will be uploaded to
5122 /// Artifact Registry with this location as a prefix.
5123 pub repository: std::string::String,
5124
5125 /// Optional. Path to an artifact in the build's workspace to be uploaded to
5126 /// Artifact Registry.
5127 /// This can be either an absolute path,
5128 /// e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar
5129 /// or a relative path from /workspace,
5130 /// e.g. my-app/target/my-app-1.0.SNAPSHOT.jar.
5131 pub path: std::string::String,
5132
5133 /// Maven `artifactId` value used when uploading the artifact to Artifact
5134 /// Registry.
5135 pub artifact_id: std::string::String,
5136
5137 /// Maven `groupId` value used when uploading the artifact to Artifact
5138 /// Registry.
5139 pub group_id: std::string::String,
5140
5141 /// Maven `version` value used when uploading the artifact to Artifact
5142 /// Registry.
5143 pub version: std::string::String,
5144
5145 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5146 }
5147
5148 impl MavenArtifact {
5149 /// Creates a new default instance.
5150 pub fn new() -> Self {
5151 std::default::Default::default()
5152 }
5153
5154 /// Sets the value of [repository][crate::model::artifacts::MavenArtifact::repository].
5155 ///
5156 /// # Example
5157 /// ```ignore,no_run
5158 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5159 /// let x = MavenArtifact::new().set_repository("example");
5160 /// ```
5161 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5162 self.repository = v.into();
5163 self
5164 }
5165
5166 /// Sets the value of [path][crate::model::artifacts::MavenArtifact::path].
5167 ///
5168 /// # Example
5169 /// ```ignore,no_run
5170 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5171 /// let x = MavenArtifact::new().set_path("example");
5172 /// ```
5173 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5174 self.path = v.into();
5175 self
5176 }
5177
5178 /// Sets the value of [artifact_id][crate::model::artifacts::MavenArtifact::artifact_id].
5179 ///
5180 /// # Example
5181 /// ```ignore,no_run
5182 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5183 /// let x = MavenArtifact::new().set_artifact_id("example");
5184 /// ```
5185 pub fn set_artifact_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5186 self.artifact_id = v.into();
5187 self
5188 }
5189
5190 /// Sets the value of [group_id][crate::model::artifacts::MavenArtifact::group_id].
5191 ///
5192 /// # Example
5193 /// ```ignore,no_run
5194 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5195 /// let x = MavenArtifact::new().set_group_id("example");
5196 /// ```
5197 pub fn set_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5198 self.group_id = v.into();
5199 self
5200 }
5201
5202 /// Sets the value of [version][crate::model::artifacts::MavenArtifact::version].
5203 ///
5204 /// # Example
5205 /// ```ignore,no_run
5206 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5207 /// let x = MavenArtifact::new().set_version("example");
5208 /// ```
5209 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5210 self.version = v.into();
5211 self
5212 }
5213 }
5214
5215 impl wkt::message::Message for MavenArtifact {
5216 fn typename() -> &'static str {
5217 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.MavenArtifact"
5218 }
5219 }
5220
5221 /// Go module to upload to Artifact Registry upon successful completion of all
5222 /// build steps. A module refers to all dependencies in a go.mod file.
5223 #[derive(Clone, Default, PartialEq)]
5224 #[non_exhaustive]
5225 pub struct GoModule {
5226 /// Optional. Artifact Registry repository name.
5227 ///
5228 /// Specified Go modules will be zipped and uploaded to Artifact Registry
5229 /// with this location as a prefix.
5230 /// e.g. my-go-repo
5231 pub repository_name: std::string::String,
5232
5233 /// Optional. Location of the Artifact Registry repository. i.e. us-east1
5234 /// Defaults to the build’s location.
5235 pub repository_location: std::string::String,
5236
5237 /// Optional. Project ID of the Artifact Registry repository.
5238 /// Defaults to the build project.
5239 pub repository_project_id: std::string::String,
5240
5241 /// Optional. Source path of the go.mod file in the build's workspace. If not
5242 /// specified, this will default to the current directory.
5243 /// e.g. ~/code/go/mypackage
5244 pub source_path: std::string::String,
5245
5246 /// Optional. The Go module's "module path".
5247 /// e.g. example.com/foo/v2
5248 pub module_path: std::string::String,
5249
5250 /// Optional. The Go module's semantic version in the form vX.Y.Z. e.g.
5251 /// v0.1.1 Pre-release identifiers can also be added by appending a dash and
5252 /// dot separated ASCII alphanumeric characters and hyphens.
5253 /// e.g. v0.2.3-alpha.x.12m.5
5254 pub module_version: std::string::String,
5255
5256 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5257 }
5258
5259 impl GoModule {
5260 /// Creates a new default instance.
5261 pub fn new() -> Self {
5262 std::default::Default::default()
5263 }
5264
5265 /// Sets the value of [repository_name][crate::model::artifacts::GoModule::repository_name].
5266 ///
5267 /// # Example
5268 /// ```ignore,no_run
5269 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5270 /// let x = GoModule::new().set_repository_name("example");
5271 /// ```
5272 pub fn set_repository_name<T: std::convert::Into<std::string::String>>(
5273 mut self,
5274 v: T,
5275 ) -> Self {
5276 self.repository_name = v.into();
5277 self
5278 }
5279
5280 /// Sets the value of [repository_location][crate::model::artifacts::GoModule::repository_location].
5281 ///
5282 /// # Example
5283 /// ```ignore,no_run
5284 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5285 /// let x = GoModule::new().set_repository_location("example");
5286 /// ```
5287 pub fn set_repository_location<T: std::convert::Into<std::string::String>>(
5288 mut self,
5289 v: T,
5290 ) -> Self {
5291 self.repository_location = v.into();
5292 self
5293 }
5294
5295 /// Sets the value of [repository_project_id][crate::model::artifacts::GoModule::repository_project_id].
5296 ///
5297 /// # Example
5298 /// ```ignore,no_run
5299 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5300 /// let x = GoModule::new().set_repository_project_id("example");
5301 /// ```
5302 pub fn set_repository_project_id<T: std::convert::Into<std::string::String>>(
5303 mut self,
5304 v: T,
5305 ) -> Self {
5306 self.repository_project_id = v.into();
5307 self
5308 }
5309
5310 /// Sets the value of [source_path][crate::model::artifacts::GoModule::source_path].
5311 ///
5312 /// # Example
5313 /// ```ignore,no_run
5314 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5315 /// let x = GoModule::new().set_source_path("example");
5316 /// ```
5317 pub fn set_source_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5318 self.source_path = v.into();
5319 self
5320 }
5321
5322 /// Sets the value of [module_path][crate::model::artifacts::GoModule::module_path].
5323 ///
5324 /// # Example
5325 /// ```ignore,no_run
5326 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5327 /// let x = GoModule::new().set_module_path("example");
5328 /// ```
5329 pub fn set_module_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5330 self.module_path = v.into();
5331 self
5332 }
5333
5334 /// Sets the value of [module_version][crate::model::artifacts::GoModule::module_version].
5335 ///
5336 /// # Example
5337 /// ```ignore,no_run
5338 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5339 /// let x = GoModule::new().set_module_version("example");
5340 /// ```
5341 pub fn set_module_version<T: std::convert::Into<std::string::String>>(
5342 mut self,
5343 v: T,
5344 ) -> Self {
5345 self.module_version = v.into();
5346 self
5347 }
5348 }
5349
5350 impl wkt::message::Message for GoModule {
5351 fn typename() -> &'static str {
5352 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.GoModule"
5353 }
5354 }
5355
5356 /// Python package to upload to Artifact Registry upon successful completion
5357 /// of all build steps. A package can encapsulate multiple objects to be
5358 /// uploaded to a single repository.
5359 #[derive(Clone, Default, PartialEq)]
5360 #[non_exhaustive]
5361 pub struct PythonPackage {
5362 /// Artifact Registry repository, in the form
5363 /// "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY"
5364 ///
5365 /// Files in the workspace matching any path pattern will be uploaded to
5366 /// Artifact Registry with this location as a prefix.
5367 pub repository: std::string::String,
5368
5369 /// Path globs used to match files in the build's workspace. For Python/
5370 /// Twine, this is usually `dist/*`, and sometimes additionally an `.asc`
5371 /// file.
5372 pub paths: std::vec::Vec<std::string::String>,
5373
5374 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5375 }
5376
5377 impl PythonPackage {
5378 /// Creates a new default instance.
5379 pub fn new() -> Self {
5380 std::default::Default::default()
5381 }
5382
5383 /// Sets the value of [repository][crate::model::artifacts::PythonPackage::repository].
5384 ///
5385 /// # Example
5386 /// ```ignore,no_run
5387 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5388 /// let x = PythonPackage::new().set_repository("example");
5389 /// ```
5390 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5391 self.repository = v.into();
5392 self
5393 }
5394
5395 /// Sets the value of [paths][crate::model::artifacts::PythonPackage::paths].
5396 ///
5397 /// # Example
5398 /// ```ignore,no_run
5399 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5400 /// let x = PythonPackage::new().set_paths(["a", "b", "c"]);
5401 /// ```
5402 pub fn set_paths<T, V>(mut self, v: T) -> Self
5403 where
5404 T: std::iter::IntoIterator<Item = V>,
5405 V: std::convert::Into<std::string::String>,
5406 {
5407 use std::iter::Iterator;
5408 self.paths = v.into_iter().map(|i| i.into()).collect();
5409 self
5410 }
5411 }
5412
5413 impl wkt::message::Message for PythonPackage {
5414 fn typename() -> &'static str {
5415 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.PythonPackage"
5416 }
5417 }
5418
5419 /// Npm package to upload to Artifact Registry upon successful completion
5420 /// of all build steps.
5421 #[derive(Clone, Default, PartialEq)]
5422 #[non_exhaustive]
5423 pub struct NpmPackage {
5424 /// Artifact Registry repository, in the form
5425 /// "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY"
5426 ///
5427 /// Npm package in the workspace specified by path will be zipped and
5428 /// uploaded to Artifact Registry with this location as a prefix.
5429 pub repository: std::string::String,
5430
5431 /// Optional. Path to the package.json.
5432 /// e.g. workspace/path/to/package
5433 ///
5434 /// Only one of `archive` or `package_path` can be specified.
5435 pub package_path: std::string::String,
5436
5437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5438 }
5439
5440 impl NpmPackage {
5441 /// Creates a new default instance.
5442 pub fn new() -> Self {
5443 std::default::Default::default()
5444 }
5445
5446 /// Sets the value of [repository][crate::model::artifacts::NpmPackage::repository].
5447 ///
5448 /// # Example
5449 /// ```ignore,no_run
5450 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5451 /// let x = NpmPackage::new().set_repository("example");
5452 /// ```
5453 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5454 self.repository = v.into();
5455 self
5456 }
5457
5458 /// Sets the value of [package_path][crate::model::artifacts::NpmPackage::package_path].
5459 ///
5460 /// # Example
5461 /// ```ignore,no_run
5462 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5463 /// let x = NpmPackage::new().set_package_path("example");
5464 /// ```
5465 pub fn set_package_path<T: std::convert::Into<std::string::String>>(
5466 mut self,
5467 v: T,
5468 ) -> Self {
5469 self.package_path = v.into();
5470 self
5471 }
5472 }
5473
5474 impl wkt::message::Message for NpmPackage {
5475 fn typename() -> &'static str {
5476 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.NpmPackage"
5477 }
5478 }
5479}
5480
5481/// Start and end times for a build execution phase.
5482#[derive(Clone, Default, PartialEq)]
5483#[non_exhaustive]
5484pub struct TimeSpan {
5485 /// Start of time span.
5486 pub start_time: std::option::Option<wkt::Timestamp>,
5487
5488 /// End of time span.
5489 pub end_time: std::option::Option<wkt::Timestamp>,
5490
5491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5492}
5493
5494impl TimeSpan {
5495 /// Creates a new default instance.
5496 pub fn new() -> Self {
5497 std::default::Default::default()
5498 }
5499
5500 /// Sets the value of [start_time][crate::model::TimeSpan::start_time].
5501 ///
5502 /// # Example
5503 /// ```ignore,no_run
5504 /// # use google_cloud_build_v1::model::TimeSpan;
5505 /// use wkt::Timestamp;
5506 /// let x = TimeSpan::new().set_start_time(Timestamp::default()/* use setters */);
5507 /// ```
5508 pub fn set_start_time<T>(mut self, v: T) -> Self
5509 where
5510 T: std::convert::Into<wkt::Timestamp>,
5511 {
5512 self.start_time = std::option::Option::Some(v.into());
5513 self
5514 }
5515
5516 /// Sets or clears the value of [start_time][crate::model::TimeSpan::start_time].
5517 ///
5518 /// # Example
5519 /// ```ignore,no_run
5520 /// # use google_cloud_build_v1::model::TimeSpan;
5521 /// use wkt::Timestamp;
5522 /// let x = TimeSpan::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
5523 /// let x = TimeSpan::new().set_or_clear_start_time(None::<Timestamp>);
5524 /// ```
5525 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5526 where
5527 T: std::convert::Into<wkt::Timestamp>,
5528 {
5529 self.start_time = v.map(|x| x.into());
5530 self
5531 }
5532
5533 /// Sets the value of [end_time][crate::model::TimeSpan::end_time].
5534 ///
5535 /// # Example
5536 /// ```ignore,no_run
5537 /// # use google_cloud_build_v1::model::TimeSpan;
5538 /// use wkt::Timestamp;
5539 /// let x = TimeSpan::new().set_end_time(Timestamp::default()/* use setters */);
5540 /// ```
5541 pub fn set_end_time<T>(mut self, v: T) -> Self
5542 where
5543 T: std::convert::Into<wkt::Timestamp>,
5544 {
5545 self.end_time = std::option::Option::Some(v.into());
5546 self
5547 }
5548
5549 /// Sets or clears the value of [end_time][crate::model::TimeSpan::end_time].
5550 ///
5551 /// # Example
5552 /// ```ignore,no_run
5553 /// # use google_cloud_build_v1::model::TimeSpan;
5554 /// use wkt::Timestamp;
5555 /// let x = TimeSpan::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5556 /// let x = TimeSpan::new().set_or_clear_end_time(None::<Timestamp>);
5557 /// ```
5558 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5559 where
5560 T: std::convert::Into<wkt::Timestamp>,
5561 {
5562 self.end_time = v.map(|x| x.into());
5563 self
5564 }
5565}
5566
5567impl wkt::message::Message for TimeSpan {
5568 fn typename() -> &'static str {
5569 "type.googleapis.com/google.devtools.cloudbuild.v1.TimeSpan"
5570 }
5571}
5572
5573/// Metadata for build operations.
5574#[derive(Clone, Default, PartialEq)]
5575#[non_exhaustive]
5576pub struct BuildOperationMetadata {
5577 /// The build that the operation is tracking.
5578 pub build: std::option::Option<crate::model::Build>,
5579
5580 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5581}
5582
5583impl BuildOperationMetadata {
5584 /// Creates a new default instance.
5585 pub fn new() -> Self {
5586 std::default::Default::default()
5587 }
5588
5589 /// Sets the value of [build][crate::model::BuildOperationMetadata::build].
5590 ///
5591 /// # Example
5592 /// ```ignore,no_run
5593 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5594 /// use google_cloud_build_v1::model::Build;
5595 /// let x = BuildOperationMetadata::new().set_build(Build::default()/* use setters */);
5596 /// ```
5597 pub fn set_build<T>(mut self, v: T) -> Self
5598 where
5599 T: std::convert::Into<crate::model::Build>,
5600 {
5601 self.build = std::option::Option::Some(v.into());
5602 self
5603 }
5604
5605 /// Sets or clears the value of [build][crate::model::BuildOperationMetadata::build].
5606 ///
5607 /// # Example
5608 /// ```ignore,no_run
5609 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5610 /// use google_cloud_build_v1::model::Build;
5611 /// let x = BuildOperationMetadata::new().set_or_clear_build(Some(Build::default()/* use setters */));
5612 /// let x = BuildOperationMetadata::new().set_or_clear_build(None::<Build>);
5613 /// ```
5614 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
5615 where
5616 T: std::convert::Into<crate::model::Build>,
5617 {
5618 self.build = v.map(|x| x.into());
5619 self
5620 }
5621}
5622
5623impl wkt::message::Message for BuildOperationMetadata {
5624 fn typename() -> &'static str {
5625 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata"
5626 }
5627}
5628
5629/// Provenance of the source. Ways to find the original source, or verify that
5630/// some source was used for this build.
5631#[derive(Clone, Default, PartialEq)]
5632#[non_exhaustive]
5633pub struct SourceProvenance {
5634 /// A copy of the build's `source.storage_source`, if exists, with any
5635 /// generations resolved.
5636 pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
5637
5638 /// A copy of the build's `source.repo_source`, if exists, with any
5639 /// revisions resolved.
5640 pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
5641
5642 /// A copy of the build's `source.storage_source_manifest`, if exists, with any
5643 /// revisions resolved.
5644 /// This feature is in Preview.
5645 pub resolved_storage_source_manifest: std::option::Option<crate::model::StorageSourceManifest>,
5646
5647 /// Output only. A copy of the build's `source.connected_repository`, if
5648 /// exists, with any revisions resolved.
5649 pub resolved_connected_repository: std::option::Option<crate::model::ConnectedRepository>,
5650
5651 /// Output only. A copy of the build's `source.git_source`, if exists, with any
5652 /// revisions resolved.
5653 pub resolved_git_source: std::option::Option<crate::model::GitSource>,
5654
5655 /// Output only. Hash(es) of the build source, which can be used to verify that
5656 /// the original source integrity was maintained in the build. Note that
5657 /// `FileHashes` will only be populated if `BuildOptions` has requested a
5658 /// `SourceProvenanceHash`.
5659 ///
5660 /// The keys to this map are file paths used as build source and the values
5661 /// contain the hash values for those files.
5662 ///
5663 /// If the build source came in a single package such as a gzipped tarfile
5664 /// (`.tar.gz`), the `FileHash` will be for the single path to that file.
5665 pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
5666
5667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5668}
5669
5670impl SourceProvenance {
5671 /// Creates a new default instance.
5672 pub fn new() -> Self {
5673 std::default::Default::default()
5674 }
5675
5676 /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5677 ///
5678 /// # Example
5679 /// ```ignore,no_run
5680 /// # use google_cloud_build_v1::model::SourceProvenance;
5681 /// use google_cloud_build_v1::model::StorageSource;
5682 /// let x = SourceProvenance::new().set_resolved_storage_source(StorageSource::default()/* use setters */);
5683 /// ```
5684 pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
5685 where
5686 T: std::convert::Into<crate::model::StorageSource>,
5687 {
5688 self.resolved_storage_source = std::option::Option::Some(v.into());
5689 self
5690 }
5691
5692 /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5693 ///
5694 /// # Example
5695 /// ```ignore,no_run
5696 /// # use google_cloud_build_v1::model::SourceProvenance;
5697 /// use google_cloud_build_v1::model::StorageSource;
5698 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(Some(StorageSource::default()/* use setters */));
5699 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(None::<StorageSource>);
5700 /// ```
5701 pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
5702 where
5703 T: std::convert::Into<crate::model::StorageSource>,
5704 {
5705 self.resolved_storage_source = v.map(|x| x.into());
5706 self
5707 }
5708
5709 /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5710 ///
5711 /// # Example
5712 /// ```ignore,no_run
5713 /// # use google_cloud_build_v1::model::SourceProvenance;
5714 /// use google_cloud_build_v1::model::RepoSource;
5715 /// let x = SourceProvenance::new().set_resolved_repo_source(RepoSource::default()/* use setters */);
5716 /// ```
5717 pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
5718 where
5719 T: std::convert::Into<crate::model::RepoSource>,
5720 {
5721 self.resolved_repo_source = std::option::Option::Some(v.into());
5722 self
5723 }
5724
5725 /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5726 ///
5727 /// # Example
5728 /// ```ignore,no_run
5729 /// # use google_cloud_build_v1::model::SourceProvenance;
5730 /// use google_cloud_build_v1::model::RepoSource;
5731 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(Some(RepoSource::default()/* use setters */));
5732 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(None::<RepoSource>);
5733 /// ```
5734 pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
5735 where
5736 T: std::convert::Into<crate::model::RepoSource>,
5737 {
5738 self.resolved_repo_source = v.map(|x| x.into());
5739 self
5740 }
5741
5742 /// Sets the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5743 ///
5744 /// # Example
5745 /// ```ignore,no_run
5746 /// # use google_cloud_build_v1::model::SourceProvenance;
5747 /// use google_cloud_build_v1::model::StorageSourceManifest;
5748 /// let x = SourceProvenance::new().set_resolved_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
5749 /// ```
5750 pub fn set_resolved_storage_source_manifest<T>(mut self, v: T) -> Self
5751 where
5752 T: std::convert::Into<crate::model::StorageSourceManifest>,
5753 {
5754 self.resolved_storage_source_manifest = std::option::Option::Some(v.into());
5755 self
5756 }
5757
5758 /// Sets or clears the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5759 ///
5760 /// # Example
5761 /// ```ignore,no_run
5762 /// # use google_cloud_build_v1::model::SourceProvenance;
5763 /// use google_cloud_build_v1::model::StorageSourceManifest;
5764 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(Some(StorageSourceManifest::default()/* use setters */));
5765 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(None::<StorageSourceManifest>);
5766 /// ```
5767 pub fn set_or_clear_resolved_storage_source_manifest<T>(
5768 mut self,
5769 v: std::option::Option<T>,
5770 ) -> Self
5771 where
5772 T: std::convert::Into<crate::model::StorageSourceManifest>,
5773 {
5774 self.resolved_storage_source_manifest = v.map(|x| x.into());
5775 self
5776 }
5777
5778 /// Sets the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5779 ///
5780 /// # Example
5781 /// ```ignore,no_run
5782 /// # use google_cloud_build_v1::model::SourceProvenance;
5783 /// use google_cloud_build_v1::model::ConnectedRepository;
5784 /// let x = SourceProvenance::new().set_resolved_connected_repository(ConnectedRepository::default()/* use setters */);
5785 /// ```
5786 pub fn set_resolved_connected_repository<T>(mut self, v: T) -> Self
5787 where
5788 T: std::convert::Into<crate::model::ConnectedRepository>,
5789 {
5790 self.resolved_connected_repository = std::option::Option::Some(v.into());
5791 self
5792 }
5793
5794 /// Sets or clears the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5795 ///
5796 /// # Example
5797 /// ```ignore,no_run
5798 /// # use google_cloud_build_v1::model::SourceProvenance;
5799 /// use google_cloud_build_v1::model::ConnectedRepository;
5800 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(Some(ConnectedRepository::default()/* use setters */));
5801 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(None::<ConnectedRepository>);
5802 /// ```
5803 pub fn set_or_clear_resolved_connected_repository<T>(
5804 mut self,
5805 v: std::option::Option<T>,
5806 ) -> Self
5807 where
5808 T: std::convert::Into<crate::model::ConnectedRepository>,
5809 {
5810 self.resolved_connected_repository = v.map(|x| x.into());
5811 self
5812 }
5813
5814 /// Sets the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5815 ///
5816 /// # Example
5817 /// ```ignore,no_run
5818 /// # use google_cloud_build_v1::model::SourceProvenance;
5819 /// use google_cloud_build_v1::model::GitSource;
5820 /// let x = SourceProvenance::new().set_resolved_git_source(GitSource::default()/* use setters */);
5821 /// ```
5822 pub fn set_resolved_git_source<T>(mut self, v: T) -> Self
5823 where
5824 T: std::convert::Into<crate::model::GitSource>,
5825 {
5826 self.resolved_git_source = std::option::Option::Some(v.into());
5827 self
5828 }
5829
5830 /// Sets or clears the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5831 ///
5832 /// # Example
5833 /// ```ignore,no_run
5834 /// # use google_cloud_build_v1::model::SourceProvenance;
5835 /// use google_cloud_build_v1::model::GitSource;
5836 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(Some(GitSource::default()/* use setters */));
5837 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(None::<GitSource>);
5838 /// ```
5839 pub fn set_or_clear_resolved_git_source<T>(mut self, v: std::option::Option<T>) -> Self
5840 where
5841 T: std::convert::Into<crate::model::GitSource>,
5842 {
5843 self.resolved_git_source = v.map(|x| x.into());
5844 self
5845 }
5846
5847 /// Sets the value of [file_hashes][crate::model::SourceProvenance::file_hashes].
5848 ///
5849 /// # Example
5850 /// ```ignore,no_run
5851 /// # use google_cloud_build_v1::model::SourceProvenance;
5852 /// use google_cloud_build_v1::model::FileHashes;
5853 /// let x = SourceProvenance::new().set_file_hashes([
5854 /// ("key0", FileHashes::default()/* use setters */),
5855 /// ("key1", FileHashes::default()/* use (different) setters */),
5856 /// ]);
5857 /// ```
5858 pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
5859 where
5860 T: std::iter::IntoIterator<Item = (K, V)>,
5861 K: std::convert::Into<std::string::String>,
5862 V: std::convert::Into<crate::model::FileHashes>,
5863 {
5864 use std::iter::Iterator;
5865 self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5866 self
5867 }
5868}
5869
5870impl wkt::message::Message for SourceProvenance {
5871 fn typename() -> &'static str {
5872 "type.googleapis.com/google.devtools.cloudbuild.v1.SourceProvenance"
5873 }
5874}
5875
5876/// Container message for hashes of byte content of files, used in
5877/// SourceProvenance messages to verify integrity of source input to the build.
5878#[derive(Clone, Default, PartialEq)]
5879#[non_exhaustive]
5880pub struct FileHashes {
5881 /// Collection of file hashes.
5882 pub file_hash: std::vec::Vec<crate::model::Hash>,
5883
5884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5885}
5886
5887impl FileHashes {
5888 /// Creates a new default instance.
5889 pub fn new() -> Self {
5890 std::default::Default::default()
5891 }
5892
5893 /// Sets the value of [file_hash][crate::model::FileHashes::file_hash].
5894 ///
5895 /// # Example
5896 /// ```ignore,no_run
5897 /// # use google_cloud_build_v1::model::FileHashes;
5898 /// use google_cloud_build_v1::model::Hash;
5899 /// let x = FileHashes::new()
5900 /// .set_file_hash([
5901 /// Hash::default()/* use setters */,
5902 /// Hash::default()/* use (different) setters */,
5903 /// ]);
5904 /// ```
5905 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
5906 where
5907 T: std::iter::IntoIterator<Item = V>,
5908 V: std::convert::Into<crate::model::Hash>,
5909 {
5910 use std::iter::Iterator;
5911 self.file_hash = v.into_iter().map(|i| i.into()).collect();
5912 self
5913 }
5914}
5915
5916impl wkt::message::Message for FileHashes {
5917 fn typename() -> &'static str {
5918 "type.googleapis.com/google.devtools.cloudbuild.v1.FileHashes"
5919 }
5920}
5921
5922/// Container message for hash values.
5923#[derive(Clone, Default, PartialEq)]
5924#[non_exhaustive]
5925pub struct Hash {
5926 /// The type of hash that was performed.
5927 pub r#type: crate::model::hash::HashType,
5928
5929 /// The hash value.
5930 pub value: ::bytes::Bytes,
5931
5932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5933}
5934
5935impl Hash {
5936 /// Creates a new default instance.
5937 pub fn new() -> Self {
5938 std::default::Default::default()
5939 }
5940
5941 /// Sets the value of [r#type][crate::model::Hash::type].
5942 ///
5943 /// # Example
5944 /// ```ignore,no_run
5945 /// # use google_cloud_build_v1::model::Hash;
5946 /// use google_cloud_build_v1::model::hash::HashType;
5947 /// let x0 = Hash::new().set_type(HashType::Sha256);
5948 /// let x1 = Hash::new().set_type(HashType::Md5);
5949 /// let x2 = Hash::new().set_type(HashType::GoModuleH1);
5950 /// ```
5951 pub fn set_type<T: std::convert::Into<crate::model::hash::HashType>>(mut self, v: T) -> Self {
5952 self.r#type = v.into();
5953 self
5954 }
5955
5956 /// Sets the value of [value][crate::model::Hash::value].
5957 ///
5958 /// # Example
5959 /// ```ignore,no_run
5960 /// # use google_cloud_build_v1::model::Hash;
5961 /// let x = Hash::new().set_value(bytes::Bytes::from_static(b"example"));
5962 /// ```
5963 pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5964 self.value = v.into();
5965 self
5966 }
5967}
5968
5969impl wkt::message::Message for Hash {
5970 fn typename() -> &'static str {
5971 "type.googleapis.com/google.devtools.cloudbuild.v1.Hash"
5972 }
5973}
5974
5975/// Defines additional types related to [Hash].
5976pub mod hash {
5977 #[allow(unused_imports)]
5978 use super::*;
5979
5980 /// Specifies the hash algorithm, if any.
5981 ///
5982 /// # Working with unknown values
5983 ///
5984 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5985 /// additional enum variants at any time. Adding new variants is not considered
5986 /// a breaking change. Applications should write their code in anticipation of:
5987 ///
5988 /// - New values appearing in future releases of the client library, **and**
5989 /// - New values received dynamically, without application changes.
5990 ///
5991 /// Please consult the [Working with enums] section in the user guide for some
5992 /// guidelines.
5993 ///
5994 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5995 #[derive(Clone, Debug, PartialEq)]
5996 #[non_exhaustive]
5997 pub enum HashType {
5998 /// No hash requested.
5999 None,
6000 /// Use a sha256 hash.
6001 Sha256,
6002 /// Use a md5 hash.
6003 Md5,
6004 /// Dirhash of a Go module's source code which is then hex-encoded.
6005 GoModuleH1,
6006 /// Use a sha512 hash.
6007 Sha512,
6008 /// If set, the enum was initialized with an unknown value.
6009 ///
6010 /// Applications can examine the value using [HashType::value] or
6011 /// [HashType::name].
6012 UnknownValue(hash_type::UnknownValue),
6013 }
6014
6015 #[doc(hidden)]
6016 pub mod hash_type {
6017 #[allow(unused_imports)]
6018 use super::*;
6019 #[derive(Clone, Debug, PartialEq)]
6020 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6021 }
6022
6023 impl HashType {
6024 /// Gets the enum value.
6025 ///
6026 /// Returns `None` if the enum contains an unknown value deserialized from
6027 /// the string representation of enums.
6028 pub fn value(&self) -> std::option::Option<i32> {
6029 match self {
6030 Self::None => std::option::Option::Some(0),
6031 Self::Sha256 => std::option::Option::Some(1),
6032 Self::Md5 => std::option::Option::Some(2),
6033 Self::GoModuleH1 => std::option::Option::Some(3),
6034 Self::Sha512 => std::option::Option::Some(4),
6035 Self::UnknownValue(u) => u.0.value(),
6036 }
6037 }
6038
6039 /// Gets the enum value as a string.
6040 ///
6041 /// Returns `None` if the enum contains an unknown value deserialized from
6042 /// the integer representation of enums.
6043 pub fn name(&self) -> std::option::Option<&str> {
6044 match self {
6045 Self::None => std::option::Option::Some("NONE"),
6046 Self::Sha256 => std::option::Option::Some("SHA256"),
6047 Self::Md5 => std::option::Option::Some("MD5"),
6048 Self::GoModuleH1 => std::option::Option::Some("GO_MODULE_H1"),
6049 Self::Sha512 => std::option::Option::Some("SHA512"),
6050 Self::UnknownValue(u) => u.0.name(),
6051 }
6052 }
6053 }
6054
6055 impl std::default::Default for HashType {
6056 fn default() -> Self {
6057 use std::convert::From;
6058 Self::from(0)
6059 }
6060 }
6061
6062 impl std::fmt::Display for HashType {
6063 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6064 wkt::internal::display_enum(f, self.name(), self.value())
6065 }
6066 }
6067
6068 impl std::convert::From<i32> for HashType {
6069 fn from(value: i32) -> Self {
6070 match value {
6071 0 => Self::None,
6072 1 => Self::Sha256,
6073 2 => Self::Md5,
6074 3 => Self::GoModuleH1,
6075 4 => Self::Sha512,
6076 _ => Self::UnknownValue(hash_type::UnknownValue(
6077 wkt::internal::UnknownEnumValue::Integer(value),
6078 )),
6079 }
6080 }
6081 }
6082
6083 impl std::convert::From<&str> for HashType {
6084 fn from(value: &str) -> Self {
6085 use std::string::ToString;
6086 match value {
6087 "NONE" => Self::None,
6088 "SHA256" => Self::Sha256,
6089 "MD5" => Self::Md5,
6090 "GO_MODULE_H1" => Self::GoModuleH1,
6091 "SHA512" => Self::Sha512,
6092 _ => Self::UnknownValue(hash_type::UnknownValue(
6093 wkt::internal::UnknownEnumValue::String(value.to_string()),
6094 )),
6095 }
6096 }
6097 }
6098
6099 impl serde::ser::Serialize for HashType {
6100 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6101 where
6102 S: serde::Serializer,
6103 {
6104 match self {
6105 Self::None => serializer.serialize_i32(0),
6106 Self::Sha256 => serializer.serialize_i32(1),
6107 Self::Md5 => serializer.serialize_i32(2),
6108 Self::GoModuleH1 => serializer.serialize_i32(3),
6109 Self::Sha512 => serializer.serialize_i32(4),
6110 Self::UnknownValue(u) => u.0.serialize(serializer),
6111 }
6112 }
6113 }
6114
6115 impl<'de> serde::de::Deserialize<'de> for HashType {
6116 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6117 where
6118 D: serde::Deserializer<'de>,
6119 {
6120 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HashType>::new(
6121 ".google.devtools.cloudbuild.v1.Hash.HashType",
6122 ))
6123 }
6124 }
6125}
6126
6127/// Secrets and secret environment variables.
6128#[derive(Clone, Default, PartialEq)]
6129#[non_exhaustive]
6130pub struct Secrets {
6131 /// Secrets in Secret Manager and associated secret environment variable.
6132 pub secret_manager: std::vec::Vec<crate::model::SecretManagerSecret>,
6133
6134 /// Secrets encrypted with KMS key and the associated secret environment
6135 /// variable.
6136 pub inline: std::vec::Vec<crate::model::InlineSecret>,
6137
6138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6139}
6140
6141impl Secrets {
6142 /// Creates a new default instance.
6143 pub fn new() -> Self {
6144 std::default::Default::default()
6145 }
6146
6147 /// Sets the value of [secret_manager][crate::model::Secrets::secret_manager].
6148 ///
6149 /// # Example
6150 /// ```ignore,no_run
6151 /// # use google_cloud_build_v1::model::Secrets;
6152 /// use google_cloud_build_v1::model::SecretManagerSecret;
6153 /// let x = Secrets::new()
6154 /// .set_secret_manager([
6155 /// SecretManagerSecret::default()/* use setters */,
6156 /// SecretManagerSecret::default()/* use (different) setters */,
6157 /// ]);
6158 /// ```
6159 pub fn set_secret_manager<T, V>(mut self, v: T) -> Self
6160 where
6161 T: std::iter::IntoIterator<Item = V>,
6162 V: std::convert::Into<crate::model::SecretManagerSecret>,
6163 {
6164 use std::iter::Iterator;
6165 self.secret_manager = v.into_iter().map(|i| i.into()).collect();
6166 self
6167 }
6168
6169 /// Sets the value of [inline][crate::model::Secrets::inline].
6170 ///
6171 /// # Example
6172 /// ```ignore,no_run
6173 /// # use google_cloud_build_v1::model::Secrets;
6174 /// use google_cloud_build_v1::model::InlineSecret;
6175 /// let x = Secrets::new()
6176 /// .set_inline([
6177 /// InlineSecret::default()/* use setters */,
6178 /// InlineSecret::default()/* use (different) setters */,
6179 /// ]);
6180 /// ```
6181 pub fn set_inline<T, V>(mut self, v: T) -> Self
6182 where
6183 T: std::iter::IntoIterator<Item = V>,
6184 V: std::convert::Into<crate::model::InlineSecret>,
6185 {
6186 use std::iter::Iterator;
6187 self.inline = v.into_iter().map(|i| i.into()).collect();
6188 self
6189 }
6190}
6191
6192impl wkt::message::Message for Secrets {
6193 fn typename() -> &'static str {
6194 "type.googleapis.com/google.devtools.cloudbuild.v1.Secrets"
6195 }
6196}
6197
6198/// Pairs a set of secret environment variables mapped to encrypted
6199/// values with the Cloud KMS key to use to decrypt the value.
6200#[derive(Clone, Default, PartialEq)]
6201#[non_exhaustive]
6202pub struct InlineSecret {
6203 /// Resource name of Cloud KMS crypto key to decrypt the encrypted value.
6204 /// In format: projects/*/locations/*/keyRings/*/cryptoKeys/*
6205 pub kms_key_name: std::string::String,
6206
6207 /// Map of environment variable name to its encrypted value.
6208 ///
6209 /// Secret environment variables must be unique across all of a build's
6210 /// secrets, and must be used by at least one build step. Values can be at most
6211 /// 64 KB in size. There can be at most 100 secret values across all of a
6212 /// build's secrets.
6213 pub env_map: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6214
6215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6216}
6217
6218impl InlineSecret {
6219 /// Creates a new default instance.
6220 pub fn new() -> Self {
6221 std::default::Default::default()
6222 }
6223
6224 /// Sets the value of [kms_key_name][crate::model::InlineSecret::kms_key_name].
6225 ///
6226 /// # Example
6227 /// ```ignore,no_run
6228 /// # use google_cloud_build_v1::model::InlineSecret;
6229 /// let x = InlineSecret::new().set_kms_key_name("example");
6230 /// ```
6231 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6232 self.kms_key_name = v.into();
6233 self
6234 }
6235
6236 /// Sets the value of [env_map][crate::model::InlineSecret::env_map].
6237 ///
6238 /// # Example
6239 /// ```ignore,no_run
6240 /// # use google_cloud_build_v1::model::InlineSecret;
6241 /// let x = InlineSecret::new().set_env_map([
6242 /// ("key0", bytes::Bytes::from_static(b"abc")),
6243 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6244 /// ]);
6245 /// ```
6246 pub fn set_env_map<T, K, V>(mut self, v: T) -> Self
6247 where
6248 T: std::iter::IntoIterator<Item = (K, V)>,
6249 K: std::convert::Into<std::string::String>,
6250 V: std::convert::Into<::bytes::Bytes>,
6251 {
6252 use std::iter::Iterator;
6253 self.env_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6254 self
6255 }
6256}
6257
6258impl wkt::message::Message for InlineSecret {
6259 fn typename() -> &'static str {
6260 "type.googleapis.com/google.devtools.cloudbuild.v1.InlineSecret"
6261 }
6262}
6263
6264/// Pairs a secret environment variable with a SecretVersion in Secret Manager.
6265#[derive(Clone, Default, PartialEq)]
6266#[non_exhaustive]
6267pub struct SecretManagerSecret {
6268 /// Resource name of the SecretVersion. In format:
6269 /// projects/*/secrets/*/versions/*
6270 pub version_name: std::string::String,
6271
6272 /// Environment variable name to associate with the secret.
6273 /// Secret environment variables must be unique across all of a build's
6274 /// secrets, and must be used by at least one build step.
6275 pub env: std::string::String,
6276
6277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6278}
6279
6280impl SecretManagerSecret {
6281 /// Creates a new default instance.
6282 pub fn new() -> Self {
6283 std::default::Default::default()
6284 }
6285
6286 /// Sets the value of [version_name][crate::model::SecretManagerSecret::version_name].
6287 ///
6288 /// # Example
6289 /// ```ignore,no_run
6290 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6291 /// let x = SecretManagerSecret::new().set_version_name("example");
6292 /// ```
6293 pub fn set_version_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6294 self.version_name = v.into();
6295 self
6296 }
6297
6298 /// Sets the value of [env][crate::model::SecretManagerSecret::env].
6299 ///
6300 /// # Example
6301 /// ```ignore,no_run
6302 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6303 /// let x = SecretManagerSecret::new().set_env("example");
6304 /// ```
6305 pub fn set_env<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6306 self.env = v.into();
6307 self
6308 }
6309}
6310
6311impl wkt::message::Message for SecretManagerSecret {
6312 fn typename() -> &'static str {
6313 "type.googleapis.com/google.devtools.cloudbuild.v1.SecretManagerSecret"
6314 }
6315}
6316
6317/// Pairs a set of secret environment variables containing encrypted
6318/// values with the Cloud KMS key to use to decrypt the value.
6319/// Note: Use `kmsKeyName` with `available_secrets` instead of using
6320/// `kmsKeyName` with `secret`. For instructions see:
6321/// <https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials>.
6322#[derive(Clone, Default, PartialEq)]
6323#[non_exhaustive]
6324pub struct Secret {
6325 /// Cloud KMS key name to use to decrypt these envs.
6326 pub kms_key_name: std::string::String,
6327
6328 /// Map of environment variable name to its encrypted value.
6329 ///
6330 /// Secret environment variables must be unique across all of a build's
6331 /// secrets, and must be used by at least one build step. Values can be at most
6332 /// 64 KB in size. There can be at most 100 secret values across all of a
6333 /// build's secrets.
6334 pub secret_env: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6335
6336 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6337}
6338
6339impl Secret {
6340 /// Creates a new default instance.
6341 pub fn new() -> Self {
6342 std::default::Default::default()
6343 }
6344
6345 /// Sets the value of [kms_key_name][crate::model::Secret::kms_key_name].
6346 ///
6347 /// # Example
6348 /// ```ignore,no_run
6349 /// # use google_cloud_build_v1::model::Secret;
6350 /// let x = Secret::new().set_kms_key_name("example");
6351 /// ```
6352 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6353 self.kms_key_name = v.into();
6354 self
6355 }
6356
6357 /// Sets the value of [secret_env][crate::model::Secret::secret_env].
6358 ///
6359 /// # Example
6360 /// ```ignore,no_run
6361 /// # use google_cloud_build_v1::model::Secret;
6362 /// let x = Secret::new().set_secret_env([
6363 /// ("key0", bytes::Bytes::from_static(b"abc")),
6364 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6365 /// ]);
6366 /// ```
6367 pub fn set_secret_env<T, K, V>(mut self, v: T) -> Self
6368 where
6369 T: std::iter::IntoIterator<Item = (K, V)>,
6370 K: std::convert::Into<std::string::String>,
6371 V: std::convert::Into<::bytes::Bytes>,
6372 {
6373 use std::iter::Iterator;
6374 self.secret_env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6375 self
6376 }
6377}
6378
6379impl wkt::message::Message for Secret {
6380 fn typename() -> &'static str {
6381 "type.googleapis.com/google.devtools.cloudbuild.v1.Secret"
6382 }
6383}
6384
6385/// Request to create a new build.
6386#[derive(Clone, Default, PartialEq)]
6387#[non_exhaustive]
6388pub struct CreateBuildRequest {
6389 /// The parent resource where this build will be created.
6390 /// Format: `projects/{project}/locations/{location}`
6391 pub parent: std::string::String,
6392
6393 /// Required. ID of the project.
6394 pub project_id: std::string::String,
6395
6396 /// Required. Build resource to create.
6397 pub build: std::option::Option<crate::model::Build>,
6398
6399 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6400}
6401
6402impl CreateBuildRequest {
6403 /// Creates a new default instance.
6404 pub fn new() -> Self {
6405 std::default::Default::default()
6406 }
6407
6408 /// Sets the value of [parent][crate::model::CreateBuildRequest::parent].
6409 ///
6410 /// # Example
6411 /// ```ignore,no_run
6412 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6413 /// # let project_id = "project_id";
6414 /// let x = CreateBuildRequest::new().set_parent(format!("projects/{project_id}"));
6415 /// ```
6416 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6417 self.parent = v.into();
6418 self
6419 }
6420
6421 /// Sets the value of [project_id][crate::model::CreateBuildRequest::project_id].
6422 ///
6423 /// # Example
6424 /// ```ignore,no_run
6425 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6426 /// let x = CreateBuildRequest::new().set_project_id("example");
6427 /// ```
6428 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6429 self.project_id = v.into();
6430 self
6431 }
6432
6433 /// Sets the value of [build][crate::model::CreateBuildRequest::build].
6434 ///
6435 /// # Example
6436 /// ```ignore,no_run
6437 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6438 /// use google_cloud_build_v1::model::Build;
6439 /// let x = CreateBuildRequest::new().set_build(Build::default()/* use setters */);
6440 /// ```
6441 pub fn set_build<T>(mut self, v: T) -> Self
6442 where
6443 T: std::convert::Into<crate::model::Build>,
6444 {
6445 self.build = std::option::Option::Some(v.into());
6446 self
6447 }
6448
6449 /// Sets or clears the value of [build][crate::model::CreateBuildRequest::build].
6450 ///
6451 /// # Example
6452 /// ```ignore,no_run
6453 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6454 /// use google_cloud_build_v1::model::Build;
6455 /// let x = CreateBuildRequest::new().set_or_clear_build(Some(Build::default()/* use setters */));
6456 /// let x = CreateBuildRequest::new().set_or_clear_build(None::<Build>);
6457 /// ```
6458 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
6459 where
6460 T: std::convert::Into<crate::model::Build>,
6461 {
6462 self.build = v.map(|x| x.into());
6463 self
6464 }
6465}
6466
6467impl wkt::message::Message for CreateBuildRequest {
6468 fn typename() -> &'static str {
6469 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildRequest"
6470 }
6471}
6472
6473/// Request to get a build.
6474#[derive(Clone, Default, PartialEq)]
6475#[non_exhaustive]
6476pub struct GetBuildRequest {
6477 /// The name of the `Build` to retrieve.
6478 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6479 pub name: std::string::String,
6480
6481 /// Required. ID of the project.
6482 pub project_id: std::string::String,
6483
6484 /// Required. ID of the build.
6485 pub id: std::string::String,
6486
6487 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6488}
6489
6490impl GetBuildRequest {
6491 /// Creates a new default instance.
6492 pub fn new() -> Self {
6493 std::default::Default::default()
6494 }
6495
6496 /// Sets the value of [name][crate::model::GetBuildRequest::name].
6497 ///
6498 /// # Example
6499 /// ```ignore,no_run
6500 /// # use google_cloud_build_v1::model::GetBuildRequest;
6501 /// # let project_id = "project_id";
6502 /// # let build_id = "build_id";
6503 /// let x = GetBuildRequest::new().set_name(format!("projects/{project_id}/builds/{build_id}"));
6504 /// ```
6505 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6506 self.name = v.into();
6507 self
6508 }
6509
6510 /// Sets the value of [project_id][crate::model::GetBuildRequest::project_id].
6511 ///
6512 /// # Example
6513 /// ```ignore,no_run
6514 /// # use google_cloud_build_v1::model::GetBuildRequest;
6515 /// let x = GetBuildRequest::new().set_project_id("example");
6516 /// ```
6517 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6518 self.project_id = v.into();
6519 self
6520 }
6521
6522 /// Sets the value of [id][crate::model::GetBuildRequest::id].
6523 ///
6524 /// # Example
6525 /// ```ignore,no_run
6526 /// # use google_cloud_build_v1::model::GetBuildRequest;
6527 /// let x = GetBuildRequest::new().set_id("example");
6528 /// ```
6529 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6530 self.id = v.into();
6531 self
6532 }
6533}
6534
6535impl wkt::message::Message for GetBuildRequest {
6536 fn typename() -> &'static str {
6537 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildRequest"
6538 }
6539}
6540
6541/// Request to list builds.
6542#[derive(Clone, Default, PartialEq)]
6543#[non_exhaustive]
6544pub struct ListBuildsRequest {
6545 /// The parent of the collection of `Builds`.
6546 /// Format: `projects/{project}/locations/{location}`
6547 pub parent: std::string::String,
6548
6549 /// Required. ID of the project.
6550 pub project_id: std::string::String,
6551
6552 /// Number of results to return in the list.
6553 pub page_size: i32,
6554
6555 /// The page token for the next page of Builds.
6556 ///
6557 /// If unspecified, the first page of results is returned.
6558 ///
6559 /// If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
6560 /// In this case, the token should be discarded, and pagination should be
6561 /// restarted from the first page of results.
6562 ///
6563 /// See <https://google.aip.dev/158> for more.
6564 pub page_token: std::string::String,
6565
6566 /// The raw filter text to constrain the results.
6567 pub filter: std::string::String,
6568
6569 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6570}
6571
6572impl ListBuildsRequest {
6573 /// Creates a new default instance.
6574 pub fn new() -> Self {
6575 std::default::Default::default()
6576 }
6577
6578 /// Sets the value of [parent][crate::model::ListBuildsRequest::parent].
6579 ///
6580 /// # Example
6581 /// ```ignore,no_run
6582 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6583 /// # let project_id = "project_id";
6584 /// let x = ListBuildsRequest::new().set_parent(format!("projects/{project_id}"));
6585 /// ```
6586 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6587 self.parent = v.into();
6588 self
6589 }
6590
6591 /// Sets the value of [project_id][crate::model::ListBuildsRequest::project_id].
6592 ///
6593 /// # Example
6594 /// ```ignore,no_run
6595 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6596 /// let x = ListBuildsRequest::new().set_project_id("example");
6597 /// ```
6598 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6599 self.project_id = v.into();
6600 self
6601 }
6602
6603 /// Sets the value of [page_size][crate::model::ListBuildsRequest::page_size].
6604 ///
6605 /// # Example
6606 /// ```ignore,no_run
6607 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6608 /// let x = ListBuildsRequest::new().set_page_size(42);
6609 /// ```
6610 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6611 self.page_size = v.into();
6612 self
6613 }
6614
6615 /// Sets the value of [page_token][crate::model::ListBuildsRequest::page_token].
6616 ///
6617 /// # Example
6618 /// ```ignore,no_run
6619 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6620 /// let x = ListBuildsRequest::new().set_page_token("example");
6621 /// ```
6622 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6623 self.page_token = v.into();
6624 self
6625 }
6626
6627 /// Sets the value of [filter][crate::model::ListBuildsRequest::filter].
6628 ///
6629 /// # Example
6630 /// ```ignore,no_run
6631 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6632 /// let x = ListBuildsRequest::new().set_filter("example");
6633 /// ```
6634 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6635 self.filter = v.into();
6636 self
6637 }
6638}
6639
6640impl wkt::message::Message for ListBuildsRequest {
6641 fn typename() -> &'static str {
6642 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsRequest"
6643 }
6644}
6645
6646/// Response including listed builds.
6647#[derive(Clone, Default, PartialEq)]
6648#[non_exhaustive]
6649pub struct ListBuildsResponse {
6650 /// Builds will be sorted by `create_time`, descending.
6651 pub builds: std::vec::Vec<crate::model::Build>,
6652
6653 /// Token to receive the next page of results.
6654 /// This will be absent if the end of the response list has been reached.
6655 pub next_page_token: std::string::String,
6656
6657 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6658}
6659
6660impl ListBuildsResponse {
6661 /// Creates a new default instance.
6662 pub fn new() -> Self {
6663 std::default::Default::default()
6664 }
6665
6666 /// Sets the value of [builds][crate::model::ListBuildsResponse::builds].
6667 ///
6668 /// # Example
6669 /// ```ignore,no_run
6670 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6671 /// use google_cloud_build_v1::model::Build;
6672 /// let x = ListBuildsResponse::new()
6673 /// .set_builds([
6674 /// Build::default()/* use setters */,
6675 /// Build::default()/* use (different) setters */,
6676 /// ]);
6677 /// ```
6678 pub fn set_builds<T, V>(mut self, v: T) -> Self
6679 where
6680 T: std::iter::IntoIterator<Item = V>,
6681 V: std::convert::Into<crate::model::Build>,
6682 {
6683 use std::iter::Iterator;
6684 self.builds = v.into_iter().map(|i| i.into()).collect();
6685 self
6686 }
6687
6688 /// Sets the value of [next_page_token][crate::model::ListBuildsResponse::next_page_token].
6689 ///
6690 /// # Example
6691 /// ```ignore,no_run
6692 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6693 /// let x = ListBuildsResponse::new().set_next_page_token("example");
6694 /// ```
6695 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6696 self.next_page_token = v.into();
6697 self
6698 }
6699}
6700
6701impl wkt::message::Message for ListBuildsResponse {
6702 fn typename() -> &'static str {
6703 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsResponse"
6704 }
6705}
6706
6707#[doc(hidden)]
6708impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildsResponse {
6709 type PageItem = crate::model::Build;
6710
6711 fn items(self) -> std::vec::Vec<Self::PageItem> {
6712 self.builds
6713 }
6714
6715 fn next_page_token(&self) -> std::string::String {
6716 use std::clone::Clone;
6717 self.next_page_token.clone()
6718 }
6719}
6720
6721/// Request to cancel an ongoing build.
6722#[derive(Clone, Default, PartialEq)]
6723#[non_exhaustive]
6724pub struct CancelBuildRequest {
6725 /// The name of the `Build` to cancel.
6726 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6727 pub name: std::string::String,
6728
6729 /// Required. ID of the project.
6730 pub project_id: std::string::String,
6731
6732 /// Required. ID of the build.
6733 pub id: std::string::String,
6734
6735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6736}
6737
6738impl CancelBuildRequest {
6739 /// Creates a new default instance.
6740 pub fn new() -> Self {
6741 std::default::Default::default()
6742 }
6743
6744 /// Sets the value of [name][crate::model::CancelBuildRequest::name].
6745 ///
6746 /// # Example
6747 /// ```ignore,no_run
6748 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6749 /// # let project_id = "project_id";
6750 /// # let build_id = "build_id";
6751 /// let x = CancelBuildRequest::new().set_name(format!("projects/{project_id}/builds/{build_id}"));
6752 /// ```
6753 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6754 self.name = v.into();
6755 self
6756 }
6757
6758 /// Sets the value of [project_id][crate::model::CancelBuildRequest::project_id].
6759 ///
6760 /// # Example
6761 /// ```ignore,no_run
6762 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6763 /// let x = CancelBuildRequest::new().set_project_id("example");
6764 /// ```
6765 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6766 self.project_id = v.into();
6767 self
6768 }
6769
6770 /// Sets the value of [id][crate::model::CancelBuildRequest::id].
6771 ///
6772 /// # Example
6773 /// ```ignore,no_run
6774 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6775 /// let x = CancelBuildRequest::new().set_id("example");
6776 /// ```
6777 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6778 self.id = v.into();
6779 self
6780 }
6781}
6782
6783impl wkt::message::Message for CancelBuildRequest {
6784 fn typename() -> &'static str {
6785 "type.googleapis.com/google.devtools.cloudbuild.v1.CancelBuildRequest"
6786 }
6787}
6788
6789/// Request to approve or reject a pending build.
6790#[derive(Clone, Default, PartialEq)]
6791#[non_exhaustive]
6792pub struct ApproveBuildRequest {
6793 /// Required. Name of the target build.
6794 /// For example: "projects/{$project_id}/builds/{$build_id}"
6795 pub name: std::string::String,
6796
6797 /// Approval decision and metadata.
6798 pub approval_result: std::option::Option<crate::model::ApprovalResult>,
6799
6800 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6801}
6802
6803impl ApproveBuildRequest {
6804 /// Creates a new default instance.
6805 pub fn new() -> Self {
6806 std::default::Default::default()
6807 }
6808
6809 /// Sets the value of [name][crate::model::ApproveBuildRequest::name].
6810 ///
6811 /// # Example
6812 /// ```ignore,no_run
6813 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6814 /// let x = ApproveBuildRequest::new().set_name("example");
6815 /// ```
6816 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6817 self.name = v.into();
6818 self
6819 }
6820
6821 /// Sets the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6822 ///
6823 /// # Example
6824 /// ```ignore,no_run
6825 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6826 /// use google_cloud_build_v1::model::ApprovalResult;
6827 /// let x = ApproveBuildRequest::new().set_approval_result(ApprovalResult::default()/* use setters */);
6828 /// ```
6829 pub fn set_approval_result<T>(mut self, v: T) -> Self
6830 where
6831 T: std::convert::Into<crate::model::ApprovalResult>,
6832 {
6833 self.approval_result = std::option::Option::Some(v.into());
6834 self
6835 }
6836
6837 /// Sets or clears the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6838 ///
6839 /// # Example
6840 /// ```ignore,no_run
6841 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6842 /// use google_cloud_build_v1::model::ApprovalResult;
6843 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(Some(ApprovalResult::default()/* use setters */));
6844 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(None::<ApprovalResult>);
6845 /// ```
6846 pub fn set_or_clear_approval_result<T>(mut self, v: std::option::Option<T>) -> Self
6847 where
6848 T: std::convert::Into<crate::model::ApprovalResult>,
6849 {
6850 self.approval_result = v.map(|x| x.into());
6851 self
6852 }
6853}
6854
6855impl wkt::message::Message for ApproveBuildRequest {
6856 fn typename() -> &'static str {
6857 "type.googleapis.com/google.devtools.cloudbuild.v1.ApproveBuildRequest"
6858 }
6859}
6860
6861/// BuildApproval describes a build's approval configuration, state, and
6862/// result.
6863#[derive(Clone, Default, PartialEq)]
6864#[non_exhaustive]
6865pub struct BuildApproval {
6866 /// Output only. The state of this build's approval.
6867 pub state: crate::model::build_approval::State,
6868
6869 /// Output only. Configuration for manual approval of this build.
6870 pub config: std::option::Option<crate::model::ApprovalConfig>,
6871
6872 /// Output only. Result of manual approval for this Build.
6873 pub result: std::option::Option<crate::model::ApprovalResult>,
6874
6875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6876}
6877
6878impl BuildApproval {
6879 /// Creates a new default instance.
6880 pub fn new() -> Self {
6881 std::default::Default::default()
6882 }
6883
6884 /// Sets the value of [state][crate::model::BuildApproval::state].
6885 ///
6886 /// # Example
6887 /// ```ignore,no_run
6888 /// # use google_cloud_build_v1::model::BuildApproval;
6889 /// use google_cloud_build_v1::model::build_approval::State;
6890 /// let x0 = BuildApproval::new().set_state(State::Pending);
6891 /// let x1 = BuildApproval::new().set_state(State::Approved);
6892 /// let x2 = BuildApproval::new().set_state(State::Rejected);
6893 /// ```
6894 pub fn set_state<T: std::convert::Into<crate::model::build_approval::State>>(
6895 mut self,
6896 v: T,
6897 ) -> Self {
6898 self.state = v.into();
6899 self
6900 }
6901
6902 /// Sets the value of [config][crate::model::BuildApproval::config].
6903 ///
6904 /// # Example
6905 /// ```ignore,no_run
6906 /// # use google_cloud_build_v1::model::BuildApproval;
6907 /// use google_cloud_build_v1::model::ApprovalConfig;
6908 /// let x = BuildApproval::new().set_config(ApprovalConfig::default()/* use setters */);
6909 /// ```
6910 pub fn set_config<T>(mut self, v: T) -> Self
6911 where
6912 T: std::convert::Into<crate::model::ApprovalConfig>,
6913 {
6914 self.config = std::option::Option::Some(v.into());
6915 self
6916 }
6917
6918 /// Sets or clears the value of [config][crate::model::BuildApproval::config].
6919 ///
6920 /// # Example
6921 /// ```ignore,no_run
6922 /// # use google_cloud_build_v1::model::BuildApproval;
6923 /// use google_cloud_build_v1::model::ApprovalConfig;
6924 /// let x = BuildApproval::new().set_or_clear_config(Some(ApprovalConfig::default()/* use setters */));
6925 /// let x = BuildApproval::new().set_or_clear_config(None::<ApprovalConfig>);
6926 /// ```
6927 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
6928 where
6929 T: std::convert::Into<crate::model::ApprovalConfig>,
6930 {
6931 self.config = v.map(|x| x.into());
6932 self
6933 }
6934
6935 /// Sets the value of [result][crate::model::BuildApproval::result].
6936 ///
6937 /// # Example
6938 /// ```ignore,no_run
6939 /// # use google_cloud_build_v1::model::BuildApproval;
6940 /// use google_cloud_build_v1::model::ApprovalResult;
6941 /// let x = BuildApproval::new().set_result(ApprovalResult::default()/* use setters */);
6942 /// ```
6943 pub fn set_result<T>(mut self, v: T) -> Self
6944 where
6945 T: std::convert::Into<crate::model::ApprovalResult>,
6946 {
6947 self.result = std::option::Option::Some(v.into());
6948 self
6949 }
6950
6951 /// Sets or clears the value of [result][crate::model::BuildApproval::result].
6952 ///
6953 /// # Example
6954 /// ```ignore,no_run
6955 /// # use google_cloud_build_v1::model::BuildApproval;
6956 /// use google_cloud_build_v1::model::ApprovalResult;
6957 /// let x = BuildApproval::new().set_or_clear_result(Some(ApprovalResult::default()/* use setters */));
6958 /// let x = BuildApproval::new().set_or_clear_result(None::<ApprovalResult>);
6959 /// ```
6960 pub fn set_or_clear_result<T>(mut self, v: std::option::Option<T>) -> Self
6961 where
6962 T: std::convert::Into<crate::model::ApprovalResult>,
6963 {
6964 self.result = v.map(|x| x.into());
6965 self
6966 }
6967}
6968
6969impl wkt::message::Message for BuildApproval {
6970 fn typename() -> &'static str {
6971 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildApproval"
6972 }
6973}
6974
6975/// Defines additional types related to [BuildApproval].
6976pub mod build_approval {
6977 #[allow(unused_imports)]
6978 use super::*;
6979
6980 /// Specifies the current state of a build's approval.
6981 ///
6982 /// # Working with unknown values
6983 ///
6984 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6985 /// additional enum variants at any time. Adding new variants is not considered
6986 /// a breaking change. Applications should write their code in anticipation of:
6987 ///
6988 /// - New values appearing in future releases of the client library, **and**
6989 /// - New values received dynamically, without application changes.
6990 ///
6991 /// Please consult the [Working with enums] section in the user guide for some
6992 /// guidelines.
6993 ///
6994 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6995 #[derive(Clone, Debug, PartialEq)]
6996 #[non_exhaustive]
6997 pub enum State {
6998 /// Default enum type. This should not be used.
6999 Unspecified,
7000 /// Build approval is pending.
7001 Pending,
7002 /// Build approval has been approved.
7003 Approved,
7004 /// Build approval has been rejected.
7005 Rejected,
7006 /// Build was cancelled while it was still pending approval.
7007 Cancelled,
7008 /// If set, the enum was initialized with an unknown value.
7009 ///
7010 /// Applications can examine the value using [State::value] or
7011 /// [State::name].
7012 UnknownValue(state::UnknownValue),
7013 }
7014
7015 #[doc(hidden)]
7016 pub mod state {
7017 #[allow(unused_imports)]
7018 use super::*;
7019 #[derive(Clone, Debug, PartialEq)]
7020 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7021 }
7022
7023 impl State {
7024 /// Gets the enum value.
7025 ///
7026 /// Returns `None` if the enum contains an unknown value deserialized from
7027 /// the string representation of enums.
7028 pub fn value(&self) -> std::option::Option<i32> {
7029 match self {
7030 Self::Unspecified => std::option::Option::Some(0),
7031 Self::Pending => std::option::Option::Some(1),
7032 Self::Approved => std::option::Option::Some(2),
7033 Self::Rejected => std::option::Option::Some(3),
7034 Self::Cancelled => std::option::Option::Some(5),
7035 Self::UnknownValue(u) => u.0.value(),
7036 }
7037 }
7038
7039 /// Gets the enum value as a string.
7040 ///
7041 /// Returns `None` if the enum contains an unknown value deserialized from
7042 /// the integer representation of enums.
7043 pub fn name(&self) -> std::option::Option<&str> {
7044 match self {
7045 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7046 Self::Pending => std::option::Option::Some("PENDING"),
7047 Self::Approved => std::option::Option::Some("APPROVED"),
7048 Self::Rejected => std::option::Option::Some("REJECTED"),
7049 Self::Cancelled => std::option::Option::Some("CANCELLED"),
7050 Self::UnknownValue(u) => u.0.name(),
7051 }
7052 }
7053 }
7054
7055 impl std::default::Default for State {
7056 fn default() -> Self {
7057 use std::convert::From;
7058 Self::from(0)
7059 }
7060 }
7061
7062 impl std::fmt::Display for State {
7063 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7064 wkt::internal::display_enum(f, self.name(), self.value())
7065 }
7066 }
7067
7068 impl std::convert::From<i32> for State {
7069 fn from(value: i32) -> Self {
7070 match value {
7071 0 => Self::Unspecified,
7072 1 => Self::Pending,
7073 2 => Self::Approved,
7074 3 => Self::Rejected,
7075 5 => Self::Cancelled,
7076 _ => Self::UnknownValue(state::UnknownValue(
7077 wkt::internal::UnknownEnumValue::Integer(value),
7078 )),
7079 }
7080 }
7081 }
7082
7083 impl std::convert::From<&str> for State {
7084 fn from(value: &str) -> Self {
7085 use std::string::ToString;
7086 match value {
7087 "STATE_UNSPECIFIED" => Self::Unspecified,
7088 "PENDING" => Self::Pending,
7089 "APPROVED" => Self::Approved,
7090 "REJECTED" => Self::Rejected,
7091 "CANCELLED" => Self::Cancelled,
7092 _ => Self::UnknownValue(state::UnknownValue(
7093 wkt::internal::UnknownEnumValue::String(value.to_string()),
7094 )),
7095 }
7096 }
7097 }
7098
7099 impl serde::ser::Serialize for State {
7100 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7101 where
7102 S: serde::Serializer,
7103 {
7104 match self {
7105 Self::Unspecified => serializer.serialize_i32(0),
7106 Self::Pending => serializer.serialize_i32(1),
7107 Self::Approved => serializer.serialize_i32(2),
7108 Self::Rejected => serializer.serialize_i32(3),
7109 Self::Cancelled => serializer.serialize_i32(5),
7110 Self::UnknownValue(u) => u.0.serialize(serializer),
7111 }
7112 }
7113 }
7114
7115 impl<'de> serde::de::Deserialize<'de> for State {
7116 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7117 where
7118 D: serde::Deserializer<'de>,
7119 {
7120 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7121 ".google.devtools.cloudbuild.v1.BuildApproval.State",
7122 ))
7123 }
7124 }
7125}
7126
7127/// ApprovalConfig describes configuration for manual approval of a build.
7128#[derive(Clone, Default, PartialEq)]
7129#[non_exhaustive]
7130pub struct ApprovalConfig {
7131 /// Whether or not approval is needed. If this is set on a build, it will
7132 /// become pending when created, and will need to be explicitly approved
7133 /// to start.
7134 pub approval_required: bool,
7135
7136 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7137}
7138
7139impl ApprovalConfig {
7140 /// Creates a new default instance.
7141 pub fn new() -> Self {
7142 std::default::Default::default()
7143 }
7144
7145 /// Sets the value of [approval_required][crate::model::ApprovalConfig::approval_required].
7146 ///
7147 /// # Example
7148 /// ```ignore,no_run
7149 /// # use google_cloud_build_v1::model::ApprovalConfig;
7150 /// let x = ApprovalConfig::new().set_approval_required(true);
7151 /// ```
7152 pub fn set_approval_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7153 self.approval_required = v.into();
7154 self
7155 }
7156}
7157
7158impl wkt::message::Message for ApprovalConfig {
7159 fn typename() -> &'static str {
7160 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalConfig"
7161 }
7162}
7163
7164/// ApprovalResult describes the decision and associated metadata of a manual
7165/// approval of a build.
7166#[derive(Clone, Default, PartialEq)]
7167#[non_exhaustive]
7168pub struct ApprovalResult {
7169 /// Output only. Email of the user that called the ApproveBuild API to
7170 /// approve or reject a build at the time that the API was called.
7171 pub approver_account: std::string::String,
7172
7173 /// Output only. The time when the approval decision was made.
7174 pub approval_time: std::option::Option<wkt::Timestamp>,
7175
7176 /// Required. The decision of this manual approval.
7177 pub decision: crate::model::approval_result::Decision,
7178
7179 /// Optional. An optional comment for this manual approval result.
7180 pub comment: std::string::String,
7181
7182 /// Optional. An optional URL tied to this manual approval result. This field
7183 /// is essentially the same as comment, except that it will be rendered by the
7184 /// UI differently. An example use case is a link to an external job that
7185 /// approved this Build.
7186 pub url: std::string::String,
7187
7188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7189}
7190
7191impl ApprovalResult {
7192 /// Creates a new default instance.
7193 pub fn new() -> Self {
7194 std::default::Default::default()
7195 }
7196
7197 /// Sets the value of [approver_account][crate::model::ApprovalResult::approver_account].
7198 ///
7199 /// # Example
7200 /// ```ignore,no_run
7201 /// # use google_cloud_build_v1::model::ApprovalResult;
7202 /// let x = ApprovalResult::new().set_approver_account("example");
7203 /// ```
7204 pub fn set_approver_account<T: std::convert::Into<std::string::String>>(
7205 mut self,
7206 v: T,
7207 ) -> Self {
7208 self.approver_account = v.into();
7209 self
7210 }
7211
7212 /// Sets the value of [approval_time][crate::model::ApprovalResult::approval_time].
7213 ///
7214 /// # Example
7215 /// ```ignore,no_run
7216 /// # use google_cloud_build_v1::model::ApprovalResult;
7217 /// use wkt::Timestamp;
7218 /// let x = ApprovalResult::new().set_approval_time(Timestamp::default()/* use setters */);
7219 /// ```
7220 pub fn set_approval_time<T>(mut self, v: T) -> Self
7221 where
7222 T: std::convert::Into<wkt::Timestamp>,
7223 {
7224 self.approval_time = std::option::Option::Some(v.into());
7225 self
7226 }
7227
7228 /// Sets or clears the value of [approval_time][crate::model::ApprovalResult::approval_time].
7229 ///
7230 /// # Example
7231 /// ```ignore,no_run
7232 /// # use google_cloud_build_v1::model::ApprovalResult;
7233 /// use wkt::Timestamp;
7234 /// let x = ApprovalResult::new().set_or_clear_approval_time(Some(Timestamp::default()/* use setters */));
7235 /// let x = ApprovalResult::new().set_or_clear_approval_time(None::<Timestamp>);
7236 /// ```
7237 pub fn set_or_clear_approval_time<T>(mut self, v: std::option::Option<T>) -> Self
7238 where
7239 T: std::convert::Into<wkt::Timestamp>,
7240 {
7241 self.approval_time = v.map(|x| x.into());
7242 self
7243 }
7244
7245 /// Sets the value of [decision][crate::model::ApprovalResult::decision].
7246 ///
7247 /// # Example
7248 /// ```ignore,no_run
7249 /// # use google_cloud_build_v1::model::ApprovalResult;
7250 /// use google_cloud_build_v1::model::approval_result::Decision;
7251 /// let x0 = ApprovalResult::new().set_decision(Decision::Approved);
7252 /// let x1 = ApprovalResult::new().set_decision(Decision::Rejected);
7253 /// ```
7254 pub fn set_decision<T: std::convert::Into<crate::model::approval_result::Decision>>(
7255 mut self,
7256 v: T,
7257 ) -> Self {
7258 self.decision = v.into();
7259 self
7260 }
7261
7262 /// Sets the value of [comment][crate::model::ApprovalResult::comment].
7263 ///
7264 /// # Example
7265 /// ```ignore,no_run
7266 /// # use google_cloud_build_v1::model::ApprovalResult;
7267 /// let x = ApprovalResult::new().set_comment("example");
7268 /// ```
7269 pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7270 self.comment = v.into();
7271 self
7272 }
7273
7274 /// Sets the value of [url][crate::model::ApprovalResult::url].
7275 ///
7276 /// # Example
7277 /// ```ignore,no_run
7278 /// # use google_cloud_build_v1::model::ApprovalResult;
7279 /// let x = ApprovalResult::new().set_url("example");
7280 /// ```
7281 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7282 self.url = v.into();
7283 self
7284 }
7285}
7286
7287impl wkt::message::Message for ApprovalResult {
7288 fn typename() -> &'static str {
7289 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalResult"
7290 }
7291}
7292
7293/// Defines additional types related to [ApprovalResult].
7294pub mod approval_result {
7295 #[allow(unused_imports)]
7296 use super::*;
7297
7298 /// Specifies whether or not this manual approval result is to approve
7299 /// or reject a build.
7300 ///
7301 /// # Working with unknown values
7302 ///
7303 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7304 /// additional enum variants at any time. Adding new variants is not considered
7305 /// a breaking change. Applications should write their code in anticipation of:
7306 ///
7307 /// - New values appearing in future releases of the client library, **and**
7308 /// - New values received dynamically, without application changes.
7309 ///
7310 /// Please consult the [Working with enums] section in the user guide for some
7311 /// guidelines.
7312 ///
7313 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7314 #[derive(Clone, Debug, PartialEq)]
7315 #[non_exhaustive]
7316 pub enum Decision {
7317 /// Default enum type. This should not be used.
7318 Unspecified,
7319 /// Build is approved.
7320 Approved,
7321 /// Build is rejected.
7322 Rejected,
7323 /// If set, the enum was initialized with an unknown value.
7324 ///
7325 /// Applications can examine the value using [Decision::value] or
7326 /// [Decision::name].
7327 UnknownValue(decision::UnknownValue),
7328 }
7329
7330 #[doc(hidden)]
7331 pub mod decision {
7332 #[allow(unused_imports)]
7333 use super::*;
7334 #[derive(Clone, Debug, PartialEq)]
7335 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7336 }
7337
7338 impl Decision {
7339 /// Gets the enum value.
7340 ///
7341 /// Returns `None` if the enum contains an unknown value deserialized from
7342 /// the string representation of enums.
7343 pub fn value(&self) -> std::option::Option<i32> {
7344 match self {
7345 Self::Unspecified => std::option::Option::Some(0),
7346 Self::Approved => std::option::Option::Some(1),
7347 Self::Rejected => std::option::Option::Some(2),
7348 Self::UnknownValue(u) => u.0.value(),
7349 }
7350 }
7351
7352 /// Gets the enum value as a string.
7353 ///
7354 /// Returns `None` if the enum contains an unknown value deserialized from
7355 /// the integer representation of enums.
7356 pub fn name(&self) -> std::option::Option<&str> {
7357 match self {
7358 Self::Unspecified => std::option::Option::Some("DECISION_UNSPECIFIED"),
7359 Self::Approved => std::option::Option::Some("APPROVED"),
7360 Self::Rejected => std::option::Option::Some("REJECTED"),
7361 Self::UnknownValue(u) => u.0.name(),
7362 }
7363 }
7364 }
7365
7366 impl std::default::Default for Decision {
7367 fn default() -> Self {
7368 use std::convert::From;
7369 Self::from(0)
7370 }
7371 }
7372
7373 impl std::fmt::Display for Decision {
7374 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7375 wkt::internal::display_enum(f, self.name(), self.value())
7376 }
7377 }
7378
7379 impl std::convert::From<i32> for Decision {
7380 fn from(value: i32) -> Self {
7381 match value {
7382 0 => Self::Unspecified,
7383 1 => Self::Approved,
7384 2 => Self::Rejected,
7385 _ => Self::UnknownValue(decision::UnknownValue(
7386 wkt::internal::UnknownEnumValue::Integer(value),
7387 )),
7388 }
7389 }
7390 }
7391
7392 impl std::convert::From<&str> for Decision {
7393 fn from(value: &str) -> Self {
7394 use std::string::ToString;
7395 match value {
7396 "DECISION_UNSPECIFIED" => Self::Unspecified,
7397 "APPROVED" => Self::Approved,
7398 "REJECTED" => Self::Rejected,
7399 _ => Self::UnknownValue(decision::UnknownValue(
7400 wkt::internal::UnknownEnumValue::String(value.to_string()),
7401 )),
7402 }
7403 }
7404 }
7405
7406 impl serde::ser::Serialize for Decision {
7407 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7408 where
7409 S: serde::Serializer,
7410 {
7411 match self {
7412 Self::Unspecified => serializer.serialize_i32(0),
7413 Self::Approved => serializer.serialize_i32(1),
7414 Self::Rejected => serializer.serialize_i32(2),
7415 Self::UnknownValue(u) => u.0.serialize(serializer),
7416 }
7417 }
7418 }
7419
7420 impl<'de> serde::de::Deserialize<'de> for Decision {
7421 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7422 where
7423 D: serde::Deserializer<'de>,
7424 {
7425 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Decision>::new(
7426 ".google.devtools.cloudbuild.v1.ApprovalResult.Decision",
7427 ))
7428 }
7429 }
7430}
7431
7432/// GitRepoSource describes a repo and ref of a code repository.
7433#[derive(Clone, Default, PartialEq)]
7434#[non_exhaustive]
7435pub struct GitRepoSource {
7436 /// The URI of the repo (e.g. <https://github.com/user/repo.git>).
7437 /// Either `uri` or `repository` can be specified and is required.
7438 pub uri: std::string::String,
7439
7440 /// The branch or tag to use. Must start with "refs/" (required).
7441 pub r#ref: std::string::String,
7442
7443 /// See RepoType below.
7444 pub repo_type: crate::model::git_file_source::RepoType,
7445
7446 /// The source of the SCM repo.
7447 pub source: std::option::Option<crate::model::git_repo_source::Source>,
7448
7449 /// The resource name of the enterprise config that should be applied
7450 /// to this source.
7451 pub enterprise_config: std::option::Option<crate::model::git_repo_source::EnterpriseConfig>,
7452
7453 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7454}
7455
7456impl GitRepoSource {
7457 /// Creates a new default instance.
7458 pub fn new() -> Self {
7459 std::default::Default::default()
7460 }
7461
7462 /// Sets the value of [uri][crate::model::GitRepoSource::uri].
7463 ///
7464 /// # Example
7465 /// ```ignore,no_run
7466 /// # use google_cloud_build_v1::model::GitRepoSource;
7467 /// let x = GitRepoSource::new().set_uri("example");
7468 /// ```
7469 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7470 self.uri = v.into();
7471 self
7472 }
7473
7474 /// Sets the value of [r#ref][crate::model::GitRepoSource::ref].
7475 ///
7476 /// # Example
7477 /// ```ignore,no_run
7478 /// # use google_cloud_build_v1::model::GitRepoSource;
7479 /// let x = GitRepoSource::new().set_ref("example");
7480 /// ```
7481 pub fn set_ref<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7482 self.r#ref = v.into();
7483 self
7484 }
7485
7486 /// Sets the value of [repo_type][crate::model::GitRepoSource::repo_type].
7487 ///
7488 /// # Example
7489 /// ```ignore,no_run
7490 /// # use google_cloud_build_v1::model::GitRepoSource;
7491 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7492 /// let x0 = GitRepoSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7493 /// let x1 = GitRepoSource::new().set_repo_type(RepoType::Github);
7494 /// let x2 = GitRepoSource::new().set_repo_type(RepoType::BitbucketServer);
7495 /// ```
7496 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7497 mut self,
7498 v: T,
7499 ) -> Self {
7500 self.repo_type = v.into();
7501 self
7502 }
7503
7504 /// Sets the value of [source][crate::model::GitRepoSource::source].
7505 ///
7506 /// Note that all the setters affecting `source` are mutually
7507 /// exclusive.
7508 ///
7509 /// # Example
7510 /// ```ignore,no_run
7511 /// # use google_cloud_build_v1::model::GitRepoSource;
7512 /// use google_cloud_build_v1::model::git_repo_source::Source;
7513 /// let x = GitRepoSource::new().set_source(Some(Source::Repository("example".to_string())));
7514 /// ```
7515 pub fn set_source<
7516 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::Source>>,
7517 >(
7518 mut self,
7519 v: T,
7520 ) -> Self {
7521 self.source = v.into();
7522 self
7523 }
7524
7525 /// The value of [source][crate::model::GitRepoSource::source]
7526 /// if it holds a `Repository`, `None` if the field is not set or
7527 /// holds a different branch.
7528 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7529 #[allow(unreachable_patterns)]
7530 self.source.as_ref().and_then(|v| match v {
7531 crate::model::git_repo_source::Source::Repository(v) => std::option::Option::Some(v),
7532 _ => std::option::Option::None,
7533 })
7534 }
7535
7536 /// Sets the value of [source][crate::model::GitRepoSource::source]
7537 /// to hold a `Repository`.
7538 ///
7539 /// Note that all the setters affecting `source` are
7540 /// mutually exclusive.
7541 ///
7542 /// # Example
7543 /// ```ignore,no_run
7544 /// # use google_cloud_build_v1::model::GitRepoSource;
7545 /// let x = GitRepoSource::new().set_repository("example");
7546 /// assert!(x.repository().is_some());
7547 /// ```
7548 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7549 self.source =
7550 std::option::Option::Some(crate::model::git_repo_source::Source::Repository(v.into()));
7551 self
7552 }
7553
7554 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config].
7555 ///
7556 /// Note that all the setters affecting `enterprise_config` are mutually
7557 /// exclusive.
7558 ///
7559 /// # Example
7560 /// ```ignore,no_run
7561 /// # use google_cloud_build_v1::model::GitRepoSource;
7562 /// use google_cloud_build_v1::model::git_repo_source::EnterpriseConfig;
7563 /// let x = GitRepoSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7564 /// ```
7565 pub fn set_enterprise_config<
7566 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::EnterpriseConfig>>,
7567 >(
7568 mut self,
7569 v: T,
7570 ) -> Self {
7571 self.enterprise_config = v.into();
7572 self
7573 }
7574
7575 /// The value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7576 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7577 /// holds a different branch.
7578 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7579 #[allow(unreachable_patterns)]
7580 self.enterprise_config.as_ref().and_then(|v| match v {
7581 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7582 std::option::Option::Some(v)
7583 }
7584 _ => std::option::Option::None,
7585 })
7586 }
7587
7588 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7589 /// to hold a `GithubEnterpriseConfig`.
7590 ///
7591 /// Note that all the setters affecting `enterprise_config` are
7592 /// mutually exclusive.
7593 ///
7594 /// # Example
7595 /// ```ignore,no_run
7596 /// # use google_cloud_build_v1::model::GitRepoSource;
7597 /// # let project_id = "project_id";
7598 /// # let config_id = "config_id";
7599 /// let x = GitRepoSource::new().set_github_enterprise_config(format!("projects/{project_id}/githubEnterpriseConfigs/{config_id}"));
7600 /// assert!(x.github_enterprise_config().is_some());
7601 /// ```
7602 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7603 mut self,
7604 v: T,
7605 ) -> Self {
7606 self.enterprise_config = std::option::Option::Some(
7607 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7608 );
7609 self
7610 }
7611}
7612
7613impl wkt::message::Message for GitRepoSource {
7614 fn typename() -> &'static str {
7615 "type.googleapis.com/google.devtools.cloudbuild.v1.GitRepoSource"
7616 }
7617}
7618
7619/// Defines additional types related to [GitRepoSource].
7620pub mod git_repo_source {
7621 #[allow(unused_imports)]
7622 use super::*;
7623
7624 /// The source of the SCM repo.
7625 #[derive(Clone, Debug, PartialEq)]
7626 #[non_exhaustive]
7627 pub enum Source {
7628 /// The connected repository resource name, in the format
7629 /// `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or
7630 /// `repository` can be specified and is required.
7631 Repository(std::string::String),
7632 }
7633
7634 /// The resource name of the enterprise config that should be applied
7635 /// to this source.
7636 #[derive(Clone, Debug, PartialEq)]
7637 #[non_exhaustive]
7638 pub enum EnterpriseConfig {
7639 /// The full resource name of the github enterprise config.
7640 /// Format:
7641 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7642 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7643 GithubEnterpriseConfig(std::string::String),
7644 }
7645}
7646
7647/// GitFileSource describes a file within a (possibly remote) code repository.
7648#[derive(Clone, Default, PartialEq)]
7649#[non_exhaustive]
7650pub struct GitFileSource {
7651 /// The path of the file, with the repo root as the root of the path.
7652 pub path: std::string::String,
7653
7654 /// The URI of the repo.
7655 /// Either uri or repository can be specified.
7656 /// If unspecified, the repo from which the trigger invocation originated is
7657 /// assumed to be the repo from which to read the specified path.
7658 pub uri: std::string::String,
7659
7660 /// See RepoType above.
7661 pub repo_type: crate::model::git_file_source::RepoType,
7662
7663 /// The branch, tag, arbitrary ref, or SHA version of the repo to use when
7664 /// resolving the filename (optional).
7665 /// This field respects the same syntax/resolution as described here:
7666 /// <https://git-scm.com/docs/gitrevisions>
7667 /// If unspecified, the revision from which the trigger invocation originated
7668 /// is assumed to be the revision from which to read the specified path.
7669 pub revision: std::string::String,
7670
7671 /// The source of the SCM repo.
7672 pub source: std::option::Option<crate::model::git_file_source::Source>,
7673
7674 /// The resource name of the enterprise config that should be applied
7675 /// to this source.
7676 pub enterprise_config: std::option::Option<crate::model::git_file_source::EnterpriseConfig>,
7677
7678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7679}
7680
7681impl GitFileSource {
7682 /// Creates a new default instance.
7683 pub fn new() -> Self {
7684 std::default::Default::default()
7685 }
7686
7687 /// Sets the value of [path][crate::model::GitFileSource::path].
7688 ///
7689 /// # Example
7690 /// ```ignore,no_run
7691 /// # use google_cloud_build_v1::model::GitFileSource;
7692 /// let x = GitFileSource::new().set_path("example");
7693 /// ```
7694 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7695 self.path = v.into();
7696 self
7697 }
7698
7699 /// Sets the value of [uri][crate::model::GitFileSource::uri].
7700 ///
7701 /// # Example
7702 /// ```ignore,no_run
7703 /// # use google_cloud_build_v1::model::GitFileSource;
7704 /// let x = GitFileSource::new().set_uri("example");
7705 /// ```
7706 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7707 self.uri = v.into();
7708 self
7709 }
7710
7711 /// Sets the value of [repo_type][crate::model::GitFileSource::repo_type].
7712 ///
7713 /// # Example
7714 /// ```ignore,no_run
7715 /// # use google_cloud_build_v1::model::GitFileSource;
7716 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7717 /// let x0 = GitFileSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7718 /// let x1 = GitFileSource::new().set_repo_type(RepoType::Github);
7719 /// let x2 = GitFileSource::new().set_repo_type(RepoType::BitbucketServer);
7720 /// ```
7721 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7722 mut self,
7723 v: T,
7724 ) -> Self {
7725 self.repo_type = v.into();
7726 self
7727 }
7728
7729 /// Sets the value of [revision][crate::model::GitFileSource::revision].
7730 ///
7731 /// # Example
7732 /// ```ignore,no_run
7733 /// # use google_cloud_build_v1::model::GitFileSource;
7734 /// let x = GitFileSource::new().set_revision("example");
7735 /// ```
7736 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7737 self.revision = v.into();
7738 self
7739 }
7740
7741 /// Sets the value of [source][crate::model::GitFileSource::source].
7742 ///
7743 /// Note that all the setters affecting `source` are mutually
7744 /// exclusive.
7745 ///
7746 /// # Example
7747 /// ```ignore,no_run
7748 /// # use google_cloud_build_v1::model::GitFileSource;
7749 /// use google_cloud_build_v1::model::git_file_source::Source;
7750 /// let x = GitFileSource::new().set_source(Some(Source::Repository("example".to_string())));
7751 /// ```
7752 pub fn set_source<
7753 T: std::convert::Into<std::option::Option<crate::model::git_file_source::Source>>,
7754 >(
7755 mut self,
7756 v: T,
7757 ) -> Self {
7758 self.source = v.into();
7759 self
7760 }
7761
7762 /// The value of [source][crate::model::GitFileSource::source]
7763 /// if it holds a `Repository`, `None` if the field is not set or
7764 /// holds a different branch.
7765 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7766 #[allow(unreachable_patterns)]
7767 self.source.as_ref().and_then(|v| match v {
7768 crate::model::git_file_source::Source::Repository(v) => std::option::Option::Some(v),
7769 _ => std::option::Option::None,
7770 })
7771 }
7772
7773 /// Sets the value of [source][crate::model::GitFileSource::source]
7774 /// to hold a `Repository`.
7775 ///
7776 /// Note that all the setters affecting `source` are
7777 /// mutually exclusive.
7778 ///
7779 /// # Example
7780 /// ```ignore,no_run
7781 /// # use google_cloud_build_v1::model::GitFileSource;
7782 /// let x = GitFileSource::new().set_repository("example");
7783 /// assert!(x.repository().is_some());
7784 /// ```
7785 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7786 self.source =
7787 std::option::Option::Some(crate::model::git_file_source::Source::Repository(v.into()));
7788 self
7789 }
7790
7791 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config].
7792 ///
7793 /// Note that all the setters affecting `enterprise_config` are mutually
7794 /// exclusive.
7795 ///
7796 /// # Example
7797 /// ```ignore,no_run
7798 /// # use google_cloud_build_v1::model::GitFileSource;
7799 /// use google_cloud_build_v1::model::git_file_source::EnterpriseConfig;
7800 /// let x = GitFileSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7801 /// ```
7802 pub fn set_enterprise_config<
7803 T: std::convert::Into<std::option::Option<crate::model::git_file_source::EnterpriseConfig>>,
7804 >(
7805 mut self,
7806 v: T,
7807 ) -> Self {
7808 self.enterprise_config = v.into();
7809 self
7810 }
7811
7812 /// The value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7813 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7814 /// holds a different branch.
7815 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7816 #[allow(unreachable_patterns)]
7817 self.enterprise_config.as_ref().and_then(|v| match v {
7818 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7819 std::option::Option::Some(v)
7820 }
7821 _ => std::option::Option::None,
7822 })
7823 }
7824
7825 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7826 /// to hold a `GithubEnterpriseConfig`.
7827 ///
7828 /// Note that all the setters affecting `enterprise_config` are
7829 /// mutually exclusive.
7830 ///
7831 /// # Example
7832 /// ```ignore,no_run
7833 /// # use google_cloud_build_v1::model::GitFileSource;
7834 /// # let project_id = "project_id";
7835 /// # let config_id = "config_id";
7836 /// let x = GitFileSource::new().set_github_enterprise_config(format!("projects/{project_id}/githubEnterpriseConfigs/{config_id}"));
7837 /// assert!(x.github_enterprise_config().is_some());
7838 /// ```
7839 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7840 mut self,
7841 v: T,
7842 ) -> Self {
7843 self.enterprise_config = std::option::Option::Some(
7844 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7845 );
7846 self
7847 }
7848}
7849
7850impl wkt::message::Message for GitFileSource {
7851 fn typename() -> &'static str {
7852 "type.googleapis.com/google.devtools.cloudbuild.v1.GitFileSource"
7853 }
7854}
7855
7856/// Defines additional types related to [GitFileSource].
7857pub mod git_file_source {
7858 #[allow(unused_imports)]
7859 use super::*;
7860
7861 /// The type of the repo, since it may not be explicit from the `repo` field
7862 /// (e.g from a URL).
7863 ///
7864 /// # Working with unknown values
7865 ///
7866 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7867 /// additional enum variants at any time. Adding new variants is not considered
7868 /// a breaking change. Applications should write their code in anticipation of:
7869 ///
7870 /// - New values appearing in future releases of the client library, **and**
7871 /// - New values received dynamically, without application changes.
7872 ///
7873 /// Please consult the [Working with enums] section in the user guide for some
7874 /// guidelines.
7875 ///
7876 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7877 #[derive(Clone, Debug, PartialEq)]
7878 #[non_exhaustive]
7879 pub enum RepoType {
7880 /// The default, unknown repo type. Don't use it, instead use one of
7881 /// the other repo types.
7882 Unknown,
7883 /// A Google Cloud Source Repositories-hosted repo.
7884 CloudSourceRepositories,
7885 /// A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub
7886 /// Enterprise).
7887 Github,
7888 /// A Bitbucket Server-hosted repo.
7889 BitbucketServer,
7890 /// A GitLab-hosted repo.
7891 Gitlab,
7892 /// If set, the enum was initialized with an unknown value.
7893 ///
7894 /// Applications can examine the value using [RepoType::value] or
7895 /// [RepoType::name].
7896 UnknownValue(repo_type::UnknownValue),
7897 }
7898
7899 #[doc(hidden)]
7900 pub mod repo_type {
7901 #[allow(unused_imports)]
7902 use super::*;
7903 #[derive(Clone, Debug, PartialEq)]
7904 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7905 }
7906
7907 impl RepoType {
7908 /// Gets the enum value.
7909 ///
7910 /// Returns `None` if the enum contains an unknown value deserialized from
7911 /// the string representation of enums.
7912 pub fn value(&self) -> std::option::Option<i32> {
7913 match self {
7914 Self::Unknown => std::option::Option::Some(0),
7915 Self::CloudSourceRepositories => std::option::Option::Some(1),
7916 Self::Github => std::option::Option::Some(2),
7917 Self::BitbucketServer => std::option::Option::Some(3),
7918 Self::Gitlab => std::option::Option::Some(4),
7919 Self::UnknownValue(u) => u.0.value(),
7920 }
7921 }
7922
7923 /// Gets the enum value as a string.
7924 ///
7925 /// Returns `None` if the enum contains an unknown value deserialized from
7926 /// the integer representation of enums.
7927 pub fn name(&self) -> std::option::Option<&str> {
7928 match self {
7929 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7930 Self::CloudSourceRepositories => {
7931 std::option::Option::Some("CLOUD_SOURCE_REPOSITORIES")
7932 }
7933 Self::Github => std::option::Option::Some("GITHUB"),
7934 Self::BitbucketServer => std::option::Option::Some("BITBUCKET_SERVER"),
7935 Self::Gitlab => std::option::Option::Some("GITLAB"),
7936 Self::UnknownValue(u) => u.0.name(),
7937 }
7938 }
7939 }
7940
7941 impl std::default::Default for RepoType {
7942 fn default() -> Self {
7943 use std::convert::From;
7944 Self::from(0)
7945 }
7946 }
7947
7948 impl std::fmt::Display for RepoType {
7949 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7950 wkt::internal::display_enum(f, self.name(), self.value())
7951 }
7952 }
7953
7954 impl std::convert::From<i32> for RepoType {
7955 fn from(value: i32) -> Self {
7956 match value {
7957 0 => Self::Unknown,
7958 1 => Self::CloudSourceRepositories,
7959 2 => Self::Github,
7960 3 => Self::BitbucketServer,
7961 4 => Self::Gitlab,
7962 _ => Self::UnknownValue(repo_type::UnknownValue(
7963 wkt::internal::UnknownEnumValue::Integer(value),
7964 )),
7965 }
7966 }
7967 }
7968
7969 impl std::convert::From<&str> for RepoType {
7970 fn from(value: &str) -> Self {
7971 use std::string::ToString;
7972 match value {
7973 "UNKNOWN" => Self::Unknown,
7974 "CLOUD_SOURCE_REPOSITORIES" => Self::CloudSourceRepositories,
7975 "GITHUB" => Self::Github,
7976 "BITBUCKET_SERVER" => Self::BitbucketServer,
7977 "GITLAB" => Self::Gitlab,
7978 _ => Self::UnknownValue(repo_type::UnknownValue(
7979 wkt::internal::UnknownEnumValue::String(value.to_string()),
7980 )),
7981 }
7982 }
7983 }
7984
7985 impl serde::ser::Serialize for RepoType {
7986 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7987 where
7988 S: serde::Serializer,
7989 {
7990 match self {
7991 Self::Unknown => serializer.serialize_i32(0),
7992 Self::CloudSourceRepositories => serializer.serialize_i32(1),
7993 Self::Github => serializer.serialize_i32(2),
7994 Self::BitbucketServer => serializer.serialize_i32(3),
7995 Self::Gitlab => serializer.serialize_i32(4),
7996 Self::UnknownValue(u) => u.0.serialize(serializer),
7997 }
7998 }
7999 }
8000
8001 impl<'de> serde::de::Deserialize<'de> for RepoType {
8002 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8003 where
8004 D: serde::Deserializer<'de>,
8005 {
8006 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepoType>::new(
8007 ".google.devtools.cloudbuild.v1.GitFileSource.RepoType",
8008 ))
8009 }
8010 }
8011
8012 /// The source of the SCM repo.
8013 #[derive(Clone, Debug, PartialEq)]
8014 #[non_exhaustive]
8015 pub enum Source {
8016 /// The fully qualified resource name of the Repos API repository.
8017 /// Either URI or repository can be specified.
8018 /// If unspecified, the repo from which the trigger invocation originated is
8019 /// assumed to be the repo from which to read the specified path.
8020 Repository(std::string::String),
8021 }
8022
8023 /// The resource name of the enterprise config that should be applied
8024 /// to this source.
8025 #[derive(Clone, Debug, PartialEq)]
8026 #[non_exhaustive]
8027 pub enum EnterpriseConfig {
8028 /// The full resource name of the github enterprise config.
8029 /// Format:
8030 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
8031 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
8032 GithubEnterpriseConfig(std::string::String),
8033 }
8034}
8035
8036/// Configuration for an automated build in response to source repository
8037/// changes.
8038#[derive(Clone, Default, PartialEq)]
8039#[non_exhaustive]
8040pub struct BuildTrigger {
8041 /// The `Trigger` name with format:
8042 /// `projects/{project}/locations/{location}/triggers/{trigger}`, where
8043 /// {trigger} is a unique identifier generated by the service.
8044 pub resource_name: std::string::String,
8045
8046 /// Output only. Unique identifier of the trigger.
8047 pub id: std::string::String,
8048
8049 /// Human-readable description of this trigger.
8050 pub description: std::string::String,
8051
8052 /// User-assigned name of the trigger. Must be unique within the project.
8053 /// Trigger names must meet the following requirements:
8054 ///
8055 /// + They must contain only alphanumeric characters and dashes.
8056 /// + They can be 1-64 characters long.
8057 /// + They must begin and end with an alphanumeric character.
8058 pub name: std::string::String,
8059
8060 /// Tags for annotation of a `BuildTrigger`
8061 pub tags: std::vec::Vec<std::string::String>,
8062
8063 /// Template describing the types of source changes to trigger a build.
8064 ///
8065 /// Branch and tag names in trigger templates are interpreted as regular
8066 /// expressions. Any branch or tag change that matches that regular expression
8067 /// will trigger a build.
8068 ///
8069 /// Mutually exclusive with `github`.
8070 pub trigger_template: std::option::Option<crate::model::RepoSource>,
8071
8072 /// GitHubEventsConfig describes the configuration of a trigger that creates
8073 /// a build whenever a GitHub event is received.
8074 ///
8075 /// Mutually exclusive with `trigger_template`.
8076 pub github: std::option::Option<crate::model::GitHubEventsConfig>,
8077
8078 /// PubsubConfig describes the configuration of a trigger that
8079 /// creates a build whenever a Pub/Sub message is published.
8080 pub pubsub_config: std::option::Option<crate::model::PubsubConfig>,
8081
8082 /// WebhookConfig describes the configuration of a trigger that
8083 /// creates a build whenever a webhook is sent to a trigger's webhook URL.
8084 pub webhook_config: std::option::Option<crate::model::WebhookConfig>,
8085
8086 /// Output only. Time when the trigger was created.
8087 pub create_time: std::option::Option<wkt::Timestamp>,
8088
8089 /// If true, the trigger will never automatically execute a build.
8090 pub disabled: bool,
8091
8092 /// Substitutions for Build resource. The keys must match the following
8093 /// regular expression: `^_[A-Z0-9_]+$`.
8094 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
8095
8096 /// ignored_files and included_files are file glob matches using
8097 /// <https://golang.org/pkg/path/filepath/#Match> extended with support for "**".
8098 ///
8099 /// If ignored_files and changed files are both empty, then they are
8100 /// not used to determine whether or not to trigger a build.
8101 ///
8102 /// If ignored_files is not empty, then we ignore any files that match
8103 /// any of the ignored_file globs. If the change has no files that are
8104 /// outside of the ignored_files globs, then we do not trigger a build.
8105 pub ignored_files: std::vec::Vec<std::string::String>,
8106
8107 /// If any of the files altered in the commit pass the ignored_files
8108 /// filter and included_files is empty, then as far as this filter is
8109 /// concerned, we should trigger the build.
8110 ///
8111 /// If any of the files altered in the commit pass the ignored_files
8112 /// filter and included_files is not empty, then we make sure that at
8113 /// least one of those files matches a included_files glob. If not,
8114 /// then we do not trigger a build.
8115 pub included_files: std::vec::Vec<std::string::String>,
8116
8117 /// Optional. A Common Expression Language string.
8118 pub filter: std::string::String,
8119
8120 /// The repo and ref of the repository from which to build. This field
8121 /// is used only for those triggers that do not respond to SCM events.
8122 /// Triggers that respond to such events build source at whatever commit
8123 /// caused the event.
8124 /// This field is currently only used by Webhook, Pub/Sub, Manual, and Cron
8125 /// triggers.
8126 pub source_to_build: std::option::Option<crate::model::GitRepoSource>,
8127
8128 /// The service account used for all user-controlled operations including
8129 /// UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
8130 /// If no service account is set and the legacy Cloud Build service account
8131 /// (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the
8132 /// project then it will be used instead.
8133 /// Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
8134 pub service_account: std::string::String,
8135
8136 /// The configuration of a trigger that creates a build whenever an event from
8137 /// Repo API is received.
8138 pub repository_event_config: std::option::Option<crate::model::RepositoryEventConfig>,
8139
8140 /// Template describing the Build request to make when the trigger is matched.
8141 /// At least one of the template fields must be provided.
8142 pub build_template: std::option::Option<crate::model::build_trigger::BuildTemplate>,
8143
8144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8145}
8146
8147impl BuildTrigger {
8148 /// Creates a new default instance.
8149 pub fn new() -> Self {
8150 std::default::Default::default()
8151 }
8152
8153 /// Sets the value of [resource_name][crate::model::BuildTrigger::resource_name].
8154 ///
8155 /// # Example
8156 /// ```ignore,no_run
8157 /// # use google_cloud_build_v1::model::BuildTrigger;
8158 /// let x = BuildTrigger::new().set_resource_name("example");
8159 /// ```
8160 pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8161 self.resource_name = v.into();
8162 self
8163 }
8164
8165 /// Sets the value of [id][crate::model::BuildTrigger::id].
8166 ///
8167 /// # Example
8168 /// ```ignore,no_run
8169 /// # use google_cloud_build_v1::model::BuildTrigger;
8170 /// let x = BuildTrigger::new().set_id("example");
8171 /// ```
8172 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8173 self.id = v.into();
8174 self
8175 }
8176
8177 /// Sets the value of [description][crate::model::BuildTrigger::description].
8178 ///
8179 /// # Example
8180 /// ```ignore,no_run
8181 /// # use google_cloud_build_v1::model::BuildTrigger;
8182 /// let x = BuildTrigger::new().set_description("example");
8183 /// ```
8184 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8185 self.description = v.into();
8186 self
8187 }
8188
8189 /// Sets the value of [name][crate::model::BuildTrigger::name].
8190 ///
8191 /// # Example
8192 /// ```ignore,no_run
8193 /// # use google_cloud_build_v1::model::BuildTrigger;
8194 /// # let project_id = "project_id";
8195 /// # let trigger_id = "trigger_id";
8196 /// let x = BuildTrigger::new().set_name(format!("projects/{project_id}/triggers/{trigger_id}"));
8197 /// ```
8198 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8199 self.name = v.into();
8200 self
8201 }
8202
8203 /// Sets the value of [tags][crate::model::BuildTrigger::tags].
8204 ///
8205 /// # Example
8206 /// ```ignore,no_run
8207 /// # use google_cloud_build_v1::model::BuildTrigger;
8208 /// let x = BuildTrigger::new().set_tags(["a", "b", "c"]);
8209 /// ```
8210 pub fn set_tags<T, V>(mut self, v: T) -> Self
8211 where
8212 T: std::iter::IntoIterator<Item = V>,
8213 V: std::convert::Into<std::string::String>,
8214 {
8215 use std::iter::Iterator;
8216 self.tags = v.into_iter().map(|i| i.into()).collect();
8217 self
8218 }
8219
8220 /// Sets the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8221 ///
8222 /// # Example
8223 /// ```ignore,no_run
8224 /// # use google_cloud_build_v1::model::BuildTrigger;
8225 /// use google_cloud_build_v1::model::RepoSource;
8226 /// let x = BuildTrigger::new().set_trigger_template(RepoSource::default()/* use setters */);
8227 /// ```
8228 pub fn set_trigger_template<T>(mut self, v: T) -> Self
8229 where
8230 T: std::convert::Into<crate::model::RepoSource>,
8231 {
8232 self.trigger_template = std::option::Option::Some(v.into());
8233 self
8234 }
8235
8236 /// Sets or clears the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8237 ///
8238 /// # Example
8239 /// ```ignore,no_run
8240 /// # use google_cloud_build_v1::model::BuildTrigger;
8241 /// use google_cloud_build_v1::model::RepoSource;
8242 /// let x = BuildTrigger::new().set_or_clear_trigger_template(Some(RepoSource::default()/* use setters */));
8243 /// let x = BuildTrigger::new().set_or_clear_trigger_template(None::<RepoSource>);
8244 /// ```
8245 pub fn set_or_clear_trigger_template<T>(mut self, v: std::option::Option<T>) -> Self
8246 where
8247 T: std::convert::Into<crate::model::RepoSource>,
8248 {
8249 self.trigger_template = v.map(|x| x.into());
8250 self
8251 }
8252
8253 /// Sets the value of [github][crate::model::BuildTrigger::github].
8254 ///
8255 /// # Example
8256 /// ```ignore,no_run
8257 /// # use google_cloud_build_v1::model::BuildTrigger;
8258 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8259 /// let x = BuildTrigger::new().set_github(GitHubEventsConfig::default()/* use setters */);
8260 /// ```
8261 pub fn set_github<T>(mut self, v: T) -> Self
8262 where
8263 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8264 {
8265 self.github = std::option::Option::Some(v.into());
8266 self
8267 }
8268
8269 /// Sets or clears the value of [github][crate::model::BuildTrigger::github].
8270 ///
8271 /// # Example
8272 /// ```ignore,no_run
8273 /// # use google_cloud_build_v1::model::BuildTrigger;
8274 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8275 /// let x = BuildTrigger::new().set_or_clear_github(Some(GitHubEventsConfig::default()/* use setters */));
8276 /// let x = BuildTrigger::new().set_or_clear_github(None::<GitHubEventsConfig>);
8277 /// ```
8278 pub fn set_or_clear_github<T>(mut self, v: std::option::Option<T>) -> Self
8279 where
8280 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8281 {
8282 self.github = v.map(|x| x.into());
8283 self
8284 }
8285
8286 /// Sets the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8287 ///
8288 /// # Example
8289 /// ```ignore,no_run
8290 /// # use google_cloud_build_v1::model::BuildTrigger;
8291 /// use google_cloud_build_v1::model::PubsubConfig;
8292 /// let x = BuildTrigger::new().set_pubsub_config(PubsubConfig::default()/* use setters */);
8293 /// ```
8294 pub fn set_pubsub_config<T>(mut self, v: T) -> Self
8295 where
8296 T: std::convert::Into<crate::model::PubsubConfig>,
8297 {
8298 self.pubsub_config = std::option::Option::Some(v.into());
8299 self
8300 }
8301
8302 /// Sets or clears the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8303 ///
8304 /// # Example
8305 /// ```ignore,no_run
8306 /// # use google_cloud_build_v1::model::BuildTrigger;
8307 /// use google_cloud_build_v1::model::PubsubConfig;
8308 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(Some(PubsubConfig::default()/* use setters */));
8309 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(None::<PubsubConfig>);
8310 /// ```
8311 pub fn set_or_clear_pubsub_config<T>(mut self, v: std::option::Option<T>) -> Self
8312 where
8313 T: std::convert::Into<crate::model::PubsubConfig>,
8314 {
8315 self.pubsub_config = v.map(|x| x.into());
8316 self
8317 }
8318
8319 /// Sets the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8320 ///
8321 /// # Example
8322 /// ```ignore,no_run
8323 /// # use google_cloud_build_v1::model::BuildTrigger;
8324 /// use google_cloud_build_v1::model::WebhookConfig;
8325 /// let x = BuildTrigger::new().set_webhook_config(WebhookConfig::default()/* use setters */);
8326 /// ```
8327 pub fn set_webhook_config<T>(mut self, v: T) -> Self
8328 where
8329 T: std::convert::Into<crate::model::WebhookConfig>,
8330 {
8331 self.webhook_config = std::option::Option::Some(v.into());
8332 self
8333 }
8334
8335 /// Sets or clears the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8336 ///
8337 /// # Example
8338 /// ```ignore,no_run
8339 /// # use google_cloud_build_v1::model::BuildTrigger;
8340 /// use google_cloud_build_v1::model::WebhookConfig;
8341 /// let x = BuildTrigger::new().set_or_clear_webhook_config(Some(WebhookConfig::default()/* use setters */));
8342 /// let x = BuildTrigger::new().set_or_clear_webhook_config(None::<WebhookConfig>);
8343 /// ```
8344 pub fn set_or_clear_webhook_config<T>(mut self, v: std::option::Option<T>) -> Self
8345 where
8346 T: std::convert::Into<crate::model::WebhookConfig>,
8347 {
8348 self.webhook_config = v.map(|x| x.into());
8349 self
8350 }
8351
8352 /// Sets the value of [create_time][crate::model::BuildTrigger::create_time].
8353 ///
8354 /// # Example
8355 /// ```ignore,no_run
8356 /// # use google_cloud_build_v1::model::BuildTrigger;
8357 /// use wkt::Timestamp;
8358 /// let x = BuildTrigger::new().set_create_time(Timestamp::default()/* use setters */);
8359 /// ```
8360 pub fn set_create_time<T>(mut self, v: T) -> Self
8361 where
8362 T: std::convert::Into<wkt::Timestamp>,
8363 {
8364 self.create_time = std::option::Option::Some(v.into());
8365 self
8366 }
8367
8368 /// Sets or clears the value of [create_time][crate::model::BuildTrigger::create_time].
8369 ///
8370 /// # Example
8371 /// ```ignore,no_run
8372 /// # use google_cloud_build_v1::model::BuildTrigger;
8373 /// use wkt::Timestamp;
8374 /// let x = BuildTrigger::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8375 /// let x = BuildTrigger::new().set_or_clear_create_time(None::<Timestamp>);
8376 /// ```
8377 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8378 where
8379 T: std::convert::Into<wkt::Timestamp>,
8380 {
8381 self.create_time = v.map(|x| x.into());
8382 self
8383 }
8384
8385 /// Sets the value of [disabled][crate::model::BuildTrigger::disabled].
8386 ///
8387 /// # Example
8388 /// ```ignore,no_run
8389 /// # use google_cloud_build_v1::model::BuildTrigger;
8390 /// let x = BuildTrigger::new().set_disabled(true);
8391 /// ```
8392 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8393 self.disabled = v.into();
8394 self
8395 }
8396
8397 /// Sets the value of [substitutions][crate::model::BuildTrigger::substitutions].
8398 ///
8399 /// # Example
8400 /// ```ignore,no_run
8401 /// # use google_cloud_build_v1::model::BuildTrigger;
8402 /// let x = BuildTrigger::new().set_substitutions([
8403 /// ("key0", "abc"),
8404 /// ("key1", "xyz"),
8405 /// ]);
8406 /// ```
8407 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
8408 where
8409 T: std::iter::IntoIterator<Item = (K, V)>,
8410 K: std::convert::Into<std::string::String>,
8411 V: std::convert::Into<std::string::String>,
8412 {
8413 use std::iter::Iterator;
8414 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8415 self
8416 }
8417
8418 /// Sets the value of [ignored_files][crate::model::BuildTrigger::ignored_files].
8419 ///
8420 /// # Example
8421 /// ```ignore,no_run
8422 /// # use google_cloud_build_v1::model::BuildTrigger;
8423 /// let x = BuildTrigger::new().set_ignored_files(["a", "b", "c"]);
8424 /// ```
8425 pub fn set_ignored_files<T, V>(mut self, v: T) -> Self
8426 where
8427 T: std::iter::IntoIterator<Item = V>,
8428 V: std::convert::Into<std::string::String>,
8429 {
8430 use std::iter::Iterator;
8431 self.ignored_files = v.into_iter().map(|i| i.into()).collect();
8432 self
8433 }
8434
8435 /// Sets the value of [included_files][crate::model::BuildTrigger::included_files].
8436 ///
8437 /// # Example
8438 /// ```ignore,no_run
8439 /// # use google_cloud_build_v1::model::BuildTrigger;
8440 /// let x = BuildTrigger::new().set_included_files(["a", "b", "c"]);
8441 /// ```
8442 pub fn set_included_files<T, V>(mut self, v: T) -> Self
8443 where
8444 T: std::iter::IntoIterator<Item = V>,
8445 V: std::convert::Into<std::string::String>,
8446 {
8447 use std::iter::Iterator;
8448 self.included_files = v.into_iter().map(|i| i.into()).collect();
8449 self
8450 }
8451
8452 /// Sets the value of [filter][crate::model::BuildTrigger::filter].
8453 ///
8454 /// # Example
8455 /// ```ignore,no_run
8456 /// # use google_cloud_build_v1::model::BuildTrigger;
8457 /// let x = BuildTrigger::new().set_filter("example");
8458 /// ```
8459 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8460 self.filter = v.into();
8461 self
8462 }
8463
8464 /// Sets the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8465 ///
8466 /// # Example
8467 /// ```ignore,no_run
8468 /// # use google_cloud_build_v1::model::BuildTrigger;
8469 /// use google_cloud_build_v1::model::GitRepoSource;
8470 /// let x = BuildTrigger::new().set_source_to_build(GitRepoSource::default()/* use setters */);
8471 /// ```
8472 pub fn set_source_to_build<T>(mut self, v: T) -> Self
8473 where
8474 T: std::convert::Into<crate::model::GitRepoSource>,
8475 {
8476 self.source_to_build = std::option::Option::Some(v.into());
8477 self
8478 }
8479
8480 /// Sets or clears the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8481 ///
8482 /// # Example
8483 /// ```ignore,no_run
8484 /// # use google_cloud_build_v1::model::BuildTrigger;
8485 /// use google_cloud_build_v1::model::GitRepoSource;
8486 /// let x = BuildTrigger::new().set_or_clear_source_to_build(Some(GitRepoSource::default()/* use setters */));
8487 /// let x = BuildTrigger::new().set_or_clear_source_to_build(None::<GitRepoSource>);
8488 /// ```
8489 pub fn set_or_clear_source_to_build<T>(mut self, v: std::option::Option<T>) -> Self
8490 where
8491 T: std::convert::Into<crate::model::GitRepoSource>,
8492 {
8493 self.source_to_build = v.map(|x| x.into());
8494 self
8495 }
8496
8497 /// Sets the value of [service_account][crate::model::BuildTrigger::service_account].
8498 ///
8499 /// # Example
8500 /// ```ignore,no_run
8501 /// # use google_cloud_build_v1::model::BuildTrigger;
8502 /// let x = BuildTrigger::new().set_service_account("example");
8503 /// ```
8504 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8505 self.service_account = v.into();
8506 self
8507 }
8508
8509 /// Sets the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8510 ///
8511 /// # Example
8512 /// ```ignore,no_run
8513 /// # use google_cloud_build_v1::model::BuildTrigger;
8514 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8515 /// let x = BuildTrigger::new().set_repository_event_config(RepositoryEventConfig::default()/* use setters */);
8516 /// ```
8517 pub fn set_repository_event_config<T>(mut self, v: T) -> Self
8518 where
8519 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8520 {
8521 self.repository_event_config = std::option::Option::Some(v.into());
8522 self
8523 }
8524
8525 /// Sets or clears the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8526 ///
8527 /// # Example
8528 /// ```ignore,no_run
8529 /// # use google_cloud_build_v1::model::BuildTrigger;
8530 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8531 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(Some(RepositoryEventConfig::default()/* use setters */));
8532 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(None::<RepositoryEventConfig>);
8533 /// ```
8534 pub fn set_or_clear_repository_event_config<T>(mut self, v: std::option::Option<T>) -> Self
8535 where
8536 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8537 {
8538 self.repository_event_config = v.map(|x| x.into());
8539 self
8540 }
8541
8542 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template].
8543 ///
8544 /// Note that all the setters affecting `build_template` are mutually
8545 /// exclusive.
8546 ///
8547 /// # Example
8548 /// ```ignore,no_run
8549 /// # use google_cloud_build_v1::model::BuildTrigger;
8550 /// use google_cloud_build_v1::model::build_trigger::BuildTemplate;
8551 /// let x = BuildTrigger::new().set_build_template(Some(BuildTemplate::Autodetect(true)));
8552 /// ```
8553 pub fn set_build_template<
8554 T: std::convert::Into<std::option::Option<crate::model::build_trigger::BuildTemplate>>,
8555 >(
8556 mut self,
8557 v: T,
8558 ) -> Self {
8559 self.build_template = v.into();
8560 self
8561 }
8562
8563 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8564 /// if it holds a `Autodetect`, `None` if the field is not set or
8565 /// holds a different branch.
8566 pub fn autodetect(&self) -> std::option::Option<&bool> {
8567 #[allow(unreachable_patterns)]
8568 self.build_template.as_ref().and_then(|v| match v {
8569 crate::model::build_trigger::BuildTemplate::Autodetect(v) => {
8570 std::option::Option::Some(v)
8571 }
8572 _ => std::option::Option::None,
8573 })
8574 }
8575
8576 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8577 /// to hold a `Autodetect`.
8578 ///
8579 /// Note that all the setters affecting `build_template` are
8580 /// mutually exclusive.
8581 ///
8582 /// # Example
8583 /// ```ignore,no_run
8584 /// # use google_cloud_build_v1::model::BuildTrigger;
8585 /// let x = BuildTrigger::new().set_autodetect(true);
8586 /// assert!(x.autodetect().is_some());
8587 /// assert!(x.build().is_none());
8588 /// assert!(x.filename().is_none());
8589 /// assert!(x.git_file_source().is_none());
8590 /// ```
8591 pub fn set_autodetect<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8592 self.build_template = std::option::Option::Some(
8593 crate::model::build_trigger::BuildTemplate::Autodetect(v.into()),
8594 );
8595 self
8596 }
8597
8598 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8599 /// if it holds a `Build`, `None` if the field is not set or
8600 /// holds a different branch.
8601 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::Build>> {
8602 #[allow(unreachable_patterns)]
8603 self.build_template.as_ref().and_then(|v| match v {
8604 crate::model::build_trigger::BuildTemplate::Build(v) => std::option::Option::Some(v),
8605 _ => std::option::Option::None,
8606 })
8607 }
8608
8609 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8610 /// to hold a `Build`.
8611 ///
8612 /// Note that all the setters affecting `build_template` are
8613 /// mutually exclusive.
8614 ///
8615 /// # Example
8616 /// ```ignore,no_run
8617 /// # use google_cloud_build_v1::model::BuildTrigger;
8618 /// use google_cloud_build_v1::model::Build;
8619 /// let x = BuildTrigger::new().set_build(Build::default()/* use setters */);
8620 /// assert!(x.build().is_some());
8621 /// assert!(x.autodetect().is_none());
8622 /// assert!(x.filename().is_none());
8623 /// assert!(x.git_file_source().is_none());
8624 /// ```
8625 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::Build>>>(
8626 mut self,
8627 v: T,
8628 ) -> Self {
8629 self.build_template =
8630 std::option::Option::Some(crate::model::build_trigger::BuildTemplate::Build(v.into()));
8631 self
8632 }
8633
8634 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8635 /// if it holds a `Filename`, `None` if the field is not set or
8636 /// holds a different branch.
8637 pub fn filename(&self) -> std::option::Option<&std::string::String> {
8638 #[allow(unreachable_patterns)]
8639 self.build_template.as_ref().and_then(|v| match v {
8640 crate::model::build_trigger::BuildTemplate::Filename(v) => std::option::Option::Some(v),
8641 _ => std::option::Option::None,
8642 })
8643 }
8644
8645 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8646 /// to hold a `Filename`.
8647 ///
8648 /// Note that all the setters affecting `build_template` are
8649 /// mutually exclusive.
8650 ///
8651 /// # Example
8652 /// ```ignore,no_run
8653 /// # use google_cloud_build_v1::model::BuildTrigger;
8654 /// let x = BuildTrigger::new().set_filename("example");
8655 /// assert!(x.filename().is_some());
8656 /// assert!(x.autodetect().is_none());
8657 /// assert!(x.build().is_none());
8658 /// assert!(x.git_file_source().is_none());
8659 /// ```
8660 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8661 self.build_template = std::option::Option::Some(
8662 crate::model::build_trigger::BuildTemplate::Filename(v.into()),
8663 );
8664 self
8665 }
8666
8667 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8668 /// if it holds a `GitFileSource`, `None` if the field is not set or
8669 /// holds a different branch.
8670 pub fn git_file_source(
8671 &self,
8672 ) -> std::option::Option<&std::boxed::Box<crate::model::GitFileSource>> {
8673 #[allow(unreachable_patterns)]
8674 self.build_template.as_ref().and_then(|v| match v {
8675 crate::model::build_trigger::BuildTemplate::GitFileSource(v) => {
8676 std::option::Option::Some(v)
8677 }
8678 _ => std::option::Option::None,
8679 })
8680 }
8681
8682 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8683 /// to hold a `GitFileSource`.
8684 ///
8685 /// Note that all the setters affecting `build_template` are
8686 /// mutually exclusive.
8687 ///
8688 /// # Example
8689 /// ```ignore,no_run
8690 /// # use google_cloud_build_v1::model::BuildTrigger;
8691 /// use google_cloud_build_v1::model::GitFileSource;
8692 /// let x = BuildTrigger::new().set_git_file_source(GitFileSource::default()/* use setters */);
8693 /// assert!(x.git_file_source().is_some());
8694 /// assert!(x.autodetect().is_none());
8695 /// assert!(x.build().is_none());
8696 /// assert!(x.filename().is_none());
8697 /// ```
8698 pub fn set_git_file_source<
8699 T: std::convert::Into<std::boxed::Box<crate::model::GitFileSource>>,
8700 >(
8701 mut self,
8702 v: T,
8703 ) -> Self {
8704 self.build_template = std::option::Option::Some(
8705 crate::model::build_trigger::BuildTemplate::GitFileSource(v.into()),
8706 );
8707 self
8708 }
8709}
8710
8711impl wkt::message::Message for BuildTrigger {
8712 fn typename() -> &'static str {
8713 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildTrigger"
8714 }
8715}
8716
8717/// Defines additional types related to [BuildTrigger].
8718pub mod build_trigger {
8719 #[allow(unused_imports)]
8720 use super::*;
8721
8722 /// Template describing the Build request to make when the trigger is matched.
8723 /// At least one of the template fields must be provided.
8724 #[derive(Clone, Debug, PartialEq)]
8725 #[non_exhaustive]
8726 pub enum BuildTemplate {
8727 /// Autodetect build configuration. The following precedence is used (case
8728 /// insensitive):
8729 ///
8730 /// 1. cloudbuild.yaml
8731 /// 1. cloudbuild.yml
8732 /// 1. cloudbuild.json
8733 /// 1. Dockerfile
8734 ///
8735 /// Currently only available for GitHub App Triggers.
8736 Autodetect(bool),
8737 /// Contents of the build template.
8738 Build(std::boxed::Box<crate::model::Build>),
8739 /// Path, from the source root, to the build configuration file
8740 /// (i.e. cloudbuild.yaml).
8741 Filename(std::string::String),
8742 /// The file source describing the local or remote Build template.
8743 GitFileSource(std::boxed::Box<crate::model::GitFileSource>),
8744 }
8745}
8746
8747/// The configuration of a trigger that creates a build whenever an event from
8748/// Repo API is received.
8749#[derive(Clone, Default, PartialEq)]
8750#[non_exhaustive]
8751pub struct RepositoryEventConfig {
8752 /// The resource name of the Repo API resource.
8753 pub repository: std::string::String,
8754
8755 /// Output only. The type of the SCM vendor the repository points to.
8756 pub repository_type: crate::model::repository_event_config::RepositoryType,
8757
8758 /// The types of filter to trigger a build.
8759 pub filter: std::option::Option<crate::model::repository_event_config::Filter>,
8760
8761 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8762}
8763
8764impl RepositoryEventConfig {
8765 /// Creates a new default instance.
8766 pub fn new() -> Self {
8767 std::default::Default::default()
8768 }
8769
8770 /// Sets the value of [repository][crate::model::RepositoryEventConfig::repository].
8771 ///
8772 /// # Example
8773 /// ```ignore,no_run
8774 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8775 /// let x = RepositoryEventConfig::new().set_repository("example");
8776 /// ```
8777 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8778 self.repository = v.into();
8779 self
8780 }
8781
8782 /// Sets the value of [repository_type][crate::model::RepositoryEventConfig::repository_type].
8783 ///
8784 /// # Example
8785 /// ```ignore,no_run
8786 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8787 /// use google_cloud_build_v1::model::repository_event_config::RepositoryType;
8788 /// let x0 = RepositoryEventConfig::new().set_repository_type(RepositoryType::Github);
8789 /// let x1 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GithubEnterprise);
8790 /// let x2 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GitlabEnterprise);
8791 /// ```
8792 pub fn set_repository_type<
8793 T: std::convert::Into<crate::model::repository_event_config::RepositoryType>,
8794 >(
8795 mut self,
8796 v: T,
8797 ) -> Self {
8798 self.repository_type = v.into();
8799 self
8800 }
8801
8802 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter].
8803 ///
8804 /// Note that all the setters affecting `filter` are mutually
8805 /// exclusive.
8806 ///
8807 /// # Example
8808 /// ```ignore,no_run
8809 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8810 /// use google_cloud_build_v1::model::PullRequestFilter;
8811 /// let x = RepositoryEventConfig::new().set_filter(Some(
8812 /// google_cloud_build_v1::model::repository_event_config::Filter::PullRequest(PullRequestFilter::default().into())));
8813 /// ```
8814 pub fn set_filter<
8815 T: std::convert::Into<std::option::Option<crate::model::repository_event_config::Filter>>,
8816 >(
8817 mut self,
8818 v: T,
8819 ) -> Self {
8820 self.filter = v.into();
8821 self
8822 }
8823
8824 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8825 /// if it holds a `PullRequest`, `None` if the field is not set or
8826 /// holds a different branch.
8827 pub fn pull_request(
8828 &self,
8829 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
8830 #[allow(unreachable_patterns)]
8831 self.filter.as_ref().and_then(|v| match v {
8832 crate::model::repository_event_config::Filter::PullRequest(v) => {
8833 std::option::Option::Some(v)
8834 }
8835 _ => std::option::Option::None,
8836 })
8837 }
8838
8839 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8840 /// to hold a `PullRequest`.
8841 ///
8842 /// Note that all the setters affecting `filter` are
8843 /// mutually exclusive.
8844 ///
8845 /// # Example
8846 /// ```ignore,no_run
8847 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8848 /// use google_cloud_build_v1::model::PullRequestFilter;
8849 /// let x = RepositoryEventConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
8850 /// assert!(x.pull_request().is_some());
8851 /// assert!(x.push().is_none());
8852 /// ```
8853 pub fn set_pull_request<
8854 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
8855 >(
8856 mut self,
8857 v: T,
8858 ) -> Self {
8859 self.filter = std::option::Option::Some(
8860 crate::model::repository_event_config::Filter::PullRequest(v.into()),
8861 );
8862 self
8863 }
8864
8865 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8866 /// if it holds a `Push`, `None` if the field is not set or
8867 /// holds a different branch.
8868 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
8869 #[allow(unreachable_patterns)]
8870 self.filter.as_ref().and_then(|v| match v {
8871 crate::model::repository_event_config::Filter::Push(v) => std::option::Option::Some(v),
8872 _ => std::option::Option::None,
8873 })
8874 }
8875
8876 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8877 /// to hold a `Push`.
8878 ///
8879 /// Note that all the setters affecting `filter` are
8880 /// mutually exclusive.
8881 ///
8882 /// # Example
8883 /// ```ignore,no_run
8884 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8885 /// use google_cloud_build_v1::model::PushFilter;
8886 /// let x = RepositoryEventConfig::new().set_push(PushFilter::default()/* use setters */);
8887 /// assert!(x.push().is_some());
8888 /// assert!(x.pull_request().is_none());
8889 /// ```
8890 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
8891 mut self,
8892 v: T,
8893 ) -> Self {
8894 self.filter = std::option::Option::Some(
8895 crate::model::repository_event_config::Filter::Push(v.into()),
8896 );
8897 self
8898 }
8899}
8900
8901impl wkt::message::Message for RepositoryEventConfig {
8902 fn typename() -> &'static str {
8903 "type.googleapis.com/google.devtools.cloudbuild.v1.RepositoryEventConfig"
8904 }
8905}
8906
8907/// Defines additional types related to [RepositoryEventConfig].
8908pub mod repository_event_config {
8909 #[allow(unused_imports)]
8910 use super::*;
8911
8912 /// All possible SCM repo types from Repo API.
8913 ///
8914 /// # Working with unknown values
8915 ///
8916 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8917 /// additional enum variants at any time. Adding new variants is not considered
8918 /// a breaking change. Applications should write their code in anticipation of:
8919 ///
8920 /// - New values appearing in future releases of the client library, **and**
8921 /// - New values received dynamically, without application changes.
8922 ///
8923 /// Please consult the [Working with enums] section in the user guide for some
8924 /// guidelines.
8925 ///
8926 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8927 #[derive(Clone, Debug, PartialEq)]
8928 #[non_exhaustive]
8929 pub enum RepositoryType {
8930 /// If unspecified, RepositoryType defaults to GITHUB.
8931 Unspecified,
8932 /// The SCM repo is GITHUB.
8933 Github,
8934 /// The SCM repo is GITHUB Enterprise.
8935 GithubEnterprise,
8936 /// The SCM repo is GITLAB Enterprise.
8937 GitlabEnterprise,
8938 /// If set, the enum was initialized with an unknown value.
8939 ///
8940 /// Applications can examine the value using [RepositoryType::value] or
8941 /// [RepositoryType::name].
8942 UnknownValue(repository_type::UnknownValue),
8943 }
8944
8945 #[doc(hidden)]
8946 pub mod repository_type {
8947 #[allow(unused_imports)]
8948 use super::*;
8949 #[derive(Clone, Debug, PartialEq)]
8950 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8951 }
8952
8953 impl RepositoryType {
8954 /// Gets the enum value.
8955 ///
8956 /// Returns `None` if the enum contains an unknown value deserialized from
8957 /// the string representation of enums.
8958 pub fn value(&self) -> std::option::Option<i32> {
8959 match self {
8960 Self::Unspecified => std::option::Option::Some(0),
8961 Self::Github => std::option::Option::Some(1),
8962 Self::GithubEnterprise => std::option::Option::Some(2),
8963 Self::GitlabEnterprise => std::option::Option::Some(3),
8964 Self::UnknownValue(u) => u.0.value(),
8965 }
8966 }
8967
8968 /// Gets the enum value as a string.
8969 ///
8970 /// Returns `None` if the enum contains an unknown value deserialized from
8971 /// the integer representation of enums.
8972 pub fn name(&self) -> std::option::Option<&str> {
8973 match self {
8974 Self::Unspecified => std::option::Option::Some("REPOSITORY_TYPE_UNSPECIFIED"),
8975 Self::Github => std::option::Option::Some("GITHUB"),
8976 Self::GithubEnterprise => std::option::Option::Some("GITHUB_ENTERPRISE"),
8977 Self::GitlabEnterprise => std::option::Option::Some("GITLAB_ENTERPRISE"),
8978 Self::UnknownValue(u) => u.0.name(),
8979 }
8980 }
8981 }
8982
8983 impl std::default::Default for RepositoryType {
8984 fn default() -> Self {
8985 use std::convert::From;
8986 Self::from(0)
8987 }
8988 }
8989
8990 impl std::fmt::Display for RepositoryType {
8991 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8992 wkt::internal::display_enum(f, self.name(), self.value())
8993 }
8994 }
8995
8996 impl std::convert::From<i32> for RepositoryType {
8997 fn from(value: i32) -> Self {
8998 match value {
8999 0 => Self::Unspecified,
9000 1 => Self::Github,
9001 2 => Self::GithubEnterprise,
9002 3 => Self::GitlabEnterprise,
9003 _ => Self::UnknownValue(repository_type::UnknownValue(
9004 wkt::internal::UnknownEnumValue::Integer(value),
9005 )),
9006 }
9007 }
9008 }
9009
9010 impl std::convert::From<&str> for RepositoryType {
9011 fn from(value: &str) -> Self {
9012 use std::string::ToString;
9013 match value {
9014 "REPOSITORY_TYPE_UNSPECIFIED" => Self::Unspecified,
9015 "GITHUB" => Self::Github,
9016 "GITHUB_ENTERPRISE" => Self::GithubEnterprise,
9017 "GITLAB_ENTERPRISE" => Self::GitlabEnterprise,
9018 _ => Self::UnknownValue(repository_type::UnknownValue(
9019 wkt::internal::UnknownEnumValue::String(value.to_string()),
9020 )),
9021 }
9022 }
9023 }
9024
9025 impl serde::ser::Serialize for RepositoryType {
9026 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9027 where
9028 S: serde::Serializer,
9029 {
9030 match self {
9031 Self::Unspecified => serializer.serialize_i32(0),
9032 Self::Github => serializer.serialize_i32(1),
9033 Self::GithubEnterprise => serializer.serialize_i32(2),
9034 Self::GitlabEnterprise => serializer.serialize_i32(3),
9035 Self::UnknownValue(u) => u.0.serialize(serializer),
9036 }
9037 }
9038 }
9039
9040 impl<'de> serde::de::Deserialize<'de> for RepositoryType {
9041 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9042 where
9043 D: serde::Deserializer<'de>,
9044 {
9045 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepositoryType>::new(
9046 ".google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType",
9047 ))
9048 }
9049 }
9050
9051 /// The types of filter to trigger a build.
9052 #[derive(Clone, Debug, PartialEq)]
9053 #[non_exhaustive]
9054 pub enum Filter {
9055 /// Filter to match changes in pull requests.
9056 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9057 /// Filter to match changes in refs like branches, tags.
9058 Push(std::boxed::Box<crate::model::PushFilter>),
9059 }
9060}
9061
9062/// GitHubEventsConfig describes the configuration of a trigger that creates a
9063/// build whenever a GitHub event is received.
9064#[derive(Clone, Default, PartialEq)]
9065#[non_exhaustive]
9066pub struct GitHubEventsConfig {
9067 /// The installationID that emits the GitHub event.
9068 #[deprecated]
9069 pub installation_id: i64,
9070
9071 /// Owner of the repository. For example: The owner for
9072 /// <https://github.com/googlecloudplatform/cloud-builders> is
9073 /// "googlecloudplatform".
9074 pub owner: std::string::String,
9075
9076 /// Name of the repository. For example: The name for
9077 /// <https://github.com/googlecloudplatform/cloud-builders> is "cloud-builders".
9078 pub name: std::string::String,
9079
9080 /// Filter describing the types of events to trigger a build.
9081 /// Currently supported event types: push, pull_request.
9082 pub event: std::option::Option<crate::model::git_hub_events_config::Event>,
9083
9084 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9085}
9086
9087impl GitHubEventsConfig {
9088 /// Creates a new default instance.
9089 pub fn new() -> Self {
9090 std::default::Default::default()
9091 }
9092
9093 /// Sets the value of [installation_id][crate::model::GitHubEventsConfig::installation_id].
9094 ///
9095 /// # Example
9096 /// ```ignore,no_run
9097 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9098 /// let x = GitHubEventsConfig::new().set_installation_id(42);
9099 /// ```
9100 #[deprecated]
9101 pub fn set_installation_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9102 self.installation_id = v.into();
9103 self
9104 }
9105
9106 /// Sets the value of [owner][crate::model::GitHubEventsConfig::owner].
9107 ///
9108 /// # Example
9109 /// ```ignore,no_run
9110 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9111 /// let x = GitHubEventsConfig::new().set_owner("example");
9112 /// ```
9113 pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9114 self.owner = v.into();
9115 self
9116 }
9117
9118 /// Sets the value of [name][crate::model::GitHubEventsConfig::name].
9119 ///
9120 /// # Example
9121 /// ```ignore,no_run
9122 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9123 /// let x = GitHubEventsConfig::new().set_name("example");
9124 /// ```
9125 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9126 self.name = v.into();
9127 self
9128 }
9129
9130 /// Sets the value of [event][crate::model::GitHubEventsConfig::event].
9131 ///
9132 /// Note that all the setters affecting `event` are mutually
9133 /// exclusive.
9134 ///
9135 /// # Example
9136 /// ```ignore,no_run
9137 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9138 /// use google_cloud_build_v1::model::PullRequestFilter;
9139 /// let x = GitHubEventsConfig::new().set_event(Some(
9140 /// google_cloud_build_v1::model::git_hub_events_config::Event::PullRequest(PullRequestFilter::default().into())));
9141 /// ```
9142 pub fn set_event<
9143 T: std::convert::Into<std::option::Option<crate::model::git_hub_events_config::Event>>,
9144 >(
9145 mut self,
9146 v: T,
9147 ) -> Self {
9148 self.event = v.into();
9149 self
9150 }
9151
9152 /// The value of [event][crate::model::GitHubEventsConfig::event]
9153 /// if it holds a `PullRequest`, `None` if the field is not set or
9154 /// holds a different branch.
9155 pub fn pull_request(
9156 &self,
9157 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
9158 #[allow(unreachable_patterns)]
9159 self.event.as_ref().and_then(|v| match v {
9160 crate::model::git_hub_events_config::Event::PullRequest(v) => {
9161 std::option::Option::Some(v)
9162 }
9163 _ => std::option::Option::None,
9164 })
9165 }
9166
9167 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9168 /// to hold a `PullRequest`.
9169 ///
9170 /// Note that all the setters affecting `event` are
9171 /// mutually exclusive.
9172 ///
9173 /// # Example
9174 /// ```ignore,no_run
9175 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9176 /// use google_cloud_build_v1::model::PullRequestFilter;
9177 /// let x = GitHubEventsConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
9178 /// assert!(x.pull_request().is_some());
9179 /// assert!(x.push().is_none());
9180 /// ```
9181 pub fn set_pull_request<
9182 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
9183 >(
9184 mut self,
9185 v: T,
9186 ) -> Self {
9187 self.event = std::option::Option::Some(
9188 crate::model::git_hub_events_config::Event::PullRequest(v.into()),
9189 );
9190 self
9191 }
9192
9193 /// The value of [event][crate::model::GitHubEventsConfig::event]
9194 /// if it holds a `Push`, `None` if the field is not set or
9195 /// holds a different branch.
9196 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
9197 #[allow(unreachable_patterns)]
9198 self.event.as_ref().and_then(|v| match v {
9199 crate::model::git_hub_events_config::Event::Push(v) => std::option::Option::Some(v),
9200 _ => std::option::Option::None,
9201 })
9202 }
9203
9204 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9205 /// to hold a `Push`.
9206 ///
9207 /// Note that all the setters affecting `event` are
9208 /// mutually exclusive.
9209 ///
9210 /// # Example
9211 /// ```ignore,no_run
9212 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9213 /// use google_cloud_build_v1::model::PushFilter;
9214 /// let x = GitHubEventsConfig::new().set_push(PushFilter::default()/* use setters */);
9215 /// assert!(x.push().is_some());
9216 /// assert!(x.pull_request().is_none());
9217 /// ```
9218 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
9219 mut self,
9220 v: T,
9221 ) -> Self {
9222 self.event =
9223 std::option::Option::Some(crate::model::git_hub_events_config::Event::Push(v.into()));
9224 self
9225 }
9226}
9227
9228impl wkt::message::Message for GitHubEventsConfig {
9229 fn typename() -> &'static str {
9230 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEventsConfig"
9231 }
9232}
9233
9234/// Defines additional types related to [GitHubEventsConfig].
9235pub mod git_hub_events_config {
9236 #[allow(unused_imports)]
9237 use super::*;
9238
9239 /// Filter describing the types of events to trigger a build.
9240 /// Currently supported event types: push, pull_request.
9241 #[derive(Clone, Debug, PartialEq)]
9242 #[non_exhaustive]
9243 pub enum Event {
9244 /// filter to match changes in pull requests.
9245 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9246 /// filter to match changes in refs like branches, tags.
9247 Push(std::boxed::Box<crate::model::PushFilter>),
9248 }
9249}
9250
9251/// PubsubConfig describes the configuration of a trigger that
9252/// creates a build whenever a Pub/Sub message is published.
9253#[derive(Clone, Default, PartialEq)]
9254#[non_exhaustive]
9255pub struct PubsubConfig {
9256 /// Output only. Name of the subscription. Format is
9257 /// `projects/{project}/subscriptions/{subscription}`.
9258 pub subscription: std::string::String,
9259
9260 /// Optional. The name of the topic from which this subscription is receiving
9261 /// messages. Format is `projects/{project}/topics/{topic}`.
9262 pub topic: std::string::String,
9263
9264 /// Service account that will make the push request.
9265 pub service_account_email: std::string::String,
9266
9267 /// Potential issues with the underlying Pub/Sub subscription configuration.
9268 /// Only populated on get requests.
9269 pub state: crate::model::pubsub_config::State,
9270
9271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9272}
9273
9274impl PubsubConfig {
9275 /// Creates a new default instance.
9276 pub fn new() -> Self {
9277 std::default::Default::default()
9278 }
9279
9280 /// Sets the value of [subscription][crate::model::PubsubConfig::subscription].
9281 ///
9282 /// # Example
9283 /// ```ignore,no_run
9284 /// # use google_cloud_build_v1::model::PubsubConfig;
9285 /// let x = PubsubConfig::new().set_subscription("example");
9286 /// ```
9287 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9288 self.subscription = v.into();
9289 self
9290 }
9291
9292 /// Sets the value of [topic][crate::model::PubsubConfig::topic].
9293 ///
9294 /// # Example
9295 /// ```ignore,no_run
9296 /// # use google_cloud_build_v1::model::PubsubConfig;
9297 /// let x = PubsubConfig::new().set_topic("example");
9298 /// ```
9299 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9300 self.topic = v.into();
9301 self
9302 }
9303
9304 /// Sets the value of [service_account_email][crate::model::PubsubConfig::service_account_email].
9305 ///
9306 /// # Example
9307 /// ```ignore,no_run
9308 /// # use google_cloud_build_v1::model::PubsubConfig;
9309 /// let x = PubsubConfig::new().set_service_account_email("example");
9310 /// ```
9311 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
9312 mut self,
9313 v: T,
9314 ) -> Self {
9315 self.service_account_email = v.into();
9316 self
9317 }
9318
9319 /// Sets the value of [state][crate::model::PubsubConfig::state].
9320 ///
9321 /// # Example
9322 /// ```ignore,no_run
9323 /// # use google_cloud_build_v1::model::PubsubConfig;
9324 /// use google_cloud_build_v1::model::pubsub_config::State;
9325 /// let x0 = PubsubConfig::new().set_state(State::Ok);
9326 /// let x1 = PubsubConfig::new().set_state(State::SubscriptionDeleted);
9327 /// let x2 = PubsubConfig::new().set_state(State::TopicDeleted);
9328 /// ```
9329 pub fn set_state<T: std::convert::Into<crate::model::pubsub_config::State>>(
9330 mut self,
9331 v: T,
9332 ) -> Self {
9333 self.state = v.into();
9334 self
9335 }
9336}
9337
9338impl wkt::message::Message for PubsubConfig {
9339 fn typename() -> &'static str {
9340 "type.googleapis.com/google.devtools.cloudbuild.v1.PubsubConfig"
9341 }
9342}
9343
9344/// Defines additional types related to [PubsubConfig].
9345pub mod pubsub_config {
9346 #[allow(unused_imports)]
9347 use super::*;
9348
9349 /// Enumerates potential issues with the underlying Pub/Sub subscription
9350 /// configuration.
9351 ///
9352 /// # Working with unknown values
9353 ///
9354 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9355 /// additional enum variants at any time. Adding new variants is not considered
9356 /// a breaking change. Applications should write their code in anticipation of:
9357 ///
9358 /// - New values appearing in future releases of the client library, **and**
9359 /// - New values received dynamically, without application changes.
9360 ///
9361 /// Please consult the [Working with enums] section in the user guide for some
9362 /// guidelines.
9363 ///
9364 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9365 #[derive(Clone, Debug, PartialEq)]
9366 #[non_exhaustive]
9367 pub enum State {
9368 /// The subscription configuration has not been checked.
9369 Unspecified,
9370 /// The Pub/Sub subscription is properly configured.
9371 Ok,
9372 /// The subscription has been deleted.
9373 SubscriptionDeleted,
9374 /// The topic has been deleted.
9375 TopicDeleted,
9376 /// Some of the subscription's field are misconfigured.
9377 SubscriptionMisconfigured,
9378 /// If set, the enum was initialized with an unknown value.
9379 ///
9380 /// Applications can examine the value using [State::value] or
9381 /// [State::name].
9382 UnknownValue(state::UnknownValue),
9383 }
9384
9385 #[doc(hidden)]
9386 pub mod state {
9387 #[allow(unused_imports)]
9388 use super::*;
9389 #[derive(Clone, Debug, PartialEq)]
9390 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9391 }
9392
9393 impl State {
9394 /// Gets the enum value.
9395 ///
9396 /// Returns `None` if the enum contains an unknown value deserialized from
9397 /// the string representation of enums.
9398 pub fn value(&self) -> std::option::Option<i32> {
9399 match self {
9400 Self::Unspecified => std::option::Option::Some(0),
9401 Self::Ok => std::option::Option::Some(1),
9402 Self::SubscriptionDeleted => std::option::Option::Some(2),
9403 Self::TopicDeleted => std::option::Option::Some(3),
9404 Self::SubscriptionMisconfigured => std::option::Option::Some(4),
9405 Self::UnknownValue(u) => u.0.value(),
9406 }
9407 }
9408
9409 /// Gets the enum value as a string.
9410 ///
9411 /// Returns `None` if the enum contains an unknown value deserialized from
9412 /// the integer representation of enums.
9413 pub fn name(&self) -> std::option::Option<&str> {
9414 match self {
9415 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9416 Self::Ok => std::option::Option::Some("OK"),
9417 Self::SubscriptionDeleted => std::option::Option::Some("SUBSCRIPTION_DELETED"),
9418 Self::TopicDeleted => std::option::Option::Some("TOPIC_DELETED"),
9419 Self::SubscriptionMisconfigured => {
9420 std::option::Option::Some("SUBSCRIPTION_MISCONFIGURED")
9421 }
9422 Self::UnknownValue(u) => u.0.name(),
9423 }
9424 }
9425 }
9426
9427 impl std::default::Default for State {
9428 fn default() -> Self {
9429 use std::convert::From;
9430 Self::from(0)
9431 }
9432 }
9433
9434 impl std::fmt::Display for State {
9435 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9436 wkt::internal::display_enum(f, self.name(), self.value())
9437 }
9438 }
9439
9440 impl std::convert::From<i32> for State {
9441 fn from(value: i32) -> Self {
9442 match value {
9443 0 => Self::Unspecified,
9444 1 => Self::Ok,
9445 2 => Self::SubscriptionDeleted,
9446 3 => Self::TopicDeleted,
9447 4 => Self::SubscriptionMisconfigured,
9448 _ => Self::UnknownValue(state::UnknownValue(
9449 wkt::internal::UnknownEnumValue::Integer(value),
9450 )),
9451 }
9452 }
9453 }
9454
9455 impl std::convert::From<&str> for State {
9456 fn from(value: &str) -> Self {
9457 use std::string::ToString;
9458 match value {
9459 "STATE_UNSPECIFIED" => Self::Unspecified,
9460 "OK" => Self::Ok,
9461 "SUBSCRIPTION_DELETED" => Self::SubscriptionDeleted,
9462 "TOPIC_DELETED" => Self::TopicDeleted,
9463 "SUBSCRIPTION_MISCONFIGURED" => Self::SubscriptionMisconfigured,
9464 _ => Self::UnknownValue(state::UnknownValue(
9465 wkt::internal::UnknownEnumValue::String(value.to_string()),
9466 )),
9467 }
9468 }
9469 }
9470
9471 impl serde::ser::Serialize for State {
9472 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9473 where
9474 S: serde::Serializer,
9475 {
9476 match self {
9477 Self::Unspecified => serializer.serialize_i32(0),
9478 Self::Ok => serializer.serialize_i32(1),
9479 Self::SubscriptionDeleted => serializer.serialize_i32(2),
9480 Self::TopicDeleted => serializer.serialize_i32(3),
9481 Self::SubscriptionMisconfigured => serializer.serialize_i32(4),
9482 Self::UnknownValue(u) => u.0.serialize(serializer),
9483 }
9484 }
9485 }
9486
9487 impl<'de> serde::de::Deserialize<'de> for State {
9488 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9489 where
9490 D: serde::Deserializer<'de>,
9491 {
9492 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9493 ".google.devtools.cloudbuild.v1.PubsubConfig.State",
9494 ))
9495 }
9496 }
9497}
9498
9499/// WebhookConfig describes the configuration of a trigger that
9500/// creates a build whenever a webhook is sent to a trigger's webhook URL.
9501#[derive(Clone, Default, PartialEq)]
9502#[non_exhaustive]
9503pub struct WebhookConfig {
9504 /// Potential issues with the underlying Pub/Sub subscription configuration.
9505 /// Only populated on get requests.
9506 pub state: crate::model::webhook_config::State,
9507
9508 /// Auth method specifies how the webhook authenticates with GCP.
9509 pub auth_method: std::option::Option<crate::model::webhook_config::AuthMethod>,
9510
9511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9512}
9513
9514impl WebhookConfig {
9515 /// Creates a new default instance.
9516 pub fn new() -> Self {
9517 std::default::Default::default()
9518 }
9519
9520 /// Sets the value of [state][crate::model::WebhookConfig::state].
9521 ///
9522 /// # Example
9523 /// ```ignore,no_run
9524 /// # use google_cloud_build_v1::model::WebhookConfig;
9525 /// use google_cloud_build_v1::model::webhook_config::State;
9526 /// let x0 = WebhookConfig::new().set_state(State::Ok);
9527 /// let x1 = WebhookConfig::new().set_state(State::SecretDeleted);
9528 /// ```
9529 pub fn set_state<T: std::convert::Into<crate::model::webhook_config::State>>(
9530 mut self,
9531 v: T,
9532 ) -> Self {
9533 self.state = v.into();
9534 self
9535 }
9536
9537 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method].
9538 ///
9539 /// Note that all the setters affecting `auth_method` are mutually
9540 /// exclusive.
9541 ///
9542 /// # Example
9543 /// ```ignore,no_run
9544 /// # use google_cloud_build_v1::model::WebhookConfig;
9545 /// use google_cloud_build_v1::model::webhook_config::AuthMethod;
9546 /// let x = WebhookConfig::new().set_auth_method(Some(AuthMethod::Secret("example".to_string())));
9547 /// ```
9548 pub fn set_auth_method<
9549 T: std::convert::Into<std::option::Option<crate::model::webhook_config::AuthMethod>>,
9550 >(
9551 mut self,
9552 v: T,
9553 ) -> Self {
9554 self.auth_method = v.into();
9555 self
9556 }
9557
9558 /// The value of [auth_method][crate::model::WebhookConfig::auth_method]
9559 /// if it holds a `Secret`, `None` if the field is not set or
9560 /// holds a different branch.
9561 pub fn secret(&self) -> std::option::Option<&std::string::String> {
9562 #[allow(unreachable_patterns)]
9563 self.auth_method.as_ref().and_then(|v| match v {
9564 crate::model::webhook_config::AuthMethod::Secret(v) => std::option::Option::Some(v),
9565 _ => std::option::Option::None,
9566 })
9567 }
9568
9569 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method]
9570 /// to hold a `Secret`.
9571 ///
9572 /// Note that all the setters affecting `auth_method` are
9573 /// mutually exclusive.
9574 ///
9575 /// # Example
9576 /// ```ignore,no_run
9577 /// # use google_cloud_build_v1::model::WebhookConfig;
9578 /// let x = WebhookConfig::new().set_secret("example");
9579 /// assert!(x.secret().is_some());
9580 /// ```
9581 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9582 self.auth_method =
9583 std::option::Option::Some(crate::model::webhook_config::AuthMethod::Secret(v.into()));
9584 self
9585 }
9586}
9587
9588impl wkt::message::Message for WebhookConfig {
9589 fn typename() -> &'static str {
9590 "type.googleapis.com/google.devtools.cloudbuild.v1.WebhookConfig"
9591 }
9592}
9593
9594/// Defines additional types related to [WebhookConfig].
9595pub mod webhook_config {
9596 #[allow(unused_imports)]
9597 use super::*;
9598
9599 /// Enumerates potential issues with the Secret Manager secret provided by the
9600 /// user.
9601 ///
9602 /// # Working with unknown values
9603 ///
9604 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9605 /// additional enum variants at any time. Adding new variants is not considered
9606 /// a breaking change. Applications should write their code in anticipation of:
9607 ///
9608 /// - New values appearing in future releases of the client library, **and**
9609 /// - New values received dynamically, without application changes.
9610 ///
9611 /// Please consult the [Working with enums] section in the user guide for some
9612 /// guidelines.
9613 ///
9614 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9615 #[derive(Clone, Debug, PartialEq)]
9616 #[non_exhaustive]
9617 pub enum State {
9618 /// The webhook auth configuration not been checked.
9619 Unspecified,
9620 /// The auth configuration is properly setup.
9621 Ok,
9622 /// The secret provided in auth_method has been deleted.
9623 SecretDeleted,
9624 /// If set, the enum was initialized with an unknown value.
9625 ///
9626 /// Applications can examine the value using [State::value] or
9627 /// [State::name].
9628 UnknownValue(state::UnknownValue),
9629 }
9630
9631 #[doc(hidden)]
9632 pub mod state {
9633 #[allow(unused_imports)]
9634 use super::*;
9635 #[derive(Clone, Debug, PartialEq)]
9636 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9637 }
9638
9639 impl State {
9640 /// Gets the enum value.
9641 ///
9642 /// Returns `None` if the enum contains an unknown value deserialized from
9643 /// the string representation of enums.
9644 pub fn value(&self) -> std::option::Option<i32> {
9645 match self {
9646 Self::Unspecified => std::option::Option::Some(0),
9647 Self::Ok => std::option::Option::Some(1),
9648 Self::SecretDeleted => std::option::Option::Some(2),
9649 Self::UnknownValue(u) => u.0.value(),
9650 }
9651 }
9652
9653 /// Gets the enum value as a string.
9654 ///
9655 /// Returns `None` if the enum contains an unknown value deserialized from
9656 /// the integer representation of enums.
9657 pub fn name(&self) -> std::option::Option<&str> {
9658 match self {
9659 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9660 Self::Ok => std::option::Option::Some("OK"),
9661 Self::SecretDeleted => std::option::Option::Some("SECRET_DELETED"),
9662 Self::UnknownValue(u) => u.0.name(),
9663 }
9664 }
9665 }
9666
9667 impl std::default::Default for State {
9668 fn default() -> Self {
9669 use std::convert::From;
9670 Self::from(0)
9671 }
9672 }
9673
9674 impl std::fmt::Display for State {
9675 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9676 wkt::internal::display_enum(f, self.name(), self.value())
9677 }
9678 }
9679
9680 impl std::convert::From<i32> for State {
9681 fn from(value: i32) -> Self {
9682 match value {
9683 0 => Self::Unspecified,
9684 1 => Self::Ok,
9685 2 => Self::SecretDeleted,
9686 _ => Self::UnknownValue(state::UnknownValue(
9687 wkt::internal::UnknownEnumValue::Integer(value),
9688 )),
9689 }
9690 }
9691 }
9692
9693 impl std::convert::From<&str> for State {
9694 fn from(value: &str) -> Self {
9695 use std::string::ToString;
9696 match value {
9697 "STATE_UNSPECIFIED" => Self::Unspecified,
9698 "OK" => Self::Ok,
9699 "SECRET_DELETED" => Self::SecretDeleted,
9700 _ => Self::UnknownValue(state::UnknownValue(
9701 wkt::internal::UnknownEnumValue::String(value.to_string()),
9702 )),
9703 }
9704 }
9705 }
9706
9707 impl serde::ser::Serialize for State {
9708 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9709 where
9710 S: serde::Serializer,
9711 {
9712 match self {
9713 Self::Unspecified => serializer.serialize_i32(0),
9714 Self::Ok => serializer.serialize_i32(1),
9715 Self::SecretDeleted => serializer.serialize_i32(2),
9716 Self::UnknownValue(u) => u.0.serialize(serializer),
9717 }
9718 }
9719 }
9720
9721 impl<'de> serde::de::Deserialize<'de> for State {
9722 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9723 where
9724 D: serde::Deserializer<'de>,
9725 {
9726 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9727 ".google.devtools.cloudbuild.v1.WebhookConfig.State",
9728 ))
9729 }
9730 }
9731
9732 /// Auth method specifies how the webhook authenticates with GCP.
9733 #[derive(Clone, Debug, PartialEq)]
9734 #[non_exhaustive]
9735 pub enum AuthMethod {
9736 /// Required. Resource name for the secret required as a URL parameter.
9737 Secret(std::string::String),
9738 }
9739}
9740
9741/// PullRequestFilter contains filter properties for matching GitHub Pull
9742/// Requests.
9743#[derive(Clone, Default, PartialEq)]
9744#[non_exhaustive]
9745pub struct PullRequestFilter {
9746 /// If CommentControl is enabled, depending on the setting, builds may not
9747 /// fire until a repository writer comments `/gcbrun` on a pull
9748 /// request or `/gcbrun` is in the pull request description.
9749 /// Only PR comments that contain `/gcbrun` will trigger builds.
9750 ///
9751 /// If CommentControl is set to disabled, comments with `/gcbrun` from a user
9752 /// with repository write permission or above will
9753 /// still trigger builds to run.
9754 pub comment_control: crate::model::pull_request_filter::CommentControl,
9755
9756 /// If true, branches that do NOT match the git_ref will trigger a build.
9757 pub invert_regex: bool,
9758
9759 /// Target refs to match.
9760 /// A target ref is the git reference where the pull request will be applied.
9761 pub git_ref: std::option::Option<crate::model::pull_request_filter::GitRef>,
9762
9763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9764}
9765
9766impl PullRequestFilter {
9767 /// Creates a new default instance.
9768 pub fn new() -> Self {
9769 std::default::Default::default()
9770 }
9771
9772 /// Sets the value of [comment_control][crate::model::PullRequestFilter::comment_control].
9773 ///
9774 /// # Example
9775 /// ```ignore,no_run
9776 /// # use google_cloud_build_v1::model::PullRequestFilter;
9777 /// use google_cloud_build_v1::model::pull_request_filter::CommentControl;
9778 /// let x0 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabled);
9779 /// let x1 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabledForExternalContributorsOnly);
9780 /// ```
9781 pub fn set_comment_control<
9782 T: std::convert::Into<crate::model::pull_request_filter::CommentControl>,
9783 >(
9784 mut self,
9785 v: T,
9786 ) -> Self {
9787 self.comment_control = v.into();
9788 self
9789 }
9790
9791 /// Sets the value of [invert_regex][crate::model::PullRequestFilter::invert_regex].
9792 ///
9793 /// # Example
9794 /// ```ignore,no_run
9795 /// # use google_cloud_build_v1::model::PullRequestFilter;
9796 /// let x = PullRequestFilter::new().set_invert_regex(true);
9797 /// ```
9798 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9799 self.invert_regex = v.into();
9800 self
9801 }
9802
9803 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref].
9804 ///
9805 /// Note that all the setters affecting `git_ref` are mutually
9806 /// exclusive.
9807 ///
9808 /// # Example
9809 /// ```ignore,no_run
9810 /// # use google_cloud_build_v1::model::PullRequestFilter;
9811 /// use google_cloud_build_v1::model::pull_request_filter::GitRef;
9812 /// let x = PullRequestFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9813 /// ```
9814 pub fn set_git_ref<
9815 T: std::convert::Into<std::option::Option<crate::model::pull_request_filter::GitRef>>,
9816 >(
9817 mut self,
9818 v: T,
9819 ) -> Self {
9820 self.git_ref = v.into();
9821 self
9822 }
9823
9824 /// The value of [git_ref][crate::model::PullRequestFilter::git_ref]
9825 /// if it holds a `Branch`, `None` if the field is not set or
9826 /// holds a different branch.
9827 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9828 #[allow(unreachable_patterns)]
9829 self.git_ref.as_ref().and_then(|v| match v {
9830 crate::model::pull_request_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9831 _ => std::option::Option::None,
9832 })
9833 }
9834
9835 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref]
9836 /// to hold a `Branch`.
9837 ///
9838 /// Note that all the setters affecting `git_ref` are
9839 /// mutually exclusive.
9840 ///
9841 /// # Example
9842 /// ```ignore,no_run
9843 /// # use google_cloud_build_v1::model::PullRequestFilter;
9844 /// let x = PullRequestFilter::new().set_branch("example");
9845 /// assert!(x.branch().is_some());
9846 /// ```
9847 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9848 self.git_ref =
9849 std::option::Option::Some(crate::model::pull_request_filter::GitRef::Branch(v.into()));
9850 self
9851 }
9852}
9853
9854impl wkt::message::Message for PullRequestFilter {
9855 fn typename() -> &'static str {
9856 "type.googleapis.com/google.devtools.cloudbuild.v1.PullRequestFilter"
9857 }
9858}
9859
9860/// Defines additional types related to [PullRequestFilter].
9861pub mod pull_request_filter {
9862 #[allow(unused_imports)]
9863 use super::*;
9864
9865 /// Controls whether or not a `/gcbrun` comment is required from a user with
9866 /// repository write permission or above in order to
9867 /// trigger Build runs for pull requests. Pull Request update events differ
9868 /// between repo types.
9869 /// Check repo specific guides
9870 /// ([GitHub](https://cloud.google.com/build/docs/automating-builds/github/build-repos-from-github-enterprise#creating_a_github_enterprise_trigger),
9871 /// [Bitbucket](https://cloud.google.com/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-server#creating_a_bitbucket_server_trigger),
9872 /// [GitLab](https://cloud.google.com/build/docs/automating-builds/gitlab/build-repos-from-gitlab#creating_a_gitlab_trigger)
9873 /// for details.
9874 ///
9875 /// # Working with unknown values
9876 ///
9877 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9878 /// additional enum variants at any time. Adding new variants is not considered
9879 /// a breaking change. Applications should write their code in anticipation of:
9880 ///
9881 /// - New values appearing in future releases of the client library, **and**
9882 /// - New values received dynamically, without application changes.
9883 ///
9884 /// Please consult the [Working with enums] section in the user guide for some
9885 /// guidelines.
9886 ///
9887 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9888 #[derive(Clone, Debug, PartialEq)]
9889 #[non_exhaustive]
9890 pub enum CommentControl {
9891 /// Do not require `/gcbrun` comments from a user with repository write
9892 /// permission or above on pull requests before builds are triggered.
9893 /// Comments that contain `/gcbrun` will still fire builds so this should
9894 /// be thought of as comments not required.
9895 CommentsDisabled,
9896 /// Builds will only fire in response to pull requests if:
9897 ///
9898 /// 1. The pull request author has repository write permission or above and
9899 /// `/gcbrun` is in the PR description.
9900 /// 1. A user with repository writer permissions or above comments `/gcbrun`
9901 /// on a pull request authored by any user.
9902 CommentsEnabled,
9903 /// Builds will only fire in response to pull requests if:
9904 ///
9905 /// 1. The pull request author is a repository writer or above.
9906 /// 1. If the author does not have write permissions, a user with write
9907 /// permissions or above must comment `/gcbrun` in order to fire a build.
9908 CommentsEnabledForExternalContributorsOnly,
9909 /// If set, the enum was initialized with an unknown value.
9910 ///
9911 /// Applications can examine the value using [CommentControl::value] or
9912 /// [CommentControl::name].
9913 UnknownValue(comment_control::UnknownValue),
9914 }
9915
9916 #[doc(hidden)]
9917 pub mod comment_control {
9918 #[allow(unused_imports)]
9919 use super::*;
9920 #[derive(Clone, Debug, PartialEq)]
9921 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9922 }
9923
9924 impl CommentControl {
9925 /// Gets the enum value.
9926 ///
9927 /// Returns `None` if the enum contains an unknown value deserialized from
9928 /// the string representation of enums.
9929 pub fn value(&self) -> std::option::Option<i32> {
9930 match self {
9931 Self::CommentsDisabled => std::option::Option::Some(0),
9932 Self::CommentsEnabled => std::option::Option::Some(1),
9933 Self::CommentsEnabledForExternalContributorsOnly => std::option::Option::Some(2),
9934 Self::UnknownValue(u) => u.0.value(),
9935 }
9936 }
9937
9938 /// Gets the enum value as a string.
9939 ///
9940 /// Returns `None` if the enum contains an unknown value deserialized from
9941 /// the integer representation of enums.
9942 pub fn name(&self) -> std::option::Option<&str> {
9943 match self {
9944 Self::CommentsDisabled => std::option::Option::Some("COMMENTS_DISABLED"),
9945 Self::CommentsEnabled => std::option::Option::Some("COMMENTS_ENABLED"),
9946 Self::CommentsEnabledForExternalContributorsOnly => {
9947 std::option::Option::Some("COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY")
9948 }
9949 Self::UnknownValue(u) => u.0.name(),
9950 }
9951 }
9952 }
9953
9954 impl std::default::Default for CommentControl {
9955 fn default() -> Self {
9956 use std::convert::From;
9957 Self::from(0)
9958 }
9959 }
9960
9961 impl std::fmt::Display for CommentControl {
9962 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9963 wkt::internal::display_enum(f, self.name(), self.value())
9964 }
9965 }
9966
9967 impl std::convert::From<i32> for CommentControl {
9968 fn from(value: i32) -> Self {
9969 match value {
9970 0 => Self::CommentsDisabled,
9971 1 => Self::CommentsEnabled,
9972 2 => Self::CommentsEnabledForExternalContributorsOnly,
9973 _ => Self::UnknownValue(comment_control::UnknownValue(
9974 wkt::internal::UnknownEnumValue::Integer(value),
9975 )),
9976 }
9977 }
9978 }
9979
9980 impl std::convert::From<&str> for CommentControl {
9981 fn from(value: &str) -> Self {
9982 use std::string::ToString;
9983 match value {
9984 "COMMENTS_DISABLED" => Self::CommentsDisabled,
9985 "COMMENTS_ENABLED" => Self::CommentsEnabled,
9986 "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" => {
9987 Self::CommentsEnabledForExternalContributorsOnly
9988 }
9989 _ => Self::UnknownValue(comment_control::UnknownValue(
9990 wkt::internal::UnknownEnumValue::String(value.to_string()),
9991 )),
9992 }
9993 }
9994 }
9995
9996 impl serde::ser::Serialize for CommentControl {
9997 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9998 where
9999 S: serde::Serializer,
10000 {
10001 match self {
10002 Self::CommentsDisabled => serializer.serialize_i32(0),
10003 Self::CommentsEnabled => serializer.serialize_i32(1),
10004 Self::CommentsEnabledForExternalContributorsOnly => serializer.serialize_i32(2),
10005 Self::UnknownValue(u) => u.0.serialize(serializer),
10006 }
10007 }
10008 }
10009
10010 impl<'de> serde::de::Deserialize<'de> for CommentControl {
10011 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10012 where
10013 D: serde::Deserializer<'de>,
10014 {
10015 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommentControl>::new(
10016 ".google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl",
10017 ))
10018 }
10019 }
10020
10021 /// Target refs to match.
10022 /// A target ref is the git reference where the pull request will be applied.
10023 #[derive(Clone, Debug, PartialEq)]
10024 #[non_exhaustive]
10025 pub enum GitRef {
10026 /// Regex of branches to match.
10027 ///
10028 /// The syntax of the regular expressions accepted is the syntax accepted by
10029 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10030 Branch(std::string::String),
10031 }
10032}
10033
10034/// Push contains filter properties for matching GitHub git pushes.
10035#[derive(Clone, Default, PartialEq)]
10036#[non_exhaustive]
10037pub struct PushFilter {
10038 /// When true, only trigger a build if the revision regex does NOT match the
10039 /// git_ref regex.
10040 pub invert_regex: bool,
10041
10042 /// Modified refs to match.
10043 /// A modified refs are the refs modified by a git push operation.
10044 pub git_ref: std::option::Option<crate::model::push_filter::GitRef>,
10045
10046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10047}
10048
10049impl PushFilter {
10050 /// Creates a new default instance.
10051 pub fn new() -> Self {
10052 std::default::Default::default()
10053 }
10054
10055 /// Sets the value of [invert_regex][crate::model::PushFilter::invert_regex].
10056 ///
10057 /// # Example
10058 /// ```ignore,no_run
10059 /// # use google_cloud_build_v1::model::PushFilter;
10060 /// let x = PushFilter::new().set_invert_regex(true);
10061 /// ```
10062 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10063 self.invert_regex = v.into();
10064 self
10065 }
10066
10067 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref].
10068 ///
10069 /// Note that all the setters affecting `git_ref` are mutually
10070 /// exclusive.
10071 ///
10072 /// # Example
10073 /// ```ignore,no_run
10074 /// # use google_cloud_build_v1::model::PushFilter;
10075 /// use google_cloud_build_v1::model::push_filter::GitRef;
10076 /// let x = PushFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
10077 /// ```
10078 pub fn set_git_ref<
10079 T: std::convert::Into<std::option::Option<crate::model::push_filter::GitRef>>,
10080 >(
10081 mut self,
10082 v: T,
10083 ) -> Self {
10084 self.git_ref = v.into();
10085 self
10086 }
10087
10088 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10089 /// if it holds a `Branch`, `None` if the field is not set or
10090 /// holds a different branch.
10091 pub fn branch(&self) -> std::option::Option<&std::string::String> {
10092 #[allow(unreachable_patterns)]
10093 self.git_ref.as_ref().and_then(|v| match v {
10094 crate::model::push_filter::GitRef::Branch(v) => std::option::Option::Some(v),
10095 _ => std::option::Option::None,
10096 })
10097 }
10098
10099 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10100 /// to hold a `Branch`.
10101 ///
10102 /// Note that all the setters affecting `git_ref` are
10103 /// mutually exclusive.
10104 ///
10105 /// # Example
10106 /// ```ignore,no_run
10107 /// # use google_cloud_build_v1::model::PushFilter;
10108 /// let x = PushFilter::new().set_branch("example");
10109 /// assert!(x.branch().is_some());
10110 /// assert!(x.tag().is_none());
10111 /// ```
10112 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10113 self.git_ref =
10114 std::option::Option::Some(crate::model::push_filter::GitRef::Branch(v.into()));
10115 self
10116 }
10117
10118 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10119 /// if it holds a `Tag`, `None` if the field is not set or
10120 /// holds a different branch.
10121 pub fn tag(&self) -> std::option::Option<&std::string::String> {
10122 #[allow(unreachable_patterns)]
10123 self.git_ref.as_ref().and_then(|v| match v {
10124 crate::model::push_filter::GitRef::Tag(v) => std::option::Option::Some(v),
10125 _ => std::option::Option::None,
10126 })
10127 }
10128
10129 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10130 /// to hold a `Tag`.
10131 ///
10132 /// Note that all the setters affecting `git_ref` are
10133 /// mutually exclusive.
10134 ///
10135 /// # Example
10136 /// ```ignore,no_run
10137 /// # use google_cloud_build_v1::model::PushFilter;
10138 /// let x = PushFilter::new().set_tag("example");
10139 /// assert!(x.tag().is_some());
10140 /// assert!(x.branch().is_none());
10141 /// ```
10142 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10143 self.git_ref = std::option::Option::Some(crate::model::push_filter::GitRef::Tag(v.into()));
10144 self
10145 }
10146}
10147
10148impl wkt::message::Message for PushFilter {
10149 fn typename() -> &'static str {
10150 "type.googleapis.com/google.devtools.cloudbuild.v1.PushFilter"
10151 }
10152}
10153
10154/// Defines additional types related to [PushFilter].
10155pub mod push_filter {
10156 #[allow(unused_imports)]
10157 use super::*;
10158
10159 /// Modified refs to match.
10160 /// A modified refs are the refs modified by a git push operation.
10161 #[derive(Clone, Debug, PartialEq)]
10162 #[non_exhaustive]
10163 pub enum GitRef {
10164 /// Regexes matching branches to build.
10165 ///
10166 /// The syntax of the regular expressions accepted is the syntax accepted by
10167 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10168 Branch(std::string::String),
10169 /// Regexes matching tags to build.
10170 ///
10171 /// The syntax of the regular expressions accepted is the syntax accepted by
10172 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10173 Tag(std::string::String),
10174 }
10175}
10176
10177/// Request to create a new `BuildTrigger`.
10178#[derive(Clone, Default, PartialEq)]
10179#[non_exhaustive]
10180pub struct CreateBuildTriggerRequest {
10181 /// The parent resource where this trigger will be created.
10182 /// Format: `projects/{project}/locations/{location}`
10183 pub parent: std::string::String,
10184
10185 /// Required. ID of the project for which to configure automatic builds.
10186 pub project_id: std::string::String,
10187
10188 /// Required. `BuildTrigger` to create.
10189 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10190
10191 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10192}
10193
10194impl CreateBuildTriggerRequest {
10195 /// Creates a new default instance.
10196 pub fn new() -> Self {
10197 std::default::Default::default()
10198 }
10199
10200 /// Sets the value of [parent][crate::model::CreateBuildTriggerRequest::parent].
10201 ///
10202 /// # Example
10203 /// ```ignore,no_run
10204 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10205 /// # let project_id = "project_id";
10206 /// let x = CreateBuildTriggerRequest::new().set_parent(format!("projects/{project_id}"));
10207 /// ```
10208 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10209 self.parent = v.into();
10210 self
10211 }
10212
10213 /// Sets the value of [project_id][crate::model::CreateBuildTriggerRequest::project_id].
10214 ///
10215 /// # Example
10216 /// ```ignore,no_run
10217 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10218 /// let x = CreateBuildTriggerRequest::new().set_project_id("example");
10219 /// ```
10220 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10221 self.project_id = v.into();
10222 self
10223 }
10224
10225 /// Sets the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10226 ///
10227 /// # Example
10228 /// ```ignore,no_run
10229 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10230 /// use google_cloud_build_v1::model::BuildTrigger;
10231 /// let x = CreateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10232 /// ```
10233 pub fn set_trigger<T>(mut self, v: T) -> Self
10234 where
10235 T: std::convert::Into<crate::model::BuildTrigger>,
10236 {
10237 self.trigger = std::option::Option::Some(v.into());
10238 self
10239 }
10240
10241 /// Sets or clears the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10242 ///
10243 /// # Example
10244 /// ```ignore,no_run
10245 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10246 /// use google_cloud_build_v1::model::BuildTrigger;
10247 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10248 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10249 /// ```
10250 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10251 where
10252 T: std::convert::Into<crate::model::BuildTrigger>,
10253 {
10254 self.trigger = v.map(|x| x.into());
10255 self
10256 }
10257}
10258
10259impl wkt::message::Message for CreateBuildTriggerRequest {
10260 fn typename() -> &'static str {
10261 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildTriggerRequest"
10262 }
10263}
10264
10265/// Returns the `BuildTrigger` with the specified ID.
10266#[derive(Clone, Default, PartialEq)]
10267#[non_exhaustive]
10268pub struct GetBuildTriggerRequest {
10269 /// The name of the `Trigger` to retrieve.
10270 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10271 pub name: std::string::String,
10272
10273 /// Required. ID of the project that owns the trigger.
10274 pub project_id: std::string::String,
10275
10276 /// Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
10277 pub trigger_id: std::string::String,
10278
10279 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10280}
10281
10282impl GetBuildTriggerRequest {
10283 /// Creates a new default instance.
10284 pub fn new() -> Self {
10285 std::default::Default::default()
10286 }
10287
10288 /// Sets the value of [name][crate::model::GetBuildTriggerRequest::name].
10289 ///
10290 /// # Example
10291 /// ```ignore,no_run
10292 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10293 /// # let project_id = "project_id";
10294 /// # let trigger_id = "trigger_id";
10295 /// let x = GetBuildTriggerRequest::new().set_name(format!("projects/{project_id}/triggers/{trigger_id}"));
10296 /// ```
10297 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10298 self.name = v.into();
10299 self
10300 }
10301
10302 /// Sets the value of [project_id][crate::model::GetBuildTriggerRequest::project_id].
10303 ///
10304 /// # Example
10305 /// ```ignore,no_run
10306 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10307 /// let x = GetBuildTriggerRequest::new().set_project_id("example");
10308 /// ```
10309 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10310 self.project_id = v.into();
10311 self
10312 }
10313
10314 /// Sets the value of [trigger_id][crate::model::GetBuildTriggerRequest::trigger_id].
10315 ///
10316 /// # Example
10317 /// ```ignore,no_run
10318 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10319 /// let x = GetBuildTriggerRequest::new().set_trigger_id("example");
10320 /// ```
10321 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10322 self.trigger_id = v.into();
10323 self
10324 }
10325}
10326
10327impl wkt::message::Message for GetBuildTriggerRequest {
10328 fn typename() -> &'static str {
10329 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildTriggerRequest"
10330 }
10331}
10332
10333/// Request to list existing `BuildTriggers`.
10334#[derive(Clone, Default, PartialEq)]
10335#[non_exhaustive]
10336pub struct ListBuildTriggersRequest {
10337 /// The parent of the collection of `Triggers`.
10338 /// Format: `projects/{project}/locations/{location}`
10339 pub parent: std::string::String,
10340
10341 /// Required. ID of the project for which to list BuildTriggers.
10342 pub project_id: std::string::String,
10343
10344 /// Number of results to return in the list.
10345 pub page_size: i32,
10346
10347 /// Token to provide to skip to a particular spot in the list.
10348 pub page_token: std::string::String,
10349
10350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10351}
10352
10353impl ListBuildTriggersRequest {
10354 /// Creates a new default instance.
10355 pub fn new() -> Self {
10356 std::default::Default::default()
10357 }
10358
10359 /// Sets the value of [parent][crate::model::ListBuildTriggersRequest::parent].
10360 ///
10361 /// # Example
10362 /// ```ignore,no_run
10363 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10364 /// # let project_id = "project_id";
10365 /// let x = ListBuildTriggersRequest::new().set_parent(format!("projects/{project_id}"));
10366 /// ```
10367 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10368 self.parent = v.into();
10369 self
10370 }
10371
10372 /// Sets the value of [project_id][crate::model::ListBuildTriggersRequest::project_id].
10373 ///
10374 /// # Example
10375 /// ```ignore,no_run
10376 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10377 /// let x = ListBuildTriggersRequest::new().set_project_id("example");
10378 /// ```
10379 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10380 self.project_id = v.into();
10381 self
10382 }
10383
10384 /// Sets the value of [page_size][crate::model::ListBuildTriggersRequest::page_size].
10385 ///
10386 /// # Example
10387 /// ```ignore,no_run
10388 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10389 /// let x = ListBuildTriggersRequest::new().set_page_size(42);
10390 /// ```
10391 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10392 self.page_size = v.into();
10393 self
10394 }
10395
10396 /// Sets the value of [page_token][crate::model::ListBuildTriggersRequest::page_token].
10397 ///
10398 /// # Example
10399 /// ```ignore,no_run
10400 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10401 /// let x = ListBuildTriggersRequest::new().set_page_token("example");
10402 /// ```
10403 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10404 self.page_token = v.into();
10405 self
10406 }
10407}
10408
10409impl wkt::message::Message for ListBuildTriggersRequest {
10410 fn typename() -> &'static str {
10411 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersRequest"
10412 }
10413}
10414
10415/// Response containing existing `BuildTriggers`.
10416#[derive(Clone, Default, PartialEq)]
10417#[non_exhaustive]
10418pub struct ListBuildTriggersResponse {
10419 /// `BuildTriggers` for the project, sorted by `create_time` descending.
10420 pub triggers: std::vec::Vec<crate::model::BuildTrigger>,
10421
10422 /// Token to receive the next page of results.
10423 pub next_page_token: std::string::String,
10424
10425 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10426}
10427
10428impl ListBuildTriggersResponse {
10429 /// Creates a new default instance.
10430 pub fn new() -> Self {
10431 std::default::Default::default()
10432 }
10433
10434 /// Sets the value of [triggers][crate::model::ListBuildTriggersResponse::triggers].
10435 ///
10436 /// # Example
10437 /// ```ignore,no_run
10438 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10439 /// use google_cloud_build_v1::model::BuildTrigger;
10440 /// let x = ListBuildTriggersResponse::new()
10441 /// .set_triggers([
10442 /// BuildTrigger::default()/* use setters */,
10443 /// BuildTrigger::default()/* use (different) setters */,
10444 /// ]);
10445 /// ```
10446 pub fn set_triggers<T, V>(mut self, v: T) -> Self
10447 where
10448 T: std::iter::IntoIterator<Item = V>,
10449 V: std::convert::Into<crate::model::BuildTrigger>,
10450 {
10451 use std::iter::Iterator;
10452 self.triggers = v.into_iter().map(|i| i.into()).collect();
10453 self
10454 }
10455
10456 /// Sets the value of [next_page_token][crate::model::ListBuildTriggersResponse::next_page_token].
10457 ///
10458 /// # Example
10459 /// ```ignore,no_run
10460 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10461 /// let x = ListBuildTriggersResponse::new().set_next_page_token("example");
10462 /// ```
10463 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10464 self.next_page_token = v.into();
10465 self
10466 }
10467}
10468
10469impl wkt::message::Message for ListBuildTriggersResponse {
10470 fn typename() -> &'static str {
10471 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersResponse"
10472 }
10473}
10474
10475#[doc(hidden)]
10476impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildTriggersResponse {
10477 type PageItem = crate::model::BuildTrigger;
10478
10479 fn items(self) -> std::vec::Vec<Self::PageItem> {
10480 self.triggers
10481 }
10482
10483 fn next_page_token(&self) -> std::string::String {
10484 use std::clone::Clone;
10485 self.next_page_token.clone()
10486 }
10487}
10488
10489/// Request to delete a `BuildTrigger`.
10490#[derive(Clone, Default, PartialEq)]
10491#[non_exhaustive]
10492pub struct DeleteBuildTriggerRequest {
10493 /// The name of the `Trigger` to delete.
10494 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10495 pub name: std::string::String,
10496
10497 /// Required. ID of the project that owns the trigger.
10498 pub project_id: std::string::String,
10499
10500 /// Required. ID of the `BuildTrigger` to delete.
10501 pub trigger_id: std::string::String,
10502
10503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10504}
10505
10506impl DeleteBuildTriggerRequest {
10507 /// Creates a new default instance.
10508 pub fn new() -> Self {
10509 std::default::Default::default()
10510 }
10511
10512 /// Sets the value of [name][crate::model::DeleteBuildTriggerRequest::name].
10513 ///
10514 /// # Example
10515 /// ```ignore,no_run
10516 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10517 /// # let project_id = "project_id";
10518 /// # let trigger_id = "trigger_id";
10519 /// let x = DeleteBuildTriggerRequest::new().set_name(format!("projects/{project_id}/triggers/{trigger_id}"));
10520 /// ```
10521 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10522 self.name = v.into();
10523 self
10524 }
10525
10526 /// Sets the value of [project_id][crate::model::DeleteBuildTriggerRequest::project_id].
10527 ///
10528 /// # Example
10529 /// ```ignore,no_run
10530 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10531 /// let x = DeleteBuildTriggerRequest::new().set_project_id("example");
10532 /// ```
10533 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10534 self.project_id = v.into();
10535 self
10536 }
10537
10538 /// Sets the value of [trigger_id][crate::model::DeleteBuildTriggerRequest::trigger_id].
10539 ///
10540 /// # Example
10541 /// ```ignore,no_run
10542 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10543 /// let x = DeleteBuildTriggerRequest::new().set_trigger_id("example");
10544 /// ```
10545 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10546 self.trigger_id = v.into();
10547 self
10548 }
10549}
10550
10551impl wkt::message::Message for DeleteBuildTriggerRequest {
10552 fn typename() -> &'static str {
10553 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest"
10554 }
10555}
10556
10557/// Request to update an existing `BuildTrigger`.
10558#[derive(Clone, Default, PartialEq)]
10559#[non_exhaustive]
10560pub struct UpdateBuildTriggerRequest {
10561 /// Required. ID of the project that owns the trigger.
10562 pub project_id: std::string::String,
10563
10564 /// Required. ID of the `BuildTrigger` to update.
10565 pub trigger_id: std::string::String,
10566
10567 /// Required. `BuildTrigger` to update.
10568 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10569
10570 /// Update mask for the resource. If this is set,
10571 /// the server will only update the fields specified in the field mask.
10572 /// Otherwise, a full update of the mutable resource fields will be performed.
10573 pub update_mask: std::option::Option<wkt::FieldMask>,
10574
10575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10576}
10577
10578impl UpdateBuildTriggerRequest {
10579 /// Creates a new default instance.
10580 pub fn new() -> Self {
10581 std::default::Default::default()
10582 }
10583
10584 /// Sets the value of [project_id][crate::model::UpdateBuildTriggerRequest::project_id].
10585 ///
10586 /// # Example
10587 /// ```ignore,no_run
10588 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10589 /// let x = UpdateBuildTriggerRequest::new().set_project_id("example");
10590 /// ```
10591 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10592 self.project_id = v.into();
10593 self
10594 }
10595
10596 /// Sets the value of [trigger_id][crate::model::UpdateBuildTriggerRequest::trigger_id].
10597 ///
10598 /// # Example
10599 /// ```ignore,no_run
10600 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10601 /// let x = UpdateBuildTriggerRequest::new().set_trigger_id("example");
10602 /// ```
10603 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10604 self.trigger_id = v.into();
10605 self
10606 }
10607
10608 /// Sets the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10609 ///
10610 /// # Example
10611 /// ```ignore,no_run
10612 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10613 /// use google_cloud_build_v1::model::BuildTrigger;
10614 /// let x = UpdateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10615 /// ```
10616 pub fn set_trigger<T>(mut self, v: T) -> Self
10617 where
10618 T: std::convert::Into<crate::model::BuildTrigger>,
10619 {
10620 self.trigger = std::option::Option::Some(v.into());
10621 self
10622 }
10623
10624 /// Sets or clears the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10625 ///
10626 /// # Example
10627 /// ```ignore,no_run
10628 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10629 /// use google_cloud_build_v1::model::BuildTrigger;
10630 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10631 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10632 /// ```
10633 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10634 where
10635 T: std::convert::Into<crate::model::BuildTrigger>,
10636 {
10637 self.trigger = v.map(|x| x.into());
10638 self
10639 }
10640
10641 /// Sets the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10642 ///
10643 /// # Example
10644 /// ```ignore,no_run
10645 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10646 /// use wkt::FieldMask;
10647 /// let x = UpdateBuildTriggerRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10648 /// ```
10649 pub fn set_update_mask<T>(mut self, v: T) -> Self
10650 where
10651 T: std::convert::Into<wkt::FieldMask>,
10652 {
10653 self.update_mask = std::option::Option::Some(v.into());
10654 self
10655 }
10656
10657 /// Sets or clears the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10658 ///
10659 /// # Example
10660 /// ```ignore,no_run
10661 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10662 /// use wkt::FieldMask;
10663 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10664 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10665 /// ```
10666 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10667 where
10668 T: std::convert::Into<wkt::FieldMask>,
10669 {
10670 self.update_mask = v.map(|x| x.into());
10671 self
10672 }
10673}
10674
10675impl wkt::message::Message for UpdateBuildTriggerRequest {
10676 fn typename() -> &'static str {
10677 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest"
10678 }
10679}
10680
10681/// Optional arguments to enable specific features of builds.
10682#[derive(Clone, Default, PartialEq)]
10683#[non_exhaustive]
10684pub struct BuildOptions {
10685 /// Requested hash for SourceProvenance.
10686 pub source_provenance_hash: std::vec::Vec<crate::model::hash::HashType>,
10687
10688 /// Requested verifiability options.
10689 pub requested_verify_option: crate::model::build_options::VerifyOption,
10690
10691 /// Compute Engine machine type on which to run the build.
10692 pub machine_type: crate::model::build_options::MachineType,
10693
10694 /// Requested disk size for the VM that runs the build. Note that this is *NOT*
10695 /// "disk free"; some of the space will be used by the operating system and
10696 /// build utilities. Also note that this is the minimum disk size that will be
10697 /// allocated for the build -- the build may run with a larger disk than
10698 /// requested. At present, the maximum disk size is 4000GB; builds that request
10699 /// more than the maximum are rejected with an error.
10700 pub disk_size_gb: i64,
10701
10702 /// Option to specify behavior when there is an error in the substitution
10703 /// checks.
10704 ///
10705 /// NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot
10706 /// be overridden in the build configuration file.
10707 pub substitution_option: crate::model::build_options::SubstitutionOption,
10708
10709 /// Option to specify whether or not to apply bash style string
10710 /// operations to the substitutions.
10711 ///
10712 /// NOTE: this is always enabled for triggered builds and cannot be
10713 /// overridden in the build configuration file.
10714 pub dynamic_substitutions: bool,
10715
10716 /// Option to include built-in and custom substitutions as env variables
10717 /// for all build steps.
10718 pub automap_substitutions: bool,
10719
10720 /// Option to define build log streaming behavior to Cloud
10721 /// Storage.
10722 pub log_streaming_option: crate::model::build_options::LogStreamingOption,
10723
10724 /// This field deprecated; please use `pool.name` instead.
10725 #[deprecated]
10726 pub worker_pool: std::string::String,
10727
10728 /// Optional. Specification for execution on a `WorkerPool`.
10729 ///
10730 /// See [running builds in a private
10731 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10732 /// for more information.
10733 pub pool: std::option::Option<crate::model::build_options::PoolOption>,
10734
10735 /// Option to specify the logging mode, which determines if and where build
10736 /// logs are stored.
10737 pub logging: crate::model::build_options::LoggingMode,
10738
10739 /// A list of global environment variable definitions that will exist for all
10740 /// build steps in this build. If a variable is defined in both globally and in
10741 /// a build step, the variable will use the build step value.
10742 ///
10743 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
10744 /// being given the value "VALUE".
10745 pub env: std::vec::Vec<std::string::String>,
10746
10747 /// A list of global environment variables, which are encrypted using a Cloud
10748 /// Key Management Service crypto key. These values must be specified in the
10749 /// build's `Secret`. These variables will be available to all build steps
10750 /// in this build.
10751 pub secret_env: std::vec::Vec<std::string::String>,
10752
10753 /// Global list of volumes to mount for ALL build steps
10754 ///
10755 /// Each volume is created as an empty volume prior to starting the build
10756 /// process. Upon completion of the build, volumes and their contents are
10757 /// discarded. Global volume names and paths cannot conflict with the volumes
10758 /// defined a build step.
10759 ///
10760 /// Using a global volume in a build with only one step is not valid as
10761 /// it is indicative of a build request with an incorrect configuration.
10762 pub volumes: std::vec::Vec<crate::model::Volume>,
10763
10764 /// Optional. Option to specify how default logs buckets are setup.
10765 pub default_logs_bucket_behavior: crate::model::build_options::DefaultLogsBucketBehavior,
10766
10767 /// Optional. Option to specify whether structured logging is enabled.
10768 ///
10769 /// If true, JSON-formatted logs are parsed as structured logs.
10770 pub enable_structured_logging: bool,
10771
10772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10773}
10774
10775impl BuildOptions {
10776 /// Creates a new default instance.
10777 pub fn new() -> Self {
10778 std::default::Default::default()
10779 }
10780
10781 /// Sets the value of [source_provenance_hash][crate::model::BuildOptions::source_provenance_hash].
10782 ///
10783 /// # Example
10784 /// ```ignore,no_run
10785 /// # use google_cloud_build_v1::model::BuildOptions;
10786 /// use google_cloud_build_v1::model::hash::HashType;
10787 /// let x = BuildOptions::new().set_source_provenance_hash([
10788 /// HashType::Sha256,
10789 /// HashType::Md5,
10790 /// HashType::GoModuleH1,
10791 /// ]);
10792 /// ```
10793 pub fn set_source_provenance_hash<T, V>(mut self, v: T) -> Self
10794 where
10795 T: std::iter::IntoIterator<Item = V>,
10796 V: std::convert::Into<crate::model::hash::HashType>,
10797 {
10798 use std::iter::Iterator;
10799 self.source_provenance_hash = v.into_iter().map(|i| i.into()).collect();
10800 self
10801 }
10802
10803 /// Sets the value of [requested_verify_option][crate::model::BuildOptions::requested_verify_option].
10804 ///
10805 /// # Example
10806 /// ```ignore,no_run
10807 /// # use google_cloud_build_v1::model::BuildOptions;
10808 /// use google_cloud_build_v1::model::build_options::VerifyOption;
10809 /// let x0 = BuildOptions::new().set_requested_verify_option(VerifyOption::Verified);
10810 /// ```
10811 pub fn set_requested_verify_option<
10812 T: std::convert::Into<crate::model::build_options::VerifyOption>,
10813 >(
10814 mut self,
10815 v: T,
10816 ) -> Self {
10817 self.requested_verify_option = v.into();
10818 self
10819 }
10820
10821 /// Sets the value of [machine_type][crate::model::BuildOptions::machine_type].
10822 ///
10823 /// # Example
10824 /// ```ignore,no_run
10825 /// # use google_cloud_build_v1::model::BuildOptions;
10826 /// use google_cloud_build_v1::model::build_options::MachineType;
10827 /// let x0 = BuildOptions::new().set_machine_type(MachineType::E2Highcpu8);
10828 /// let x1 = BuildOptions::new().set_machine_type(MachineType::E2Highcpu32);
10829 /// let x2 = BuildOptions::new().set_machine_type(MachineType::E2Medium);
10830 /// ```
10831 pub fn set_machine_type<T: std::convert::Into<crate::model::build_options::MachineType>>(
10832 mut self,
10833 v: T,
10834 ) -> Self {
10835 self.machine_type = v.into();
10836 self
10837 }
10838
10839 /// Sets the value of [disk_size_gb][crate::model::BuildOptions::disk_size_gb].
10840 ///
10841 /// # Example
10842 /// ```ignore,no_run
10843 /// # use google_cloud_build_v1::model::BuildOptions;
10844 /// let x = BuildOptions::new().set_disk_size_gb(42);
10845 /// ```
10846 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10847 self.disk_size_gb = v.into();
10848 self
10849 }
10850
10851 /// Sets the value of [substitution_option][crate::model::BuildOptions::substitution_option].
10852 ///
10853 /// # Example
10854 /// ```ignore,no_run
10855 /// # use google_cloud_build_v1::model::BuildOptions;
10856 /// use google_cloud_build_v1::model::build_options::SubstitutionOption;
10857 /// let x0 = BuildOptions::new().set_substitution_option(SubstitutionOption::AllowLoose);
10858 /// ```
10859 pub fn set_substitution_option<
10860 T: std::convert::Into<crate::model::build_options::SubstitutionOption>,
10861 >(
10862 mut self,
10863 v: T,
10864 ) -> Self {
10865 self.substitution_option = v.into();
10866 self
10867 }
10868
10869 /// Sets the value of [dynamic_substitutions][crate::model::BuildOptions::dynamic_substitutions].
10870 ///
10871 /// # Example
10872 /// ```ignore,no_run
10873 /// # use google_cloud_build_v1::model::BuildOptions;
10874 /// let x = BuildOptions::new().set_dynamic_substitutions(true);
10875 /// ```
10876 pub fn set_dynamic_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10877 self.dynamic_substitutions = v.into();
10878 self
10879 }
10880
10881 /// Sets the value of [automap_substitutions][crate::model::BuildOptions::automap_substitutions].
10882 ///
10883 /// # Example
10884 /// ```ignore,no_run
10885 /// # use google_cloud_build_v1::model::BuildOptions;
10886 /// let x = BuildOptions::new().set_automap_substitutions(true);
10887 /// ```
10888 pub fn set_automap_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10889 self.automap_substitutions = v.into();
10890 self
10891 }
10892
10893 /// Sets the value of [log_streaming_option][crate::model::BuildOptions::log_streaming_option].
10894 ///
10895 /// # Example
10896 /// ```ignore,no_run
10897 /// # use google_cloud_build_v1::model::BuildOptions;
10898 /// use google_cloud_build_v1::model::build_options::LogStreamingOption;
10899 /// let x0 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOn);
10900 /// let x1 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOff);
10901 /// ```
10902 pub fn set_log_streaming_option<
10903 T: std::convert::Into<crate::model::build_options::LogStreamingOption>,
10904 >(
10905 mut self,
10906 v: T,
10907 ) -> Self {
10908 self.log_streaming_option = v.into();
10909 self
10910 }
10911
10912 /// Sets the value of [worker_pool][crate::model::BuildOptions::worker_pool].
10913 ///
10914 /// # Example
10915 /// ```ignore,no_run
10916 /// # use google_cloud_build_v1::model::BuildOptions;
10917 /// let x = BuildOptions::new().set_worker_pool("example");
10918 /// ```
10919 #[deprecated]
10920 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10921 self.worker_pool = v.into();
10922 self
10923 }
10924
10925 /// Sets the value of [pool][crate::model::BuildOptions::pool].
10926 ///
10927 /// # Example
10928 /// ```ignore,no_run
10929 /// # use google_cloud_build_v1::model::BuildOptions;
10930 /// use google_cloud_build_v1::model::build_options::PoolOption;
10931 /// let x = BuildOptions::new().set_pool(PoolOption::default()/* use setters */);
10932 /// ```
10933 pub fn set_pool<T>(mut self, v: T) -> Self
10934 where
10935 T: std::convert::Into<crate::model::build_options::PoolOption>,
10936 {
10937 self.pool = std::option::Option::Some(v.into());
10938 self
10939 }
10940
10941 /// Sets or clears the value of [pool][crate::model::BuildOptions::pool].
10942 ///
10943 /// # Example
10944 /// ```ignore,no_run
10945 /// # use google_cloud_build_v1::model::BuildOptions;
10946 /// use google_cloud_build_v1::model::build_options::PoolOption;
10947 /// let x = BuildOptions::new().set_or_clear_pool(Some(PoolOption::default()/* use setters */));
10948 /// let x = BuildOptions::new().set_or_clear_pool(None::<PoolOption>);
10949 /// ```
10950 pub fn set_or_clear_pool<T>(mut self, v: std::option::Option<T>) -> Self
10951 where
10952 T: std::convert::Into<crate::model::build_options::PoolOption>,
10953 {
10954 self.pool = v.map(|x| x.into());
10955 self
10956 }
10957
10958 /// Sets the value of [logging][crate::model::BuildOptions::logging].
10959 ///
10960 /// # Example
10961 /// ```ignore,no_run
10962 /// # use google_cloud_build_v1::model::BuildOptions;
10963 /// use google_cloud_build_v1::model::build_options::LoggingMode;
10964 /// let x0 = BuildOptions::new().set_logging(LoggingMode::Legacy);
10965 /// let x1 = BuildOptions::new().set_logging(LoggingMode::GcsOnly);
10966 /// let x2 = BuildOptions::new().set_logging(LoggingMode::CloudLoggingOnly);
10967 /// ```
10968 pub fn set_logging<T: std::convert::Into<crate::model::build_options::LoggingMode>>(
10969 mut self,
10970 v: T,
10971 ) -> Self {
10972 self.logging = v.into();
10973 self
10974 }
10975
10976 /// Sets the value of [env][crate::model::BuildOptions::env].
10977 ///
10978 /// # Example
10979 /// ```ignore,no_run
10980 /// # use google_cloud_build_v1::model::BuildOptions;
10981 /// let x = BuildOptions::new().set_env(["a", "b", "c"]);
10982 /// ```
10983 pub fn set_env<T, V>(mut self, v: T) -> Self
10984 where
10985 T: std::iter::IntoIterator<Item = V>,
10986 V: std::convert::Into<std::string::String>,
10987 {
10988 use std::iter::Iterator;
10989 self.env = v.into_iter().map(|i| i.into()).collect();
10990 self
10991 }
10992
10993 /// Sets the value of [secret_env][crate::model::BuildOptions::secret_env].
10994 ///
10995 /// # Example
10996 /// ```ignore,no_run
10997 /// # use google_cloud_build_v1::model::BuildOptions;
10998 /// let x = BuildOptions::new().set_secret_env(["a", "b", "c"]);
10999 /// ```
11000 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
11001 where
11002 T: std::iter::IntoIterator<Item = V>,
11003 V: std::convert::Into<std::string::String>,
11004 {
11005 use std::iter::Iterator;
11006 self.secret_env = v.into_iter().map(|i| i.into()).collect();
11007 self
11008 }
11009
11010 /// Sets the value of [volumes][crate::model::BuildOptions::volumes].
11011 ///
11012 /// # Example
11013 /// ```ignore,no_run
11014 /// # use google_cloud_build_v1::model::BuildOptions;
11015 /// use google_cloud_build_v1::model::Volume;
11016 /// let x = BuildOptions::new()
11017 /// .set_volumes([
11018 /// Volume::default()/* use setters */,
11019 /// Volume::default()/* use (different) setters */,
11020 /// ]);
11021 /// ```
11022 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11023 where
11024 T: std::iter::IntoIterator<Item = V>,
11025 V: std::convert::Into<crate::model::Volume>,
11026 {
11027 use std::iter::Iterator;
11028 self.volumes = v.into_iter().map(|i| i.into()).collect();
11029 self
11030 }
11031
11032 /// Sets the value of [default_logs_bucket_behavior][crate::model::BuildOptions::default_logs_bucket_behavior].
11033 ///
11034 /// # Example
11035 /// ```ignore,no_run
11036 /// # use google_cloud_build_v1::model::BuildOptions;
11037 /// use google_cloud_build_v1::model::build_options::DefaultLogsBucketBehavior;
11038 /// let x0 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::RegionalUserOwnedBucket);
11039 /// let x1 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::LegacyBucket);
11040 /// ```
11041 pub fn set_default_logs_bucket_behavior<
11042 T: std::convert::Into<crate::model::build_options::DefaultLogsBucketBehavior>,
11043 >(
11044 mut self,
11045 v: T,
11046 ) -> Self {
11047 self.default_logs_bucket_behavior = v.into();
11048 self
11049 }
11050
11051 /// Sets the value of [enable_structured_logging][crate::model::BuildOptions::enable_structured_logging].
11052 ///
11053 /// # Example
11054 /// ```ignore,no_run
11055 /// # use google_cloud_build_v1::model::BuildOptions;
11056 /// let x = BuildOptions::new().set_enable_structured_logging(true);
11057 /// ```
11058 pub fn set_enable_structured_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11059 self.enable_structured_logging = v.into();
11060 self
11061 }
11062}
11063
11064impl wkt::message::Message for BuildOptions {
11065 fn typename() -> &'static str {
11066 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions"
11067 }
11068}
11069
11070/// Defines additional types related to [BuildOptions].
11071pub mod build_options {
11072 #[allow(unused_imports)]
11073 use super::*;
11074
11075 /// Details about how a build should be executed on a `WorkerPool`.
11076 ///
11077 /// See [running builds in a private
11078 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
11079 /// for more information.
11080 #[derive(Clone, Default, PartialEq)]
11081 #[non_exhaustive]
11082 pub struct PoolOption {
11083 /// The `WorkerPool` resource to execute the build on.
11084 /// You must have `cloudbuild.workerpools.use` on the project hosting the
11085 /// WorkerPool.
11086 ///
11087 /// Format projects/{project}/locations/{location}/workerPools/{workerPoolId}
11088 pub name: std::string::String,
11089
11090 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11091 }
11092
11093 impl PoolOption {
11094 /// Creates a new default instance.
11095 pub fn new() -> Self {
11096 std::default::Default::default()
11097 }
11098
11099 /// Sets the value of [name][crate::model::build_options::PoolOption::name].
11100 ///
11101 /// # Example
11102 /// ```ignore,no_run
11103 /// # use google_cloud_build_v1::model::build_options::PoolOption;
11104 /// # let project_id = "project_id";
11105 /// # let location_id = "location_id";
11106 /// # let worker_pool_id = "worker_pool_id";
11107 /// let x = PoolOption::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
11108 /// ```
11109 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11110 self.name = v.into();
11111 self
11112 }
11113 }
11114
11115 impl wkt::message::Message for PoolOption {
11116 fn typename() -> &'static str {
11117 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions.PoolOption"
11118 }
11119 }
11120
11121 /// Specifies the manner in which the build should be verified, if at all.
11122 ///
11123 /// If a verified build is requested, and any part of the process to generate
11124 /// and upload provenance fails, the build will also fail.
11125 ///
11126 /// If the build does not request verification then that process may occur, but
11127 /// is not guaranteed to. If it does occur and fails, the build will not fail.
11128 ///
11129 /// For more information, see [Viewing Build
11130 /// Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance).
11131 ///
11132 /// # Working with unknown values
11133 ///
11134 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11135 /// additional enum variants at any time. Adding new variants is not considered
11136 /// a breaking change. Applications should write their code in anticipation of:
11137 ///
11138 /// - New values appearing in future releases of the client library, **and**
11139 /// - New values received dynamically, without application changes.
11140 ///
11141 /// Please consult the [Working with enums] section in the user guide for some
11142 /// guidelines.
11143 ///
11144 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11145 #[derive(Clone, Debug, PartialEq)]
11146 #[non_exhaustive]
11147 pub enum VerifyOption {
11148 /// Not a verifiable build (the default).
11149 NotVerified,
11150 /// Build must be verified.
11151 Verified,
11152 /// If set, the enum was initialized with an unknown value.
11153 ///
11154 /// Applications can examine the value using [VerifyOption::value] or
11155 /// [VerifyOption::name].
11156 UnknownValue(verify_option::UnknownValue),
11157 }
11158
11159 #[doc(hidden)]
11160 pub mod verify_option {
11161 #[allow(unused_imports)]
11162 use super::*;
11163 #[derive(Clone, Debug, PartialEq)]
11164 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11165 }
11166
11167 impl VerifyOption {
11168 /// Gets the enum value.
11169 ///
11170 /// Returns `None` if the enum contains an unknown value deserialized from
11171 /// the string representation of enums.
11172 pub fn value(&self) -> std::option::Option<i32> {
11173 match self {
11174 Self::NotVerified => std::option::Option::Some(0),
11175 Self::Verified => std::option::Option::Some(1),
11176 Self::UnknownValue(u) => u.0.value(),
11177 }
11178 }
11179
11180 /// Gets the enum value as a string.
11181 ///
11182 /// Returns `None` if the enum contains an unknown value deserialized from
11183 /// the integer representation of enums.
11184 pub fn name(&self) -> std::option::Option<&str> {
11185 match self {
11186 Self::NotVerified => std::option::Option::Some("NOT_VERIFIED"),
11187 Self::Verified => std::option::Option::Some("VERIFIED"),
11188 Self::UnknownValue(u) => u.0.name(),
11189 }
11190 }
11191 }
11192
11193 impl std::default::Default for VerifyOption {
11194 fn default() -> Self {
11195 use std::convert::From;
11196 Self::from(0)
11197 }
11198 }
11199
11200 impl std::fmt::Display for VerifyOption {
11201 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11202 wkt::internal::display_enum(f, self.name(), self.value())
11203 }
11204 }
11205
11206 impl std::convert::From<i32> for VerifyOption {
11207 fn from(value: i32) -> Self {
11208 match value {
11209 0 => Self::NotVerified,
11210 1 => Self::Verified,
11211 _ => Self::UnknownValue(verify_option::UnknownValue(
11212 wkt::internal::UnknownEnumValue::Integer(value),
11213 )),
11214 }
11215 }
11216 }
11217
11218 impl std::convert::From<&str> for VerifyOption {
11219 fn from(value: &str) -> Self {
11220 use std::string::ToString;
11221 match value {
11222 "NOT_VERIFIED" => Self::NotVerified,
11223 "VERIFIED" => Self::Verified,
11224 _ => Self::UnknownValue(verify_option::UnknownValue(
11225 wkt::internal::UnknownEnumValue::String(value.to_string()),
11226 )),
11227 }
11228 }
11229 }
11230
11231 impl serde::ser::Serialize for VerifyOption {
11232 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11233 where
11234 S: serde::Serializer,
11235 {
11236 match self {
11237 Self::NotVerified => serializer.serialize_i32(0),
11238 Self::Verified => serializer.serialize_i32(1),
11239 Self::UnknownValue(u) => u.0.serialize(serializer),
11240 }
11241 }
11242 }
11243
11244 impl<'de> serde::de::Deserialize<'de> for VerifyOption {
11245 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11246 where
11247 D: serde::Deserializer<'de>,
11248 {
11249 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerifyOption>::new(
11250 ".google.devtools.cloudbuild.v1.BuildOptions.VerifyOption",
11251 ))
11252 }
11253 }
11254
11255 /// Supported Compute Engine machine types.
11256 /// For more information, see [Machine
11257 /// types](https://cloud.google.com/compute/docs/machine-types).
11258 ///
11259 /// # Working with unknown values
11260 ///
11261 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11262 /// additional enum variants at any time. Adding new variants is not considered
11263 /// a breaking change. Applications should write their code in anticipation of:
11264 ///
11265 /// - New values appearing in future releases of the client library, **and**
11266 /// - New values received dynamically, without application changes.
11267 ///
11268 /// Please consult the [Working with enums] section in the user guide for some
11269 /// guidelines.
11270 ///
11271 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11272 #[derive(Clone, Debug, PartialEq)]
11273 #[non_exhaustive]
11274 pub enum MachineType {
11275 /// Standard machine type.
11276 Unspecified,
11277 /// Highcpu machine with 8 CPUs.
11278 #[deprecated]
11279 N1Highcpu8,
11280 /// Highcpu machine with 32 CPUs.
11281 #[deprecated]
11282 N1Highcpu32,
11283 /// Highcpu e2 machine with 8 CPUs.
11284 E2Highcpu8,
11285 /// Highcpu e2 machine with 32 CPUs.
11286 E2Highcpu32,
11287 /// E2 machine with 1 CPU.
11288 E2Medium,
11289 /// E2 machine with 2 CPUs.
11290 E2Standard2,
11291 /// If set, the enum was initialized with an unknown value.
11292 ///
11293 /// Applications can examine the value using [MachineType::value] or
11294 /// [MachineType::name].
11295 UnknownValue(machine_type::UnknownValue),
11296 }
11297
11298 #[doc(hidden)]
11299 pub mod machine_type {
11300 #[allow(unused_imports)]
11301 use super::*;
11302 #[derive(Clone, Debug, PartialEq)]
11303 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11304 }
11305
11306 impl MachineType {
11307 /// Gets the enum value.
11308 ///
11309 /// Returns `None` if the enum contains an unknown value deserialized from
11310 /// the string representation of enums.
11311 pub fn value(&self) -> std::option::Option<i32> {
11312 match self {
11313 Self::Unspecified => std::option::Option::Some(0),
11314 Self::N1Highcpu8 => std::option::Option::Some(1),
11315 Self::N1Highcpu32 => std::option::Option::Some(2),
11316 Self::E2Highcpu8 => std::option::Option::Some(5),
11317 Self::E2Highcpu32 => std::option::Option::Some(6),
11318 Self::E2Medium => std::option::Option::Some(7),
11319 Self::E2Standard2 => std::option::Option::Some(11),
11320 Self::UnknownValue(u) => u.0.value(),
11321 }
11322 }
11323
11324 /// Gets the enum value as a string.
11325 ///
11326 /// Returns `None` if the enum contains an unknown value deserialized from
11327 /// the integer representation of enums.
11328 pub fn name(&self) -> std::option::Option<&str> {
11329 match self {
11330 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
11331 Self::N1Highcpu8 => std::option::Option::Some("N1_HIGHCPU_8"),
11332 Self::N1Highcpu32 => std::option::Option::Some("N1_HIGHCPU_32"),
11333 Self::E2Highcpu8 => std::option::Option::Some("E2_HIGHCPU_8"),
11334 Self::E2Highcpu32 => std::option::Option::Some("E2_HIGHCPU_32"),
11335 Self::E2Medium => std::option::Option::Some("E2_MEDIUM"),
11336 Self::E2Standard2 => std::option::Option::Some("E2_STANDARD_2"),
11337 Self::UnknownValue(u) => u.0.name(),
11338 }
11339 }
11340 }
11341
11342 impl std::default::Default for MachineType {
11343 fn default() -> Self {
11344 use std::convert::From;
11345 Self::from(0)
11346 }
11347 }
11348
11349 impl std::fmt::Display for MachineType {
11350 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11351 wkt::internal::display_enum(f, self.name(), self.value())
11352 }
11353 }
11354
11355 impl std::convert::From<i32> for MachineType {
11356 fn from(value: i32) -> Self {
11357 match value {
11358 0 => Self::Unspecified,
11359 1 => Self::N1Highcpu8,
11360 2 => Self::N1Highcpu32,
11361 5 => Self::E2Highcpu8,
11362 6 => Self::E2Highcpu32,
11363 7 => Self::E2Medium,
11364 11 => Self::E2Standard2,
11365 _ => Self::UnknownValue(machine_type::UnknownValue(
11366 wkt::internal::UnknownEnumValue::Integer(value),
11367 )),
11368 }
11369 }
11370 }
11371
11372 impl std::convert::From<&str> for MachineType {
11373 fn from(value: &str) -> Self {
11374 use std::string::ToString;
11375 match value {
11376 "UNSPECIFIED" => Self::Unspecified,
11377 "N1_HIGHCPU_8" => Self::N1Highcpu8,
11378 "N1_HIGHCPU_32" => Self::N1Highcpu32,
11379 "E2_HIGHCPU_8" => Self::E2Highcpu8,
11380 "E2_HIGHCPU_32" => Self::E2Highcpu32,
11381 "E2_MEDIUM" => Self::E2Medium,
11382 "E2_STANDARD_2" => Self::E2Standard2,
11383 _ => Self::UnknownValue(machine_type::UnknownValue(
11384 wkt::internal::UnknownEnumValue::String(value.to_string()),
11385 )),
11386 }
11387 }
11388 }
11389
11390 impl serde::ser::Serialize for MachineType {
11391 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11392 where
11393 S: serde::Serializer,
11394 {
11395 match self {
11396 Self::Unspecified => serializer.serialize_i32(0),
11397 Self::N1Highcpu8 => serializer.serialize_i32(1),
11398 Self::N1Highcpu32 => serializer.serialize_i32(2),
11399 Self::E2Highcpu8 => serializer.serialize_i32(5),
11400 Self::E2Highcpu32 => serializer.serialize_i32(6),
11401 Self::E2Medium => serializer.serialize_i32(7),
11402 Self::E2Standard2 => serializer.serialize_i32(11),
11403 Self::UnknownValue(u) => u.0.serialize(serializer),
11404 }
11405 }
11406 }
11407
11408 impl<'de> serde::de::Deserialize<'de> for MachineType {
11409 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11410 where
11411 D: serde::Deserializer<'de>,
11412 {
11413 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MachineType>::new(
11414 ".google.devtools.cloudbuild.v1.BuildOptions.MachineType",
11415 ))
11416 }
11417 }
11418
11419 /// Specifies the behavior when there is an error in the substitution checks.
11420 ///
11421 /// # Working with unknown values
11422 ///
11423 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11424 /// additional enum variants at any time. Adding new variants is not considered
11425 /// a breaking change. Applications should write their code in anticipation of:
11426 ///
11427 /// - New values appearing in future releases of the client library, **and**
11428 /// - New values received dynamically, without application changes.
11429 ///
11430 /// Please consult the [Working with enums] section in the user guide for some
11431 /// guidelines.
11432 ///
11433 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11434 #[derive(Clone, Debug, PartialEq)]
11435 #[non_exhaustive]
11436 pub enum SubstitutionOption {
11437 /// Fails the build if error in substitutions checks, like missing
11438 /// a substitution in the template or in the map.
11439 MustMatch,
11440 /// Do not fail the build if error in substitutions checks.
11441 AllowLoose,
11442 /// If set, the enum was initialized with an unknown value.
11443 ///
11444 /// Applications can examine the value using [SubstitutionOption::value] or
11445 /// [SubstitutionOption::name].
11446 UnknownValue(substitution_option::UnknownValue),
11447 }
11448
11449 #[doc(hidden)]
11450 pub mod substitution_option {
11451 #[allow(unused_imports)]
11452 use super::*;
11453 #[derive(Clone, Debug, PartialEq)]
11454 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11455 }
11456
11457 impl SubstitutionOption {
11458 /// Gets the enum value.
11459 ///
11460 /// Returns `None` if the enum contains an unknown value deserialized from
11461 /// the string representation of enums.
11462 pub fn value(&self) -> std::option::Option<i32> {
11463 match self {
11464 Self::MustMatch => std::option::Option::Some(0),
11465 Self::AllowLoose => std::option::Option::Some(1),
11466 Self::UnknownValue(u) => u.0.value(),
11467 }
11468 }
11469
11470 /// Gets the enum value as a string.
11471 ///
11472 /// Returns `None` if the enum contains an unknown value deserialized from
11473 /// the integer representation of enums.
11474 pub fn name(&self) -> std::option::Option<&str> {
11475 match self {
11476 Self::MustMatch => std::option::Option::Some("MUST_MATCH"),
11477 Self::AllowLoose => std::option::Option::Some("ALLOW_LOOSE"),
11478 Self::UnknownValue(u) => u.0.name(),
11479 }
11480 }
11481 }
11482
11483 impl std::default::Default for SubstitutionOption {
11484 fn default() -> Self {
11485 use std::convert::From;
11486 Self::from(0)
11487 }
11488 }
11489
11490 impl std::fmt::Display for SubstitutionOption {
11491 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11492 wkt::internal::display_enum(f, self.name(), self.value())
11493 }
11494 }
11495
11496 impl std::convert::From<i32> for SubstitutionOption {
11497 fn from(value: i32) -> Self {
11498 match value {
11499 0 => Self::MustMatch,
11500 1 => Self::AllowLoose,
11501 _ => Self::UnknownValue(substitution_option::UnknownValue(
11502 wkt::internal::UnknownEnumValue::Integer(value),
11503 )),
11504 }
11505 }
11506 }
11507
11508 impl std::convert::From<&str> for SubstitutionOption {
11509 fn from(value: &str) -> Self {
11510 use std::string::ToString;
11511 match value {
11512 "MUST_MATCH" => Self::MustMatch,
11513 "ALLOW_LOOSE" => Self::AllowLoose,
11514 _ => Self::UnknownValue(substitution_option::UnknownValue(
11515 wkt::internal::UnknownEnumValue::String(value.to_string()),
11516 )),
11517 }
11518 }
11519 }
11520
11521 impl serde::ser::Serialize for SubstitutionOption {
11522 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11523 where
11524 S: serde::Serializer,
11525 {
11526 match self {
11527 Self::MustMatch => serializer.serialize_i32(0),
11528 Self::AllowLoose => serializer.serialize_i32(1),
11529 Self::UnknownValue(u) => u.0.serialize(serializer),
11530 }
11531 }
11532 }
11533
11534 impl<'de> serde::de::Deserialize<'de> for SubstitutionOption {
11535 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11536 where
11537 D: serde::Deserializer<'de>,
11538 {
11539 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SubstitutionOption>::new(
11540 ".google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption",
11541 ))
11542 }
11543 }
11544
11545 /// Specifies the behavior when writing build logs to Cloud Storage.
11546 ///
11547 /// # Working with unknown values
11548 ///
11549 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11550 /// additional enum variants at any time. Adding new variants is not considered
11551 /// a breaking change. Applications should write their code in anticipation of:
11552 ///
11553 /// - New values appearing in future releases of the client library, **and**
11554 /// - New values received dynamically, without application changes.
11555 ///
11556 /// Please consult the [Working with enums] section in the user guide for some
11557 /// guidelines.
11558 ///
11559 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11560 #[derive(Clone, Debug, PartialEq)]
11561 #[non_exhaustive]
11562 pub enum LogStreamingOption {
11563 /// Service may automatically determine build log streaming behavior.
11564 StreamDefault,
11565 /// Build logs should be streamed to Cloud Storage.
11566 StreamOn,
11567 /// Build logs should not be streamed to Cloud Storage; they will be
11568 /// written when the build is completed.
11569 StreamOff,
11570 /// If set, the enum was initialized with an unknown value.
11571 ///
11572 /// Applications can examine the value using [LogStreamingOption::value] or
11573 /// [LogStreamingOption::name].
11574 UnknownValue(log_streaming_option::UnknownValue),
11575 }
11576
11577 #[doc(hidden)]
11578 pub mod log_streaming_option {
11579 #[allow(unused_imports)]
11580 use super::*;
11581 #[derive(Clone, Debug, PartialEq)]
11582 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11583 }
11584
11585 impl LogStreamingOption {
11586 /// Gets the enum value.
11587 ///
11588 /// Returns `None` if the enum contains an unknown value deserialized from
11589 /// the string representation of enums.
11590 pub fn value(&self) -> std::option::Option<i32> {
11591 match self {
11592 Self::StreamDefault => std::option::Option::Some(0),
11593 Self::StreamOn => std::option::Option::Some(1),
11594 Self::StreamOff => std::option::Option::Some(2),
11595 Self::UnknownValue(u) => u.0.value(),
11596 }
11597 }
11598
11599 /// Gets the enum value as a string.
11600 ///
11601 /// Returns `None` if the enum contains an unknown value deserialized from
11602 /// the integer representation of enums.
11603 pub fn name(&self) -> std::option::Option<&str> {
11604 match self {
11605 Self::StreamDefault => std::option::Option::Some("STREAM_DEFAULT"),
11606 Self::StreamOn => std::option::Option::Some("STREAM_ON"),
11607 Self::StreamOff => std::option::Option::Some("STREAM_OFF"),
11608 Self::UnknownValue(u) => u.0.name(),
11609 }
11610 }
11611 }
11612
11613 impl std::default::Default for LogStreamingOption {
11614 fn default() -> Self {
11615 use std::convert::From;
11616 Self::from(0)
11617 }
11618 }
11619
11620 impl std::fmt::Display for LogStreamingOption {
11621 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11622 wkt::internal::display_enum(f, self.name(), self.value())
11623 }
11624 }
11625
11626 impl std::convert::From<i32> for LogStreamingOption {
11627 fn from(value: i32) -> Self {
11628 match value {
11629 0 => Self::StreamDefault,
11630 1 => Self::StreamOn,
11631 2 => Self::StreamOff,
11632 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11633 wkt::internal::UnknownEnumValue::Integer(value),
11634 )),
11635 }
11636 }
11637 }
11638
11639 impl std::convert::From<&str> for LogStreamingOption {
11640 fn from(value: &str) -> Self {
11641 use std::string::ToString;
11642 match value {
11643 "STREAM_DEFAULT" => Self::StreamDefault,
11644 "STREAM_ON" => Self::StreamOn,
11645 "STREAM_OFF" => Self::StreamOff,
11646 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11647 wkt::internal::UnknownEnumValue::String(value.to_string()),
11648 )),
11649 }
11650 }
11651 }
11652
11653 impl serde::ser::Serialize for LogStreamingOption {
11654 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11655 where
11656 S: serde::Serializer,
11657 {
11658 match self {
11659 Self::StreamDefault => serializer.serialize_i32(0),
11660 Self::StreamOn => serializer.serialize_i32(1),
11661 Self::StreamOff => serializer.serialize_i32(2),
11662 Self::UnknownValue(u) => u.0.serialize(serializer),
11663 }
11664 }
11665 }
11666
11667 impl<'de> serde::de::Deserialize<'de> for LogStreamingOption {
11668 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11669 where
11670 D: serde::Deserializer<'de>,
11671 {
11672 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogStreamingOption>::new(
11673 ".google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption",
11674 ))
11675 }
11676 }
11677
11678 /// Specifies the logging mode.
11679 ///
11680 /// # Working with unknown values
11681 ///
11682 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11683 /// additional enum variants at any time. Adding new variants is not considered
11684 /// a breaking change. Applications should write their code in anticipation of:
11685 ///
11686 /// - New values appearing in future releases of the client library, **and**
11687 /// - New values received dynamically, without application changes.
11688 ///
11689 /// Please consult the [Working with enums] section in the user guide for some
11690 /// guidelines.
11691 ///
11692 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11693 #[derive(Clone, Debug, PartialEq)]
11694 #[non_exhaustive]
11695 pub enum LoggingMode {
11696 /// The service determines the logging mode. The default is `LEGACY`. Do not
11697 /// rely on the default logging behavior as it may change in the future.
11698 LoggingUnspecified,
11699 /// Build logs are stored in Cloud Logging and Cloud Storage.
11700 Legacy,
11701 /// Build logs are stored in Cloud Storage.
11702 GcsOnly,
11703 /// This option is the same as CLOUD_LOGGING_ONLY.
11704 #[deprecated]
11705 StackdriverOnly,
11706 /// Build logs are stored in Cloud Logging. Selecting this option will not
11707 /// allow [logs
11708 /// streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log).
11709 CloudLoggingOnly,
11710 /// Turn off all logging. No build logs will be captured.
11711 None,
11712 /// If set, the enum was initialized with an unknown value.
11713 ///
11714 /// Applications can examine the value using [LoggingMode::value] or
11715 /// [LoggingMode::name].
11716 UnknownValue(logging_mode::UnknownValue),
11717 }
11718
11719 #[doc(hidden)]
11720 pub mod logging_mode {
11721 #[allow(unused_imports)]
11722 use super::*;
11723 #[derive(Clone, Debug, PartialEq)]
11724 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11725 }
11726
11727 impl LoggingMode {
11728 /// Gets the enum value.
11729 ///
11730 /// Returns `None` if the enum contains an unknown value deserialized from
11731 /// the string representation of enums.
11732 pub fn value(&self) -> std::option::Option<i32> {
11733 match self {
11734 Self::LoggingUnspecified => std::option::Option::Some(0),
11735 Self::Legacy => std::option::Option::Some(1),
11736 Self::GcsOnly => std::option::Option::Some(2),
11737 Self::StackdriverOnly => std::option::Option::Some(3),
11738 Self::CloudLoggingOnly => std::option::Option::Some(5),
11739 Self::None => std::option::Option::Some(4),
11740 Self::UnknownValue(u) => u.0.value(),
11741 }
11742 }
11743
11744 /// Gets the enum value as a string.
11745 ///
11746 /// Returns `None` if the enum contains an unknown value deserialized from
11747 /// the integer representation of enums.
11748 pub fn name(&self) -> std::option::Option<&str> {
11749 match self {
11750 Self::LoggingUnspecified => std::option::Option::Some("LOGGING_UNSPECIFIED"),
11751 Self::Legacy => std::option::Option::Some("LEGACY"),
11752 Self::GcsOnly => std::option::Option::Some("GCS_ONLY"),
11753 Self::StackdriverOnly => std::option::Option::Some("STACKDRIVER_ONLY"),
11754 Self::CloudLoggingOnly => std::option::Option::Some("CLOUD_LOGGING_ONLY"),
11755 Self::None => std::option::Option::Some("NONE"),
11756 Self::UnknownValue(u) => u.0.name(),
11757 }
11758 }
11759 }
11760
11761 impl std::default::Default for LoggingMode {
11762 fn default() -> Self {
11763 use std::convert::From;
11764 Self::from(0)
11765 }
11766 }
11767
11768 impl std::fmt::Display for LoggingMode {
11769 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11770 wkt::internal::display_enum(f, self.name(), self.value())
11771 }
11772 }
11773
11774 impl std::convert::From<i32> for LoggingMode {
11775 fn from(value: i32) -> Self {
11776 match value {
11777 0 => Self::LoggingUnspecified,
11778 1 => Self::Legacy,
11779 2 => Self::GcsOnly,
11780 3 => Self::StackdriverOnly,
11781 4 => Self::None,
11782 5 => Self::CloudLoggingOnly,
11783 _ => Self::UnknownValue(logging_mode::UnknownValue(
11784 wkt::internal::UnknownEnumValue::Integer(value),
11785 )),
11786 }
11787 }
11788 }
11789
11790 impl std::convert::From<&str> for LoggingMode {
11791 fn from(value: &str) -> Self {
11792 use std::string::ToString;
11793 match value {
11794 "LOGGING_UNSPECIFIED" => Self::LoggingUnspecified,
11795 "LEGACY" => Self::Legacy,
11796 "GCS_ONLY" => Self::GcsOnly,
11797 "STACKDRIVER_ONLY" => Self::StackdriverOnly,
11798 "CLOUD_LOGGING_ONLY" => Self::CloudLoggingOnly,
11799 "NONE" => Self::None,
11800 _ => Self::UnknownValue(logging_mode::UnknownValue(
11801 wkt::internal::UnknownEnumValue::String(value.to_string()),
11802 )),
11803 }
11804 }
11805 }
11806
11807 impl serde::ser::Serialize for LoggingMode {
11808 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11809 where
11810 S: serde::Serializer,
11811 {
11812 match self {
11813 Self::LoggingUnspecified => serializer.serialize_i32(0),
11814 Self::Legacy => serializer.serialize_i32(1),
11815 Self::GcsOnly => serializer.serialize_i32(2),
11816 Self::StackdriverOnly => serializer.serialize_i32(3),
11817 Self::CloudLoggingOnly => serializer.serialize_i32(5),
11818 Self::None => serializer.serialize_i32(4),
11819 Self::UnknownValue(u) => u.0.serialize(serializer),
11820 }
11821 }
11822 }
11823
11824 impl<'de> serde::de::Deserialize<'de> for LoggingMode {
11825 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11826 where
11827 D: serde::Deserializer<'de>,
11828 {
11829 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggingMode>::new(
11830 ".google.devtools.cloudbuild.v1.BuildOptions.LoggingMode",
11831 ))
11832 }
11833 }
11834
11835 /// Default Cloud Storage log bucket behavior options.
11836 ///
11837 /// # Working with unknown values
11838 ///
11839 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11840 /// additional enum variants at any time. Adding new variants is not considered
11841 /// a breaking change. Applications should write their code in anticipation of:
11842 ///
11843 /// - New values appearing in future releases of the client library, **and**
11844 /// - New values received dynamically, without application changes.
11845 ///
11846 /// Please consult the [Working with enums] section in the user guide for some
11847 /// guidelines.
11848 ///
11849 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11850 #[derive(Clone, Debug, PartialEq)]
11851 #[non_exhaustive]
11852 pub enum DefaultLogsBucketBehavior {
11853 /// Unspecified.
11854 Unspecified,
11855 /// Bucket is located in user-owned project in the same region as the
11856 /// build. The builder service account must have access to create and write
11857 /// to Cloud Storage buckets in the build project.
11858 RegionalUserOwnedBucket,
11859 /// Bucket is located in a Google-owned project and is not regionalized.
11860 LegacyBucket,
11861 /// If set, the enum was initialized with an unknown value.
11862 ///
11863 /// Applications can examine the value using [DefaultLogsBucketBehavior::value] or
11864 /// [DefaultLogsBucketBehavior::name].
11865 UnknownValue(default_logs_bucket_behavior::UnknownValue),
11866 }
11867
11868 #[doc(hidden)]
11869 pub mod default_logs_bucket_behavior {
11870 #[allow(unused_imports)]
11871 use super::*;
11872 #[derive(Clone, Debug, PartialEq)]
11873 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11874 }
11875
11876 impl DefaultLogsBucketBehavior {
11877 /// Gets the enum value.
11878 ///
11879 /// Returns `None` if the enum contains an unknown value deserialized from
11880 /// the string representation of enums.
11881 pub fn value(&self) -> std::option::Option<i32> {
11882 match self {
11883 Self::Unspecified => std::option::Option::Some(0),
11884 Self::RegionalUserOwnedBucket => std::option::Option::Some(1),
11885 Self::LegacyBucket => std::option::Option::Some(2),
11886 Self::UnknownValue(u) => u.0.value(),
11887 }
11888 }
11889
11890 /// Gets the enum value as a string.
11891 ///
11892 /// Returns `None` if the enum contains an unknown value deserialized from
11893 /// the integer representation of enums.
11894 pub fn name(&self) -> std::option::Option<&str> {
11895 match self {
11896 Self::Unspecified => {
11897 std::option::Option::Some("DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED")
11898 }
11899 Self::RegionalUserOwnedBucket => {
11900 std::option::Option::Some("REGIONAL_USER_OWNED_BUCKET")
11901 }
11902 Self::LegacyBucket => std::option::Option::Some("LEGACY_BUCKET"),
11903 Self::UnknownValue(u) => u.0.name(),
11904 }
11905 }
11906 }
11907
11908 impl std::default::Default for DefaultLogsBucketBehavior {
11909 fn default() -> Self {
11910 use std::convert::From;
11911 Self::from(0)
11912 }
11913 }
11914
11915 impl std::fmt::Display for DefaultLogsBucketBehavior {
11916 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11917 wkt::internal::display_enum(f, self.name(), self.value())
11918 }
11919 }
11920
11921 impl std::convert::From<i32> for DefaultLogsBucketBehavior {
11922 fn from(value: i32) -> Self {
11923 match value {
11924 0 => Self::Unspecified,
11925 1 => Self::RegionalUserOwnedBucket,
11926 2 => Self::LegacyBucket,
11927 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11928 wkt::internal::UnknownEnumValue::Integer(value),
11929 )),
11930 }
11931 }
11932 }
11933
11934 impl std::convert::From<&str> for DefaultLogsBucketBehavior {
11935 fn from(value: &str) -> Self {
11936 use std::string::ToString;
11937 match value {
11938 "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11939 "REGIONAL_USER_OWNED_BUCKET" => Self::RegionalUserOwnedBucket,
11940 "LEGACY_BUCKET" => Self::LegacyBucket,
11941 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11942 wkt::internal::UnknownEnumValue::String(value.to_string()),
11943 )),
11944 }
11945 }
11946 }
11947
11948 impl serde::ser::Serialize for DefaultLogsBucketBehavior {
11949 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11950 where
11951 S: serde::Serializer,
11952 {
11953 match self {
11954 Self::Unspecified => serializer.serialize_i32(0),
11955 Self::RegionalUserOwnedBucket => serializer.serialize_i32(1),
11956 Self::LegacyBucket => serializer.serialize_i32(2),
11957 Self::UnknownValue(u) => u.0.serialize(serializer),
11958 }
11959 }
11960 }
11961
11962 impl<'de> serde::de::Deserialize<'de> for DefaultLogsBucketBehavior {
11963 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11964 where
11965 D: serde::Deserializer<'de>,
11966 {
11967 deserializer.deserialize_any(
11968 wkt::internal::EnumVisitor::<DefaultLogsBucketBehavior>::new(
11969 ".google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior",
11970 ),
11971 )
11972 }
11973 }
11974}
11975
11976/// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by
11977/// the ReceiveTriggerWebhook method.
11978#[derive(Clone, Default, PartialEq)]
11979#[non_exhaustive]
11980pub struct ReceiveTriggerWebhookRequest {
11981 /// The name of the `ReceiveTriggerWebhook` to retrieve.
11982 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
11983 pub name: std::string::String,
11984
11985 /// HTTP request body.
11986 pub body: std::option::Option<google_cloud_api::model::HttpBody>,
11987
11988 /// Project in which the specified trigger lives
11989 pub project_id: std::string::String,
11990
11991 /// Name of the trigger to run the payload against
11992 pub trigger: std::string::String,
11993
11994 /// Secret token used for authorization if an OAuth token isn't provided.
11995 pub secret: std::string::String,
11996
11997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11998}
11999
12000impl ReceiveTriggerWebhookRequest {
12001 /// Creates a new default instance.
12002 pub fn new() -> Self {
12003 std::default::Default::default()
12004 }
12005
12006 /// Sets the value of [name][crate::model::ReceiveTriggerWebhookRequest::name].
12007 ///
12008 /// # Example
12009 /// ```ignore,no_run
12010 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12011 /// let x = ReceiveTriggerWebhookRequest::new().set_name("example");
12012 /// ```
12013 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12014 self.name = v.into();
12015 self
12016 }
12017
12018 /// Sets the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
12019 ///
12020 /// # Example
12021 /// ```ignore,no_run
12022 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12023 /// use google_cloud_api::model::HttpBody;
12024 /// let x = ReceiveTriggerWebhookRequest::new().set_body(HttpBody::default()/* use setters */);
12025 /// ```
12026 pub fn set_body<T>(mut self, v: T) -> Self
12027 where
12028 T: std::convert::Into<google_cloud_api::model::HttpBody>,
12029 {
12030 self.body = std::option::Option::Some(v.into());
12031 self
12032 }
12033
12034 /// Sets or clears the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
12035 ///
12036 /// # Example
12037 /// ```ignore,no_run
12038 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12039 /// use google_cloud_api::model::HttpBody;
12040 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(Some(HttpBody::default()/* use setters */));
12041 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(None::<HttpBody>);
12042 /// ```
12043 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
12044 where
12045 T: std::convert::Into<google_cloud_api::model::HttpBody>,
12046 {
12047 self.body = v.map(|x| x.into());
12048 self
12049 }
12050
12051 /// Sets the value of [project_id][crate::model::ReceiveTriggerWebhookRequest::project_id].
12052 ///
12053 /// # Example
12054 /// ```ignore,no_run
12055 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12056 /// let x = ReceiveTriggerWebhookRequest::new().set_project_id("example");
12057 /// ```
12058 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12059 self.project_id = v.into();
12060 self
12061 }
12062
12063 /// Sets the value of [trigger][crate::model::ReceiveTriggerWebhookRequest::trigger].
12064 ///
12065 /// # Example
12066 /// ```ignore,no_run
12067 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12068 /// let x = ReceiveTriggerWebhookRequest::new().set_trigger("example");
12069 /// ```
12070 pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12071 self.trigger = v.into();
12072 self
12073 }
12074
12075 /// Sets the value of [secret][crate::model::ReceiveTriggerWebhookRequest::secret].
12076 ///
12077 /// # Example
12078 /// ```ignore,no_run
12079 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12080 /// let x = ReceiveTriggerWebhookRequest::new().set_secret("example");
12081 /// ```
12082 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12083 self.secret = v.into();
12084 self
12085 }
12086}
12087
12088impl wkt::message::Message for ReceiveTriggerWebhookRequest {
12089 fn typename() -> &'static str {
12090 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest"
12091 }
12092}
12093
12094/// ReceiveTriggerWebhookResponse [Experimental] is the response object for the
12095/// ReceiveTriggerWebhook method.
12096#[derive(Clone, Default, PartialEq)]
12097#[non_exhaustive]
12098pub struct ReceiveTriggerWebhookResponse {
12099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12100}
12101
12102impl ReceiveTriggerWebhookResponse {
12103 /// Creates a new default instance.
12104 pub fn new() -> Self {
12105 std::default::Default::default()
12106 }
12107}
12108
12109impl wkt::message::Message for ReceiveTriggerWebhookResponse {
12110 fn typename() -> &'static str {
12111 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse"
12112 }
12113}
12114
12115/// GitHubEnterpriseConfig represents a configuration for a GitHub Enterprise
12116/// server.
12117#[derive(Clone, Default, PartialEq)]
12118#[non_exhaustive]
12119pub struct GitHubEnterpriseConfig {
12120 /// The full resource name for the GitHubEnterpriseConfig
12121 /// For example:
12122 /// "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}"
12123 pub name: std::string::String,
12124
12125 /// The URL of the github enterprise host the configuration is for.
12126 pub host_url: std::string::String,
12127
12128 /// Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise
12129 /// server.
12130 pub app_id: i64,
12131
12132 /// Output only. Time when the installation was associated with the project.
12133 pub create_time: std::option::Option<wkt::Timestamp>,
12134
12135 /// The key that should be attached to webhook calls to the ReceiveWebhook
12136 /// endpoint.
12137 pub webhook_key: std::string::String,
12138
12139 /// Optional. The network to be used when reaching out to the GitHub
12140 /// Enterprise server. The VPC network must be enabled for private
12141 /// service connection. This should be set if the GitHub Enterprise server is
12142 /// hosted on-premises and not reachable by public internet.
12143 /// If this field is left empty, no network peering will occur and calls to
12144 /// the GitHub Enterprise server will be made over the public internet.
12145 /// Must be in the format
12146 /// `projects/{project}/global/networks/{network}`, where {project}
12147 /// is a project number or id and {network} is the name of a
12148 /// VPC network in the project.
12149 pub peered_network: std::string::String,
12150
12151 /// Optional. Names of secrets in Secret Manager.
12152 pub secrets: std::option::Option<crate::model::GitHubEnterpriseSecrets>,
12153
12154 /// Optional. Name to display for this config.
12155 pub display_name: std::string::String,
12156
12157 /// Optional. SSL certificate to use for requests to GitHub Enterprise.
12158 pub ssl_ca: std::string::String,
12159
12160 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12161}
12162
12163impl GitHubEnterpriseConfig {
12164 /// Creates a new default instance.
12165 pub fn new() -> Self {
12166 std::default::Default::default()
12167 }
12168
12169 /// Sets the value of [name][crate::model::GitHubEnterpriseConfig::name].
12170 ///
12171 /// # Example
12172 /// ```ignore,no_run
12173 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12174 /// # let project_id = "project_id";
12175 /// # let config_id = "config_id";
12176 /// let x = GitHubEnterpriseConfig::new().set_name(format!("projects/{project_id}/githubEnterpriseConfigs/{config_id}"));
12177 /// ```
12178 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12179 self.name = v.into();
12180 self
12181 }
12182
12183 /// Sets the value of [host_url][crate::model::GitHubEnterpriseConfig::host_url].
12184 ///
12185 /// # Example
12186 /// ```ignore,no_run
12187 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12188 /// let x = GitHubEnterpriseConfig::new().set_host_url("example");
12189 /// ```
12190 pub fn set_host_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12191 self.host_url = v.into();
12192 self
12193 }
12194
12195 /// Sets the value of [app_id][crate::model::GitHubEnterpriseConfig::app_id].
12196 ///
12197 /// # Example
12198 /// ```ignore,no_run
12199 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12200 /// let x = GitHubEnterpriseConfig::new().set_app_id(42);
12201 /// ```
12202 pub fn set_app_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12203 self.app_id = v.into();
12204 self
12205 }
12206
12207 /// Sets the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12208 ///
12209 /// # Example
12210 /// ```ignore,no_run
12211 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12212 /// use wkt::Timestamp;
12213 /// let x = GitHubEnterpriseConfig::new().set_create_time(Timestamp::default()/* use setters */);
12214 /// ```
12215 pub fn set_create_time<T>(mut self, v: T) -> Self
12216 where
12217 T: std::convert::Into<wkt::Timestamp>,
12218 {
12219 self.create_time = std::option::Option::Some(v.into());
12220 self
12221 }
12222
12223 /// Sets or clears the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12224 ///
12225 /// # Example
12226 /// ```ignore,no_run
12227 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12228 /// use wkt::Timestamp;
12229 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12230 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(None::<Timestamp>);
12231 /// ```
12232 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12233 where
12234 T: std::convert::Into<wkt::Timestamp>,
12235 {
12236 self.create_time = v.map(|x| x.into());
12237 self
12238 }
12239
12240 /// Sets the value of [webhook_key][crate::model::GitHubEnterpriseConfig::webhook_key].
12241 ///
12242 /// # Example
12243 /// ```ignore,no_run
12244 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12245 /// let x = GitHubEnterpriseConfig::new().set_webhook_key("example");
12246 /// ```
12247 pub fn set_webhook_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12248 self.webhook_key = v.into();
12249 self
12250 }
12251
12252 /// Sets the value of [peered_network][crate::model::GitHubEnterpriseConfig::peered_network].
12253 ///
12254 /// # Example
12255 /// ```ignore,no_run
12256 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12257 /// let x = GitHubEnterpriseConfig::new().set_peered_network("example");
12258 /// ```
12259 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12260 self.peered_network = v.into();
12261 self
12262 }
12263
12264 /// Sets the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12265 ///
12266 /// # Example
12267 /// ```ignore,no_run
12268 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12269 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12270 /// let x = GitHubEnterpriseConfig::new().set_secrets(GitHubEnterpriseSecrets::default()/* use setters */);
12271 /// ```
12272 pub fn set_secrets<T>(mut self, v: T) -> Self
12273 where
12274 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12275 {
12276 self.secrets = std::option::Option::Some(v.into());
12277 self
12278 }
12279
12280 /// Sets or clears the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12281 ///
12282 /// # Example
12283 /// ```ignore,no_run
12284 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12285 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12286 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(Some(GitHubEnterpriseSecrets::default()/* use setters */));
12287 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(None::<GitHubEnterpriseSecrets>);
12288 /// ```
12289 pub fn set_or_clear_secrets<T>(mut self, v: std::option::Option<T>) -> Self
12290 where
12291 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12292 {
12293 self.secrets = v.map(|x| x.into());
12294 self
12295 }
12296
12297 /// Sets the value of [display_name][crate::model::GitHubEnterpriseConfig::display_name].
12298 ///
12299 /// # Example
12300 /// ```ignore,no_run
12301 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12302 /// let x = GitHubEnterpriseConfig::new().set_display_name("example");
12303 /// ```
12304 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12305 self.display_name = v.into();
12306 self
12307 }
12308
12309 /// Sets the value of [ssl_ca][crate::model::GitHubEnterpriseConfig::ssl_ca].
12310 ///
12311 /// # Example
12312 /// ```ignore,no_run
12313 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12314 /// let x = GitHubEnterpriseConfig::new().set_ssl_ca("example");
12315 /// ```
12316 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12317 self.ssl_ca = v.into();
12318 self
12319 }
12320}
12321
12322impl wkt::message::Message for GitHubEnterpriseConfig {
12323 fn typename() -> &'static str {
12324 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseConfig"
12325 }
12326}
12327
12328/// GitHubEnterpriseSecrets represents the names of all necessary secrets in
12329/// Secret Manager for a GitHub Enterprise server.
12330/// Format is: projects/\<project number\>/secrets/\<secret name\>.
12331#[derive(Clone, Default, PartialEq)]
12332#[non_exhaustive]
12333pub struct GitHubEnterpriseSecrets {
12334 /// The resource name for the private key secret version.
12335 pub private_key_version_name: std::string::String,
12336
12337 /// The resource name for the webhook secret secret version in Secret Manager.
12338 pub webhook_secret_version_name: std::string::String,
12339
12340 /// The resource name for the OAuth secret secret version in Secret Manager.
12341 pub oauth_secret_version_name: std::string::String,
12342
12343 /// The resource name for the OAuth client ID secret version in Secret Manager.
12344 pub oauth_client_id_version_name: std::string::String,
12345
12346 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12347}
12348
12349impl GitHubEnterpriseSecrets {
12350 /// Creates a new default instance.
12351 pub fn new() -> Self {
12352 std::default::Default::default()
12353 }
12354
12355 /// Sets the value of [private_key_version_name][crate::model::GitHubEnterpriseSecrets::private_key_version_name].
12356 ///
12357 /// # Example
12358 /// ```ignore,no_run
12359 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12360 /// let x = GitHubEnterpriseSecrets::new().set_private_key_version_name("example");
12361 /// ```
12362 pub fn set_private_key_version_name<T: std::convert::Into<std::string::String>>(
12363 mut self,
12364 v: T,
12365 ) -> Self {
12366 self.private_key_version_name = v.into();
12367 self
12368 }
12369
12370 /// Sets the value of [webhook_secret_version_name][crate::model::GitHubEnterpriseSecrets::webhook_secret_version_name].
12371 ///
12372 /// # Example
12373 /// ```ignore,no_run
12374 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12375 /// let x = GitHubEnterpriseSecrets::new().set_webhook_secret_version_name("example");
12376 /// ```
12377 pub fn set_webhook_secret_version_name<T: std::convert::Into<std::string::String>>(
12378 mut self,
12379 v: T,
12380 ) -> Self {
12381 self.webhook_secret_version_name = v.into();
12382 self
12383 }
12384
12385 /// Sets the value of [oauth_secret_version_name][crate::model::GitHubEnterpriseSecrets::oauth_secret_version_name].
12386 ///
12387 /// # Example
12388 /// ```ignore,no_run
12389 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12390 /// let x = GitHubEnterpriseSecrets::new().set_oauth_secret_version_name("example");
12391 /// ```
12392 pub fn set_oauth_secret_version_name<T: std::convert::Into<std::string::String>>(
12393 mut self,
12394 v: T,
12395 ) -> Self {
12396 self.oauth_secret_version_name = v.into();
12397 self
12398 }
12399
12400 /// Sets the value of [oauth_client_id_version_name][crate::model::GitHubEnterpriseSecrets::oauth_client_id_version_name].
12401 ///
12402 /// # Example
12403 /// ```ignore,no_run
12404 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12405 /// let x = GitHubEnterpriseSecrets::new().set_oauth_client_id_version_name("example");
12406 /// ```
12407 pub fn set_oauth_client_id_version_name<T: std::convert::Into<std::string::String>>(
12408 mut self,
12409 v: T,
12410 ) -> Self {
12411 self.oauth_client_id_version_name = v.into();
12412 self
12413 }
12414}
12415
12416impl wkt::message::Message for GitHubEnterpriseSecrets {
12417 fn typename() -> &'static str {
12418 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets"
12419 }
12420}
12421
12422/// Configuration for a `WorkerPool`.
12423///
12424/// Cloud Build owns and maintains a pool of workers for general use and have no
12425/// access to a project's private network. By default, builds submitted to
12426/// Cloud Build will use a worker from this pool.
12427///
12428/// If your build needs access to resources on a private network,
12429/// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give
12430/// your builds access to any single VPC network that you
12431/// administer, including any on-prem resources connected to that VPC
12432/// network. For an overview of private pools, see
12433/// [Private pools
12434/// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview).
12435#[derive(Clone, Default, PartialEq)]
12436#[non_exhaustive]
12437pub struct WorkerPool {
12438 /// Output only. The resource name of the `WorkerPool`, with format
12439 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
12440 /// The value of `{worker_pool}` is provided by `worker_pool_id` in
12441 /// `CreateWorkerPool` request and the value of `{location}` is determined by
12442 /// the endpoint accessed.
12443 pub name: std::string::String,
12444
12445 /// A user-specified, human-readable name for the `WorkerPool`. If provided,
12446 /// this value must be 1-63 characters.
12447 pub display_name: std::string::String,
12448
12449 /// Output only. A unique identifier for the `WorkerPool`.
12450 pub uid: std::string::String,
12451
12452 /// User specified annotations. See <https://google.aip.dev/128#annotations>
12453 /// for more details such as format and size limitations.
12454 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12455
12456 /// Output only. Time at which the request to create the `WorkerPool` was
12457 /// received.
12458 pub create_time: std::option::Option<wkt::Timestamp>,
12459
12460 /// Output only. Time at which the request to update the `WorkerPool` was
12461 /// received.
12462 pub update_time: std::option::Option<wkt::Timestamp>,
12463
12464 /// Output only. Time at which the request to delete the `WorkerPool` was
12465 /// received.
12466 pub delete_time: std::option::Option<wkt::Timestamp>,
12467
12468 /// Output only. `WorkerPool` state.
12469 pub state: crate::model::worker_pool::State,
12470
12471 /// Output only. Checksum computed by the server. May be sent on update and
12472 /// delete requests to ensure that the client has an up-to-date value before
12473 /// proceeding.
12474 pub etag: std::string::String,
12475
12476 /// Configuration for the `WorkerPool`.
12477 pub config: std::option::Option<crate::model::worker_pool::Config>,
12478
12479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12480}
12481
12482impl WorkerPool {
12483 /// Creates a new default instance.
12484 pub fn new() -> Self {
12485 std::default::Default::default()
12486 }
12487
12488 /// Sets the value of [name][crate::model::WorkerPool::name].
12489 ///
12490 /// # Example
12491 /// ```ignore,no_run
12492 /// # use google_cloud_build_v1::model::WorkerPool;
12493 /// # let project_id = "project_id";
12494 /// # let location_id = "location_id";
12495 /// # let worker_pool_id = "worker_pool_id";
12496 /// let x = WorkerPool::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
12497 /// ```
12498 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12499 self.name = v.into();
12500 self
12501 }
12502
12503 /// Sets the value of [display_name][crate::model::WorkerPool::display_name].
12504 ///
12505 /// # Example
12506 /// ```ignore,no_run
12507 /// # use google_cloud_build_v1::model::WorkerPool;
12508 /// let x = WorkerPool::new().set_display_name("example");
12509 /// ```
12510 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12511 self.display_name = v.into();
12512 self
12513 }
12514
12515 /// Sets the value of [uid][crate::model::WorkerPool::uid].
12516 ///
12517 /// # Example
12518 /// ```ignore,no_run
12519 /// # use google_cloud_build_v1::model::WorkerPool;
12520 /// let x = WorkerPool::new().set_uid("example");
12521 /// ```
12522 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12523 self.uid = v.into();
12524 self
12525 }
12526
12527 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
12528 ///
12529 /// # Example
12530 /// ```ignore,no_run
12531 /// # use google_cloud_build_v1::model::WorkerPool;
12532 /// let x = WorkerPool::new().set_annotations([
12533 /// ("key0", "abc"),
12534 /// ("key1", "xyz"),
12535 /// ]);
12536 /// ```
12537 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12538 where
12539 T: std::iter::IntoIterator<Item = (K, V)>,
12540 K: std::convert::Into<std::string::String>,
12541 V: std::convert::Into<std::string::String>,
12542 {
12543 use std::iter::Iterator;
12544 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12545 self
12546 }
12547
12548 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
12549 ///
12550 /// # Example
12551 /// ```ignore,no_run
12552 /// # use google_cloud_build_v1::model::WorkerPool;
12553 /// use wkt::Timestamp;
12554 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
12555 /// ```
12556 pub fn set_create_time<T>(mut self, v: T) -> Self
12557 where
12558 T: std::convert::Into<wkt::Timestamp>,
12559 {
12560 self.create_time = std::option::Option::Some(v.into());
12561 self
12562 }
12563
12564 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
12565 ///
12566 /// # Example
12567 /// ```ignore,no_run
12568 /// # use google_cloud_build_v1::model::WorkerPool;
12569 /// use wkt::Timestamp;
12570 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12571 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
12572 /// ```
12573 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12574 where
12575 T: std::convert::Into<wkt::Timestamp>,
12576 {
12577 self.create_time = v.map(|x| x.into());
12578 self
12579 }
12580
12581 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
12582 ///
12583 /// # Example
12584 /// ```ignore,no_run
12585 /// # use google_cloud_build_v1::model::WorkerPool;
12586 /// use wkt::Timestamp;
12587 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
12588 /// ```
12589 pub fn set_update_time<T>(mut self, v: T) -> Self
12590 where
12591 T: std::convert::Into<wkt::Timestamp>,
12592 {
12593 self.update_time = std::option::Option::Some(v.into());
12594 self
12595 }
12596
12597 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
12598 ///
12599 /// # Example
12600 /// ```ignore,no_run
12601 /// # use google_cloud_build_v1::model::WorkerPool;
12602 /// use wkt::Timestamp;
12603 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12604 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
12605 /// ```
12606 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12607 where
12608 T: std::convert::Into<wkt::Timestamp>,
12609 {
12610 self.update_time = v.map(|x| x.into());
12611 self
12612 }
12613
12614 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
12615 ///
12616 /// # Example
12617 /// ```ignore,no_run
12618 /// # use google_cloud_build_v1::model::WorkerPool;
12619 /// use wkt::Timestamp;
12620 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
12621 /// ```
12622 pub fn set_delete_time<T>(mut self, v: T) -> Self
12623 where
12624 T: std::convert::Into<wkt::Timestamp>,
12625 {
12626 self.delete_time = std::option::Option::Some(v.into());
12627 self
12628 }
12629
12630 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
12631 ///
12632 /// # Example
12633 /// ```ignore,no_run
12634 /// # use google_cloud_build_v1::model::WorkerPool;
12635 /// use wkt::Timestamp;
12636 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12637 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
12638 /// ```
12639 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12640 where
12641 T: std::convert::Into<wkt::Timestamp>,
12642 {
12643 self.delete_time = v.map(|x| x.into());
12644 self
12645 }
12646
12647 /// Sets the value of [state][crate::model::WorkerPool::state].
12648 ///
12649 /// # Example
12650 /// ```ignore,no_run
12651 /// # use google_cloud_build_v1::model::WorkerPool;
12652 /// use google_cloud_build_v1::model::worker_pool::State;
12653 /// let x0 = WorkerPool::new().set_state(State::Creating);
12654 /// let x1 = WorkerPool::new().set_state(State::Running);
12655 /// let x2 = WorkerPool::new().set_state(State::Deleting);
12656 /// ```
12657 pub fn set_state<T: std::convert::Into<crate::model::worker_pool::State>>(
12658 mut self,
12659 v: T,
12660 ) -> Self {
12661 self.state = v.into();
12662 self
12663 }
12664
12665 /// Sets the value of [etag][crate::model::WorkerPool::etag].
12666 ///
12667 /// # Example
12668 /// ```ignore,no_run
12669 /// # use google_cloud_build_v1::model::WorkerPool;
12670 /// let x = WorkerPool::new().set_etag("example");
12671 /// ```
12672 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12673 self.etag = v.into();
12674 self
12675 }
12676
12677 /// Sets the value of [config][crate::model::WorkerPool::config].
12678 ///
12679 /// Note that all the setters affecting `config` are mutually
12680 /// exclusive.
12681 ///
12682 /// # Example
12683 /// ```ignore,no_run
12684 /// # use google_cloud_build_v1::model::WorkerPool;
12685 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12686 /// let x = WorkerPool::new().set_config(Some(
12687 /// google_cloud_build_v1::model::worker_pool::Config::PrivatePoolV1Config(PrivatePoolV1Config::default().into())));
12688 /// ```
12689 pub fn set_config<
12690 T: std::convert::Into<std::option::Option<crate::model::worker_pool::Config>>,
12691 >(
12692 mut self,
12693 v: T,
12694 ) -> Self {
12695 self.config = v.into();
12696 self
12697 }
12698
12699 /// The value of [config][crate::model::WorkerPool::config]
12700 /// if it holds a `PrivatePoolV1Config`, `None` if the field is not set or
12701 /// holds a different branch.
12702 pub fn private_pool_v1_config(
12703 &self,
12704 ) -> std::option::Option<&std::boxed::Box<crate::model::PrivatePoolV1Config>> {
12705 #[allow(unreachable_patterns)]
12706 self.config.as_ref().and_then(|v| match v {
12707 crate::model::worker_pool::Config::PrivatePoolV1Config(v) => {
12708 std::option::Option::Some(v)
12709 }
12710 _ => std::option::Option::None,
12711 })
12712 }
12713
12714 /// Sets the value of [config][crate::model::WorkerPool::config]
12715 /// to hold a `PrivatePoolV1Config`.
12716 ///
12717 /// Note that all the setters affecting `config` are
12718 /// mutually exclusive.
12719 ///
12720 /// # Example
12721 /// ```ignore,no_run
12722 /// # use google_cloud_build_v1::model::WorkerPool;
12723 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12724 /// let x = WorkerPool::new().set_private_pool_v1_config(PrivatePoolV1Config::default()/* use setters */);
12725 /// assert!(x.private_pool_v1_config().is_some());
12726 /// ```
12727 pub fn set_private_pool_v1_config<
12728 T: std::convert::Into<std::boxed::Box<crate::model::PrivatePoolV1Config>>,
12729 >(
12730 mut self,
12731 v: T,
12732 ) -> Self {
12733 self.config = std::option::Option::Some(
12734 crate::model::worker_pool::Config::PrivatePoolV1Config(v.into()),
12735 );
12736 self
12737 }
12738}
12739
12740impl wkt::message::Message for WorkerPool {
12741 fn typename() -> &'static str {
12742 "type.googleapis.com/google.devtools.cloudbuild.v1.WorkerPool"
12743 }
12744}
12745
12746/// Defines additional types related to [WorkerPool].
12747pub mod worker_pool {
12748 #[allow(unused_imports)]
12749 use super::*;
12750
12751 /// State of the `WorkerPool`.
12752 ///
12753 /// # Working with unknown values
12754 ///
12755 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12756 /// additional enum variants at any time. Adding new variants is not considered
12757 /// a breaking change. Applications should write their code in anticipation of:
12758 ///
12759 /// - New values appearing in future releases of the client library, **and**
12760 /// - New values received dynamically, without application changes.
12761 ///
12762 /// Please consult the [Working with enums] section in the user guide for some
12763 /// guidelines.
12764 ///
12765 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12766 #[derive(Clone, Debug, PartialEq)]
12767 #[non_exhaustive]
12768 pub enum State {
12769 /// State of the `WorkerPool` is unknown.
12770 Unspecified,
12771 /// `WorkerPool` is being created.
12772 Creating,
12773 /// `WorkerPool` is running.
12774 Running,
12775 /// `WorkerPool` is being deleted: cancelling builds and draining workers.
12776 Deleting,
12777 /// `WorkerPool` is deleted.
12778 Deleted,
12779 /// `WorkerPool` is being updated; new builds cannot be run.
12780 Updating,
12781 /// If set, the enum was initialized with an unknown value.
12782 ///
12783 /// Applications can examine the value using [State::value] or
12784 /// [State::name].
12785 UnknownValue(state::UnknownValue),
12786 }
12787
12788 #[doc(hidden)]
12789 pub mod state {
12790 #[allow(unused_imports)]
12791 use super::*;
12792 #[derive(Clone, Debug, PartialEq)]
12793 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12794 }
12795
12796 impl State {
12797 /// Gets the enum value.
12798 ///
12799 /// Returns `None` if the enum contains an unknown value deserialized from
12800 /// the string representation of enums.
12801 pub fn value(&self) -> std::option::Option<i32> {
12802 match self {
12803 Self::Unspecified => std::option::Option::Some(0),
12804 Self::Creating => std::option::Option::Some(1),
12805 Self::Running => std::option::Option::Some(2),
12806 Self::Deleting => std::option::Option::Some(3),
12807 Self::Deleted => std::option::Option::Some(4),
12808 Self::Updating => std::option::Option::Some(5),
12809 Self::UnknownValue(u) => u.0.value(),
12810 }
12811 }
12812
12813 /// Gets the enum value as a string.
12814 ///
12815 /// Returns `None` if the enum contains an unknown value deserialized from
12816 /// the integer representation of enums.
12817 pub fn name(&self) -> std::option::Option<&str> {
12818 match self {
12819 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12820 Self::Creating => std::option::Option::Some("CREATING"),
12821 Self::Running => std::option::Option::Some("RUNNING"),
12822 Self::Deleting => std::option::Option::Some("DELETING"),
12823 Self::Deleted => std::option::Option::Some("DELETED"),
12824 Self::Updating => std::option::Option::Some("UPDATING"),
12825 Self::UnknownValue(u) => u.0.name(),
12826 }
12827 }
12828 }
12829
12830 impl std::default::Default for State {
12831 fn default() -> Self {
12832 use std::convert::From;
12833 Self::from(0)
12834 }
12835 }
12836
12837 impl std::fmt::Display for State {
12838 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12839 wkt::internal::display_enum(f, self.name(), self.value())
12840 }
12841 }
12842
12843 impl std::convert::From<i32> for State {
12844 fn from(value: i32) -> Self {
12845 match value {
12846 0 => Self::Unspecified,
12847 1 => Self::Creating,
12848 2 => Self::Running,
12849 3 => Self::Deleting,
12850 4 => Self::Deleted,
12851 5 => Self::Updating,
12852 _ => Self::UnknownValue(state::UnknownValue(
12853 wkt::internal::UnknownEnumValue::Integer(value),
12854 )),
12855 }
12856 }
12857 }
12858
12859 impl std::convert::From<&str> for State {
12860 fn from(value: &str) -> Self {
12861 use std::string::ToString;
12862 match value {
12863 "STATE_UNSPECIFIED" => Self::Unspecified,
12864 "CREATING" => Self::Creating,
12865 "RUNNING" => Self::Running,
12866 "DELETING" => Self::Deleting,
12867 "DELETED" => Self::Deleted,
12868 "UPDATING" => Self::Updating,
12869 _ => Self::UnknownValue(state::UnknownValue(
12870 wkt::internal::UnknownEnumValue::String(value.to_string()),
12871 )),
12872 }
12873 }
12874 }
12875
12876 impl serde::ser::Serialize for State {
12877 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12878 where
12879 S: serde::Serializer,
12880 {
12881 match self {
12882 Self::Unspecified => serializer.serialize_i32(0),
12883 Self::Creating => serializer.serialize_i32(1),
12884 Self::Running => serializer.serialize_i32(2),
12885 Self::Deleting => serializer.serialize_i32(3),
12886 Self::Deleted => serializer.serialize_i32(4),
12887 Self::Updating => serializer.serialize_i32(5),
12888 Self::UnknownValue(u) => u.0.serialize(serializer),
12889 }
12890 }
12891 }
12892
12893 impl<'de> serde::de::Deserialize<'de> for State {
12894 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12895 where
12896 D: serde::Deserializer<'de>,
12897 {
12898 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12899 ".google.devtools.cloudbuild.v1.WorkerPool.State",
12900 ))
12901 }
12902 }
12903
12904 /// Configuration for the `WorkerPool`.
12905 #[derive(Clone, Debug, PartialEq)]
12906 #[non_exhaustive]
12907 pub enum Config {
12908 /// Private Pool configuration.
12909 PrivatePoolV1Config(std::boxed::Box<crate::model::PrivatePoolV1Config>),
12910 }
12911}
12912
12913/// Configuration for a V1 `PrivatePool`.
12914#[derive(Clone, Default, PartialEq)]
12915#[non_exhaustive]
12916pub struct PrivatePoolV1Config {
12917 /// Machine configuration for the workers in the pool.
12918 pub worker_config: std::option::Option<crate::model::private_pool_v_1_config::WorkerConfig>,
12919
12920 /// Network configuration for the pool.
12921 pub network_config: std::option::Option<crate::model::private_pool_v_1_config::NetworkConfig>,
12922
12923 /// Immutable. Private Service Connect(PSC) Network configuration for the pool.
12924 pub private_service_connect:
12925 std::option::Option<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12926
12927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12928}
12929
12930impl PrivatePoolV1Config {
12931 /// Creates a new default instance.
12932 pub fn new() -> Self {
12933 std::default::Default::default()
12934 }
12935
12936 /// Sets the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12937 ///
12938 /// # Example
12939 /// ```ignore,no_run
12940 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12941 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12942 /// let x = PrivatePoolV1Config::new().set_worker_config(WorkerConfig::default()/* use setters */);
12943 /// ```
12944 pub fn set_worker_config<T>(mut self, v: T) -> Self
12945 where
12946 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12947 {
12948 self.worker_config = std::option::Option::Some(v.into());
12949 self
12950 }
12951
12952 /// Sets or clears the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12953 ///
12954 /// # Example
12955 /// ```ignore,no_run
12956 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12957 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12958 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(Some(WorkerConfig::default()/* use setters */));
12959 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(None::<WorkerConfig>);
12960 /// ```
12961 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
12962 where
12963 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12964 {
12965 self.worker_config = v.map(|x| x.into());
12966 self
12967 }
12968
12969 /// Sets the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12970 ///
12971 /// # Example
12972 /// ```ignore,no_run
12973 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12974 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12975 /// let x = PrivatePoolV1Config::new().set_network_config(NetworkConfig::default()/* use setters */);
12976 /// ```
12977 pub fn set_network_config<T>(mut self, v: T) -> Self
12978 where
12979 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12980 {
12981 self.network_config = std::option::Option::Some(v.into());
12982 self
12983 }
12984
12985 /// Sets or clears the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12986 ///
12987 /// # Example
12988 /// ```ignore,no_run
12989 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12990 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12991 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(Some(NetworkConfig::default()/* use setters */));
12992 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(None::<NetworkConfig>);
12993 /// ```
12994 pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
12995 where
12996 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12997 {
12998 self.network_config = v.map(|x| x.into());
12999 self
13000 }
13001
13002 /// Sets the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
13003 ///
13004 /// # Example
13005 /// ```ignore,no_run
13006 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
13007 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13008 /// let x = PrivatePoolV1Config::new().set_private_service_connect(PrivateServiceConnect::default()/* use setters */);
13009 /// ```
13010 pub fn set_private_service_connect<T>(mut self, v: T) -> Self
13011 where
13012 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
13013 {
13014 self.private_service_connect = std::option::Option::Some(v.into());
13015 self
13016 }
13017
13018 /// Sets or clears the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
13019 ///
13020 /// # Example
13021 /// ```ignore,no_run
13022 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
13023 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13024 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(Some(PrivateServiceConnect::default()/* use setters */));
13025 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(None::<PrivateServiceConnect>);
13026 /// ```
13027 pub fn set_or_clear_private_service_connect<T>(mut self, v: std::option::Option<T>) -> Self
13028 where
13029 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
13030 {
13031 self.private_service_connect = v.map(|x| x.into());
13032 self
13033 }
13034}
13035
13036impl wkt::message::Message for PrivatePoolV1Config {
13037 fn typename() -> &'static str {
13038 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config"
13039 }
13040}
13041
13042/// Defines additional types related to [PrivatePoolV1Config].
13043pub mod private_pool_v_1_config {
13044 #[allow(unused_imports)]
13045 use super::*;
13046
13047 /// Defines the configuration to be used for creating workers in
13048 /// the pool.
13049 #[derive(Clone, Default, PartialEq)]
13050 #[non_exhaustive]
13051 pub struct WorkerConfig {
13052 /// Optional. Machine type of a worker, such as `e2-medium`.
13053 /// See [Worker pool config
13054 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
13055 /// If left blank, Cloud Build will use a sensible default.
13056 pub machine_type: std::string::String,
13057
13058 /// Size of the disk attached to the worker, in GB.
13059 /// See [Worker pool config
13060 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
13061 /// Specify a value of up to 4000. If `0` is specified, Cloud Build will use
13062 /// a standard disk size.
13063 pub disk_size_gb: i64,
13064
13065 /// Optional. Enable nested virtualization on the worker, if supported by the
13066 /// machine type. By default, nested virtualization is disabled.
13067 pub enable_nested_virtualization: std::option::Option<bool>,
13068
13069 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13070 }
13071
13072 impl WorkerConfig {
13073 /// Creates a new default instance.
13074 pub fn new() -> Self {
13075 std::default::Default::default()
13076 }
13077
13078 /// Sets the value of [machine_type][crate::model::private_pool_v_1_config::WorkerConfig::machine_type].
13079 ///
13080 /// # Example
13081 /// ```ignore,no_run
13082 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13083 /// let x = WorkerConfig::new().set_machine_type("example");
13084 /// ```
13085 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
13086 mut self,
13087 v: T,
13088 ) -> Self {
13089 self.machine_type = v.into();
13090 self
13091 }
13092
13093 /// Sets the value of [disk_size_gb][crate::model::private_pool_v_1_config::WorkerConfig::disk_size_gb].
13094 ///
13095 /// # Example
13096 /// ```ignore,no_run
13097 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13098 /// let x = WorkerConfig::new().set_disk_size_gb(42);
13099 /// ```
13100 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13101 self.disk_size_gb = v.into();
13102 self
13103 }
13104
13105 /// Sets the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
13106 ///
13107 /// # Example
13108 /// ```ignore,no_run
13109 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13110 /// let x = WorkerConfig::new().set_enable_nested_virtualization(true);
13111 /// ```
13112 pub fn set_enable_nested_virtualization<T>(mut self, v: T) -> Self
13113 where
13114 T: std::convert::Into<bool>,
13115 {
13116 self.enable_nested_virtualization = std::option::Option::Some(v.into());
13117 self
13118 }
13119
13120 /// Sets or clears the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
13121 ///
13122 /// # Example
13123 /// ```ignore,no_run
13124 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13125 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(Some(false));
13126 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(None::<bool>);
13127 /// ```
13128 pub fn set_or_clear_enable_nested_virtualization<T>(
13129 mut self,
13130 v: std::option::Option<T>,
13131 ) -> Self
13132 where
13133 T: std::convert::Into<bool>,
13134 {
13135 self.enable_nested_virtualization = v.map(|x| x.into());
13136 self
13137 }
13138 }
13139
13140 impl wkt::message::Message for WorkerConfig {
13141 fn typename() -> &'static str {
13142 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.WorkerConfig"
13143 }
13144 }
13145
13146 /// Defines the network configuration for the pool.
13147 #[derive(Clone, Default, PartialEq)]
13148 #[non_exhaustive]
13149 pub struct NetworkConfig {
13150 /// Required. Immutable. The network definition that the workers are peered
13151 /// to. If this section is left empty, the workers will be peered to
13152 /// `WorkerPool.project_id` on the service producer network. Must be in the
13153 /// format `projects/{project}/global/networks/{network}`, where `{project}`
13154 /// is a project number, such as `12345`, and `{network}` is the name of a
13155 /// VPC network in the project. See
13156 /// [Understanding network configuration
13157 /// options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment)
13158 pub peered_network: std::string::String,
13159
13160 /// Option to configure network egress for the workers.
13161 pub egress_option: crate::model::private_pool_v_1_config::network_config::EgressOption,
13162
13163 /// Immutable. Subnet IP range within the peered network. This is specified
13164 /// in CIDR notation with a slash and the subnet prefix size. You can
13165 /// optionally specify an IP address before the subnet prefix value. e.g.
13166 /// `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a
13167 /// prefix size of 29 bits.
13168 /// `/16` would specify a prefix size of 16 bits, with an automatically
13169 /// determined IP within the peered VPC.
13170 /// If unspecified, a value of `/24` will be used.
13171 pub peered_network_ip_range: std::string::String,
13172
13173 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13174 }
13175
13176 impl NetworkConfig {
13177 /// Creates a new default instance.
13178 pub fn new() -> Self {
13179 std::default::Default::default()
13180 }
13181
13182 /// Sets the value of [peered_network][crate::model::private_pool_v_1_config::NetworkConfig::peered_network].
13183 ///
13184 /// # Example
13185 /// ```ignore,no_run
13186 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13187 /// let x = NetworkConfig::new().set_peered_network("example");
13188 /// ```
13189 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(
13190 mut self,
13191 v: T,
13192 ) -> Self {
13193 self.peered_network = v.into();
13194 self
13195 }
13196
13197 /// Sets the value of [egress_option][crate::model::private_pool_v_1_config::NetworkConfig::egress_option].
13198 ///
13199 /// # Example
13200 /// ```ignore,no_run
13201 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13202 /// use google_cloud_build_v1::model::private_pool_v_1_config::network_config::EgressOption;
13203 /// let x0 = NetworkConfig::new().set_egress_option(EgressOption::NoPublicEgress);
13204 /// let x1 = NetworkConfig::new().set_egress_option(EgressOption::PublicEgress);
13205 /// ```
13206 pub fn set_egress_option<
13207 T: std::convert::Into<crate::model::private_pool_v_1_config::network_config::EgressOption>,
13208 >(
13209 mut self,
13210 v: T,
13211 ) -> Self {
13212 self.egress_option = v.into();
13213 self
13214 }
13215
13216 /// Sets the value of [peered_network_ip_range][crate::model::private_pool_v_1_config::NetworkConfig::peered_network_ip_range].
13217 ///
13218 /// # Example
13219 /// ```ignore,no_run
13220 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13221 /// let x = NetworkConfig::new().set_peered_network_ip_range("example");
13222 /// ```
13223 pub fn set_peered_network_ip_range<T: std::convert::Into<std::string::String>>(
13224 mut self,
13225 v: T,
13226 ) -> Self {
13227 self.peered_network_ip_range = v.into();
13228 self
13229 }
13230 }
13231
13232 impl wkt::message::Message for NetworkConfig {
13233 fn typename() -> &'static str {
13234 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig"
13235 }
13236 }
13237
13238 /// Defines additional types related to [NetworkConfig].
13239 pub mod network_config {
13240 #[allow(unused_imports)]
13241 use super::*;
13242
13243 /// Defines the egress option for the pool.
13244 ///
13245 /// # Working with unknown values
13246 ///
13247 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13248 /// additional enum variants at any time. Adding new variants is not considered
13249 /// a breaking change. Applications should write their code in anticipation of:
13250 ///
13251 /// - New values appearing in future releases of the client library, **and**
13252 /// - New values received dynamically, without application changes.
13253 ///
13254 /// Please consult the [Working with enums] section in the user guide for some
13255 /// guidelines.
13256 ///
13257 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13258 #[derive(Clone, Debug, PartialEq)]
13259 #[non_exhaustive]
13260 pub enum EgressOption {
13261 /// If set, defaults to PUBLIC_EGRESS.
13262 Unspecified,
13263 /// If set, workers are created without any public address, which prevents
13264 /// network egress to public IPs unless a network proxy is configured.
13265 NoPublicEgress,
13266 /// If set, workers are created with a public address which allows for
13267 /// public internet egress.
13268 PublicEgress,
13269 /// If set, the enum was initialized with an unknown value.
13270 ///
13271 /// Applications can examine the value using [EgressOption::value] or
13272 /// [EgressOption::name].
13273 UnknownValue(egress_option::UnknownValue),
13274 }
13275
13276 #[doc(hidden)]
13277 pub mod egress_option {
13278 #[allow(unused_imports)]
13279 use super::*;
13280 #[derive(Clone, Debug, PartialEq)]
13281 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13282 }
13283
13284 impl EgressOption {
13285 /// Gets the enum value.
13286 ///
13287 /// Returns `None` if the enum contains an unknown value deserialized from
13288 /// the string representation of enums.
13289 pub fn value(&self) -> std::option::Option<i32> {
13290 match self {
13291 Self::Unspecified => std::option::Option::Some(0),
13292 Self::NoPublicEgress => std::option::Option::Some(1),
13293 Self::PublicEgress => std::option::Option::Some(2),
13294 Self::UnknownValue(u) => u.0.value(),
13295 }
13296 }
13297
13298 /// Gets the enum value as a string.
13299 ///
13300 /// Returns `None` if the enum contains an unknown value deserialized from
13301 /// the integer representation of enums.
13302 pub fn name(&self) -> std::option::Option<&str> {
13303 match self {
13304 Self::Unspecified => std::option::Option::Some("EGRESS_OPTION_UNSPECIFIED"),
13305 Self::NoPublicEgress => std::option::Option::Some("NO_PUBLIC_EGRESS"),
13306 Self::PublicEgress => std::option::Option::Some("PUBLIC_EGRESS"),
13307 Self::UnknownValue(u) => u.0.name(),
13308 }
13309 }
13310 }
13311
13312 impl std::default::Default for EgressOption {
13313 fn default() -> Self {
13314 use std::convert::From;
13315 Self::from(0)
13316 }
13317 }
13318
13319 impl std::fmt::Display for EgressOption {
13320 fn fmt(
13321 &self,
13322 f: &mut std::fmt::Formatter<'_>,
13323 ) -> std::result::Result<(), std::fmt::Error> {
13324 wkt::internal::display_enum(f, self.name(), self.value())
13325 }
13326 }
13327
13328 impl std::convert::From<i32> for EgressOption {
13329 fn from(value: i32) -> Self {
13330 match value {
13331 0 => Self::Unspecified,
13332 1 => Self::NoPublicEgress,
13333 2 => Self::PublicEgress,
13334 _ => Self::UnknownValue(egress_option::UnknownValue(
13335 wkt::internal::UnknownEnumValue::Integer(value),
13336 )),
13337 }
13338 }
13339 }
13340
13341 impl std::convert::From<&str> for EgressOption {
13342 fn from(value: &str) -> Self {
13343 use std::string::ToString;
13344 match value {
13345 "EGRESS_OPTION_UNSPECIFIED" => Self::Unspecified,
13346 "NO_PUBLIC_EGRESS" => Self::NoPublicEgress,
13347 "PUBLIC_EGRESS" => Self::PublicEgress,
13348 _ => Self::UnknownValue(egress_option::UnknownValue(
13349 wkt::internal::UnknownEnumValue::String(value.to_string()),
13350 )),
13351 }
13352 }
13353 }
13354
13355 impl serde::ser::Serialize for EgressOption {
13356 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13357 where
13358 S: serde::Serializer,
13359 {
13360 match self {
13361 Self::Unspecified => serializer.serialize_i32(0),
13362 Self::NoPublicEgress => serializer.serialize_i32(1),
13363 Self::PublicEgress => serializer.serialize_i32(2),
13364 Self::UnknownValue(u) => u.0.serialize(serializer),
13365 }
13366 }
13367 }
13368
13369 impl<'de> serde::de::Deserialize<'de> for EgressOption {
13370 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13371 where
13372 D: serde::Deserializer<'de>,
13373 {
13374 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EgressOption>::new(
13375 ".google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig.EgressOption",
13376 ))
13377 }
13378 }
13379 }
13380
13381 /// Defines the Private Service Connect network configuration for the pool.
13382 #[derive(Clone, Default, PartialEq)]
13383 #[non_exhaustive]
13384 pub struct PrivateServiceConnect {
13385 /// Required. Immutable. The network attachment that the worker network
13386 /// interface is peered to. Must be in the format
13387 /// `projects/{project}/regions/{region}/networkAttachments/{networkAttachment}`.
13388 /// The region of network attachment must be the same as the worker pool.
13389 /// See [Network
13390 /// Attachments](https://cloud.google.com/vpc/docs/about-network-attachments)
13391 pub network_attachment: std::string::String,
13392
13393 /// Required. Immutable. Disable public IP on the primary network interface.
13394 ///
13395 /// If true, workers are created without any public address, which prevents
13396 /// network egress to public IPs unless a network proxy is configured.
13397 /// If false, workers are created with a public address which allows for
13398 /// public internet egress. The public address only applies to traffic
13399 /// through the primary network interface.
13400 /// If `route_all_traffic` is set to true, all traffic will go through the
13401 /// non-primary network interface, this boolean has no effect.
13402 pub public_ip_address_disabled: bool,
13403
13404 /// Immutable. Route all traffic through PSC interface. Enable this if you
13405 /// want full control of traffic in the private pool. Configure Cloud NAT for
13406 /// the subnet of network attachment if you need to access public Internet.
13407 ///
13408 /// If false, Only route RFC 1918 (10.0.0.0/8, 172.16.0.0/12, and
13409 /// 192.168.0.0/16) and RFC 6598 (100.64.0.0/10) through PSC interface.
13410 pub route_all_traffic: bool,
13411
13412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13413 }
13414
13415 impl PrivateServiceConnect {
13416 /// Creates a new default instance.
13417 pub fn new() -> Self {
13418 std::default::Default::default()
13419 }
13420
13421 /// Sets the value of [network_attachment][crate::model::private_pool_v_1_config::PrivateServiceConnect::network_attachment].
13422 ///
13423 /// # Example
13424 /// ```ignore,no_run
13425 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13426 /// let x = PrivateServiceConnect::new().set_network_attachment("example");
13427 /// ```
13428 pub fn set_network_attachment<T: std::convert::Into<std::string::String>>(
13429 mut self,
13430 v: T,
13431 ) -> Self {
13432 self.network_attachment = v.into();
13433 self
13434 }
13435
13436 /// Sets the value of [public_ip_address_disabled][crate::model::private_pool_v_1_config::PrivateServiceConnect::public_ip_address_disabled].
13437 ///
13438 /// # Example
13439 /// ```ignore,no_run
13440 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13441 /// let x = PrivateServiceConnect::new().set_public_ip_address_disabled(true);
13442 /// ```
13443 pub fn set_public_ip_address_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13444 self.public_ip_address_disabled = v.into();
13445 self
13446 }
13447
13448 /// Sets the value of [route_all_traffic][crate::model::private_pool_v_1_config::PrivateServiceConnect::route_all_traffic].
13449 ///
13450 /// # Example
13451 /// ```ignore,no_run
13452 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13453 /// let x = PrivateServiceConnect::new().set_route_all_traffic(true);
13454 /// ```
13455 pub fn set_route_all_traffic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13456 self.route_all_traffic = v.into();
13457 self
13458 }
13459 }
13460
13461 impl wkt::message::Message for PrivateServiceConnect {
13462 fn typename() -> &'static str {
13463 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.PrivateServiceConnect"
13464 }
13465 }
13466}
13467
13468/// Request to create a new `WorkerPool`.
13469#[derive(Clone, Default, PartialEq)]
13470#[non_exhaustive]
13471pub struct CreateWorkerPoolRequest {
13472 /// Required. The parent resource where this worker pool will be created.
13473 /// Format: `projects/{project}/locations/{location}`.
13474 pub parent: std::string::String,
13475
13476 /// Required. `WorkerPool` resource to create.
13477 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13478
13479 /// Required. Immutable. The ID to use for the `WorkerPool`, which will become
13480 /// the final component of the resource name.
13481 ///
13482 /// This value should be 1-63 characters, and valid characters
13483 /// are /[a-z][0-9]-/.
13484 pub worker_pool_id: std::string::String,
13485
13486 /// If set, validate the request and preview the response, but do not actually
13487 /// post it.
13488 pub validate_only: bool,
13489
13490 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13491}
13492
13493impl CreateWorkerPoolRequest {
13494 /// Creates a new default instance.
13495 pub fn new() -> Self {
13496 std::default::Default::default()
13497 }
13498
13499 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
13500 ///
13501 /// # Example
13502 /// ```ignore,no_run
13503 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13504 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
13505 /// ```
13506 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13507 self.parent = v.into();
13508 self
13509 }
13510
13511 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13512 ///
13513 /// # Example
13514 /// ```ignore,no_run
13515 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13516 /// use google_cloud_build_v1::model::WorkerPool;
13517 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13518 /// ```
13519 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13520 where
13521 T: std::convert::Into<crate::model::WorkerPool>,
13522 {
13523 self.worker_pool = std::option::Option::Some(v.into());
13524 self
13525 }
13526
13527 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13528 ///
13529 /// # Example
13530 /// ```ignore,no_run
13531 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13532 /// use google_cloud_build_v1::model::WorkerPool;
13533 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13534 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13535 /// ```
13536 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13537 where
13538 T: std::convert::Into<crate::model::WorkerPool>,
13539 {
13540 self.worker_pool = v.map(|x| x.into());
13541 self
13542 }
13543
13544 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
13545 ///
13546 /// # Example
13547 /// ```ignore,no_run
13548 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13549 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
13550 /// ```
13551 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13552 self.worker_pool_id = v.into();
13553 self
13554 }
13555
13556 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
13557 ///
13558 /// # Example
13559 /// ```ignore,no_run
13560 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13561 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
13562 /// ```
13563 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13564 self.validate_only = v.into();
13565 self
13566 }
13567}
13568
13569impl wkt::message::Message for CreateWorkerPoolRequest {
13570 fn typename() -> &'static str {
13571 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolRequest"
13572 }
13573}
13574
13575/// Request to get a `WorkerPool` with the specified name.
13576#[derive(Clone, Default, PartialEq)]
13577#[non_exhaustive]
13578pub struct GetWorkerPoolRequest {
13579 /// Required. The name of the `WorkerPool` to retrieve.
13580 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13581 pub name: std::string::String,
13582
13583 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13584}
13585
13586impl GetWorkerPoolRequest {
13587 /// Creates a new default instance.
13588 pub fn new() -> Self {
13589 std::default::Default::default()
13590 }
13591
13592 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
13593 ///
13594 /// # Example
13595 /// ```ignore,no_run
13596 /// # use google_cloud_build_v1::model::GetWorkerPoolRequest;
13597 /// # let project_id = "project_id";
13598 /// # let location_id = "location_id";
13599 /// # let worker_pool_id = "worker_pool_id";
13600 /// let x = GetWorkerPoolRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
13601 /// ```
13602 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13603 self.name = v.into();
13604 self
13605 }
13606}
13607
13608impl wkt::message::Message for GetWorkerPoolRequest {
13609 fn typename() -> &'static str {
13610 "type.googleapis.com/google.devtools.cloudbuild.v1.GetWorkerPoolRequest"
13611 }
13612}
13613
13614/// Request to delete a `WorkerPool`.
13615#[derive(Clone, Default, PartialEq)]
13616#[non_exhaustive]
13617pub struct DeleteWorkerPoolRequest {
13618 /// Required. The name of the `WorkerPool` to delete.
13619 /// Format:
13620 /// `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13621 pub name: std::string::String,
13622
13623 /// Optional. If provided, it must match the server's etag on the workerpool
13624 /// for the request to be processed.
13625 pub etag: std::string::String,
13626
13627 /// If set to true, and the `WorkerPool` is not found, the request will succeed
13628 /// but no action will be taken on the server.
13629 pub allow_missing: bool,
13630
13631 /// If set, validate the request and preview the response, but do not actually
13632 /// post it.
13633 pub validate_only: bool,
13634
13635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13636}
13637
13638impl DeleteWorkerPoolRequest {
13639 /// Creates a new default instance.
13640 pub fn new() -> Self {
13641 std::default::Default::default()
13642 }
13643
13644 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
13645 ///
13646 /// # Example
13647 /// ```ignore,no_run
13648 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13649 /// # let project_id = "project_id";
13650 /// # let location_id = "location_id";
13651 /// # let worker_pool_id = "worker_pool_id";
13652 /// let x = DeleteWorkerPoolRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
13653 /// ```
13654 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13655 self.name = v.into();
13656 self
13657 }
13658
13659 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
13660 ///
13661 /// # Example
13662 /// ```ignore,no_run
13663 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13664 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
13665 /// ```
13666 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13667 self.etag = v.into();
13668 self
13669 }
13670
13671 /// Sets the value of [allow_missing][crate::model::DeleteWorkerPoolRequest::allow_missing].
13672 ///
13673 /// # Example
13674 /// ```ignore,no_run
13675 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13676 /// let x = DeleteWorkerPoolRequest::new().set_allow_missing(true);
13677 /// ```
13678 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13679 self.allow_missing = v.into();
13680 self
13681 }
13682
13683 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
13684 ///
13685 /// # Example
13686 /// ```ignore,no_run
13687 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13688 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
13689 /// ```
13690 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13691 self.validate_only = v.into();
13692 self
13693 }
13694}
13695
13696impl wkt::message::Message for DeleteWorkerPoolRequest {
13697 fn typename() -> &'static str {
13698 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest"
13699 }
13700}
13701
13702/// Request to update a `WorkerPool`.
13703#[derive(Clone, Default, PartialEq)]
13704#[non_exhaustive]
13705pub struct UpdateWorkerPoolRequest {
13706 /// Required. The `WorkerPool` to update.
13707 ///
13708 /// The `name` field is used to identify the `WorkerPool` to update.
13709 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13710 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13711
13712 /// Optional. A mask specifying which fields in `worker_pool` to update.
13713 pub update_mask: std::option::Option<wkt::FieldMask>,
13714
13715 /// If set, validate the request and preview the response, but do not actually
13716 /// post it.
13717 pub validate_only: bool,
13718
13719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13720}
13721
13722impl UpdateWorkerPoolRequest {
13723 /// Creates a new default instance.
13724 pub fn new() -> Self {
13725 std::default::Default::default()
13726 }
13727
13728 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13729 ///
13730 /// # Example
13731 /// ```ignore,no_run
13732 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13733 /// use google_cloud_build_v1::model::WorkerPool;
13734 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13735 /// ```
13736 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13737 where
13738 T: std::convert::Into<crate::model::WorkerPool>,
13739 {
13740 self.worker_pool = std::option::Option::Some(v.into());
13741 self
13742 }
13743
13744 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13745 ///
13746 /// # Example
13747 /// ```ignore,no_run
13748 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13749 /// use google_cloud_build_v1::model::WorkerPool;
13750 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13751 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13752 /// ```
13753 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13754 where
13755 T: std::convert::Into<crate::model::WorkerPool>,
13756 {
13757 self.worker_pool = v.map(|x| x.into());
13758 self
13759 }
13760
13761 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13762 ///
13763 /// # Example
13764 /// ```ignore,no_run
13765 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13766 /// use wkt::FieldMask;
13767 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13768 /// ```
13769 pub fn set_update_mask<T>(mut self, v: T) -> Self
13770 where
13771 T: std::convert::Into<wkt::FieldMask>,
13772 {
13773 self.update_mask = std::option::Option::Some(v.into());
13774 self
13775 }
13776
13777 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13778 ///
13779 /// # Example
13780 /// ```ignore,no_run
13781 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13782 /// use wkt::FieldMask;
13783 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13784 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13785 /// ```
13786 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13787 where
13788 T: std::convert::Into<wkt::FieldMask>,
13789 {
13790 self.update_mask = v.map(|x| x.into());
13791 self
13792 }
13793
13794 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
13795 ///
13796 /// # Example
13797 /// ```ignore,no_run
13798 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13799 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
13800 /// ```
13801 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13802 self.validate_only = v.into();
13803 self
13804 }
13805}
13806
13807impl wkt::message::Message for UpdateWorkerPoolRequest {
13808 fn typename() -> &'static str {
13809 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest"
13810 }
13811}
13812
13813/// Request to list `WorkerPool`s.
13814#[derive(Clone, Default, PartialEq)]
13815#[non_exhaustive]
13816pub struct ListWorkerPoolsRequest {
13817 /// Required. The parent of the collection of `WorkerPools`.
13818 /// Format: `projects/{project}/locations/{location}`.
13819 pub parent: std::string::String,
13820
13821 /// The maximum number of `WorkerPool`s to return. The service may return
13822 /// fewer than this value. If omitted, the server will use a sensible default.
13823 pub page_size: i32,
13824
13825 /// A page token, received from a previous `ListWorkerPools` call. Provide this
13826 /// to retrieve the subsequent page.
13827 pub page_token: std::string::String,
13828
13829 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13830}
13831
13832impl ListWorkerPoolsRequest {
13833 /// Creates a new default instance.
13834 pub fn new() -> Self {
13835 std::default::Default::default()
13836 }
13837
13838 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
13839 ///
13840 /// # Example
13841 /// ```ignore,no_run
13842 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13843 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
13844 /// ```
13845 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13846 self.parent = v.into();
13847 self
13848 }
13849
13850 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
13851 ///
13852 /// # Example
13853 /// ```ignore,no_run
13854 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13855 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
13856 /// ```
13857 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13858 self.page_size = v.into();
13859 self
13860 }
13861
13862 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
13863 ///
13864 /// # Example
13865 /// ```ignore,no_run
13866 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13867 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
13868 /// ```
13869 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13870 self.page_token = v.into();
13871 self
13872 }
13873}
13874
13875impl wkt::message::Message for ListWorkerPoolsRequest {
13876 fn typename() -> &'static str {
13877 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsRequest"
13878 }
13879}
13880
13881/// Response containing existing `WorkerPools`.
13882#[derive(Clone, Default, PartialEq)]
13883#[non_exhaustive]
13884pub struct ListWorkerPoolsResponse {
13885 /// `WorkerPools` for the specified project.
13886 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
13887
13888 /// Continuation token used to page through large result sets. Provide this
13889 /// value in a subsequent ListWorkerPoolsRequest to return the next page of
13890 /// results.
13891 pub next_page_token: std::string::String,
13892
13893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13894}
13895
13896impl ListWorkerPoolsResponse {
13897 /// Creates a new default instance.
13898 pub fn new() -> Self {
13899 std::default::Default::default()
13900 }
13901
13902 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
13903 ///
13904 /// # Example
13905 /// ```ignore,no_run
13906 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13907 /// use google_cloud_build_v1::model::WorkerPool;
13908 /// let x = ListWorkerPoolsResponse::new()
13909 /// .set_worker_pools([
13910 /// WorkerPool::default()/* use setters */,
13911 /// WorkerPool::default()/* use (different) setters */,
13912 /// ]);
13913 /// ```
13914 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
13915 where
13916 T: std::iter::IntoIterator<Item = V>,
13917 V: std::convert::Into<crate::model::WorkerPool>,
13918 {
13919 use std::iter::Iterator;
13920 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
13921 self
13922 }
13923
13924 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
13925 ///
13926 /// # Example
13927 /// ```ignore,no_run
13928 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13929 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
13930 /// ```
13931 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13932 self.next_page_token = v.into();
13933 self
13934 }
13935}
13936
13937impl wkt::message::Message for ListWorkerPoolsResponse {
13938 fn typename() -> &'static str {
13939 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsResponse"
13940 }
13941}
13942
13943#[doc(hidden)]
13944impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
13945 type PageItem = crate::model::WorkerPool;
13946
13947 fn items(self) -> std::vec::Vec<Self::PageItem> {
13948 self.worker_pools
13949 }
13950
13951 fn next_page_token(&self) -> std::string::String {
13952 use std::clone::Clone;
13953 self.next_page_token.clone()
13954 }
13955}
13956
13957/// Metadata for the `CreateWorkerPool` operation.
13958#[derive(Clone, Default, PartialEq)]
13959#[non_exhaustive]
13960pub struct CreateWorkerPoolOperationMetadata {
13961 /// The resource name of the `WorkerPool` to create.
13962 /// Format:
13963 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13964 pub worker_pool: std::string::String,
13965
13966 /// Time the operation was created.
13967 pub create_time: std::option::Option<wkt::Timestamp>,
13968
13969 /// Time the operation was completed.
13970 pub complete_time: std::option::Option<wkt::Timestamp>,
13971
13972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13973}
13974
13975impl CreateWorkerPoolOperationMetadata {
13976 /// Creates a new default instance.
13977 pub fn new() -> Self {
13978 std::default::Default::default()
13979 }
13980
13981 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolOperationMetadata::worker_pool].
13982 ///
13983 /// # Example
13984 /// ```ignore,no_run
13985 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13986 /// # let project_id = "project_id";
13987 /// # let location_id = "location_id";
13988 /// # let worker_pool_id = "worker_pool_id";
13989 /// let x = CreateWorkerPoolOperationMetadata::new().set_worker_pool(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
13990 /// ```
13991 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13992 self.worker_pool = v.into();
13993 self
13994 }
13995
13996 /// Sets the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13997 ///
13998 /// # Example
13999 /// ```ignore,no_run
14000 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
14001 /// use wkt::Timestamp;
14002 /// let x = CreateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14003 /// ```
14004 pub fn set_create_time<T>(mut self, v: T) -> Self
14005 where
14006 T: std::convert::Into<wkt::Timestamp>,
14007 {
14008 self.create_time = std::option::Option::Some(v.into());
14009 self
14010 }
14011
14012 /// Sets or clears the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
14013 ///
14014 /// # Example
14015 /// ```ignore,no_run
14016 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
14017 /// use wkt::Timestamp;
14018 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14019 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14020 /// ```
14021 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14022 where
14023 T: std::convert::Into<wkt::Timestamp>,
14024 {
14025 self.create_time = v.map(|x| x.into());
14026 self
14027 }
14028
14029 /// Sets the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
14030 ///
14031 /// # Example
14032 /// ```ignore,no_run
14033 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
14034 /// use wkt::Timestamp;
14035 /// let x = CreateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14036 /// ```
14037 pub fn set_complete_time<T>(mut self, v: T) -> Self
14038 where
14039 T: std::convert::Into<wkt::Timestamp>,
14040 {
14041 self.complete_time = std::option::Option::Some(v.into());
14042 self
14043 }
14044
14045 /// Sets or clears the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
14046 ///
14047 /// # Example
14048 /// ```ignore,no_run
14049 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
14050 /// use wkt::Timestamp;
14051 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14052 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14053 /// ```
14054 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14055 where
14056 T: std::convert::Into<wkt::Timestamp>,
14057 {
14058 self.complete_time = v.map(|x| x.into());
14059 self
14060 }
14061}
14062
14063impl wkt::message::Message for CreateWorkerPoolOperationMetadata {
14064 fn typename() -> &'static str {
14065 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata"
14066 }
14067}
14068
14069/// Metadata for the `UpdateWorkerPool` operation.
14070#[derive(Clone, Default, PartialEq)]
14071#[non_exhaustive]
14072pub struct UpdateWorkerPoolOperationMetadata {
14073 /// The resource name of the `WorkerPool` being updated.
14074 /// Format:
14075 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14076 pub worker_pool: std::string::String,
14077
14078 /// Time the operation was created.
14079 pub create_time: std::option::Option<wkt::Timestamp>,
14080
14081 /// Time the operation was completed.
14082 pub complete_time: std::option::Option<wkt::Timestamp>,
14083
14084 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14085}
14086
14087impl UpdateWorkerPoolOperationMetadata {
14088 /// Creates a new default instance.
14089 pub fn new() -> Self {
14090 std::default::Default::default()
14091 }
14092
14093 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolOperationMetadata::worker_pool].
14094 ///
14095 /// # Example
14096 /// ```ignore,no_run
14097 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14098 /// # let project_id = "project_id";
14099 /// # let location_id = "location_id";
14100 /// # let worker_pool_id = "worker_pool_id";
14101 /// let x = UpdateWorkerPoolOperationMetadata::new().set_worker_pool(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
14102 /// ```
14103 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14104 self.worker_pool = v.into();
14105 self
14106 }
14107
14108 /// Sets the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
14109 ///
14110 /// # Example
14111 /// ```ignore,no_run
14112 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14113 /// use wkt::Timestamp;
14114 /// let x = UpdateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14115 /// ```
14116 pub fn set_create_time<T>(mut self, v: T) -> Self
14117 where
14118 T: std::convert::Into<wkt::Timestamp>,
14119 {
14120 self.create_time = std::option::Option::Some(v.into());
14121 self
14122 }
14123
14124 /// Sets or clears the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
14125 ///
14126 /// # Example
14127 /// ```ignore,no_run
14128 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14129 /// use wkt::Timestamp;
14130 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14131 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14132 /// ```
14133 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14134 where
14135 T: std::convert::Into<wkt::Timestamp>,
14136 {
14137 self.create_time = v.map(|x| x.into());
14138 self
14139 }
14140
14141 /// Sets the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
14142 ///
14143 /// # Example
14144 /// ```ignore,no_run
14145 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14146 /// use wkt::Timestamp;
14147 /// let x = UpdateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14148 /// ```
14149 pub fn set_complete_time<T>(mut self, v: T) -> Self
14150 where
14151 T: std::convert::Into<wkt::Timestamp>,
14152 {
14153 self.complete_time = std::option::Option::Some(v.into());
14154 self
14155 }
14156
14157 /// Sets or clears the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
14158 ///
14159 /// # Example
14160 /// ```ignore,no_run
14161 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14162 /// use wkt::Timestamp;
14163 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14164 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14165 /// ```
14166 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14167 where
14168 T: std::convert::Into<wkt::Timestamp>,
14169 {
14170 self.complete_time = v.map(|x| x.into());
14171 self
14172 }
14173}
14174
14175impl wkt::message::Message for UpdateWorkerPoolOperationMetadata {
14176 fn typename() -> &'static str {
14177 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata"
14178 }
14179}
14180
14181/// Metadata for the `DeleteWorkerPool` operation.
14182#[derive(Clone, Default, PartialEq)]
14183#[non_exhaustive]
14184pub struct DeleteWorkerPoolOperationMetadata {
14185 /// The resource name of the `WorkerPool` being deleted.
14186 /// Format:
14187 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14188 pub worker_pool: std::string::String,
14189
14190 /// Time the operation was created.
14191 pub create_time: std::option::Option<wkt::Timestamp>,
14192
14193 /// Time the operation was completed.
14194 pub complete_time: std::option::Option<wkt::Timestamp>,
14195
14196 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14197}
14198
14199impl DeleteWorkerPoolOperationMetadata {
14200 /// Creates a new default instance.
14201 pub fn new() -> Self {
14202 std::default::Default::default()
14203 }
14204
14205 /// Sets the value of [worker_pool][crate::model::DeleteWorkerPoolOperationMetadata::worker_pool].
14206 ///
14207 /// # Example
14208 /// ```ignore,no_run
14209 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14210 /// # let project_id = "project_id";
14211 /// # let location_id = "location_id";
14212 /// # let worker_pool_id = "worker_pool_id";
14213 /// let x = DeleteWorkerPoolOperationMetadata::new().set_worker_pool(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
14214 /// ```
14215 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14216 self.worker_pool = v.into();
14217 self
14218 }
14219
14220 /// Sets the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14221 ///
14222 /// # Example
14223 /// ```ignore,no_run
14224 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14225 /// use wkt::Timestamp;
14226 /// let x = DeleteWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14227 /// ```
14228 pub fn set_create_time<T>(mut self, v: T) -> Self
14229 where
14230 T: std::convert::Into<wkt::Timestamp>,
14231 {
14232 self.create_time = std::option::Option::Some(v.into());
14233 self
14234 }
14235
14236 /// Sets or clears the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14237 ///
14238 /// # Example
14239 /// ```ignore,no_run
14240 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14241 /// use wkt::Timestamp;
14242 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14243 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14244 /// ```
14245 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14246 where
14247 T: std::convert::Into<wkt::Timestamp>,
14248 {
14249 self.create_time = v.map(|x| x.into());
14250 self
14251 }
14252
14253 /// Sets the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14254 ///
14255 /// # Example
14256 /// ```ignore,no_run
14257 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14258 /// use wkt::Timestamp;
14259 /// let x = DeleteWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14260 /// ```
14261 pub fn set_complete_time<T>(mut self, v: T) -> Self
14262 where
14263 T: std::convert::Into<wkt::Timestamp>,
14264 {
14265 self.complete_time = std::option::Option::Some(v.into());
14266 self
14267 }
14268
14269 /// Sets or clears the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14270 ///
14271 /// # Example
14272 /// ```ignore,no_run
14273 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14274 /// use wkt::Timestamp;
14275 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14276 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14277 /// ```
14278 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14279 where
14280 T: std::convert::Into<wkt::Timestamp>,
14281 {
14282 self.complete_time = v.map(|x| x.into());
14283 self
14284 }
14285}
14286
14287impl wkt::message::Message for DeleteWorkerPoolOperationMetadata {
14288 fn typename() -> &'static str {
14289 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata"
14290 }
14291}