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 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4429 }
4430
4431 impl GitSourceDependency {
4432 /// Creates a new default instance.
4433 pub fn new() -> Self {
4434 std::default::Default::default()
4435 }
4436
4437 /// Sets the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4438 ///
4439 /// # Example
4440 /// ```ignore,no_run
4441 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4442 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4443 /// let x = GitSourceDependency::new().set_repository(GitSourceRepository::default()/* use setters */);
4444 /// ```
4445 pub fn set_repository<T>(mut self, v: T) -> Self
4446 where
4447 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4448 {
4449 self.repository = std::option::Option::Some(v.into());
4450 self
4451 }
4452
4453 /// Sets or clears the value of [repository][crate::model::dependency::GitSourceDependency::repository].
4454 ///
4455 /// # Example
4456 /// ```ignore,no_run
4457 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4458 /// use google_cloud_build_v1::model::dependency::GitSourceRepository;
4459 /// let x = GitSourceDependency::new().set_or_clear_repository(Some(GitSourceRepository::default()/* use setters */));
4460 /// let x = GitSourceDependency::new().set_or_clear_repository(None::<GitSourceRepository>);
4461 /// ```
4462 pub fn set_or_clear_repository<T>(mut self, v: std::option::Option<T>) -> Self
4463 where
4464 T: std::convert::Into<crate::model::dependency::GitSourceRepository>,
4465 {
4466 self.repository = v.map(|x| x.into());
4467 self
4468 }
4469
4470 /// Sets the value of [revision][crate::model::dependency::GitSourceDependency::revision].
4471 ///
4472 /// # Example
4473 /// ```ignore,no_run
4474 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4475 /// let x = GitSourceDependency::new().set_revision("example");
4476 /// ```
4477 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4478 self.revision = v.into();
4479 self
4480 }
4481
4482 /// Sets the value of [recurse_submodules][crate::model::dependency::GitSourceDependency::recurse_submodules].
4483 ///
4484 /// # Example
4485 /// ```ignore,no_run
4486 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4487 /// let x = GitSourceDependency::new().set_recurse_submodules(true);
4488 /// ```
4489 pub fn set_recurse_submodules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4490 self.recurse_submodules = v.into();
4491 self
4492 }
4493
4494 /// Sets the value of [depth][crate::model::dependency::GitSourceDependency::depth].
4495 ///
4496 /// # Example
4497 /// ```ignore,no_run
4498 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4499 /// let x = GitSourceDependency::new().set_depth(42);
4500 /// ```
4501 pub fn set_depth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4502 self.depth = v.into();
4503 self
4504 }
4505
4506 /// Sets the value of [dest_path][crate::model::dependency::GitSourceDependency::dest_path].
4507 ///
4508 /// # Example
4509 /// ```ignore,no_run
4510 /// # use google_cloud_build_v1::model::dependency::GitSourceDependency;
4511 /// let x = GitSourceDependency::new().set_dest_path("example");
4512 /// ```
4513 pub fn set_dest_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4514 self.dest_path = v.into();
4515 self
4516 }
4517 }
4518
4519 impl wkt::message::Message for GitSourceDependency {
4520 fn typename() -> &'static str {
4521 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceDependency"
4522 }
4523 }
4524
4525 /// A repository for a git source.
4526 #[derive(Clone, Default, PartialEq)]
4527 #[non_exhaustive]
4528 pub struct GitSourceRepository {
4529 /// The type of git source repo (url or dev connect).
4530 pub repotype:
4531 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4532
4533 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4534 }
4535
4536 impl GitSourceRepository {
4537 /// Creates a new default instance.
4538 pub fn new() -> Self {
4539 std::default::Default::default()
4540 }
4541
4542 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype].
4543 ///
4544 /// Note that all the setters affecting `repotype` are mutually
4545 /// exclusive.
4546 ///
4547 /// # Example
4548 /// ```ignore,no_run
4549 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4550 /// use google_cloud_build_v1::model::dependency::git_source_repository::Repotype;
4551 /// let x = GitSourceRepository::new().set_repotype(Some(Repotype::Url("example".to_string())));
4552 /// ```
4553 pub fn set_repotype<
4554 T: std::convert::Into<
4555 std::option::Option<crate::model::dependency::git_source_repository::Repotype>,
4556 >,
4557 >(
4558 mut self,
4559 v: T,
4560 ) -> Self {
4561 self.repotype = v.into();
4562 self
4563 }
4564
4565 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4566 /// if it holds a `Url`, `None` if the field is not set or
4567 /// holds a different branch.
4568 pub fn url(&self) -> std::option::Option<&std::string::String> {
4569 #[allow(unreachable_patterns)]
4570 self.repotype.as_ref().and_then(|v| match v {
4571 crate::model::dependency::git_source_repository::Repotype::Url(v) => {
4572 std::option::Option::Some(v)
4573 }
4574 _ => std::option::Option::None,
4575 })
4576 }
4577
4578 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4579 /// to hold a `Url`.
4580 ///
4581 /// Note that all the setters affecting `repotype` are
4582 /// mutually exclusive.
4583 ///
4584 /// # Example
4585 /// ```ignore,no_run
4586 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4587 /// let x = GitSourceRepository::new().set_url("example");
4588 /// assert!(x.url().is_some());
4589 /// assert!(x.developer_connect().is_none());
4590 /// ```
4591 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4592 self.repotype = std::option::Option::Some(
4593 crate::model::dependency::git_source_repository::Repotype::Url(v.into()),
4594 );
4595 self
4596 }
4597
4598 /// The value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4599 /// if it holds a `DeveloperConnect`, `None` if the field is not set or
4600 /// holds a different branch.
4601 pub fn developer_connect(&self) -> std::option::Option<&std::string::String> {
4602 #[allow(unreachable_patterns)]
4603 self.repotype.as_ref().and_then(|v| match v {
4604 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(v) => {
4605 std::option::Option::Some(v)
4606 }
4607 _ => std::option::Option::None,
4608 })
4609 }
4610
4611 /// Sets the value of [repotype][crate::model::dependency::GitSourceRepository::repotype]
4612 /// to hold a `DeveloperConnect`.
4613 ///
4614 /// Note that all the setters affecting `repotype` are
4615 /// mutually exclusive.
4616 ///
4617 /// # Example
4618 /// ```ignore,no_run
4619 /// # use google_cloud_build_v1::model::dependency::GitSourceRepository;
4620 /// let x = GitSourceRepository::new().set_developer_connect("example");
4621 /// assert!(x.developer_connect().is_some());
4622 /// assert!(x.url().is_none());
4623 /// ```
4624 pub fn set_developer_connect<T: std::convert::Into<std::string::String>>(
4625 mut self,
4626 v: T,
4627 ) -> Self {
4628 self.repotype = std::option::Option::Some(
4629 crate::model::dependency::git_source_repository::Repotype::DeveloperConnect(
4630 v.into(),
4631 ),
4632 );
4633 self
4634 }
4635 }
4636
4637 impl wkt::message::Message for GitSourceRepository {
4638 fn typename() -> &'static str {
4639 "type.googleapis.com/google.devtools.cloudbuild.v1.Dependency.GitSourceRepository"
4640 }
4641 }
4642
4643 /// Defines additional types related to [GitSourceRepository].
4644 pub mod git_source_repository {
4645 #[allow(unused_imports)]
4646 use super::*;
4647
4648 /// The type of git source repo (url or dev connect).
4649 #[derive(Clone, Debug, PartialEq)]
4650 #[non_exhaustive]
4651 pub enum Repotype {
4652 /// Location of the Git repository.
4653 Url(std::string::String),
4654 /// The Developer Connect Git repository link formatted as
4655 /// `projects/*/locations/*/connections/*/gitRepositoryLink/*`
4656 DeveloperConnect(std::string::String),
4657 }
4658 }
4659
4660 /// The type of dependency to fetch.
4661 #[derive(Clone, Debug, PartialEq)]
4662 #[non_exhaustive]
4663 pub enum Dep {
4664 /// If set to true disable all dependency fetching (ignoring the default
4665 /// source as well).
4666 Empty(bool),
4667 /// Represents a git repository as a build dependency.
4668 GitSource(std::boxed::Box<crate::model::dependency::GitSourceDependency>),
4669 }
4670}
4671
4672/// GitConfig is a configuration for git operations.
4673#[derive(Clone, Default, PartialEq)]
4674#[non_exhaustive]
4675pub struct GitConfig {
4676 /// Configuration for HTTP related git operations.
4677 pub http: std::option::Option<crate::model::git_config::HttpConfig>,
4678
4679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4680}
4681
4682impl GitConfig {
4683 /// Creates a new default instance.
4684 pub fn new() -> Self {
4685 std::default::Default::default()
4686 }
4687
4688 /// Sets the value of [http][crate::model::GitConfig::http].
4689 ///
4690 /// # Example
4691 /// ```ignore,no_run
4692 /// # use google_cloud_build_v1::model::GitConfig;
4693 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4694 /// let x = GitConfig::new().set_http(HttpConfig::default()/* use setters */);
4695 /// ```
4696 pub fn set_http<T>(mut self, v: T) -> Self
4697 where
4698 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4699 {
4700 self.http = std::option::Option::Some(v.into());
4701 self
4702 }
4703
4704 /// Sets or clears the value of [http][crate::model::GitConfig::http].
4705 ///
4706 /// # Example
4707 /// ```ignore,no_run
4708 /// # use google_cloud_build_v1::model::GitConfig;
4709 /// use google_cloud_build_v1::model::git_config::HttpConfig;
4710 /// let x = GitConfig::new().set_or_clear_http(Some(HttpConfig::default()/* use setters */));
4711 /// let x = GitConfig::new().set_or_clear_http(None::<HttpConfig>);
4712 /// ```
4713 pub fn set_or_clear_http<T>(mut self, v: std::option::Option<T>) -> Self
4714 where
4715 T: std::convert::Into<crate::model::git_config::HttpConfig>,
4716 {
4717 self.http = v.map(|x| x.into());
4718 self
4719 }
4720}
4721
4722impl wkt::message::Message for GitConfig {
4723 fn typename() -> &'static str {
4724 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig"
4725 }
4726}
4727
4728/// Defines additional types related to [GitConfig].
4729pub mod git_config {
4730 #[allow(unused_imports)]
4731 use super::*;
4732
4733 /// HttpConfig is a configuration for HTTP related git operations.
4734 #[derive(Clone, Default, PartialEq)]
4735 #[non_exhaustive]
4736 pub struct HttpConfig {
4737 /// SecretVersion resource of the HTTP proxy URL. The Service Account used in
4738 /// the build (either the default Service Account or
4739 /// user-specified Service Account) should have
4740 /// `secretmanager.versions.access` permissions on this secret. The proxy URL
4741 /// should be in format `[protocol://][user[:password]@]proxyhost[:port]`.
4742 pub proxy_secret_version_name: std::string::String,
4743
4744 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4745 }
4746
4747 impl HttpConfig {
4748 /// Creates a new default instance.
4749 pub fn new() -> Self {
4750 std::default::Default::default()
4751 }
4752
4753 /// Sets the value of [proxy_secret_version_name][crate::model::git_config::HttpConfig::proxy_secret_version_name].
4754 ///
4755 /// # Example
4756 /// ```ignore,no_run
4757 /// # use google_cloud_build_v1::model::git_config::HttpConfig;
4758 /// let x = HttpConfig::new().set_proxy_secret_version_name("example");
4759 /// ```
4760 pub fn set_proxy_secret_version_name<T: std::convert::Into<std::string::String>>(
4761 mut self,
4762 v: T,
4763 ) -> Self {
4764 self.proxy_secret_version_name = v.into();
4765 self
4766 }
4767 }
4768
4769 impl wkt::message::Message for HttpConfig {
4770 fn typename() -> &'static str {
4771 "type.googleapis.com/google.devtools.cloudbuild.v1.GitConfig.HttpConfig"
4772 }
4773 }
4774}
4775
4776/// Artifacts produced by a build that should be uploaded upon
4777/// successful completion of all build steps.
4778#[derive(Clone, Default, PartialEq)]
4779#[non_exhaustive]
4780pub struct Artifacts {
4781 /// A list of images to be pushed upon the successful completion of all build
4782 /// steps.
4783 ///
4784 /// The images will be pushed using the builder service account's credentials.
4785 ///
4786 /// The digests of the pushed images will be stored in the Build resource's
4787 /// results field.
4788 ///
4789 /// If any of the images fail to be pushed, the build is marked FAILURE.
4790 pub images: std::vec::Vec<std::string::String>,
4791
4792 /// A list of objects to be uploaded to Cloud Storage upon successful
4793 /// completion of all build steps.
4794 ///
4795 /// Files in the workspace matching specified paths globs will be uploaded to
4796 /// the specified Cloud Storage location using the builder service account's
4797 /// credentials.
4798 ///
4799 /// The location and generation of the uploaded objects will be stored in the
4800 /// Build resource's results field.
4801 ///
4802 /// If any objects fail to be pushed, the build is marked FAILURE.
4803 pub objects: std::option::Option<crate::model::artifacts::ArtifactObjects>,
4804
4805 /// A list of Maven artifacts to be uploaded to Artifact Registry upon
4806 /// successful completion of all build steps.
4807 ///
4808 /// Artifacts in the workspace matching specified paths globs will be uploaded
4809 /// to the specified Artifact Registry repository using the builder service
4810 /// account's credentials.
4811 ///
4812 /// If any artifacts fail to be pushed, the build is marked FAILURE.
4813 pub maven_artifacts: std::vec::Vec<crate::model::artifacts::MavenArtifact>,
4814
4815 /// Optional. A list of Go modules to be uploaded to Artifact Registry upon
4816 /// successful completion of all build steps.
4817 ///
4818 /// If any objects fail to be pushed, the build is marked FAILURE.
4819 pub go_modules: std::vec::Vec<crate::model::artifacts::GoModule>,
4820
4821 /// A list of Python packages to be uploaded to Artifact Registry upon
4822 /// successful completion of all build steps.
4823 ///
4824 /// The build service account credentials will be used to perform the upload.
4825 ///
4826 /// If any objects fail to be pushed, the build is marked FAILURE.
4827 pub python_packages: std::vec::Vec<crate::model::artifacts::PythonPackage>,
4828
4829 /// A list of npm packages to be uploaded to Artifact Registry upon
4830 /// successful completion of all build steps.
4831 ///
4832 /// Npm packages in the specified paths will be uploaded
4833 /// to the specified Artifact Registry repository using the builder service
4834 /// account's credentials.
4835 ///
4836 /// If any packages fail to be pushed, the build is marked FAILURE.
4837 pub npm_packages: std::vec::Vec<crate::model::artifacts::NpmPackage>,
4838
4839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4840}
4841
4842impl Artifacts {
4843 /// Creates a new default instance.
4844 pub fn new() -> Self {
4845 std::default::Default::default()
4846 }
4847
4848 /// Sets the value of [images][crate::model::Artifacts::images].
4849 ///
4850 /// # Example
4851 /// ```ignore,no_run
4852 /// # use google_cloud_build_v1::model::Artifacts;
4853 /// let x = Artifacts::new().set_images(["a", "b", "c"]);
4854 /// ```
4855 pub fn set_images<T, V>(mut self, v: T) -> Self
4856 where
4857 T: std::iter::IntoIterator<Item = V>,
4858 V: std::convert::Into<std::string::String>,
4859 {
4860 use std::iter::Iterator;
4861 self.images = v.into_iter().map(|i| i.into()).collect();
4862 self
4863 }
4864
4865 /// Sets the value of [objects][crate::model::Artifacts::objects].
4866 ///
4867 /// # Example
4868 /// ```ignore,no_run
4869 /// # use google_cloud_build_v1::model::Artifacts;
4870 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4871 /// let x = Artifacts::new().set_objects(ArtifactObjects::default()/* use setters */);
4872 /// ```
4873 pub fn set_objects<T>(mut self, v: T) -> Self
4874 where
4875 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4876 {
4877 self.objects = std::option::Option::Some(v.into());
4878 self
4879 }
4880
4881 /// Sets or clears the value of [objects][crate::model::Artifacts::objects].
4882 ///
4883 /// # Example
4884 /// ```ignore,no_run
4885 /// # use google_cloud_build_v1::model::Artifacts;
4886 /// use google_cloud_build_v1::model::artifacts::ArtifactObjects;
4887 /// let x = Artifacts::new().set_or_clear_objects(Some(ArtifactObjects::default()/* use setters */));
4888 /// let x = Artifacts::new().set_or_clear_objects(None::<ArtifactObjects>);
4889 /// ```
4890 pub fn set_or_clear_objects<T>(mut self, v: std::option::Option<T>) -> Self
4891 where
4892 T: std::convert::Into<crate::model::artifacts::ArtifactObjects>,
4893 {
4894 self.objects = v.map(|x| x.into());
4895 self
4896 }
4897
4898 /// Sets the value of [maven_artifacts][crate::model::Artifacts::maven_artifacts].
4899 ///
4900 /// # Example
4901 /// ```ignore,no_run
4902 /// # use google_cloud_build_v1::model::Artifacts;
4903 /// use google_cloud_build_v1::model::artifacts::MavenArtifact;
4904 /// let x = Artifacts::new()
4905 /// .set_maven_artifacts([
4906 /// MavenArtifact::default()/* use setters */,
4907 /// MavenArtifact::default()/* use (different) setters */,
4908 /// ]);
4909 /// ```
4910 pub fn set_maven_artifacts<T, V>(mut self, v: T) -> Self
4911 where
4912 T: std::iter::IntoIterator<Item = V>,
4913 V: std::convert::Into<crate::model::artifacts::MavenArtifact>,
4914 {
4915 use std::iter::Iterator;
4916 self.maven_artifacts = v.into_iter().map(|i| i.into()).collect();
4917 self
4918 }
4919
4920 /// Sets the value of [go_modules][crate::model::Artifacts::go_modules].
4921 ///
4922 /// # Example
4923 /// ```ignore,no_run
4924 /// # use google_cloud_build_v1::model::Artifacts;
4925 /// use google_cloud_build_v1::model::artifacts::GoModule;
4926 /// let x = Artifacts::new()
4927 /// .set_go_modules([
4928 /// GoModule::default()/* use setters */,
4929 /// GoModule::default()/* use (different) setters */,
4930 /// ]);
4931 /// ```
4932 pub fn set_go_modules<T, V>(mut self, v: T) -> Self
4933 where
4934 T: std::iter::IntoIterator<Item = V>,
4935 V: std::convert::Into<crate::model::artifacts::GoModule>,
4936 {
4937 use std::iter::Iterator;
4938 self.go_modules = v.into_iter().map(|i| i.into()).collect();
4939 self
4940 }
4941
4942 /// Sets the value of [python_packages][crate::model::Artifacts::python_packages].
4943 ///
4944 /// # Example
4945 /// ```ignore,no_run
4946 /// # use google_cloud_build_v1::model::Artifacts;
4947 /// use google_cloud_build_v1::model::artifacts::PythonPackage;
4948 /// let x = Artifacts::new()
4949 /// .set_python_packages([
4950 /// PythonPackage::default()/* use setters */,
4951 /// PythonPackage::default()/* use (different) setters */,
4952 /// ]);
4953 /// ```
4954 pub fn set_python_packages<T, V>(mut self, v: T) -> Self
4955 where
4956 T: std::iter::IntoIterator<Item = V>,
4957 V: std::convert::Into<crate::model::artifacts::PythonPackage>,
4958 {
4959 use std::iter::Iterator;
4960 self.python_packages = v.into_iter().map(|i| i.into()).collect();
4961 self
4962 }
4963
4964 /// Sets the value of [npm_packages][crate::model::Artifacts::npm_packages].
4965 ///
4966 /// # Example
4967 /// ```ignore,no_run
4968 /// # use google_cloud_build_v1::model::Artifacts;
4969 /// use google_cloud_build_v1::model::artifacts::NpmPackage;
4970 /// let x = Artifacts::new()
4971 /// .set_npm_packages([
4972 /// NpmPackage::default()/* use setters */,
4973 /// NpmPackage::default()/* use (different) setters */,
4974 /// ]);
4975 /// ```
4976 pub fn set_npm_packages<T, V>(mut self, v: T) -> Self
4977 where
4978 T: std::iter::IntoIterator<Item = V>,
4979 V: std::convert::Into<crate::model::artifacts::NpmPackage>,
4980 {
4981 use std::iter::Iterator;
4982 self.npm_packages = v.into_iter().map(|i| i.into()).collect();
4983 self
4984 }
4985}
4986
4987impl wkt::message::Message for Artifacts {
4988 fn typename() -> &'static str {
4989 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts"
4990 }
4991}
4992
4993/// Defines additional types related to [Artifacts].
4994pub mod artifacts {
4995 #[allow(unused_imports)]
4996 use super::*;
4997
4998 /// Files in the workspace to upload to Cloud Storage upon successful
4999 /// completion of all build steps.
5000 #[derive(Clone, Default, PartialEq)]
5001 #[non_exhaustive]
5002 pub struct ArtifactObjects {
5003 /// Cloud Storage bucket and optional object path, in the form
5004 /// "gs://bucket/path/to/somewhere/". (see [Bucket Name
5005 /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
5006 ///
5007 /// Files in the workspace matching any path pattern will be uploaded to
5008 /// Cloud Storage with this location as a prefix.
5009 pub location: std::string::String,
5010
5011 /// Path globs used to match files in the build's workspace.
5012 pub paths: std::vec::Vec<std::string::String>,
5013
5014 /// Output only. Stores timing information for pushing all artifact objects.
5015 pub timing: std::option::Option<crate::model::TimeSpan>,
5016
5017 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5018 }
5019
5020 impl ArtifactObjects {
5021 /// Creates a new default instance.
5022 pub fn new() -> Self {
5023 std::default::Default::default()
5024 }
5025
5026 /// Sets the value of [location][crate::model::artifacts::ArtifactObjects::location].
5027 ///
5028 /// # Example
5029 /// ```ignore,no_run
5030 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5031 /// let x = ArtifactObjects::new().set_location("example");
5032 /// ```
5033 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5034 self.location = v.into();
5035 self
5036 }
5037
5038 /// Sets the value of [paths][crate::model::artifacts::ArtifactObjects::paths].
5039 ///
5040 /// # Example
5041 /// ```ignore,no_run
5042 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5043 /// let x = ArtifactObjects::new().set_paths(["a", "b", "c"]);
5044 /// ```
5045 pub fn set_paths<T, V>(mut self, v: T) -> Self
5046 where
5047 T: std::iter::IntoIterator<Item = V>,
5048 V: std::convert::Into<std::string::String>,
5049 {
5050 use std::iter::Iterator;
5051 self.paths = v.into_iter().map(|i| i.into()).collect();
5052 self
5053 }
5054
5055 /// Sets the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5056 ///
5057 /// # Example
5058 /// ```ignore,no_run
5059 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5060 /// use google_cloud_build_v1::model::TimeSpan;
5061 /// let x = ArtifactObjects::new().set_timing(TimeSpan::default()/* use setters */);
5062 /// ```
5063 pub fn set_timing<T>(mut self, v: T) -> Self
5064 where
5065 T: std::convert::Into<crate::model::TimeSpan>,
5066 {
5067 self.timing = std::option::Option::Some(v.into());
5068 self
5069 }
5070
5071 /// Sets or clears the value of [timing][crate::model::artifacts::ArtifactObjects::timing].
5072 ///
5073 /// # Example
5074 /// ```ignore,no_run
5075 /// # use google_cloud_build_v1::model::artifacts::ArtifactObjects;
5076 /// use google_cloud_build_v1::model::TimeSpan;
5077 /// let x = ArtifactObjects::new().set_or_clear_timing(Some(TimeSpan::default()/* use setters */));
5078 /// let x = ArtifactObjects::new().set_or_clear_timing(None::<TimeSpan>);
5079 /// ```
5080 pub fn set_or_clear_timing<T>(mut self, v: std::option::Option<T>) -> Self
5081 where
5082 T: std::convert::Into<crate::model::TimeSpan>,
5083 {
5084 self.timing = v.map(|x| x.into());
5085 self
5086 }
5087 }
5088
5089 impl wkt::message::Message for ArtifactObjects {
5090 fn typename() -> &'static str {
5091 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects"
5092 }
5093 }
5094
5095 /// A Maven artifact to upload to Artifact Registry upon successful completion
5096 /// of all build steps.
5097 #[derive(Clone, Default, PartialEq)]
5098 #[non_exhaustive]
5099 pub struct MavenArtifact {
5100 /// Artifact Registry repository, in the form
5101 /// "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY"
5102 ///
5103 /// Artifact in the workspace specified by path will be uploaded to
5104 /// Artifact Registry with this location as a prefix.
5105 pub repository: std::string::String,
5106
5107 /// Optional. Path to an artifact in the build's workspace to be uploaded to
5108 /// Artifact Registry.
5109 /// This can be either an absolute path,
5110 /// e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar
5111 /// or a relative path from /workspace,
5112 /// e.g. my-app/target/my-app-1.0.SNAPSHOT.jar.
5113 pub path: std::string::String,
5114
5115 /// Maven `artifactId` value used when uploading the artifact to Artifact
5116 /// Registry.
5117 pub artifact_id: std::string::String,
5118
5119 /// Maven `groupId` value used when uploading the artifact to Artifact
5120 /// Registry.
5121 pub group_id: std::string::String,
5122
5123 /// Maven `version` value used when uploading the artifact to Artifact
5124 /// Registry.
5125 pub version: std::string::String,
5126
5127 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5128 }
5129
5130 impl MavenArtifact {
5131 /// Creates a new default instance.
5132 pub fn new() -> Self {
5133 std::default::Default::default()
5134 }
5135
5136 /// Sets the value of [repository][crate::model::artifacts::MavenArtifact::repository].
5137 ///
5138 /// # Example
5139 /// ```ignore,no_run
5140 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5141 /// let x = MavenArtifact::new().set_repository("example");
5142 /// ```
5143 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5144 self.repository = v.into();
5145 self
5146 }
5147
5148 /// Sets the value of [path][crate::model::artifacts::MavenArtifact::path].
5149 ///
5150 /// # Example
5151 /// ```ignore,no_run
5152 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5153 /// let x = MavenArtifact::new().set_path("example");
5154 /// ```
5155 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5156 self.path = v.into();
5157 self
5158 }
5159
5160 /// Sets the value of [artifact_id][crate::model::artifacts::MavenArtifact::artifact_id].
5161 ///
5162 /// # Example
5163 /// ```ignore,no_run
5164 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5165 /// let x = MavenArtifact::new().set_artifact_id("example");
5166 /// ```
5167 pub fn set_artifact_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5168 self.artifact_id = v.into();
5169 self
5170 }
5171
5172 /// Sets the value of [group_id][crate::model::artifacts::MavenArtifact::group_id].
5173 ///
5174 /// # Example
5175 /// ```ignore,no_run
5176 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5177 /// let x = MavenArtifact::new().set_group_id("example");
5178 /// ```
5179 pub fn set_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5180 self.group_id = v.into();
5181 self
5182 }
5183
5184 /// Sets the value of [version][crate::model::artifacts::MavenArtifact::version].
5185 ///
5186 /// # Example
5187 /// ```ignore,no_run
5188 /// # use google_cloud_build_v1::model::artifacts::MavenArtifact;
5189 /// let x = MavenArtifact::new().set_version("example");
5190 /// ```
5191 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5192 self.version = v.into();
5193 self
5194 }
5195 }
5196
5197 impl wkt::message::Message for MavenArtifact {
5198 fn typename() -> &'static str {
5199 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.MavenArtifact"
5200 }
5201 }
5202
5203 /// Go module to upload to Artifact Registry upon successful completion of all
5204 /// build steps. A module refers to all dependencies in a go.mod file.
5205 #[derive(Clone, Default, PartialEq)]
5206 #[non_exhaustive]
5207 pub struct GoModule {
5208 /// Optional. Artifact Registry repository name.
5209 ///
5210 /// Specified Go modules will be zipped and uploaded to Artifact Registry
5211 /// with this location as a prefix.
5212 /// e.g. my-go-repo
5213 pub repository_name: std::string::String,
5214
5215 /// Optional. Location of the Artifact Registry repository. i.e. us-east1
5216 /// Defaults to the build’s location.
5217 pub repository_location: std::string::String,
5218
5219 /// Optional. Project ID of the Artifact Registry repository.
5220 /// Defaults to the build project.
5221 pub repository_project_id: std::string::String,
5222
5223 /// Optional. Source path of the go.mod file in the build's workspace. If not
5224 /// specified, this will default to the current directory.
5225 /// e.g. ~/code/go/mypackage
5226 pub source_path: std::string::String,
5227
5228 /// Optional. The Go module's "module path".
5229 /// e.g. example.com/foo/v2
5230 pub module_path: std::string::String,
5231
5232 /// Optional. The Go module's semantic version in the form vX.Y.Z. e.g.
5233 /// v0.1.1 Pre-release identifiers can also be added by appending a dash and
5234 /// dot separated ASCII alphanumeric characters and hyphens.
5235 /// e.g. v0.2.3-alpha.x.12m.5
5236 pub module_version: std::string::String,
5237
5238 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5239 }
5240
5241 impl GoModule {
5242 /// Creates a new default instance.
5243 pub fn new() -> Self {
5244 std::default::Default::default()
5245 }
5246
5247 /// Sets the value of [repository_name][crate::model::artifacts::GoModule::repository_name].
5248 ///
5249 /// # Example
5250 /// ```ignore,no_run
5251 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5252 /// let x = GoModule::new().set_repository_name("example");
5253 /// ```
5254 pub fn set_repository_name<T: std::convert::Into<std::string::String>>(
5255 mut self,
5256 v: T,
5257 ) -> Self {
5258 self.repository_name = v.into();
5259 self
5260 }
5261
5262 /// Sets the value of [repository_location][crate::model::artifacts::GoModule::repository_location].
5263 ///
5264 /// # Example
5265 /// ```ignore,no_run
5266 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5267 /// let x = GoModule::new().set_repository_location("example");
5268 /// ```
5269 pub fn set_repository_location<T: std::convert::Into<std::string::String>>(
5270 mut self,
5271 v: T,
5272 ) -> Self {
5273 self.repository_location = v.into();
5274 self
5275 }
5276
5277 /// Sets the value of [repository_project_id][crate::model::artifacts::GoModule::repository_project_id].
5278 ///
5279 /// # Example
5280 /// ```ignore,no_run
5281 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5282 /// let x = GoModule::new().set_repository_project_id("example");
5283 /// ```
5284 pub fn set_repository_project_id<T: std::convert::Into<std::string::String>>(
5285 mut self,
5286 v: T,
5287 ) -> Self {
5288 self.repository_project_id = v.into();
5289 self
5290 }
5291
5292 /// Sets the value of [source_path][crate::model::artifacts::GoModule::source_path].
5293 ///
5294 /// # Example
5295 /// ```ignore,no_run
5296 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5297 /// let x = GoModule::new().set_source_path("example");
5298 /// ```
5299 pub fn set_source_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5300 self.source_path = v.into();
5301 self
5302 }
5303
5304 /// Sets the value of [module_path][crate::model::artifacts::GoModule::module_path].
5305 ///
5306 /// # Example
5307 /// ```ignore,no_run
5308 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5309 /// let x = GoModule::new().set_module_path("example");
5310 /// ```
5311 pub fn set_module_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5312 self.module_path = v.into();
5313 self
5314 }
5315
5316 /// Sets the value of [module_version][crate::model::artifacts::GoModule::module_version].
5317 ///
5318 /// # Example
5319 /// ```ignore,no_run
5320 /// # use google_cloud_build_v1::model::artifacts::GoModule;
5321 /// let x = GoModule::new().set_module_version("example");
5322 /// ```
5323 pub fn set_module_version<T: std::convert::Into<std::string::String>>(
5324 mut self,
5325 v: T,
5326 ) -> Self {
5327 self.module_version = v.into();
5328 self
5329 }
5330 }
5331
5332 impl wkt::message::Message for GoModule {
5333 fn typename() -> &'static str {
5334 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.GoModule"
5335 }
5336 }
5337
5338 /// Python package to upload to Artifact Registry upon successful completion
5339 /// of all build steps. A package can encapsulate multiple objects to be
5340 /// uploaded to a single repository.
5341 #[derive(Clone, Default, PartialEq)]
5342 #[non_exhaustive]
5343 pub struct PythonPackage {
5344 /// Artifact Registry repository, in the form
5345 /// "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY"
5346 ///
5347 /// Files in the workspace matching any path pattern will be uploaded to
5348 /// Artifact Registry with this location as a prefix.
5349 pub repository: std::string::String,
5350
5351 /// Path globs used to match files in the build's workspace. For Python/
5352 /// Twine, this is usually `dist/*`, and sometimes additionally an `.asc`
5353 /// file.
5354 pub paths: std::vec::Vec<std::string::String>,
5355
5356 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5357 }
5358
5359 impl PythonPackage {
5360 /// Creates a new default instance.
5361 pub fn new() -> Self {
5362 std::default::Default::default()
5363 }
5364
5365 /// Sets the value of [repository][crate::model::artifacts::PythonPackage::repository].
5366 ///
5367 /// # Example
5368 /// ```ignore,no_run
5369 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5370 /// let x = PythonPackage::new().set_repository("example");
5371 /// ```
5372 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5373 self.repository = v.into();
5374 self
5375 }
5376
5377 /// Sets the value of [paths][crate::model::artifacts::PythonPackage::paths].
5378 ///
5379 /// # Example
5380 /// ```ignore,no_run
5381 /// # use google_cloud_build_v1::model::artifacts::PythonPackage;
5382 /// let x = PythonPackage::new().set_paths(["a", "b", "c"]);
5383 /// ```
5384 pub fn set_paths<T, V>(mut self, v: T) -> Self
5385 where
5386 T: std::iter::IntoIterator<Item = V>,
5387 V: std::convert::Into<std::string::String>,
5388 {
5389 use std::iter::Iterator;
5390 self.paths = v.into_iter().map(|i| i.into()).collect();
5391 self
5392 }
5393 }
5394
5395 impl wkt::message::Message for PythonPackage {
5396 fn typename() -> &'static str {
5397 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.PythonPackage"
5398 }
5399 }
5400
5401 /// Npm package to upload to Artifact Registry upon successful completion
5402 /// of all build steps.
5403 #[derive(Clone, Default, PartialEq)]
5404 #[non_exhaustive]
5405 pub struct NpmPackage {
5406 /// Artifact Registry repository, in the form
5407 /// "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY"
5408 ///
5409 /// Npm package in the workspace specified by path will be zipped and
5410 /// uploaded to Artifact Registry with this location as a prefix.
5411 pub repository: std::string::String,
5412
5413 /// Optional. Path to the package.json.
5414 /// e.g. workspace/path/to/package
5415 ///
5416 /// Only one of `archive` or `package_path` can be specified.
5417 pub package_path: std::string::String,
5418
5419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5420 }
5421
5422 impl NpmPackage {
5423 /// Creates a new default instance.
5424 pub fn new() -> Self {
5425 std::default::Default::default()
5426 }
5427
5428 /// Sets the value of [repository][crate::model::artifacts::NpmPackage::repository].
5429 ///
5430 /// # Example
5431 /// ```ignore,no_run
5432 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5433 /// let x = NpmPackage::new().set_repository("example");
5434 /// ```
5435 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5436 self.repository = v.into();
5437 self
5438 }
5439
5440 /// Sets the value of [package_path][crate::model::artifacts::NpmPackage::package_path].
5441 ///
5442 /// # Example
5443 /// ```ignore,no_run
5444 /// # use google_cloud_build_v1::model::artifacts::NpmPackage;
5445 /// let x = NpmPackage::new().set_package_path("example");
5446 /// ```
5447 pub fn set_package_path<T: std::convert::Into<std::string::String>>(
5448 mut self,
5449 v: T,
5450 ) -> Self {
5451 self.package_path = v.into();
5452 self
5453 }
5454 }
5455
5456 impl wkt::message::Message for NpmPackage {
5457 fn typename() -> &'static str {
5458 "type.googleapis.com/google.devtools.cloudbuild.v1.Artifacts.NpmPackage"
5459 }
5460 }
5461}
5462
5463/// Start and end times for a build execution phase.
5464#[derive(Clone, Default, PartialEq)]
5465#[non_exhaustive]
5466pub struct TimeSpan {
5467 /// Start of time span.
5468 pub start_time: std::option::Option<wkt::Timestamp>,
5469
5470 /// End of time span.
5471 pub end_time: std::option::Option<wkt::Timestamp>,
5472
5473 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5474}
5475
5476impl TimeSpan {
5477 /// Creates a new default instance.
5478 pub fn new() -> Self {
5479 std::default::Default::default()
5480 }
5481
5482 /// Sets the value of [start_time][crate::model::TimeSpan::start_time].
5483 ///
5484 /// # Example
5485 /// ```ignore,no_run
5486 /// # use google_cloud_build_v1::model::TimeSpan;
5487 /// use wkt::Timestamp;
5488 /// let x = TimeSpan::new().set_start_time(Timestamp::default()/* use setters */);
5489 /// ```
5490 pub fn set_start_time<T>(mut self, v: T) -> Self
5491 where
5492 T: std::convert::Into<wkt::Timestamp>,
5493 {
5494 self.start_time = std::option::Option::Some(v.into());
5495 self
5496 }
5497
5498 /// Sets or clears the value of [start_time][crate::model::TimeSpan::start_time].
5499 ///
5500 /// # Example
5501 /// ```ignore,no_run
5502 /// # use google_cloud_build_v1::model::TimeSpan;
5503 /// use wkt::Timestamp;
5504 /// let x = TimeSpan::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
5505 /// let x = TimeSpan::new().set_or_clear_start_time(None::<Timestamp>);
5506 /// ```
5507 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5508 where
5509 T: std::convert::Into<wkt::Timestamp>,
5510 {
5511 self.start_time = v.map(|x| x.into());
5512 self
5513 }
5514
5515 /// Sets the value of [end_time][crate::model::TimeSpan::end_time].
5516 ///
5517 /// # Example
5518 /// ```ignore,no_run
5519 /// # use google_cloud_build_v1::model::TimeSpan;
5520 /// use wkt::Timestamp;
5521 /// let x = TimeSpan::new().set_end_time(Timestamp::default()/* use setters */);
5522 /// ```
5523 pub fn set_end_time<T>(mut self, v: T) -> Self
5524 where
5525 T: std::convert::Into<wkt::Timestamp>,
5526 {
5527 self.end_time = std::option::Option::Some(v.into());
5528 self
5529 }
5530
5531 /// Sets or clears the value of [end_time][crate::model::TimeSpan::end_time].
5532 ///
5533 /// # Example
5534 /// ```ignore,no_run
5535 /// # use google_cloud_build_v1::model::TimeSpan;
5536 /// use wkt::Timestamp;
5537 /// let x = TimeSpan::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5538 /// let x = TimeSpan::new().set_or_clear_end_time(None::<Timestamp>);
5539 /// ```
5540 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5541 where
5542 T: std::convert::Into<wkt::Timestamp>,
5543 {
5544 self.end_time = v.map(|x| x.into());
5545 self
5546 }
5547}
5548
5549impl wkt::message::Message for TimeSpan {
5550 fn typename() -> &'static str {
5551 "type.googleapis.com/google.devtools.cloudbuild.v1.TimeSpan"
5552 }
5553}
5554
5555/// Metadata for build operations.
5556#[derive(Clone, Default, PartialEq)]
5557#[non_exhaustive]
5558pub struct BuildOperationMetadata {
5559 /// The build that the operation is tracking.
5560 pub build: std::option::Option<crate::model::Build>,
5561
5562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5563}
5564
5565impl BuildOperationMetadata {
5566 /// Creates a new default instance.
5567 pub fn new() -> Self {
5568 std::default::Default::default()
5569 }
5570
5571 /// Sets the value of [build][crate::model::BuildOperationMetadata::build].
5572 ///
5573 /// # Example
5574 /// ```ignore,no_run
5575 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5576 /// use google_cloud_build_v1::model::Build;
5577 /// let x = BuildOperationMetadata::new().set_build(Build::default()/* use setters */);
5578 /// ```
5579 pub fn set_build<T>(mut self, v: T) -> Self
5580 where
5581 T: std::convert::Into<crate::model::Build>,
5582 {
5583 self.build = std::option::Option::Some(v.into());
5584 self
5585 }
5586
5587 /// Sets or clears the value of [build][crate::model::BuildOperationMetadata::build].
5588 ///
5589 /// # Example
5590 /// ```ignore,no_run
5591 /// # use google_cloud_build_v1::model::BuildOperationMetadata;
5592 /// use google_cloud_build_v1::model::Build;
5593 /// let x = BuildOperationMetadata::new().set_or_clear_build(Some(Build::default()/* use setters */));
5594 /// let x = BuildOperationMetadata::new().set_or_clear_build(None::<Build>);
5595 /// ```
5596 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
5597 where
5598 T: std::convert::Into<crate::model::Build>,
5599 {
5600 self.build = v.map(|x| x.into());
5601 self
5602 }
5603}
5604
5605impl wkt::message::Message for BuildOperationMetadata {
5606 fn typename() -> &'static str {
5607 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata"
5608 }
5609}
5610
5611/// Provenance of the source. Ways to find the original source, or verify that
5612/// some source was used for this build.
5613#[derive(Clone, Default, PartialEq)]
5614#[non_exhaustive]
5615pub struct SourceProvenance {
5616 /// A copy of the build's `source.storage_source`, if exists, with any
5617 /// generations resolved.
5618 pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
5619
5620 /// A copy of the build's `source.repo_source`, if exists, with any
5621 /// revisions resolved.
5622 pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
5623
5624 /// A copy of the build's `source.storage_source_manifest`, if exists, with any
5625 /// revisions resolved.
5626 /// This feature is in Preview.
5627 pub resolved_storage_source_manifest: std::option::Option<crate::model::StorageSourceManifest>,
5628
5629 /// Output only. A copy of the build's `source.connected_repository`, if
5630 /// exists, with any revisions resolved.
5631 pub resolved_connected_repository: std::option::Option<crate::model::ConnectedRepository>,
5632
5633 /// Output only. A copy of the build's `source.git_source`, if exists, with any
5634 /// revisions resolved.
5635 pub resolved_git_source: std::option::Option<crate::model::GitSource>,
5636
5637 /// Output only. Hash(es) of the build source, which can be used to verify that
5638 /// the original source integrity was maintained in the build. Note that
5639 /// `FileHashes` will only be populated if `BuildOptions` has requested a
5640 /// `SourceProvenanceHash`.
5641 ///
5642 /// The keys to this map are file paths used as build source and the values
5643 /// contain the hash values for those files.
5644 ///
5645 /// If the build source came in a single package such as a gzipped tarfile
5646 /// (`.tar.gz`), the `FileHash` will be for the single path to that file.
5647 pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
5648
5649 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5650}
5651
5652impl SourceProvenance {
5653 /// Creates a new default instance.
5654 pub fn new() -> Self {
5655 std::default::Default::default()
5656 }
5657
5658 /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5659 ///
5660 /// # Example
5661 /// ```ignore,no_run
5662 /// # use google_cloud_build_v1::model::SourceProvenance;
5663 /// use google_cloud_build_v1::model::StorageSource;
5664 /// let x = SourceProvenance::new().set_resolved_storage_source(StorageSource::default()/* use setters */);
5665 /// ```
5666 pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
5667 where
5668 T: std::convert::Into<crate::model::StorageSource>,
5669 {
5670 self.resolved_storage_source = std::option::Option::Some(v.into());
5671 self
5672 }
5673
5674 /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
5675 ///
5676 /// # Example
5677 /// ```ignore,no_run
5678 /// # use google_cloud_build_v1::model::SourceProvenance;
5679 /// use google_cloud_build_v1::model::StorageSource;
5680 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(Some(StorageSource::default()/* use setters */));
5681 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(None::<StorageSource>);
5682 /// ```
5683 pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
5684 where
5685 T: std::convert::Into<crate::model::StorageSource>,
5686 {
5687 self.resolved_storage_source = v.map(|x| x.into());
5688 self
5689 }
5690
5691 /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5692 ///
5693 /// # Example
5694 /// ```ignore,no_run
5695 /// # use google_cloud_build_v1::model::SourceProvenance;
5696 /// use google_cloud_build_v1::model::RepoSource;
5697 /// let x = SourceProvenance::new().set_resolved_repo_source(RepoSource::default()/* use setters */);
5698 /// ```
5699 pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
5700 where
5701 T: std::convert::Into<crate::model::RepoSource>,
5702 {
5703 self.resolved_repo_source = std::option::Option::Some(v.into());
5704 self
5705 }
5706
5707 /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
5708 ///
5709 /// # Example
5710 /// ```ignore,no_run
5711 /// # use google_cloud_build_v1::model::SourceProvenance;
5712 /// use google_cloud_build_v1::model::RepoSource;
5713 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(Some(RepoSource::default()/* use setters */));
5714 /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(None::<RepoSource>);
5715 /// ```
5716 pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
5717 where
5718 T: std::convert::Into<crate::model::RepoSource>,
5719 {
5720 self.resolved_repo_source = v.map(|x| x.into());
5721 self
5722 }
5723
5724 /// Sets the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5725 ///
5726 /// # Example
5727 /// ```ignore,no_run
5728 /// # use google_cloud_build_v1::model::SourceProvenance;
5729 /// use google_cloud_build_v1::model::StorageSourceManifest;
5730 /// let x = SourceProvenance::new().set_resolved_storage_source_manifest(StorageSourceManifest::default()/* use setters */);
5731 /// ```
5732 pub fn set_resolved_storage_source_manifest<T>(mut self, v: T) -> Self
5733 where
5734 T: std::convert::Into<crate::model::StorageSourceManifest>,
5735 {
5736 self.resolved_storage_source_manifest = std::option::Option::Some(v.into());
5737 self
5738 }
5739
5740 /// Sets or clears the value of [resolved_storage_source_manifest][crate::model::SourceProvenance::resolved_storage_source_manifest].
5741 ///
5742 /// # Example
5743 /// ```ignore,no_run
5744 /// # use google_cloud_build_v1::model::SourceProvenance;
5745 /// use google_cloud_build_v1::model::StorageSourceManifest;
5746 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(Some(StorageSourceManifest::default()/* use setters */));
5747 /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source_manifest(None::<StorageSourceManifest>);
5748 /// ```
5749 pub fn set_or_clear_resolved_storage_source_manifest<T>(
5750 mut self,
5751 v: std::option::Option<T>,
5752 ) -> Self
5753 where
5754 T: std::convert::Into<crate::model::StorageSourceManifest>,
5755 {
5756 self.resolved_storage_source_manifest = v.map(|x| x.into());
5757 self
5758 }
5759
5760 /// Sets the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5761 ///
5762 /// # Example
5763 /// ```ignore,no_run
5764 /// # use google_cloud_build_v1::model::SourceProvenance;
5765 /// use google_cloud_build_v1::model::ConnectedRepository;
5766 /// let x = SourceProvenance::new().set_resolved_connected_repository(ConnectedRepository::default()/* use setters */);
5767 /// ```
5768 pub fn set_resolved_connected_repository<T>(mut self, v: T) -> Self
5769 where
5770 T: std::convert::Into<crate::model::ConnectedRepository>,
5771 {
5772 self.resolved_connected_repository = std::option::Option::Some(v.into());
5773 self
5774 }
5775
5776 /// Sets or clears the value of [resolved_connected_repository][crate::model::SourceProvenance::resolved_connected_repository].
5777 ///
5778 /// # Example
5779 /// ```ignore,no_run
5780 /// # use google_cloud_build_v1::model::SourceProvenance;
5781 /// use google_cloud_build_v1::model::ConnectedRepository;
5782 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(Some(ConnectedRepository::default()/* use setters */));
5783 /// let x = SourceProvenance::new().set_or_clear_resolved_connected_repository(None::<ConnectedRepository>);
5784 /// ```
5785 pub fn set_or_clear_resolved_connected_repository<T>(
5786 mut self,
5787 v: std::option::Option<T>,
5788 ) -> Self
5789 where
5790 T: std::convert::Into<crate::model::ConnectedRepository>,
5791 {
5792 self.resolved_connected_repository = v.map(|x| x.into());
5793 self
5794 }
5795
5796 /// Sets the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5797 ///
5798 /// # Example
5799 /// ```ignore,no_run
5800 /// # use google_cloud_build_v1::model::SourceProvenance;
5801 /// use google_cloud_build_v1::model::GitSource;
5802 /// let x = SourceProvenance::new().set_resolved_git_source(GitSource::default()/* use setters */);
5803 /// ```
5804 pub fn set_resolved_git_source<T>(mut self, v: T) -> Self
5805 where
5806 T: std::convert::Into<crate::model::GitSource>,
5807 {
5808 self.resolved_git_source = std::option::Option::Some(v.into());
5809 self
5810 }
5811
5812 /// Sets or clears the value of [resolved_git_source][crate::model::SourceProvenance::resolved_git_source].
5813 ///
5814 /// # Example
5815 /// ```ignore,no_run
5816 /// # use google_cloud_build_v1::model::SourceProvenance;
5817 /// use google_cloud_build_v1::model::GitSource;
5818 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(Some(GitSource::default()/* use setters */));
5819 /// let x = SourceProvenance::new().set_or_clear_resolved_git_source(None::<GitSource>);
5820 /// ```
5821 pub fn set_or_clear_resolved_git_source<T>(mut self, v: std::option::Option<T>) -> Self
5822 where
5823 T: std::convert::Into<crate::model::GitSource>,
5824 {
5825 self.resolved_git_source = v.map(|x| x.into());
5826 self
5827 }
5828
5829 /// Sets the value of [file_hashes][crate::model::SourceProvenance::file_hashes].
5830 ///
5831 /// # Example
5832 /// ```ignore,no_run
5833 /// # use google_cloud_build_v1::model::SourceProvenance;
5834 /// use google_cloud_build_v1::model::FileHashes;
5835 /// let x = SourceProvenance::new().set_file_hashes([
5836 /// ("key0", FileHashes::default()/* use setters */),
5837 /// ("key1", FileHashes::default()/* use (different) setters */),
5838 /// ]);
5839 /// ```
5840 pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
5841 where
5842 T: std::iter::IntoIterator<Item = (K, V)>,
5843 K: std::convert::Into<std::string::String>,
5844 V: std::convert::Into<crate::model::FileHashes>,
5845 {
5846 use std::iter::Iterator;
5847 self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5848 self
5849 }
5850}
5851
5852impl wkt::message::Message for SourceProvenance {
5853 fn typename() -> &'static str {
5854 "type.googleapis.com/google.devtools.cloudbuild.v1.SourceProvenance"
5855 }
5856}
5857
5858/// Container message for hashes of byte content of files, used in
5859/// SourceProvenance messages to verify integrity of source input to the build.
5860#[derive(Clone, Default, PartialEq)]
5861#[non_exhaustive]
5862pub struct FileHashes {
5863 /// Collection of file hashes.
5864 pub file_hash: std::vec::Vec<crate::model::Hash>,
5865
5866 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5867}
5868
5869impl FileHashes {
5870 /// Creates a new default instance.
5871 pub fn new() -> Self {
5872 std::default::Default::default()
5873 }
5874
5875 /// Sets the value of [file_hash][crate::model::FileHashes::file_hash].
5876 ///
5877 /// # Example
5878 /// ```ignore,no_run
5879 /// # use google_cloud_build_v1::model::FileHashes;
5880 /// use google_cloud_build_v1::model::Hash;
5881 /// let x = FileHashes::new()
5882 /// .set_file_hash([
5883 /// Hash::default()/* use setters */,
5884 /// Hash::default()/* use (different) setters */,
5885 /// ]);
5886 /// ```
5887 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
5888 where
5889 T: std::iter::IntoIterator<Item = V>,
5890 V: std::convert::Into<crate::model::Hash>,
5891 {
5892 use std::iter::Iterator;
5893 self.file_hash = v.into_iter().map(|i| i.into()).collect();
5894 self
5895 }
5896}
5897
5898impl wkt::message::Message for FileHashes {
5899 fn typename() -> &'static str {
5900 "type.googleapis.com/google.devtools.cloudbuild.v1.FileHashes"
5901 }
5902}
5903
5904/// Container message for hash values.
5905#[derive(Clone, Default, PartialEq)]
5906#[non_exhaustive]
5907pub struct Hash {
5908 /// The type of hash that was performed.
5909 pub r#type: crate::model::hash::HashType,
5910
5911 /// The hash value.
5912 pub value: ::bytes::Bytes,
5913
5914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5915}
5916
5917impl Hash {
5918 /// Creates a new default instance.
5919 pub fn new() -> Self {
5920 std::default::Default::default()
5921 }
5922
5923 /// Sets the value of [r#type][crate::model::Hash::type].
5924 ///
5925 /// # Example
5926 /// ```ignore,no_run
5927 /// # use google_cloud_build_v1::model::Hash;
5928 /// use google_cloud_build_v1::model::hash::HashType;
5929 /// let x0 = Hash::new().set_type(HashType::Sha256);
5930 /// let x1 = Hash::new().set_type(HashType::Md5);
5931 /// let x2 = Hash::new().set_type(HashType::GoModuleH1);
5932 /// ```
5933 pub fn set_type<T: std::convert::Into<crate::model::hash::HashType>>(mut self, v: T) -> Self {
5934 self.r#type = v.into();
5935 self
5936 }
5937
5938 /// Sets the value of [value][crate::model::Hash::value].
5939 ///
5940 /// # Example
5941 /// ```ignore,no_run
5942 /// # use google_cloud_build_v1::model::Hash;
5943 /// let x = Hash::new().set_value(bytes::Bytes::from_static(b"example"));
5944 /// ```
5945 pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5946 self.value = v.into();
5947 self
5948 }
5949}
5950
5951impl wkt::message::Message for Hash {
5952 fn typename() -> &'static str {
5953 "type.googleapis.com/google.devtools.cloudbuild.v1.Hash"
5954 }
5955}
5956
5957/// Defines additional types related to [Hash].
5958pub mod hash {
5959 #[allow(unused_imports)]
5960 use super::*;
5961
5962 /// Specifies the hash algorithm, if any.
5963 ///
5964 /// # Working with unknown values
5965 ///
5966 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5967 /// additional enum variants at any time. Adding new variants is not considered
5968 /// a breaking change. Applications should write their code in anticipation of:
5969 ///
5970 /// - New values appearing in future releases of the client library, **and**
5971 /// - New values received dynamically, without application changes.
5972 ///
5973 /// Please consult the [Working with enums] section in the user guide for some
5974 /// guidelines.
5975 ///
5976 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5977 #[derive(Clone, Debug, PartialEq)]
5978 #[non_exhaustive]
5979 pub enum HashType {
5980 /// No hash requested.
5981 None,
5982 /// Use a sha256 hash.
5983 Sha256,
5984 /// Use a md5 hash.
5985 Md5,
5986 /// Dirhash of a Go module's source code which is then hex-encoded.
5987 GoModuleH1,
5988 /// Use a sha512 hash.
5989 Sha512,
5990 /// If set, the enum was initialized with an unknown value.
5991 ///
5992 /// Applications can examine the value using [HashType::value] or
5993 /// [HashType::name].
5994 UnknownValue(hash_type::UnknownValue),
5995 }
5996
5997 #[doc(hidden)]
5998 pub mod hash_type {
5999 #[allow(unused_imports)]
6000 use super::*;
6001 #[derive(Clone, Debug, PartialEq)]
6002 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6003 }
6004
6005 impl HashType {
6006 /// Gets the enum value.
6007 ///
6008 /// Returns `None` if the enum contains an unknown value deserialized from
6009 /// the string representation of enums.
6010 pub fn value(&self) -> std::option::Option<i32> {
6011 match self {
6012 Self::None => std::option::Option::Some(0),
6013 Self::Sha256 => std::option::Option::Some(1),
6014 Self::Md5 => std::option::Option::Some(2),
6015 Self::GoModuleH1 => std::option::Option::Some(3),
6016 Self::Sha512 => std::option::Option::Some(4),
6017 Self::UnknownValue(u) => u.0.value(),
6018 }
6019 }
6020
6021 /// Gets the enum value as a string.
6022 ///
6023 /// Returns `None` if the enum contains an unknown value deserialized from
6024 /// the integer representation of enums.
6025 pub fn name(&self) -> std::option::Option<&str> {
6026 match self {
6027 Self::None => std::option::Option::Some("NONE"),
6028 Self::Sha256 => std::option::Option::Some("SHA256"),
6029 Self::Md5 => std::option::Option::Some("MD5"),
6030 Self::GoModuleH1 => std::option::Option::Some("GO_MODULE_H1"),
6031 Self::Sha512 => std::option::Option::Some("SHA512"),
6032 Self::UnknownValue(u) => u.0.name(),
6033 }
6034 }
6035 }
6036
6037 impl std::default::Default for HashType {
6038 fn default() -> Self {
6039 use std::convert::From;
6040 Self::from(0)
6041 }
6042 }
6043
6044 impl std::fmt::Display for HashType {
6045 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6046 wkt::internal::display_enum(f, self.name(), self.value())
6047 }
6048 }
6049
6050 impl std::convert::From<i32> for HashType {
6051 fn from(value: i32) -> Self {
6052 match value {
6053 0 => Self::None,
6054 1 => Self::Sha256,
6055 2 => Self::Md5,
6056 3 => Self::GoModuleH1,
6057 4 => Self::Sha512,
6058 _ => Self::UnknownValue(hash_type::UnknownValue(
6059 wkt::internal::UnknownEnumValue::Integer(value),
6060 )),
6061 }
6062 }
6063 }
6064
6065 impl std::convert::From<&str> for HashType {
6066 fn from(value: &str) -> Self {
6067 use std::string::ToString;
6068 match value {
6069 "NONE" => Self::None,
6070 "SHA256" => Self::Sha256,
6071 "MD5" => Self::Md5,
6072 "GO_MODULE_H1" => Self::GoModuleH1,
6073 "SHA512" => Self::Sha512,
6074 _ => Self::UnknownValue(hash_type::UnknownValue(
6075 wkt::internal::UnknownEnumValue::String(value.to_string()),
6076 )),
6077 }
6078 }
6079 }
6080
6081 impl serde::ser::Serialize for HashType {
6082 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6083 where
6084 S: serde::Serializer,
6085 {
6086 match self {
6087 Self::None => serializer.serialize_i32(0),
6088 Self::Sha256 => serializer.serialize_i32(1),
6089 Self::Md5 => serializer.serialize_i32(2),
6090 Self::GoModuleH1 => serializer.serialize_i32(3),
6091 Self::Sha512 => serializer.serialize_i32(4),
6092 Self::UnknownValue(u) => u.0.serialize(serializer),
6093 }
6094 }
6095 }
6096
6097 impl<'de> serde::de::Deserialize<'de> for HashType {
6098 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6099 where
6100 D: serde::Deserializer<'de>,
6101 {
6102 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HashType>::new(
6103 ".google.devtools.cloudbuild.v1.Hash.HashType",
6104 ))
6105 }
6106 }
6107}
6108
6109/// Secrets and secret environment variables.
6110#[derive(Clone, Default, PartialEq)]
6111#[non_exhaustive]
6112pub struct Secrets {
6113 /// Secrets in Secret Manager and associated secret environment variable.
6114 pub secret_manager: std::vec::Vec<crate::model::SecretManagerSecret>,
6115
6116 /// Secrets encrypted with KMS key and the associated secret environment
6117 /// variable.
6118 pub inline: std::vec::Vec<crate::model::InlineSecret>,
6119
6120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6121}
6122
6123impl Secrets {
6124 /// Creates a new default instance.
6125 pub fn new() -> Self {
6126 std::default::Default::default()
6127 }
6128
6129 /// Sets the value of [secret_manager][crate::model::Secrets::secret_manager].
6130 ///
6131 /// # Example
6132 /// ```ignore,no_run
6133 /// # use google_cloud_build_v1::model::Secrets;
6134 /// use google_cloud_build_v1::model::SecretManagerSecret;
6135 /// let x = Secrets::new()
6136 /// .set_secret_manager([
6137 /// SecretManagerSecret::default()/* use setters */,
6138 /// SecretManagerSecret::default()/* use (different) setters */,
6139 /// ]);
6140 /// ```
6141 pub fn set_secret_manager<T, V>(mut self, v: T) -> Self
6142 where
6143 T: std::iter::IntoIterator<Item = V>,
6144 V: std::convert::Into<crate::model::SecretManagerSecret>,
6145 {
6146 use std::iter::Iterator;
6147 self.secret_manager = v.into_iter().map(|i| i.into()).collect();
6148 self
6149 }
6150
6151 /// Sets the value of [inline][crate::model::Secrets::inline].
6152 ///
6153 /// # Example
6154 /// ```ignore,no_run
6155 /// # use google_cloud_build_v1::model::Secrets;
6156 /// use google_cloud_build_v1::model::InlineSecret;
6157 /// let x = Secrets::new()
6158 /// .set_inline([
6159 /// InlineSecret::default()/* use setters */,
6160 /// InlineSecret::default()/* use (different) setters */,
6161 /// ]);
6162 /// ```
6163 pub fn set_inline<T, V>(mut self, v: T) -> Self
6164 where
6165 T: std::iter::IntoIterator<Item = V>,
6166 V: std::convert::Into<crate::model::InlineSecret>,
6167 {
6168 use std::iter::Iterator;
6169 self.inline = v.into_iter().map(|i| i.into()).collect();
6170 self
6171 }
6172}
6173
6174impl wkt::message::Message for Secrets {
6175 fn typename() -> &'static str {
6176 "type.googleapis.com/google.devtools.cloudbuild.v1.Secrets"
6177 }
6178}
6179
6180/// Pairs a set of secret environment variables mapped to encrypted
6181/// values with the Cloud KMS key to use to decrypt the value.
6182#[derive(Clone, Default, PartialEq)]
6183#[non_exhaustive]
6184pub struct InlineSecret {
6185 /// Resource name of Cloud KMS crypto key to decrypt the encrypted value.
6186 /// In format: projects/*/locations/*/keyRings/*/cryptoKeys/*
6187 pub kms_key_name: std::string::String,
6188
6189 /// Map of environment variable name to its encrypted value.
6190 ///
6191 /// Secret environment variables must be unique across all of a build's
6192 /// secrets, and must be used by at least one build step. Values can be at most
6193 /// 64 KB in size. There can be at most 100 secret values across all of a
6194 /// build's secrets.
6195 pub env_map: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6196
6197 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6198}
6199
6200impl InlineSecret {
6201 /// Creates a new default instance.
6202 pub fn new() -> Self {
6203 std::default::Default::default()
6204 }
6205
6206 /// Sets the value of [kms_key_name][crate::model::InlineSecret::kms_key_name].
6207 ///
6208 /// # Example
6209 /// ```ignore,no_run
6210 /// # use google_cloud_build_v1::model::InlineSecret;
6211 /// let x = InlineSecret::new().set_kms_key_name("example");
6212 /// ```
6213 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6214 self.kms_key_name = v.into();
6215 self
6216 }
6217
6218 /// Sets the value of [env_map][crate::model::InlineSecret::env_map].
6219 ///
6220 /// # Example
6221 /// ```ignore,no_run
6222 /// # use google_cloud_build_v1::model::InlineSecret;
6223 /// let x = InlineSecret::new().set_env_map([
6224 /// ("key0", bytes::Bytes::from_static(b"abc")),
6225 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6226 /// ]);
6227 /// ```
6228 pub fn set_env_map<T, K, V>(mut self, v: T) -> Self
6229 where
6230 T: std::iter::IntoIterator<Item = (K, V)>,
6231 K: std::convert::Into<std::string::String>,
6232 V: std::convert::Into<::bytes::Bytes>,
6233 {
6234 use std::iter::Iterator;
6235 self.env_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6236 self
6237 }
6238}
6239
6240impl wkt::message::Message for InlineSecret {
6241 fn typename() -> &'static str {
6242 "type.googleapis.com/google.devtools.cloudbuild.v1.InlineSecret"
6243 }
6244}
6245
6246/// Pairs a secret environment variable with a SecretVersion in Secret Manager.
6247#[derive(Clone, Default, PartialEq)]
6248#[non_exhaustive]
6249pub struct SecretManagerSecret {
6250 /// Resource name of the SecretVersion. In format:
6251 /// projects/*/secrets/*/versions/*
6252 pub version_name: std::string::String,
6253
6254 /// Environment variable name to associate with the secret.
6255 /// Secret environment variables must be unique across all of a build's
6256 /// secrets, and must be used by at least one build step.
6257 pub env: std::string::String,
6258
6259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6260}
6261
6262impl SecretManagerSecret {
6263 /// Creates a new default instance.
6264 pub fn new() -> Self {
6265 std::default::Default::default()
6266 }
6267
6268 /// Sets the value of [version_name][crate::model::SecretManagerSecret::version_name].
6269 ///
6270 /// # Example
6271 /// ```ignore,no_run
6272 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6273 /// let x = SecretManagerSecret::new().set_version_name("example");
6274 /// ```
6275 pub fn set_version_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6276 self.version_name = v.into();
6277 self
6278 }
6279
6280 /// Sets the value of [env][crate::model::SecretManagerSecret::env].
6281 ///
6282 /// # Example
6283 /// ```ignore,no_run
6284 /// # use google_cloud_build_v1::model::SecretManagerSecret;
6285 /// let x = SecretManagerSecret::new().set_env("example");
6286 /// ```
6287 pub fn set_env<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6288 self.env = v.into();
6289 self
6290 }
6291}
6292
6293impl wkt::message::Message for SecretManagerSecret {
6294 fn typename() -> &'static str {
6295 "type.googleapis.com/google.devtools.cloudbuild.v1.SecretManagerSecret"
6296 }
6297}
6298
6299/// Pairs a set of secret environment variables containing encrypted
6300/// values with the Cloud KMS key to use to decrypt the value.
6301/// Note: Use `kmsKeyName` with `available_secrets` instead of using
6302/// `kmsKeyName` with `secret`. For instructions see:
6303/// <https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials>.
6304#[derive(Clone, Default, PartialEq)]
6305#[non_exhaustive]
6306pub struct Secret {
6307 /// Cloud KMS key name to use to decrypt these envs.
6308 pub kms_key_name: std::string::String,
6309
6310 /// Map of environment variable name to its encrypted value.
6311 ///
6312 /// Secret environment variables must be unique across all of a build's
6313 /// secrets, and must be used by at least one build step. Values can be at most
6314 /// 64 KB in size. There can be at most 100 secret values across all of a
6315 /// build's secrets.
6316 pub secret_env: std::collections::HashMap<std::string::String, ::bytes::Bytes>,
6317
6318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6319}
6320
6321impl Secret {
6322 /// Creates a new default instance.
6323 pub fn new() -> Self {
6324 std::default::Default::default()
6325 }
6326
6327 /// Sets the value of [kms_key_name][crate::model::Secret::kms_key_name].
6328 ///
6329 /// # Example
6330 /// ```ignore,no_run
6331 /// # use google_cloud_build_v1::model::Secret;
6332 /// let x = Secret::new().set_kms_key_name("example");
6333 /// ```
6334 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6335 self.kms_key_name = v.into();
6336 self
6337 }
6338
6339 /// Sets the value of [secret_env][crate::model::Secret::secret_env].
6340 ///
6341 /// # Example
6342 /// ```ignore,no_run
6343 /// # use google_cloud_build_v1::model::Secret;
6344 /// let x = Secret::new().set_secret_env([
6345 /// ("key0", bytes::Bytes::from_static(b"abc")),
6346 /// ("key1", bytes::Bytes::from_static(b"xyz")),
6347 /// ]);
6348 /// ```
6349 pub fn set_secret_env<T, K, V>(mut self, v: T) -> Self
6350 where
6351 T: std::iter::IntoIterator<Item = (K, V)>,
6352 K: std::convert::Into<std::string::String>,
6353 V: std::convert::Into<::bytes::Bytes>,
6354 {
6355 use std::iter::Iterator;
6356 self.secret_env = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6357 self
6358 }
6359}
6360
6361impl wkt::message::Message for Secret {
6362 fn typename() -> &'static str {
6363 "type.googleapis.com/google.devtools.cloudbuild.v1.Secret"
6364 }
6365}
6366
6367/// Request to create a new build.
6368#[derive(Clone, Default, PartialEq)]
6369#[non_exhaustive]
6370pub struct CreateBuildRequest {
6371 /// The parent resource where this build will be created.
6372 /// Format: `projects/{project}/locations/{location}`
6373 pub parent: std::string::String,
6374
6375 /// Required. ID of the project.
6376 pub project_id: std::string::String,
6377
6378 /// Required. Build resource to create.
6379 pub build: std::option::Option<crate::model::Build>,
6380
6381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6382}
6383
6384impl CreateBuildRequest {
6385 /// Creates a new default instance.
6386 pub fn new() -> Self {
6387 std::default::Default::default()
6388 }
6389
6390 /// Sets the value of [parent][crate::model::CreateBuildRequest::parent].
6391 ///
6392 /// # Example
6393 /// ```ignore,no_run
6394 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6395 /// # let project_id = "project_id";
6396 /// let x = CreateBuildRequest::new().set_parent(format!("projects/{project_id}"));
6397 /// ```
6398 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6399 self.parent = v.into();
6400 self
6401 }
6402
6403 /// Sets the value of [project_id][crate::model::CreateBuildRequest::project_id].
6404 ///
6405 /// # Example
6406 /// ```ignore,no_run
6407 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6408 /// let x = CreateBuildRequest::new().set_project_id("example");
6409 /// ```
6410 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6411 self.project_id = v.into();
6412 self
6413 }
6414
6415 /// Sets the value of [build][crate::model::CreateBuildRequest::build].
6416 ///
6417 /// # Example
6418 /// ```ignore,no_run
6419 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6420 /// use google_cloud_build_v1::model::Build;
6421 /// let x = CreateBuildRequest::new().set_build(Build::default()/* use setters */);
6422 /// ```
6423 pub fn set_build<T>(mut self, v: T) -> Self
6424 where
6425 T: std::convert::Into<crate::model::Build>,
6426 {
6427 self.build = std::option::Option::Some(v.into());
6428 self
6429 }
6430
6431 /// Sets or clears the value of [build][crate::model::CreateBuildRequest::build].
6432 ///
6433 /// # Example
6434 /// ```ignore,no_run
6435 /// # use google_cloud_build_v1::model::CreateBuildRequest;
6436 /// use google_cloud_build_v1::model::Build;
6437 /// let x = CreateBuildRequest::new().set_or_clear_build(Some(Build::default()/* use setters */));
6438 /// let x = CreateBuildRequest::new().set_or_clear_build(None::<Build>);
6439 /// ```
6440 pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
6441 where
6442 T: std::convert::Into<crate::model::Build>,
6443 {
6444 self.build = v.map(|x| x.into());
6445 self
6446 }
6447}
6448
6449impl wkt::message::Message for CreateBuildRequest {
6450 fn typename() -> &'static str {
6451 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildRequest"
6452 }
6453}
6454
6455/// Request to get a build.
6456#[derive(Clone, Default, PartialEq)]
6457#[non_exhaustive]
6458pub struct GetBuildRequest {
6459 /// The name of the `Build` to retrieve.
6460 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6461 pub name: std::string::String,
6462
6463 /// Required. ID of the project.
6464 pub project_id: std::string::String,
6465
6466 /// Required. ID of the build.
6467 pub id: std::string::String,
6468
6469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6470}
6471
6472impl GetBuildRequest {
6473 /// Creates a new default instance.
6474 pub fn new() -> Self {
6475 std::default::Default::default()
6476 }
6477
6478 /// Sets the value of [name][crate::model::GetBuildRequest::name].
6479 ///
6480 /// # Example
6481 /// ```ignore,no_run
6482 /// # use google_cloud_build_v1::model::GetBuildRequest;
6483 /// # let project_id = "project_id";
6484 /// # let build_id = "build_id";
6485 /// let x = GetBuildRequest::new().set_name(format!("projects/{project_id}/builds/{build_id}"));
6486 /// ```
6487 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6488 self.name = v.into();
6489 self
6490 }
6491
6492 /// Sets the value of [project_id][crate::model::GetBuildRequest::project_id].
6493 ///
6494 /// # Example
6495 /// ```ignore,no_run
6496 /// # use google_cloud_build_v1::model::GetBuildRequest;
6497 /// let x = GetBuildRequest::new().set_project_id("example");
6498 /// ```
6499 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6500 self.project_id = v.into();
6501 self
6502 }
6503
6504 /// Sets the value of [id][crate::model::GetBuildRequest::id].
6505 ///
6506 /// # Example
6507 /// ```ignore,no_run
6508 /// # use google_cloud_build_v1::model::GetBuildRequest;
6509 /// let x = GetBuildRequest::new().set_id("example");
6510 /// ```
6511 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6512 self.id = v.into();
6513 self
6514 }
6515}
6516
6517impl wkt::message::Message for GetBuildRequest {
6518 fn typename() -> &'static str {
6519 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildRequest"
6520 }
6521}
6522
6523/// Request to list builds.
6524#[derive(Clone, Default, PartialEq)]
6525#[non_exhaustive]
6526pub struct ListBuildsRequest {
6527 /// The parent of the collection of `Builds`.
6528 /// Format: `projects/{project}/locations/{location}`
6529 pub parent: std::string::String,
6530
6531 /// Required. ID of the project.
6532 pub project_id: std::string::String,
6533
6534 /// Number of results to return in the list.
6535 pub page_size: i32,
6536
6537 /// The page token for the next page of Builds.
6538 ///
6539 /// If unspecified, the first page of results is returned.
6540 ///
6541 /// If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
6542 /// In this case, the token should be discarded, and pagination should be
6543 /// restarted from the first page of results.
6544 ///
6545 /// See <https://google.aip.dev/158> for more.
6546 pub page_token: std::string::String,
6547
6548 /// The raw filter text to constrain the results.
6549 pub filter: std::string::String,
6550
6551 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6552}
6553
6554impl ListBuildsRequest {
6555 /// Creates a new default instance.
6556 pub fn new() -> Self {
6557 std::default::Default::default()
6558 }
6559
6560 /// Sets the value of [parent][crate::model::ListBuildsRequest::parent].
6561 ///
6562 /// # Example
6563 /// ```ignore,no_run
6564 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6565 /// # let project_id = "project_id";
6566 /// let x = ListBuildsRequest::new().set_parent(format!("projects/{project_id}"));
6567 /// ```
6568 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6569 self.parent = v.into();
6570 self
6571 }
6572
6573 /// Sets the value of [project_id][crate::model::ListBuildsRequest::project_id].
6574 ///
6575 /// # Example
6576 /// ```ignore,no_run
6577 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6578 /// let x = ListBuildsRequest::new().set_project_id("example");
6579 /// ```
6580 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6581 self.project_id = v.into();
6582 self
6583 }
6584
6585 /// Sets the value of [page_size][crate::model::ListBuildsRequest::page_size].
6586 ///
6587 /// # Example
6588 /// ```ignore,no_run
6589 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6590 /// let x = ListBuildsRequest::new().set_page_size(42);
6591 /// ```
6592 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6593 self.page_size = v.into();
6594 self
6595 }
6596
6597 /// Sets the value of [page_token][crate::model::ListBuildsRequest::page_token].
6598 ///
6599 /// # Example
6600 /// ```ignore,no_run
6601 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6602 /// let x = ListBuildsRequest::new().set_page_token("example");
6603 /// ```
6604 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6605 self.page_token = v.into();
6606 self
6607 }
6608
6609 /// Sets the value of [filter][crate::model::ListBuildsRequest::filter].
6610 ///
6611 /// # Example
6612 /// ```ignore,no_run
6613 /// # use google_cloud_build_v1::model::ListBuildsRequest;
6614 /// let x = ListBuildsRequest::new().set_filter("example");
6615 /// ```
6616 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6617 self.filter = v.into();
6618 self
6619 }
6620}
6621
6622impl wkt::message::Message for ListBuildsRequest {
6623 fn typename() -> &'static str {
6624 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsRequest"
6625 }
6626}
6627
6628/// Response including listed builds.
6629#[derive(Clone, Default, PartialEq)]
6630#[non_exhaustive]
6631pub struct ListBuildsResponse {
6632 /// Builds will be sorted by `create_time`, descending.
6633 pub builds: std::vec::Vec<crate::model::Build>,
6634
6635 /// Token to receive the next page of results.
6636 /// This will be absent if the end of the response list has been reached.
6637 pub next_page_token: std::string::String,
6638
6639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6640}
6641
6642impl ListBuildsResponse {
6643 /// Creates a new default instance.
6644 pub fn new() -> Self {
6645 std::default::Default::default()
6646 }
6647
6648 /// Sets the value of [builds][crate::model::ListBuildsResponse::builds].
6649 ///
6650 /// # Example
6651 /// ```ignore,no_run
6652 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6653 /// use google_cloud_build_v1::model::Build;
6654 /// let x = ListBuildsResponse::new()
6655 /// .set_builds([
6656 /// Build::default()/* use setters */,
6657 /// Build::default()/* use (different) setters */,
6658 /// ]);
6659 /// ```
6660 pub fn set_builds<T, V>(mut self, v: T) -> Self
6661 where
6662 T: std::iter::IntoIterator<Item = V>,
6663 V: std::convert::Into<crate::model::Build>,
6664 {
6665 use std::iter::Iterator;
6666 self.builds = v.into_iter().map(|i| i.into()).collect();
6667 self
6668 }
6669
6670 /// Sets the value of [next_page_token][crate::model::ListBuildsResponse::next_page_token].
6671 ///
6672 /// # Example
6673 /// ```ignore,no_run
6674 /// # use google_cloud_build_v1::model::ListBuildsResponse;
6675 /// let x = ListBuildsResponse::new().set_next_page_token("example");
6676 /// ```
6677 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6678 self.next_page_token = v.into();
6679 self
6680 }
6681}
6682
6683impl wkt::message::Message for ListBuildsResponse {
6684 fn typename() -> &'static str {
6685 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildsResponse"
6686 }
6687}
6688
6689#[doc(hidden)]
6690impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildsResponse {
6691 type PageItem = crate::model::Build;
6692
6693 fn items(self) -> std::vec::Vec<Self::PageItem> {
6694 self.builds
6695 }
6696
6697 fn next_page_token(&self) -> std::string::String {
6698 use std::clone::Clone;
6699 self.next_page_token.clone()
6700 }
6701}
6702
6703/// Request to cancel an ongoing build.
6704#[derive(Clone, Default, PartialEq)]
6705#[non_exhaustive]
6706pub struct CancelBuildRequest {
6707 /// The name of the `Build` to cancel.
6708 /// Format: `projects/{project}/locations/{location}/builds/{build}`
6709 pub name: std::string::String,
6710
6711 /// Required. ID of the project.
6712 pub project_id: std::string::String,
6713
6714 /// Required. ID of the build.
6715 pub id: std::string::String,
6716
6717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6718}
6719
6720impl CancelBuildRequest {
6721 /// Creates a new default instance.
6722 pub fn new() -> Self {
6723 std::default::Default::default()
6724 }
6725
6726 /// Sets the value of [name][crate::model::CancelBuildRequest::name].
6727 ///
6728 /// # Example
6729 /// ```ignore,no_run
6730 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6731 /// # let project_id = "project_id";
6732 /// # let build_id = "build_id";
6733 /// let x = CancelBuildRequest::new().set_name(format!("projects/{project_id}/builds/{build_id}"));
6734 /// ```
6735 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6736 self.name = v.into();
6737 self
6738 }
6739
6740 /// Sets the value of [project_id][crate::model::CancelBuildRequest::project_id].
6741 ///
6742 /// # Example
6743 /// ```ignore,no_run
6744 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6745 /// let x = CancelBuildRequest::new().set_project_id("example");
6746 /// ```
6747 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6748 self.project_id = v.into();
6749 self
6750 }
6751
6752 /// Sets the value of [id][crate::model::CancelBuildRequest::id].
6753 ///
6754 /// # Example
6755 /// ```ignore,no_run
6756 /// # use google_cloud_build_v1::model::CancelBuildRequest;
6757 /// let x = CancelBuildRequest::new().set_id("example");
6758 /// ```
6759 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6760 self.id = v.into();
6761 self
6762 }
6763}
6764
6765impl wkt::message::Message for CancelBuildRequest {
6766 fn typename() -> &'static str {
6767 "type.googleapis.com/google.devtools.cloudbuild.v1.CancelBuildRequest"
6768 }
6769}
6770
6771/// Request to approve or reject a pending build.
6772#[derive(Clone, Default, PartialEq)]
6773#[non_exhaustive]
6774pub struct ApproveBuildRequest {
6775 /// Required. Name of the target build.
6776 /// For example: "projects/{$project_id}/builds/{$build_id}"
6777 pub name: std::string::String,
6778
6779 /// Approval decision and metadata.
6780 pub approval_result: std::option::Option<crate::model::ApprovalResult>,
6781
6782 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6783}
6784
6785impl ApproveBuildRequest {
6786 /// Creates a new default instance.
6787 pub fn new() -> Self {
6788 std::default::Default::default()
6789 }
6790
6791 /// Sets the value of [name][crate::model::ApproveBuildRequest::name].
6792 ///
6793 /// # Example
6794 /// ```ignore,no_run
6795 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6796 /// let x = ApproveBuildRequest::new().set_name("example");
6797 /// ```
6798 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6799 self.name = v.into();
6800 self
6801 }
6802
6803 /// Sets the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6804 ///
6805 /// # Example
6806 /// ```ignore,no_run
6807 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6808 /// use google_cloud_build_v1::model::ApprovalResult;
6809 /// let x = ApproveBuildRequest::new().set_approval_result(ApprovalResult::default()/* use setters */);
6810 /// ```
6811 pub fn set_approval_result<T>(mut self, v: T) -> Self
6812 where
6813 T: std::convert::Into<crate::model::ApprovalResult>,
6814 {
6815 self.approval_result = std::option::Option::Some(v.into());
6816 self
6817 }
6818
6819 /// Sets or clears the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
6820 ///
6821 /// # Example
6822 /// ```ignore,no_run
6823 /// # use google_cloud_build_v1::model::ApproveBuildRequest;
6824 /// use google_cloud_build_v1::model::ApprovalResult;
6825 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(Some(ApprovalResult::default()/* use setters */));
6826 /// let x = ApproveBuildRequest::new().set_or_clear_approval_result(None::<ApprovalResult>);
6827 /// ```
6828 pub fn set_or_clear_approval_result<T>(mut self, v: std::option::Option<T>) -> Self
6829 where
6830 T: std::convert::Into<crate::model::ApprovalResult>,
6831 {
6832 self.approval_result = v.map(|x| x.into());
6833 self
6834 }
6835}
6836
6837impl wkt::message::Message for ApproveBuildRequest {
6838 fn typename() -> &'static str {
6839 "type.googleapis.com/google.devtools.cloudbuild.v1.ApproveBuildRequest"
6840 }
6841}
6842
6843/// BuildApproval describes a build's approval configuration, state, and
6844/// result.
6845#[derive(Clone, Default, PartialEq)]
6846#[non_exhaustive]
6847pub struct BuildApproval {
6848 /// Output only. The state of this build's approval.
6849 pub state: crate::model::build_approval::State,
6850
6851 /// Output only. Configuration for manual approval of this build.
6852 pub config: std::option::Option<crate::model::ApprovalConfig>,
6853
6854 /// Output only. Result of manual approval for this Build.
6855 pub result: std::option::Option<crate::model::ApprovalResult>,
6856
6857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6858}
6859
6860impl BuildApproval {
6861 /// Creates a new default instance.
6862 pub fn new() -> Self {
6863 std::default::Default::default()
6864 }
6865
6866 /// Sets the value of [state][crate::model::BuildApproval::state].
6867 ///
6868 /// # Example
6869 /// ```ignore,no_run
6870 /// # use google_cloud_build_v1::model::BuildApproval;
6871 /// use google_cloud_build_v1::model::build_approval::State;
6872 /// let x0 = BuildApproval::new().set_state(State::Pending);
6873 /// let x1 = BuildApproval::new().set_state(State::Approved);
6874 /// let x2 = BuildApproval::new().set_state(State::Rejected);
6875 /// ```
6876 pub fn set_state<T: std::convert::Into<crate::model::build_approval::State>>(
6877 mut self,
6878 v: T,
6879 ) -> Self {
6880 self.state = v.into();
6881 self
6882 }
6883
6884 /// Sets the value of [config][crate::model::BuildApproval::config].
6885 ///
6886 /// # Example
6887 /// ```ignore,no_run
6888 /// # use google_cloud_build_v1::model::BuildApproval;
6889 /// use google_cloud_build_v1::model::ApprovalConfig;
6890 /// let x = BuildApproval::new().set_config(ApprovalConfig::default()/* use setters */);
6891 /// ```
6892 pub fn set_config<T>(mut self, v: T) -> Self
6893 where
6894 T: std::convert::Into<crate::model::ApprovalConfig>,
6895 {
6896 self.config = std::option::Option::Some(v.into());
6897 self
6898 }
6899
6900 /// Sets or clears the value of [config][crate::model::BuildApproval::config].
6901 ///
6902 /// # Example
6903 /// ```ignore,no_run
6904 /// # use google_cloud_build_v1::model::BuildApproval;
6905 /// use google_cloud_build_v1::model::ApprovalConfig;
6906 /// let x = BuildApproval::new().set_or_clear_config(Some(ApprovalConfig::default()/* use setters */));
6907 /// let x = BuildApproval::new().set_or_clear_config(None::<ApprovalConfig>);
6908 /// ```
6909 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
6910 where
6911 T: std::convert::Into<crate::model::ApprovalConfig>,
6912 {
6913 self.config = v.map(|x| x.into());
6914 self
6915 }
6916
6917 /// Sets the value of [result][crate::model::BuildApproval::result].
6918 ///
6919 /// # Example
6920 /// ```ignore,no_run
6921 /// # use google_cloud_build_v1::model::BuildApproval;
6922 /// use google_cloud_build_v1::model::ApprovalResult;
6923 /// let x = BuildApproval::new().set_result(ApprovalResult::default()/* use setters */);
6924 /// ```
6925 pub fn set_result<T>(mut self, v: T) -> Self
6926 where
6927 T: std::convert::Into<crate::model::ApprovalResult>,
6928 {
6929 self.result = std::option::Option::Some(v.into());
6930 self
6931 }
6932
6933 /// Sets or clears the value of [result][crate::model::BuildApproval::result].
6934 ///
6935 /// # Example
6936 /// ```ignore,no_run
6937 /// # use google_cloud_build_v1::model::BuildApproval;
6938 /// use google_cloud_build_v1::model::ApprovalResult;
6939 /// let x = BuildApproval::new().set_or_clear_result(Some(ApprovalResult::default()/* use setters */));
6940 /// let x = BuildApproval::new().set_or_clear_result(None::<ApprovalResult>);
6941 /// ```
6942 pub fn set_or_clear_result<T>(mut self, v: std::option::Option<T>) -> Self
6943 where
6944 T: std::convert::Into<crate::model::ApprovalResult>,
6945 {
6946 self.result = v.map(|x| x.into());
6947 self
6948 }
6949}
6950
6951impl wkt::message::Message for BuildApproval {
6952 fn typename() -> &'static str {
6953 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildApproval"
6954 }
6955}
6956
6957/// Defines additional types related to [BuildApproval].
6958pub mod build_approval {
6959 #[allow(unused_imports)]
6960 use super::*;
6961
6962 /// Specifies the current state of a build's approval.
6963 ///
6964 /// # Working with unknown values
6965 ///
6966 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6967 /// additional enum variants at any time. Adding new variants is not considered
6968 /// a breaking change. Applications should write their code in anticipation of:
6969 ///
6970 /// - New values appearing in future releases of the client library, **and**
6971 /// - New values received dynamically, without application changes.
6972 ///
6973 /// Please consult the [Working with enums] section in the user guide for some
6974 /// guidelines.
6975 ///
6976 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6977 #[derive(Clone, Debug, PartialEq)]
6978 #[non_exhaustive]
6979 pub enum State {
6980 /// Default enum type. This should not be used.
6981 Unspecified,
6982 /// Build approval is pending.
6983 Pending,
6984 /// Build approval has been approved.
6985 Approved,
6986 /// Build approval has been rejected.
6987 Rejected,
6988 /// Build was cancelled while it was still pending approval.
6989 Cancelled,
6990 /// If set, the enum was initialized with an unknown value.
6991 ///
6992 /// Applications can examine the value using [State::value] or
6993 /// [State::name].
6994 UnknownValue(state::UnknownValue),
6995 }
6996
6997 #[doc(hidden)]
6998 pub mod state {
6999 #[allow(unused_imports)]
7000 use super::*;
7001 #[derive(Clone, Debug, PartialEq)]
7002 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7003 }
7004
7005 impl State {
7006 /// Gets the enum value.
7007 ///
7008 /// Returns `None` if the enum contains an unknown value deserialized from
7009 /// the string representation of enums.
7010 pub fn value(&self) -> std::option::Option<i32> {
7011 match self {
7012 Self::Unspecified => std::option::Option::Some(0),
7013 Self::Pending => std::option::Option::Some(1),
7014 Self::Approved => std::option::Option::Some(2),
7015 Self::Rejected => std::option::Option::Some(3),
7016 Self::Cancelled => std::option::Option::Some(5),
7017 Self::UnknownValue(u) => u.0.value(),
7018 }
7019 }
7020
7021 /// Gets the enum value as a string.
7022 ///
7023 /// Returns `None` if the enum contains an unknown value deserialized from
7024 /// the integer representation of enums.
7025 pub fn name(&self) -> std::option::Option<&str> {
7026 match self {
7027 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7028 Self::Pending => std::option::Option::Some("PENDING"),
7029 Self::Approved => std::option::Option::Some("APPROVED"),
7030 Self::Rejected => std::option::Option::Some("REJECTED"),
7031 Self::Cancelled => std::option::Option::Some("CANCELLED"),
7032 Self::UnknownValue(u) => u.0.name(),
7033 }
7034 }
7035 }
7036
7037 impl std::default::Default for State {
7038 fn default() -> Self {
7039 use std::convert::From;
7040 Self::from(0)
7041 }
7042 }
7043
7044 impl std::fmt::Display for State {
7045 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7046 wkt::internal::display_enum(f, self.name(), self.value())
7047 }
7048 }
7049
7050 impl std::convert::From<i32> for State {
7051 fn from(value: i32) -> Self {
7052 match value {
7053 0 => Self::Unspecified,
7054 1 => Self::Pending,
7055 2 => Self::Approved,
7056 3 => Self::Rejected,
7057 5 => Self::Cancelled,
7058 _ => Self::UnknownValue(state::UnknownValue(
7059 wkt::internal::UnknownEnumValue::Integer(value),
7060 )),
7061 }
7062 }
7063 }
7064
7065 impl std::convert::From<&str> for State {
7066 fn from(value: &str) -> Self {
7067 use std::string::ToString;
7068 match value {
7069 "STATE_UNSPECIFIED" => Self::Unspecified,
7070 "PENDING" => Self::Pending,
7071 "APPROVED" => Self::Approved,
7072 "REJECTED" => Self::Rejected,
7073 "CANCELLED" => Self::Cancelled,
7074 _ => Self::UnknownValue(state::UnknownValue(
7075 wkt::internal::UnknownEnumValue::String(value.to_string()),
7076 )),
7077 }
7078 }
7079 }
7080
7081 impl serde::ser::Serialize for State {
7082 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7083 where
7084 S: serde::Serializer,
7085 {
7086 match self {
7087 Self::Unspecified => serializer.serialize_i32(0),
7088 Self::Pending => serializer.serialize_i32(1),
7089 Self::Approved => serializer.serialize_i32(2),
7090 Self::Rejected => serializer.serialize_i32(3),
7091 Self::Cancelled => serializer.serialize_i32(5),
7092 Self::UnknownValue(u) => u.0.serialize(serializer),
7093 }
7094 }
7095 }
7096
7097 impl<'de> serde::de::Deserialize<'de> for State {
7098 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7099 where
7100 D: serde::Deserializer<'de>,
7101 {
7102 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7103 ".google.devtools.cloudbuild.v1.BuildApproval.State",
7104 ))
7105 }
7106 }
7107}
7108
7109/// ApprovalConfig describes configuration for manual approval of a build.
7110#[derive(Clone, Default, PartialEq)]
7111#[non_exhaustive]
7112pub struct ApprovalConfig {
7113 /// Whether or not approval is needed. If this is set on a build, it will
7114 /// become pending when created, and will need to be explicitly approved
7115 /// to start.
7116 pub approval_required: bool,
7117
7118 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7119}
7120
7121impl ApprovalConfig {
7122 /// Creates a new default instance.
7123 pub fn new() -> Self {
7124 std::default::Default::default()
7125 }
7126
7127 /// Sets the value of [approval_required][crate::model::ApprovalConfig::approval_required].
7128 ///
7129 /// # Example
7130 /// ```ignore,no_run
7131 /// # use google_cloud_build_v1::model::ApprovalConfig;
7132 /// let x = ApprovalConfig::new().set_approval_required(true);
7133 /// ```
7134 pub fn set_approval_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7135 self.approval_required = v.into();
7136 self
7137 }
7138}
7139
7140impl wkt::message::Message for ApprovalConfig {
7141 fn typename() -> &'static str {
7142 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalConfig"
7143 }
7144}
7145
7146/// ApprovalResult describes the decision and associated metadata of a manual
7147/// approval of a build.
7148#[derive(Clone, Default, PartialEq)]
7149#[non_exhaustive]
7150pub struct ApprovalResult {
7151 /// Output only. Email of the user that called the ApproveBuild API to
7152 /// approve or reject a build at the time that the API was called.
7153 pub approver_account: std::string::String,
7154
7155 /// Output only. The time when the approval decision was made.
7156 pub approval_time: std::option::Option<wkt::Timestamp>,
7157
7158 /// Required. The decision of this manual approval.
7159 pub decision: crate::model::approval_result::Decision,
7160
7161 /// Optional. An optional comment for this manual approval result.
7162 pub comment: std::string::String,
7163
7164 /// Optional. An optional URL tied to this manual approval result. This field
7165 /// is essentially the same as comment, except that it will be rendered by the
7166 /// UI differently. An example use case is a link to an external job that
7167 /// approved this Build.
7168 pub url: std::string::String,
7169
7170 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7171}
7172
7173impl ApprovalResult {
7174 /// Creates a new default instance.
7175 pub fn new() -> Self {
7176 std::default::Default::default()
7177 }
7178
7179 /// Sets the value of [approver_account][crate::model::ApprovalResult::approver_account].
7180 ///
7181 /// # Example
7182 /// ```ignore,no_run
7183 /// # use google_cloud_build_v1::model::ApprovalResult;
7184 /// let x = ApprovalResult::new().set_approver_account("example");
7185 /// ```
7186 pub fn set_approver_account<T: std::convert::Into<std::string::String>>(
7187 mut self,
7188 v: T,
7189 ) -> Self {
7190 self.approver_account = v.into();
7191 self
7192 }
7193
7194 /// Sets the value of [approval_time][crate::model::ApprovalResult::approval_time].
7195 ///
7196 /// # Example
7197 /// ```ignore,no_run
7198 /// # use google_cloud_build_v1::model::ApprovalResult;
7199 /// use wkt::Timestamp;
7200 /// let x = ApprovalResult::new().set_approval_time(Timestamp::default()/* use setters */);
7201 /// ```
7202 pub fn set_approval_time<T>(mut self, v: T) -> Self
7203 where
7204 T: std::convert::Into<wkt::Timestamp>,
7205 {
7206 self.approval_time = std::option::Option::Some(v.into());
7207 self
7208 }
7209
7210 /// Sets or clears the value of [approval_time][crate::model::ApprovalResult::approval_time].
7211 ///
7212 /// # Example
7213 /// ```ignore,no_run
7214 /// # use google_cloud_build_v1::model::ApprovalResult;
7215 /// use wkt::Timestamp;
7216 /// let x = ApprovalResult::new().set_or_clear_approval_time(Some(Timestamp::default()/* use setters */));
7217 /// let x = ApprovalResult::new().set_or_clear_approval_time(None::<Timestamp>);
7218 /// ```
7219 pub fn set_or_clear_approval_time<T>(mut self, v: std::option::Option<T>) -> Self
7220 where
7221 T: std::convert::Into<wkt::Timestamp>,
7222 {
7223 self.approval_time = v.map(|x| x.into());
7224 self
7225 }
7226
7227 /// Sets the value of [decision][crate::model::ApprovalResult::decision].
7228 ///
7229 /// # Example
7230 /// ```ignore,no_run
7231 /// # use google_cloud_build_v1::model::ApprovalResult;
7232 /// use google_cloud_build_v1::model::approval_result::Decision;
7233 /// let x0 = ApprovalResult::new().set_decision(Decision::Approved);
7234 /// let x1 = ApprovalResult::new().set_decision(Decision::Rejected);
7235 /// ```
7236 pub fn set_decision<T: std::convert::Into<crate::model::approval_result::Decision>>(
7237 mut self,
7238 v: T,
7239 ) -> Self {
7240 self.decision = v.into();
7241 self
7242 }
7243
7244 /// Sets the value of [comment][crate::model::ApprovalResult::comment].
7245 ///
7246 /// # Example
7247 /// ```ignore,no_run
7248 /// # use google_cloud_build_v1::model::ApprovalResult;
7249 /// let x = ApprovalResult::new().set_comment("example");
7250 /// ```
7251 pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7252 self.comment = v.into();
7253 self
7254 }
7255
7256 /// Sets the value of [url][crate::model::ApprovalResult::url].
7257 ///
7258 /// # Example
7259 /// ```ignore,no_run
7260 /// # use google_cloud_build_v1::model::ApprovalResult;
7261 /// let x = ApprovalResult::new().set_url("example");
7262 /// ```
7263 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7264 self.url = v.into();
7265 self
7266 }
7267}
7268
7269impl wkt::message::Message for ApprovalResult {
7270 fn typename() -> &'static str {
7271 "type.googleapis.com/google.devtools.cloudbuild.v1.ApprovalResult"
7272 }
7273}
7274
7275/// Defines additional types related to [ApprovalResult].
7276pub mod approval_result {
7277 #[allow(unused_imports)]
7278 use super::*;
7279
7280 /// Specifies whether or not this manual approval result is to approve
7281 /// or reject a build.
7282 ///
7283 /// # Working with unknown values
7284 ///
7285 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7286 /// additional enum variants at any time. Adding new variants is not considered
7287 /// a breaking change. Applications should write their code in anticipation of:
7288 ///
7289 /// - New values appearing in future releases of the client library, **and**
7290 /// - New values received dynamically, without application changes.
7291 ///
7292 /// Please consult the [Working with enums] section in the user guide for some
7293 /// guidelines.
7294 ///
7295 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7296 #[derive(Clone, Debug, PartialEq)]
7297 #[non_exhaustive]
7298 pub enum Decision {
7299 /// Default enum type. This should not be used.
7300 Unspecified,
7301 /// Build is approved.
7302 Approved,
7303 /// Build is rejected.
7304 Rejected,
7305 /// If set, the enum was initialized with an unknown value.
7306 ///
7307 /// Applications can examine the value using [Decision::value] or
7308 /// [Decision::name].
7309 UnknownValue(decision::UnknownValue),
7310 }
7311
7312 #[doc(hidden)]
7313 pub mod decision {
7314 #[allow(unused_imports)]
7315 use super::*;
7316 #[derive(Clone, Debug, PartialEq)]
7317 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7318 }
7319
7320 impl Decision {
7321 /// Gets the enum value.
7322 ///
7323 /// Returns `None` if the enum contains an unknown value deserialized from
7324 /// the string representation of enums.
7325 pub fn value(&self) -> std::option::Option<i32> {
7326 match self {
7327 Self::Unspecified => std::option::Option::Some(0),
7328 Self::Approved => std::option::Option::Some(1),
7329 Self::Rejected => std::option::Option::Some(2),
7330 Self::UnknownValue(u) => u.0.value(),
7331 }
7332 }
7333
7334 /// Gets the enum value as a string.
7335 ///
7336 /// Returns `None` if the enum contains an unknown value deserialized from
7337 /// the integer representation of enums.
7338 pub fn name(&self) -> std::option::Option<&str> {
7339 match self {
7340 Self::Unspecified => std::option::Option::Some("DECISION_UNSPECIFIED"),
7341 Self::Approved => std::option::Option::Some("APPROVED"),
7342 Self::Rejected => std::option::Option::Some("REJECTED"),
7343 Self::UnknownValue(u) => u.0.name(),
7344 }
7345 }
7346 }
7347
7348 impl std::default::Default for Decision {
7349 fn default() -> Self {
7350 use std::convert::From;
7351 Self::from(0)
7352 }
7353 }
7354
7355 impl std::fmt::Display for Decision {
7356 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7357 wkt::internal::display_enum(f, self.name(), self.value())
7358 }
7359 }
7360
7361 impl std::convert::From<i32> for Decision {
7362 fn from(value: i32) -> Self {
7363 match value {
7364 0 => Self::Unspecified,
7365 1 => Self::Approved,
7366 2 => Self::Rejected,
7367 _ => Self::UnknownValue(decision::UnknownValue(
7368 wkt::internal::UnknownEnumValue::Integer(value),
7369 )),
7370 }
7371 }
7372 }
7373
7374 impl std::convert::From<&str> for Decision {
7375 fn from(value: &str) -> Self {
7376 use std::string::ToString;
7377 match value {
7378 "DECISION_UNSPECIFIED" => Self::Unspecified,
7379 "APPROVED" => Self::Approved,
7380 "REJECTED" => Self::Rejected,
7381 _ => Self::UnknownValue(decision::UnknownValue(
7382 wkt::internal::UnknownEnumValue::String(value.to_string()),
7383 )),
7384 }
7385 }
7386 }
7387
7388 impl serde::ser::Serialize for Decision {
7389 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7390 where
7391 S: serde::Serializer,
7392 {
7393 match self {
7394 Self::Unspecified => serializer.serialize_i32(0),
7395 Self::Approved => serializer.serialize_i32(1),
7396 Self::Rejected => serializer.serialize_i32(2),
7397 Self::UnknownValue(u) => u.0.serialize(serializer),
7398 }
7399 }
7400 }
7401
7402 impl<'de> serde::de::Deserialize<'de> for Decision {
7403 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7404 where
7405 D: serde::Deserializer<'de>,
7406 {
7407 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Decision>::new(
7408 ".google.devtools.cloudbuild.v1.ApprovalResult.Decision",
7409 ))
7410 }
7411 }
7412}
7413
7414/// GitRepoSource describes a repo and ref of a code repository.
7415#[derive(Clone, Default, PartialEq)]
7416#[non_exhaustive]
7417pub struct GitRepoSource {
7418 /// The URI of the repo (e.g. <https://github.com/user/repo.git>).
7419 /// Either `uri` or `repository` can be specified and is required.
7420 pub uri: std::string::String,
7421
7422 /// The branch or tag to use. Must start with "refs/" (required).
7423 pub r#ref: std::string::String,
7424
7425 /// See RepoType below.
7426 pub repo_type: crate::model::git_file_source::RepoType,
7427
7428 /// The source of the SCM repo.
7429 pub source: std::option::Option<crate::model::git_repo_source::Source>,
7430
7431 /// The resource name of the enterprise config that should be applied
7432 /// to this source.
7433 pub enterprise_config: std::option::Option<crate::model::git_repo_source::EnterpriseConfig>,
7434
7435 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7436}
7437
7438impl GitRepoSource {
7439 /// Creates a new default instance.
7440 pub fn new() -> Self {
7441 std::default::Default::default()
7442 }
7443
7444 /// Sets the value of [uri][crate::model::GitRepoSource::uri].
7445 ///
7446 /// # Example
7447 /// ```ignore,no_run
7448 /// # use google_cloud_build_v1::model::GitRepoSource;
7449 /// let x = GitRepoSource::new().set_uri("example");
7450 /// ```
7451 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7452 self.uri = v.into();
7453 self
7454 }
7455
7456 /// Sets the value of [r#ref][crate::model::GitRepoSource::ref].
7457 ///
7458 /// # Example
7459 /// ```ignore,no_run
7460 /// # use google_cloud_build_v1::model::GitRepoSource;
7461 /// let x = GitRepoSource::new().set_ref("example");
7462 /// ```
7463 pub fn set_ref<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7464 self.r#ref = v.into();
7465 self
7466 }
7467
7468 /// Sets the value of [repo_type][crate::model::GitRepoSource::repo_type].
7469 ///
7470 /// # Example
7471 /// ```ignore,no_run
7472 /// # use google_cloud_build_v1::model::GitRepoSource;
7473 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7474 /// let x0 = GitRepoSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7475 /// let x1 = GitRepoSource::new().set_repo_type(RepoType::Github);
7476 /// let x2 = GitRepoSource::new().set_repo_type(RepoType::BitbucketServer);
7477 /// ```
7478 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7479 mut self,
7480 v: T,
7481 ) -> Self {
7482 self.repo_type = v.into();
7483 self
7484 }
7485
7486 /// Sets the value of [source][crate::model::GitRepoSource::source].
7487 ///
7488 /// Note that all the setters affecting `source` are mutually
7489 /// exclusive.
7490 ///
7491 /// # Example
7492 /// ```ignore,no_run
7493 /// # use google_cloud_build_v1::model::GitRepoSource;
7494 /// use google_cloud_build_v1::model::git_repo_source::Source;
7495 /// let x = GitRepoSource::new().set_source(Some(Source::Repository("example".to_string())));
7496 /// ```
7497 pub fn set_source<
7498 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::Source>>,
7499 >(
7500 mut self,
7501 v: T,
7502 ) -> Self {
7503 self.source = v.into();
7504 self
7505 }
7506
7507 /// The value of [source][crate::model::GitRepoSource::source]
7508 /// if it holds a `Repository`, `None` if the field is not set or
7509 /// holds a different branch.
7510 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7511 #[allow(unreachable_patterns)]
7512 self.source.as_ref().and_then(|v| match v {
7513 crate::model::git_repo_source::Source::Repository(v) => std::option::Option::Some(v),
7514 _ => std::option::Option::None,
7515 })
7516 }
7517
7518 /// Sets the value of [source][crate::model::GitRepoSource::source]
7519 /// to hold a `Repository`.
7520 ///
7521 /// Note that all the setters affecting `source` are
7522 /// mutually exclusive.
7523 ///
7524 /// # Example
7525 /// ```ignore,no_run
7526 /// # use google_cloud_build_v1::model::GitRepoSource;
7527 /// let x = GitRepoSource::new().set_repository("example");
7528 /// assert!(x.repository().is_some());
7529 /// ```
7530 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7531 self.source =
7532 std::option::Option::Some(crate::model::git_repo_source::Source::Repository(v.into()));
7533 self
7534 }
7535
7536 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config].
7537 ///
7538 /// Note that all the setters affecting `enterprise_config` are mutually
7539 /// exclusive.
7540 ///
7541 /// # Example
7542 /// ```ignore,no_run
7543 /// # use google_cloud_build_v1::model::GitRepoSource;
7544 /// use google_cloud_build_v1::model::git_repo_source::EnterpriseConfig;
7545 /// let x = GitRepoSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7546 /// ```
7547 pub fn set_enterprise_config<
7548 T: std::convert::Into<std::option::Option<crate::model::git_repo_source::EnterpriseConfig>>,
7549 >(
7550 mut self,
7551 v: T,
7552 ) -> Self {
7553 self.enterprise_config = v.into();
7554 self
7555 }
7556
7557 /// The value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7558 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7559 /// holds a different branch.
7560 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7561 #[allow(unreachable_patterns)]
7562 self.enterprise_config.as_ref().and_then(|v| match v {
7563 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7564 std::option::Option::Some(v)
7565 }
7566 _ => std::option::Option::None,
7567 })
7568 }
7569
7570 /// Sets the value of [enterprise_config][crate::model::GitRepoSource::enterprise_config]
7571 /// to hold a `GithubEnterpriseConfig`.
7572 ///
7573 /// Note that all the setters affecting `enterprise_config` are
7574 /// mutually exclusive.
7575 ///
7576 /// # Example
7577 /// ```ignore,no_run
7578 /// # use google_cloud_build_v1::model::GitRepoSource;
7579 /// # let project_id = "project_id";
7580 /// # let config_id = "config_id";
7581 /// let x = GitRepoSource::new().set_github_enterprise_config(format!("projects/{project_id}/githubEnterpriseConfigs/{config_id}"));
7582 /// assert!(x.github_enterprise_config().is_some());
7583 /// ```
7584 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7585 mut self,
7586 v: T,
7587 ) -> Self {
7588 self.enterprise_config = std::option::Option::Some(
7589 crate::model::git_repo_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7590 );
7591 self
7592 }
7593}
7594
7595impl wkt::message::Message for GitRepoSource {
7596 fn typename() -> &'static str {
7597 "type.googleapis.com/google.devtools.cloudbuild.v1.GitRepoSource"
7598 }
7599}
7600
7601/// Defines additional types related to [GitRepoSource].
7602pub mod git_repo_source {
7603 #[allow(unused_imports)]
7604 use super::*;
7605
7606 /// The source of the SCM repo.
7607 #[derive(Clone, Debug, PartialEq)]
7608 #[non_exhaustive]
7609 pub enum Source {
7610 /// The connected repository resource name, in the format
7611 /// `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or
7612 /// `repository` can be specified and is required.
7613 Repository(std::string::String),
7614 }
7615
7616 /// The resource name of the enterprise config that should be applied
7617 /// to this source.
7618 #[derive(Clone, Debug, PartialEq)]
7619 #[non_exhaustive]
7620 pub enum EnterpriseConfig {
7621 /// The full resource name of the github enterprise config.
7622 /// Format:
7623 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
7624 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
7625 GithubEnterpriseConfig(std::string::String),
7626 }
7627}
7628
7629/// GitFileSource describes a file within a (possibly remote) code repository.
7630#[derive(Clone, Default, PartialEq)]
7631#[non_exhaustive]
7632pub struct GitFileSource {
7633 /// The path of the file, with the repo root as the root of the path.
7634 pub path: std::string::String,
7635
7636 /// The URI of the repo.
7637 /// Either uri or repository can be specified.
7638 /// If unspecified, the repo from which the trigger invocation originated is
7639 /// assumed to be the repo from which to read the specified path.
7640 pub uri: std::string::String,
7641
7642 /// See RepoType above.
7643 pub repo_type: crate::model::git_file_source::RepoType,
7644
7645 /// The branch, tag, arbitrary ref, or SHA version of the repo to use when
7646 /// resolving the filename (optional).
7647 /// This field respects the same syntax/resolution as described here:
7648 /// <https://git-scm.com/docs/gitrevisions>
7649 /// If unspecified, the revision from which the trigger invocation originated
7650 /// is assumed to be the revision from which to read the specified path.
7651 pub revision: std::string::String,
7652
7653 /// The source of the SCM repo.
7654 pub source: std::option::Option<crate::model::git_file_source::Source>,
7655
7656 /// The resource name of the enterprise config that should be applied
7657 /// to this source.
7658 pub enterprise_config: std::option::Option<crate::model::git_file_source::EnterpriseConfig>,
7659
7660 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7661}
7662
7663impl GitFileSource {
7664 /// Creates a new default instance.
7665 pub fn new() -> Self {
7666 std::default::Default::default()
7667 }
7668
7669 /// Sets the value of [path][crate::model::GitFileSource::path].
7670 ///
7671 /// # Example
7672 /// ```ignore,no_run
7673 /// # use google_cloud_build_v1::model::GitFileSource;
7674 /// let x = GitFileSource::new().set_path("example");
7675 /// ```
7676 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7677 self.path = v.into();
7678 self
7679 }
7680
7681 /// Sets the value of [uri][crate::model::GitFileSource::uri].
7682 ///
7683 /// # Example
7684 /// ```ignore,no_run
7685 /// # use google_cloud_build_v1::model::GitFileSource;
7686 /// let x = GitFileSource::new().set_uri("example");
7687 /// ```
7688 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7689 self.uri = v.into();
7690 self
7691 }
7692
7693 /// Sets the value of [repo_type][crate::model::GitFileSource::repo_type].
7694 ///
7695 /// # Example
7696 /// ```ignore,no_run
7697 /// # use google_cloud_build_v1::model::GitFileSource;
7698 /// use google_cloud_build_v1::model::git_file_source::RepoType;
7699 /// let x0 = GitFileSource::new().set_repo_type(RepoType::CloudSourceRepositories);
7700 /// let x1 = GitFileSource::new().set_repo_type(RepoType::Github);
7701 /// let x2 = GitFileSource::new().set_repo_type(RepoType::BitbucketServer);
7702 /// ```
7703 pub fn set_repo_type<T: std::convert::Into<crate::model::git_file_source::RepoType>>(
7704 mut self,
7705 v: T,
7706 ) -> Self {
7707 self.repo_type = v.into();
7708 self
7709 }
7710
7711 /// Sets the value of [revision][crate::model::GitFileSource::revision].
7712 ///
7713 /// # Example
7714 /// ```ignore,no_run
7715 /// # use google_cloud_build_v1::model::GitFileSource;
7716 /// let x = GitFileSource::new().set_revision("example");
7717 /// ```
7718 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7719 self.revision = v.into();
7720 self
7721 }
7722
7723 /// Sets the value of [source][crate::model::GitFileSource::source].
7724 ///
7725 /// Note that all the setters affecting `source` are mutually
7726 /// exclusive.
7727 ///
7728 /// # Example
7729 /// ```ignore,no_run
7730 /// # use google_cloud_build_v1::model::GitFileSource;
7731 /// use google_cloud_build_v1::model::git_file_source::Source;
7732 /// let x = GitFileSource::new().set_source(Some(Source::Repository("example".to_string())));
7733 /// ```
7734 pub fn set_source<
7735 T: std::convert::Into<std::option::Option<crate::model::git_file_source::Source>>,
7736 >(
7737 mut self,
7738 v: T,
7739 ) -> Self {
7740 self.source = v.into();
7741 self
7742 }
7743
7744 /// The value of [source][crate::model::GitFileSource::source]
7745 /// if it holds a `Repository`, `None` if the field is not set or
7746 /// holds a different branch.
7747 pub fn repository(&self) -> std::option::Option<&std::string::String> {
7748 #[allow(unreachable_patterns)]
7749 self.source.as_ref().and_then(|v| match v {
7750 crate::model::git_file_source::Source::Repository(v) => std::option::Option::Some(v),
7751 _ => std::option::Option::None,
7752 })
7753 }
7754
7755 /// Sets the value of [source][crate::model::GitFileSource::source]
7756 /// to hold a `Repository`.
7757 ///
7758 /// Note that all the setters affecting `source` are
7759 /// mutually exclusive.
7760 ///
7761 /// # Example
7762 /// ```ignore,no_run
7763 /// # use google_cloud_build_v1::model::GitFileSource;
7764 /// let x = GitFileSource::new().set_repository("example");
7765 /// assert!(x.repository().is_some());
7766 /// ```
7767 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7768 self.source =
7769 std::option::Option::Some(crate::model::git_file_source::Source::Repository(v.into()));
7770 self
7771 }
7772
7773 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config].
7774 ///
7775 /// Note that all the setters affecting `enterprise_config` are mutually
7776 /// exclusive.
7777 ///
7778 /// # Example
7779 /// ```ignore,no_run
7780 /// # use google_cloud_build_v1::model::GitFileSource;
7781 /// use google_cloud_build_v1::model::git_file_source::EnterpriseConfig;
7782 /// let x = GitFileSource::new().set_enterprise_config(Some(EnterpriseConfig::GithubEnterpriseConfig("example".to_string())));
7783 /// ```
7784 pub fn set_enterprise_config<
7785 T: std::convert::Into<std::option::Option<crate::model::git_file_source::EnterpriseConfig>>,
7786 >(
7787 mut self,
7788 v: T,
7789 ) -> Self {
7790 self.enterprise_config = v.into();
7791 self
7792 }
7793
7794 /// The value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7795 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
7796 /// holds a different branch.
7797 pub fn github_enterprise_config(&self) -> std::option::Option<&std::string::String> {
7798 #[allow(unreachable_patterns)]
7799 self.enterprise_config.as_ref().and_then(|v| match v {
7800 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v) => {
7801 std::option::Option::Some(v)
7802 }
7803 _ => std::option::Option::None,
7804 })
7805 }
7806
7807 /// Sets the value of [enterprise_config][crate::model::GitFileSource::enterprise_config]
7808 /// to hold a `GithubEnterpriseConfig`.
7809 ///
7810 /// Note that all the setters affecting `enterprise_config` are
7811 /// mutually exclusive.
7812 ///
7813 /// # Example
7814 /// ```ignore,no_run
7815 /// # use google_cloud_build_v1::model::GitFileSource;
7816 /// # let project_id = "project_id";
7817 /// # let config_id = "config_id";
7818 /// let x = GitFileSource::new().set_github_enterprise_config(format!("projects/{project_id}/githubEnterpriseConfigs/{config_id}"));
7819 /// assert!(x.github_enterprise_config().is_some());
7820 /// ```
7821 pub fn set_github_enterprise_config<T: std::convert::Into<std::string::String>>(
7822 mut self,
7823 v: T,
7824 ) -> Self {
7825 self.enterprise_config = std::option::Option::Some(
7826 crate::model::git_file_source::EnterpriseConfig::GithubEnterpriseConfig(v.into()),
7827 );
7828 self
7829 }
7830}
7831
7832impl wkt::message::Message for GitFileSource {
7833 fn typename() -> &'static str {
7834 "type.googleapis.com/google.devtools.cloudbuild.v1.GitFileSource"
7835 }
7836}
7837
7838/// Defines additional types related to [GitFileSource].
7839pub mod git_file_source {
7840 #[allow(unused_imports)]
7841 use super::*;
7842
7843 /// The type of the repo, since it may not be explicit from the `repo` field
7844 /// (e.g from a URL).
7845 ///
7846 /// # Working with unknown values
7847 ///
7848 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7849 /// additional enum variants at any time. Adding new variants is not considered
7850 /// a breaking change. Applications should write their code in anticipation of:
7851 ///
7852 /// - New values appearing in future releases of the client library, **and**
7853 /// - New values received dynamically, without application changes.
7854 ///
7855 /// Please consult the [Working with enums] section in the user guide for some
7856 /// guidelines.
7857 ///
7858 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7859 #[derive(Clone, Debug, PartialEq)]
7860 #[non_exhaustive]
7861 pub enum RepoType {
7862 /// The default, unknown repo type. Don't use it, instead use one of
7863 /// the other repo types.
7864 Unknown,
7865 /// A Google Cloud Source Repositories-hosted repo.
7866 CloudSourceRepositories,
7867 /// A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub
7868 /// Enterprise).
7869 Github,
7870 /// A Bitbucket Server-hosted repo.
7871 BitbucketServer,
7872 /// A GitLab-hosted repo.
7873 Gitlab,
7874 /// If set, the enum was initialized with an unknown value.
7875 ///
7876 /// Applications can examine the value using [RepoType::value] or
7877 /// [RepoType::name].
7878 UnknownValue(repo_type::UnknownValue),
7879 }
7880
7881 #[doc(hidden)]
7882 pub mod repo_type {
7883 #[allow(unused_imports)]
7884 use super::*;
7885 #[derive(Clone, Debug, PartialEq)]
7886 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7887 }
7888
7889 impl RepoType {
7890 /// Gets the enum value.
7891 ///
7892 /// Returns `None` if the enum contains an unknown value deserialized from
7893 /// the string representation of enums.
7894 pub fn value(&self) -> std::option::Option<i32> {
7895 match self {
7896 Self::Unknown => std::option::Option::Some(0),
7897 Self::CloudSourceRepositories => std::option::Option::Some(1),
7898 Self::Github => std::option::Option::Some(2),
7899 Self::BitbucketServer => std::option::Option::Some(3),
7900 Self::Gitlab => std::option::Option::Some(4),
7901 Self::UnknownValue(u) => u.0.value(),
7902 }
7903 }
7904
7905 /// Gets the enum value as a string.
7906 ///
7907 /// Returns `None` if the enum contains an unknown value deserialized from
7908 /// the integer representation of enums.
7909 pub fn name(&self) -> std::option::Option<&str> {
7910 match self {
7911 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7912 Self::CloudSourceRepositories => {
7913 std::option::Option::Some("CLOUD_SOURCE_REPOSITORIES")
7914 }
7915 Self::Github => std::option::Option::Some("GITHUB"),
7916 Self::BitbucketServer => std::option::Option::Some("BITBUCKET_SERVER"),
7917 Self::Gitlab => std::option::Option::Some("GITLAB"),
7918 Self::UnknownValue(u) => u.0.name(),
7919 }
7920 }
7921 }
7922
7923 impl std::default::Default for RepoType {
7924 fn default() -> Self {
7925 use std::convert::From;
7926 Self::from(0)
7927 }
7928 }
7929
7930 impl std::fmt::Display for RepoType {
7931 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7932 wkt::internal::display_enum(f, self.name(), self.value())
7933 }
7934 }
7935
7936 impl std::convert::From<i32> for RepoType {
7937 fn from(value: i32) -> Self {
7938 match value {
7939 0 => Self::Unknown,
7940 1 => Self::CloudSourceRepositories,
7941 2 => Self::Github,
7942 3 => Self::BitbucketServer,
7943 4 => Self::Gitlab,
7944 _ => Self::UnknownValue(repo_type::UnknownValue(
7945 wkt::internal::UnknownEnumValue::Integer(value),
7946 )),
7947 }
7948 }
7949 }
7950
7951 impl std::convert::From<&str> for RepoType {
7952 fn from(value: &str) -> Self {
7953 use std::string::ToString;
7954 match value {
7955 "UNKNOWN" => Self::Unknown,
7956 "CLOUD_SOURCE_REPOSITORIES" => Self::CloudSourceRepositories,
7957 "GITHUB" => Self::Github,
7958 "BITBUCKET_SERVER" => Self::BitbucketServer,
7959 "GITLAB" => Self::Gitlab,
7960 _ => Self::UnknownValue(repo_type::UnknownValue(
7961 wkt::internal::UnknownEnumValue::String(value.to_string()),
7962 )),
7963 }
7964 }
7965 }
7966
7967 impl serde::ser::Serialize for RepoType {
7968 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7969 where
7970 S: serde::Serializer,
7971 {
7972 match self {
7973 Self::Unknown => serializer.serialize_i32(0),
7974 Self::CloudSourceRepositories => serializer.serialize_i32(1),
7975 Self::Github => serializer.serialize_i32(2),
7976 Self::BitbucketServer => serializer.serialize_i32(3),
7977 Self::Gitlab => serializer.serialize_i32(4),
7978 Self::UnknownValue(u) => u.0.serialize(serializer),
7979 }
7980 }
7981 }
7982
7983 impl<'de> serde::de::Deserialize<'de> for RepoType {
7984 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7985 where
7986 D: serde::Deserializer<'de>,
7987 {
7988 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepoType>::new(
7989 ".google.devtools.cloudbuild.v1.GitFileSource.RepoType",
7990 ))
7991 }
7992 }
7993
7994 /// The source of the SCM repo.
7995 #[derive(Clone, Debug, PartialEq)]
7996 #[non_exhaustive]
7997 pub enum Source {
7998 /// The fully qualified resource name of the Repos API repository.
7999 /// Either URI or repository can be specified.
8000 /// If unspecified, the repo from which the trigger invocation originated is
8001 /// assumed to be the repo from which to read the specified path.
8002 Repository(std::string::String),
8003 }
8004
8005 /// The resource name of the enterprise config that should be applied
8006 /// to this source.
8007 #[derive(Clone, Debug, PartialEq)]
8008 #[non_exhaustive]
8009 pub enum EnterpriseConfig {
8010 /// The full resource name of the github enterprise config.
8011 /// Format:
8012 /// `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`.
8013 /// `projects/{project}/githubEnterpriseConfigs/{id}`.
8014 GithubEnterpriseConfig(std::string::String),
8015 }
8016}
8017
8018/// Configuration for an automated build in response to source repository
8019/// changes.
8020#[derive(Clone, Default, PartialEq)]
8021#[non_exhaustive]
8022pub struct BuildTrigger {
8023 /// The `Trigger` name with format:
8024 /// `projects/{project}/locations/{location}/triggers/{trigger}`, where
8025 /// {trigger} is a unique identifier generated by the service.
8026 pub resource_name: std::string::String,
8027
8028 /// Output only. Unique identifier of the trigger.
8029 pub id: std::string::String,
8030
8031 /// Human-readable description of this trigger.
8032 pub description: std::string::String,
8033
8034 /// User-assigned name of the trigger. Must be unique within the project.
8035 /// Trigger names must meet the following requirements:
8036 ///
8037 /// + They must contain only alphanumeric characters and dashes.
8038 /// + They can be 1-64 characters long.
8039 /// + They must begin and end with an alphanumeric character.
8040 pub name: std::string::String,
8041
8042 /// Tags for annotation of a `BuildTrigger`
8043 pub tags: std::vec::Vec<std::string::String>,
8044
8045 /// Template describing the types of source changes to trigger a build.
8046 ///
8047 /// Branch and tag names in trigger templates are interpreted as regular
8048 /// expressions. Any branch or tag change that matches that regular expression
8049 /// will trigger a build.
8050 ///
8051 /// Mutually exclusive with `github`.
8052 pub trigger_template: std::option::Option<crate::model::RepoSource>,
8053
8054 /// GitHubEventsConfig describes the configuration of a trigger that creates
8055 /// a build whenever a GitHub event is received.
8056 ///
8057 /// Mutually exclusive with `trigger_template`.
8058 pub github: std::option::Option<crate::model::GitHubEventsConfig>,
8059
8060 /// PubsubConfig describes the configuration of a trigger that
8061 /// creates a build whenever a Pub/Sub message is published.
8062 pub pubsub_config: std::option::Option<crate::model::PubsubConfig>,
8063
8064 /// WebhookConfig describes the configuration of a trigger that
8065 /// creates a build whenever a webhook is sent to a trigger's webhook URL.
8066 pub webhook_config: std::option::Option<crate::model::WebhookConfig>,
8067
8068 /// Output only. Time when the trigger was created.
8069 pub create_time: std::option::Option<wkt::Timestamp>,
8070
8071 /// If true, the trigger will never automatically execute a build.
8072 pub disabled: bool,
8073
8074 /// Substitutions for Build resource. The keys must match the following
8075 /// regular expression: `^_[A-Z0-9_]+$`.
8076 pub substitutions: std::collections::HashMap<std::string::String, std::string::String>,
8077
8078 /// ignored_files and included_files are file glob matches using
8079 /// <https://golang.org/pkg/path/filepath/#Match> extended with support for "**".
8080 ///
8081 /// If ignored_files and changed files are both empty, then they are
8082 /// not used to determine whether or not to trigger a build.
8083 ///
8084 /// If ignored_files is not empty, then we ignore any files that match
8085 /// any of the ignored_file globs. If the change has no files that are
8086 /// outside of the ignored_files globs, then we do not trigger a build.
8087 pub ignored_files: std::vec::Vec<std::string::String>,
8088
8089 /// If any of the files altered in the commit pass the ignored_files
8090 /// filter and included_files is empty, then as far as this filter is
8091 /// concerned, we should trigger the build.
8092 ///
8093 /// If any of the files altered in the commit pass the ignored_files
8094 /// filter and included_files is not empty, then we make sure that at
8095 /// least one of those files matches a included_files glob. If not,
8096 /// then we do not trigger a build.
8097 pub included_files: std::vec::Vec<std::string::String>,
8098
8099 /// Optional. A Common Expression Language string.
8100 pub filter: std::string::String,
8101
8102 /// The repo and ref of the repository from which to build. This field
8103 /// is used only for those triggers that do not respond to SCM events.
8104 /// Triggers that respond to such events build source at whatever commit
8105 /// caused the event.
8106 /// This field is currently only used by Webhook, Pub/Sub, Manual, and Cron
8107 /// triggers.
8108 pub source_to_build: std::option::Option<crate::model::GitRepoSource>,
8109
8110 /// The service account used for all user-controlled operations including
8111 /// UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
8112 /// If no service account is set and the legacy Cloud Build service account
8113 /// (`[PROJECT_NUM]@cloudbuild.gserviceaccount.com`) is the default for the
8114 /// project then it will be used instead.
8115 /// Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
8116 pub service_account: std::string::String,
8117
8118 /// The configuration of a trigger that creates a build whenever an event from
8119 /// Repo API is received.
8120 pub repository_event_config: std::option::Option<crate::model::RepositoryEventConfig>,
8121
8122 /// Template describing the Build request to make when the trigger is matched.
8123 /// At least one of the template fields must be provided.
8124 pub build_template: std::option::Option<crate::model::build_trigger::BuildTemplate>,
8125
8126 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8127}
8128
8129impl BuildTrigger {
8130 /// Creates a new default instance.
8131 pub fn new() -> Self {
8132 std::default::Default::default()
8133 }
8134
8135 /// Sets the value of [resource_name][crate::model::BuildTrigger::resource_name].
8136 ///
8137 /// # Example
8138 /// ```ignore,no_run
8139 /// # use google_cloud_build_v1::model::BuildTrigger;
8140 /// let x = BuildTrigger::new().set_resource_name("example");
8141 /// ```
8142 pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8143 self.resource_name = v.into();
8144 self
8145 }
8146
8147 /// Sets the value of [id][crate::model::BuildTrigger::id].
8148 ///
8149 /// # Example
8150 /// ```ignore,no_run
8151 /// # use google_cloud_build_v1::model::BuildTrigger;
8152 /// let x = BuildTrigger::new().set_id("example");
8153 /// ```
8154 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8155 self.id = v.into();
8156 self
8157 }
8158
8159 /// Sets the value of [description][crate::model::BuildTrigger::description].
8160 ///
8161 /// # Example
8162 /// ```ignore,no_run
8163 /// # use google_cloud_build_v1::model::BuildTrigger;
8164 /// let x = BuildTrigger::new().set_description("example");
8165 /// ```
8166 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8167 self.description = v.into();
8168 self
8169 }
8170
8171 /// Sets the value of [name][crate::model::BuildTrigger::name].
8172 ///
8173 /// # Example
8174 /// ```ignore,no_run
8175 /// # use google_cloud_build_v1::model::BuildTrigger;
8176 /// # let project_id = "project_id";
8177 /// # let trigger_id = "trigger_id";
8178 /// let x = BuildTrigger::new().set_name(format!("projects/{project_id}/triggers/{trigger_id}"));
8179 /// ```
8180 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8181 self.name = v.into();
8182 self
8183 }
8184
8185 /// Sets the value of [tags][crate::model::BuildTrigger::tags].
8186 ///
8187 /// # Example
8188 /// ```ignore,no_run
8189 /// # use google_cloud_build_v1::model::BuildTrigger;
8190 /// let x = BuildTrigger::new().set_tags(["a", "b", "c"]);
8191 /// ```
8192 pub fn set_tags<T, V>(mut self, v: T) -> Self
8193 where
8194 T: std::iter::IntoIterator<Item = V>,
8195 V: std::convert::Into<std::string::String>,
8196 {
8197 use std::iter::Iterator;
8198 self.tags = v.into_iter().map(|i| i.into()).collect();
8199 self
8200 }
8201
8202 /// Sets the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8203 ///
8204 /// # Example
8205 /// ```ignore,no_run
8206 /// # use google_cloud_build_v1::model::BuildTrigger;
8207 /// use google_cloud_build_v1::model::RepoSource;
8208 /// let x = BuildTrigger::new().set_trigger_template(RepoSource::default()/* use setters */);
8209 /// ```
8210 pub fn set_trigger_template<T>(mut self, v: T) -> Self
8211 where
8212 T: std::convert::Into<crate::model::RepoSource>,
8213 {
8214 self.trigger_template = std::option::Option::Some(v.into());
8215 self
8216 }
8217
8218 /// Sets or clears the value of [trigger_template][crate::model::BuildTrigger::trigger_template].
8219 ///
8220 /// # Example
8221 /// ```ignore,no_run
8222 /// # use google_cloud_build_v1::model::BuildTrigger;
8223 /// use google_cloud_build_v1::model::RepoSource;
8224 /// let x = BuildTrigger::new().set_or_clear_trigger_template(Some(RepoSource::default()/* use setters */));
8225 /// let x = BuildTrigger::new().set_or_clear_trigger_template(None::<RepoSource>);
8226 /// ```
8227 pub fn set_or_clear_trigger_template<T>(mut self, v: std::option::Option<T>) -> Self
8228 where
8229 T: std::convert::Into<crate::model::RepoSource>,
8230 {
8231 self.trigger_template = v.map(|x| x.into());
8232 self
8233 }
8234
8235 /// Sets the value of [github][crate::model::BuildTrigger::github].
8236 ///
8237 /// # Example
8238 /// ```ignore,no_run
8239 /// # use google_cloud_build_v1::model::BuildTrigger;
8240 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8241 /// let x = BuildTrigger::new().set_github(GitHubEventsConfig::default()/* use setters */);
8242 /// ```
8243 pub fn set_github<T>(mut self, v: T) -> Self
8244 where
8245 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8246 {
8247 self.github = std::option::Option::Some(v.into());
8248 self
8249 }
8250
8251 /// Sets or clears the value of [github][crate::model::BuildTrigger::github].
8252 ///
8253 /// # Example
8254 /// ```ignore,no_run
8255 /// # use google_cloud_build_v1::model::BuildTrigger;
8256 /// use google_cloud_build_v1::model::GitHubEventsConfig;
8257 /// let x = BuildTrigger::new().set_or_clear_github(Some(GitHubEventsConfig::default()/* use setters */));
8258 /// let x = BuildTrigger::new().set_or_clear_github(None::<GitHubEventsConfig>);
8259 /// ```
8260 pub fn set_or_clear_github<T>(mut self, v: std::option::Option<T>) -> Self
8261 where
8262 T: std::convert::Into<crate::model::GitHubEventsConfig>,
8263 {
8264 self.github = v.map(|x| x.into());
8265 self
8266 }
8267
8268 /// Sets the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8269 ///
8270 /// # Example
8271 /// ```ignore,no_run
8272 /// # use google_cloud_build_v1::model::BuildTrigger;
8273 /// use google_cloud_build_v1::model::PubsubConfig;
8274 /// let x = BuildTrigger::new().set_pubsub_config(PubsubConfig::default()/* use setters */);
8275 /// ```
8276 pub fn set_pubsub_config<T>(mut self, v: T) -> Self
8277 where
8278 T: std::convert::Into<crate::model::PubsubConfig>,
8279 {
8280 self.pubsub_config = std::option::Option::Some(v.into());
8281 self
8282 }
8283
8284 /// Sets or clears the value of [pubsub_config][crate::model::BuildTrigger::pubsub_config].
8285 ///
8286 /// # Example
8287 /// ```ignore,no_run
8288 /// # use google_cloud_build_v1::model::BuildTrigger;
8289 /// use google_cloud_build_v1::model::PubsubConfig;
8290 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(Some(PubsubConfig::default()/* use setters */));
8291 /// let x = BuildTrigger::new().set_or_clear_pubsub_config(None::<PubsubConfig>);
8292 /// ```
8293 pub fn set_or_clear_pubsub_config<T>(mut self, v: std::option::Option<T>) -> Self
8294 where
8295 T: std::convert::Into<crate::model::PubsubConfig>,
8296 {
8297 self.pubsub_config = v.map(|x| x.into());
8298 self
8299 }
8300
8301 /// Sets the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8302 ///
8303 /// # Example
8304 /// ```ignore,no_run
8305 /// # use google_cloud_build_v1::model::BuildTrigger;
8306 /// use google_cloud_build_v1::model::WebhookConfig;
8307 /// let x = BuildTrigger::new().set_webhook_config(WebhookConfig::default()/* use setters */);
8308 /// ```
8309 pub fn set_webhook_config<T>(mut self, v: T) -> Self
8310 where
8311 T: std::convert::Into<crate::model::WebhookConfig>,
8312 {
8313 self.webhook_config = std::option::Option::Some(v.into());
8314 self
8315 }
8316
8317 /// Sets or clears the value of [webhook_config][crate::model::BuildTrigger::webhook_config].
8318 ///
8319 /// # Example
8320 /// ```ignore,no_run
8321 /// # use google_cloud_build_v1::model::BuildTrigger;
8322 /// use google_cloud_build_v1::model::WebhookConfig;
8323 /// let x = BuildTrigger::new().set_or_clear_webhook_config(Some(WebhookConfig::default()/* use setters */));
8324 /// let x = BuildTrigger::new().set_or_clear_webhook_config(None::<WebhookConfig>);
8325 /// ```
8326 pub fn set_or_clear_webhook_config<T>(mut self, v: std::option::Option<T>) -> Self
8327 where
8328 T: std::convert::Into<crate::model::WebhookConfig>,
8329 {
8330 self.webhook_config = v.map(|x| x.into());
8331 self
8332 }
8333
8334 /// Sets the value of [create_time][crate::model::BuildTrigger::create_time].
8335 ///
8336 /// # Example
8337 /// ```ignore,no_run
8338 /// # use google_cloud_build_v1::model::BuildTrigger;
8339 /// use wkt::Timestamp;
8340 /// let x = BuildTrigger::new().set_create_time(Timestamp::default()/* use setters */);
8341 /// ```
8342 pub fn set_create_time<T>(mut self, v: T) -> Self
8343 where
8344 T: std::convert::Into<wkt::Timestamp>,
8345 {
8346 self.create_time = std::option::Option::Some(v.into());
8347 self
8348 }
8349
8350 /// Sets or clears the value of [create_time][crate::model::BuildTrigger::create_time].
8351 ///
8352 /// # Example
8353 /// ```ignore,no_run
8354 /// # use google_cloud_build_v1::model::BuildTrigger;
8355 /// use wkt::Timestamp;
8356 /// let x = BuildTrigger::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8357 /// let x = BuildTrigger::new().set_or_clear_create_time(None::<Timestamp>);
8358 /// ```
8359 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8360 where
8361 T: std::convert::Into<wkt::Timestamp>,
8362 {
8363 self.create_time = v.map(|x| x.into());
8364 self
8365 }
8366
8367 /// Sets the value of [disabled][crate::model::BuildTrigger::disabled].
8368 ///
8369 /// # Example
8370 /// ```ignore,no_run
8371 /// # use google_cloud_build_v1::model::BuildTrigger;
8372 /// let x = BuildTrigger::new().set_disabled(true);
8373 /// ```
8374 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8375 self.disabled = v.into();
8376 self
8377 }
8378
8379 /// Sets the value of [substitutions][crate::model::BuildTrigger::substitutions].
8380 ///
8381 /// # Example
8382 /// ```ignore,no_run
8383 /// # use google_cloud_build_v1::model::BuildTrigger;
8384 /// let x = BuildTrigger::new().set_substitutions([
8385 /// ("key0", "abc"),
8386 /// ("key1", "xyz"),
8387 /// ]);
8388 /// ```
8389 pub fn set_substitutions<T, K, V>(mut self, v: T) -> Self
8390 where
8391 T: std::iter::IntoIterator<Item = (K, V)>,
8392 K: std::convert::Into<std::string::String>,
8393 V: std::convert::Into<std::string::String>,
8394 {
8395 use std::iter::Iterator;
8396 self.substitutions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8397 self
8398 }
8399
8400 /// Sets the value of [ignored_files][crate::model::BuildTrigger::ignored_files].
8401 ///
8402 /// # Example
8403 /// ```ignore,no_run
8404 /// # use google_cloud_build_v1::model::BuildTrigger;
8405 /// let x = BuildTrigger::new().set_ignored_files(["a", "b", "c"]);
8406 /// ```
8407 pub fn set_ignored_files<T, V>(mut self, v: T) -> Self
8408 where
8409 T: std::iter::IntoIterator<Item = V>,
8410 V: std::convert::Into<std::string::String>,
8411 {
8412 use std::iter::Iterator;
8413 self.ignored_files = v.into_iter().map(|i| i.into()).collect();
8414 self
8415 }
8416
8417 /// Sets the value of [included_files][crate::model::BuildTrigger::included_files].
8418 ///
8419 /// # Example
8420 /// ```ignore,no_run
8421 /// # use google_cloud_build_v1::model::BuildTrigger;
8422 /// let x = BuildTrigger::new().set_included_files(["a", "b", "c"]);
8423 /// ```
8424 pub fn set_included_files<T, V>(mut self, v: T) -> Self
8425 where
8426 T: std::iter::IntoIterator<Item = V>,
8427 V: std::convert::Into<std::string::String>,
8428 {
8429 use std::iter::Iterator;
8430 self.included_files = v.into_iter().map(|i| i.into()).collect();
8431 self
8432 }
8433
8434 /// Sets the value of [filter][crate::model::BuildTrigger::filter].
8435 ///
8436 /// # Example
8437 /// ```ignore,no_run
8438 /// # use google_cloud_build_v1::model::BuildTrigger;
8439 /// let x = BuildTrigger::new().set_filter("example");
8440 /// ```
8441 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8442 self.filter = v.into();
8443 self
8444 }
8445
8446 /// Sets the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8447 ///
8448 /// # Example
8449 /// ```ignore,no_run
8450 /// # use google_cloud_build_v1::model::BuildTrigger;
8451 /// use google_cloud_build_v1::model::GitRepoSource;
8452 /// let x = BuildTrigger::new().set_source_to_build(GitRepoSource::default()/* use setters */);
8453 /// ```
8454 pub fn set_source_to_build<T>(mut self, v: T) -> Self
8455 where
8456 T: std::convert::Into<crate::model::GitRepoSource>,
8457 {
8458 self.source_to_build = std::option::Option::Some(v.into());
8459 self
8460 }
8461
8462 /// Sets or clears the value of [source_to_build][crate::model::BuildTrigger::source_to_build].
8463 ///
8464 /// # Example
8465 /// ```ignore,no_run
8466 /// # use google_cloud_build_v1::model::BuildTrigger;
8467 /// use google_cloud_build_v1::model::GitRepoSource;
8468 /// let x = BuildTrigger::new().set_or_clear_source_to_build(Some(GitRepoSource::default()/* use setters */));
8469 /// let x = BuildTrigger::new().set_or_clear_source_to_build(None::<GitRepoSource>);
8470 /// ```
8471 pub fn set_or_clear_source_to_build<T>(mut self, v: std::option::Option<T>) -> Self
8472 where
8473 T: std::convert::Into<crate::model::GitRepoSource>,
8474 {
8475 self.source_to_build = v.map(|x| x.into());
8476 self
8477 }
8478
8479 /// Sets the value of [service_account][crate::model::BuildTrigger::service_account].
8480 ///
8481 /// # Example
8482 /// ```ignore,no_run
8483 /// # use google_cloud_build_v1::model::BuildTrigger;
8484 /// let x = BuildTrigger::new().set_service_account("example");
8485 /// ```
8486 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8487 self.service_account = v.into();
8488 self
8489 }
8490
8491 /// Sets the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8492 ///
8493 /// # Example
8494 /// ```ignore,no_run
8495 /// # use google_cloud_build_v1::model::BuildTrigger;
8496 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8497 /// let x = BuildTrigger::new().set_repository_event_config(RepositoryEventConfig::default()/* use setters */);
8498 /// ```
8499 pub fn set_repository_event_config<T>(mut self, v: T) -> Self
8500 where
8501 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8502 {
8503 self.repository_event_config = std::option::Option::Some(v.into());
8504 self
8505 }
8506
8507 /// Sets or clears the value of [repository_event_config][crate::model::BuildTrigger::repository_event_config].
8508 ///
8509 /// # Example
8510 /// ```ignore,no_run
8511 /// # use google_cloud_build_v1::model::BuildTrigger;
8512 /// use google_cloud_build_v1::model::RepositoryEventConfig;
8513 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(Some(RepositoryEventConfig::default()/* use setters */));
8514 /// let x = BuildTrigger::new().set_or_clear_repository_event_config(None::<RepositoryEventConfig>);
8515 /// ```
8516 pub fn set_or_clear_repository_event_config<T>(mut self, v: std::option::Option<T>) -> Self
8517 where
8518 T: std::convert::Into<crate::model::RepositoryEventConfig>,
8519 {
8520 self.repository_event_config = v.map(|x| x.into());
8521 self
8522 }
8523
8524 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template].
8525 ///
8526 /// Note that all the setters affecting `build_template` are mutually
8527 /// exclusive.
8528 ///
8529 /// # Example
8530 /// ```ignore,no_run
8531 /// # use google_cloud_build_v1::model::BuildTrigger;
8532 /// use google_cloud_build_v1::model::build_trigger::BuildTemplate;
8533 /// let x = BuildTrigger::new().set_build_template(Some(BuildTemplate::Autodetect(true)));
8534 /// ```
8535 pub fn set_build_template<
8536 T: std::convert::Into<std::option::Option<crate::model::build_trigger::BuildTemplate>>,
8537 >(
8538 mut self,
8539 v: T,
8540 ) -> Self {
8541 self.build_template = v.into();
8542 self
8543 }
8544
8545 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8546 /// if it holds a `Autodetect`, `None` if the field is not set or
8547 /// holds a different branch.
8548 pub fn autodetect(&self) -> std::option::Option<&bool> {
8549 #[allow(unreachable_patterns)]
8550 self.build_template.as_ref().and_then(|v| match v {
8551 crate::model::build_trigger::BuildTemplate::Autodetect(v) => {
8552 std::option::Option::Some(v)
8553 }
8554 _ => std::option::Option::None,
8555 })
8556 }
8557
8558 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8559 /// to hold a `Autodetect`.
8560 ///
8561 /// Note that all the setters affecting `build_template` are
8562 /// mutually exclusive.
8563 ///
8564 /// # Example
8565 /// ```ignore,no_run
8566 /// # use google_cloud_build_v1::model::BuildTrigger;
8567 /// let x = BuildTrigger::new().set_autodetect(true);
8568 /// assert!(x.autodetect().is_some());
8569 /// assert!(x.build().is_none());
8570 /// assert!(x.filename().is_none());
8571 /// assert!(x.git_file_source().is_none());
8572 /// ```
8573 pub fn set_autodetect<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8574 self.build_template = std::option::Option::Some(
8575 crate::model::build_trigger::BuildTemplate::Autodetect(v.into()),
8576 );
8577 self
8578 }
8579
8580 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8581 /// if it holds a `Build`, `None` if the field is not set or
8582 /// holds a different branch.
8583 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::Build>> {
8584 #[allow(unreachable_patterns)]
8585 self.build_template.as_ref().and_then(|v| match v {
8586 crate::model::build_trigger::BuildTemplate::Build(v) => std::option::Option::Some(v),
8587 _ => std::option::Option::None,
8588 })
8589 }
8590
8591 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8592 /// to hold a `Build`.
8593 ///
8594 /// Note that all the setters affecting `build_template` are
8595 /// mutually exclusive.
8596 ///
8597 /// # Example
8598 /// ```ignore,no_run
8599 /// # use google_cloud_build_v1::model::BuildTrigger;
8600 /// use google_cloud_build_v1::model::Build;
8601 /// let x = BuildTrigger::new().set_build(Build::default()/* use setters */);
8602 /// assert!(x.build().is_some());
8603 /// assert!(x.autodetect().is_none());
8604 /// assert!(x.filename().is_none());
8605 /// assert!(x.git_file_source().is_none());
8606 /// ```
8607 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::Build>>>(
8608 mut self,
8609 v: T,
8610 ) -> Self {
8611 self.build_template =
8612 std::option::Option::Some(crate::model::build_trigger::BuildTemplate::Build(v.into()));
8613 self
8614 }
8615
8616 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8617 /// if it holds a `Filename`, `None` if the field is not set or
8618 /// holds a different branch.
8619 pub fn filename(&self) -> std::option::Option<&std::string::String> {
8620 #[allow(unreachable_patterns)]
8621 self.build_template.as_ref().and_then(|v| match v {
8622 crate::model::build_trigger::BuildTemplate::Filename(v) => std::option::Option::Some(v),
8623 _ => std::option::Option::None,
8624 })
8625 }
8626
8627 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8628 /// to hold a `Filename`.
8629 ///
8630 /// Note that all the setters affecting `build_template` are
8631 /// mutually exclusive.
8632 ///
8633 /// # Example
8634 /// ```ignore,no_run
8635 /// # use google_cloud_build_v1::model::BuildTrigger;
8636 /// let x = BuildTrigger::new().set_filename("example");
8637 /// assert!(x.filename().is_some());
8638 /// assert!(x.autodetect().is_none());
8639 /// assert!(x.build().is_none());
8640 /// assert!(x.git_file_source().is_none());
8641 /// ```
8642 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8643 self.build_template = std::option::Option::Some(
8644 crate::model::build_trigger::BuildTemplate::Filename(v.into()),
8645 );
8646 self
8647 }
8648
8649 /// The value of [build_template][crate::model::BuildTrigger::build_template]
8650 /// if it holds a `GitFileSource`, `None` if the field is not set or
8651 /// holds a different branch.
8652 pub fn git_file_source(
8653 &self,
8654 ) -> std::option::Option<&std::boxed::Box<crate::model::GitFileSource>> {
8655 #[allow(unreachable_patterns)]
8656 self.build_template.as_ref().and_then(|v| match v {
8657 crate::model::build_trigger::BuildTemplate::GitFileSource(v) => {
8658 std::option::Option::Some(v)
8659 }
8660 _ => std::option::Option::None,
8661 })
8662 }
8663
8664 /// Sets the value of [build_template][crate::model::BuildTrigger::build_template]
8665 /// to hold a `GitFileSource`.
8666 ///
8667 /// Note that all the setters affecting `build_template` are
8668 /// mutually exclusive.
8669 ///
8670 /// # Example
8671 /// ```ignore,no_run
8672 /// # use google_cloud_build_v1::model::BuildTrigger;
8673 /// use google_cloud_build_v1::model::GitFileSource;
8674 /// let x = BuildTrigger::new().set_git_file_source(GitFileSource::default()/* use setters */);
8675 /// assert!(x.git_file_source().is_some());
8676 /// assert!(x.autodetect().is_none());
8677 /// assert!(x.build().is_none());
8678 /// assert!(x.filename().is_none());
8679 /// ```
8680 pub fn set_git_file_source<
8681 T: std::convert::Into<std::boxed::Box<crate::model::GitFileSource>>,
8682 >(
8683 mut self,
8684 v: T,
8685 ) -> Self {
8686 self.build_template = std::option::Option::Some(
8687 crate::model::build_trigger::BuildTemplate::GitFileSource(v.into()),
8688 );
8689 self
8690 }
8691}
8692
8693impl wkt::message::Message for BuildTrigger {
8694 fn typename() -> &'static str {
8695 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildTrigger"
8696 }
8697}
8698
8699/// Defines additional types related to [BuildTrigger].
8700pub mod build_trigger {
8701 #[allow(unused_imports)]
8702 use super::*;
8703
8704 /// Template describing the Build request to make when the trigger is matched.
8705 /// At least one of the template fields must be provided.
8706 #[derive(Clone, Debug, PartialEq)]
8707 #[non_exhaustive]
8708 pub enum BuildTemplate {
8709 /// Autodetect build configuration. The following precedence is used (case
8710 /// insensitive):
8711 ///
8712 /// 1. cloudbuild.yaml
8713 /// 1. cloudbuild.yml
8714 /// 1. cloudbuild.json
8715 /// 1. Dockerfile
8716 ///
8717 /// Currently only available for GitHub App Triggers.
8718 Autodetect(bool),
8719 /// Contents of the build template.
8720 Build(std::boxed::Box<crate::model::Build>),
8721 /// Path, from the source root, to the build configuration file
8722 /// (i.e. cloudbuild.yaml).
8723 Filename(std::string::String),
8724 /// The file source describing the local or remote Build template.
8725 GitFileSource(std::boxed::Box<crate::model::GitFileSource>),
8726 }
8727}
8728
8729/// The configuration of a trigger that creates a build whenever an event from
8730/// Repo API is received.
8731#[derive(Clone, Default, PartialEq)]
8732#[non_exhaustive]
8733pub struct RepositoryEventConfig {
8734 /// The resource name of the Repo API resource.
8735 pub repository: std::string::String,
8736
8737 /// Output only. The type of the SCM vendor the repository points to.
8738 pub repository_type: crate::model::repository_event_config::RepositoryType,
8739
8740 /// The types of filter to trigger a build.
8741 pub filter: std::option::Option<crate::model::repository_event_config::Filter>,
8742
8743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8744}
8745
8746impl RepositoryEventConfig {
8747 /// Creates a new default instance.
8748 pub fn new() -> Self {
8749 std::default::Default::default()
8750 }
8751
8752 /// Sets the value of [repository][crate::model::RepositoryEventConfig::repository].
8753 ///
8754 /// # Example
8755 /// ```ignore,no_run
8756 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8757 /// let x = RepositoryEventConfig::new().set_repository("example");
8758 /// ```
8759 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8760 self.repository = v.into();
8761 self
8762 }
8763
8764 /// Sets the value of [repository_type][crate::model::RepositoryEventConfig::repository_type].
8765 ///
8766 /// # Example
8767 /// ```ignore,no_run
8768 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8769 /// use google_cloud_build_v1::model::repository_event_config::RepositoryType;
8770 /// let x0 = RepositoryEventConfig::new().set_repository_type(RepositoryType::Github);
8771 /// let x1 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GithubEnterprise);
8772 /// let x2 = RepositoryEventConfig::new().set_repository_type(RepositoryType::GitlabEnterprise);
8773 /// ```
8774 pub fn set_repository_type<
8775 T: std::convert::Into<crate::model::repository_event_config::RepositoryType>,
8776 >(
8777 mut self,
8778 v: T,
8779 ) -> Self {
8780 self.repository_type = v.into();
8781 self
8782 }
8783
8784 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter].
8785 ///
8786 /// Note that all the setters affecting `filter` are mutually
8787 /// exclusive.
8788 ///
8789 /// # Example
8790 /// ```ignore,no_run
8791 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8792 /// use google_cloud_build_v1::model::PullRequestFilter;
8793 /// let x = RepositoryEventConfig::new().set_filter(Some(
8794 /// google_cloud_build_v1::model::repository_event_config::Filter::PullRequest(PullRequestFilter::default().into())));
8795 /// ```
8796 pub fn set_filter<
8797 T: std::convert::Into<std::option::Option<crate::model::repository_event_config::Filter>>,
8798 >(
8799 mut self,
8800 v: T,
8801 ) -> Self {
8802 self.filter = v.into();
8803 self
8804 }
8805
8806 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8807 /// if it holds a `PullRequest`, `None` if the field is not set or
8808 /// holds a different branch.
8809 pub fn pull_request(
8810 &self,
8811 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
8812 #[allow(unreachable_patterns)]
8813 self.filter.as_ref().and_then(|v| match v {
8814 crate::model::repository_event_config::Filter::PullRequest(v) => {
8815 std::option::Option::Some(v)
8816 }
8817 _ => std::option::Option::None,
8818 })
8819 }
8820
8821 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8822 /// to hold a `PullRequest`.
8823 ///
8824 /// Note that all the setters affecting `filter` are
8825 /// mutually exclusive.
8826 ///
8827 /// # Example
8828 /// ```ignore,no_run
8829 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8830 /// use google_cloud_build_v1::model::PullRequestFilter;
8831 /// let x = RepositoryEventConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
8832 /// assert!(x.pull_request().is_some());
8833 /// assert!(x.push().is_none());
8834 /// ```
8835 pub fn set_pull_request<
8836 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
8837 >(
8838 mut self,
8839 v: T,
8840 ) -> Self {
8841 self.filter = std::option::Option::Some(
8842 crate::model::repository_event_config::Filter::PullRequest(v.into()),
8843 );
8844 self
8845 }
8846
8847 /// The value of [filter][crate::model::RepositoryEventConfig::filter]
8848 /// if it holds a `Push`, `None` if the field is not set or
8849 /// holds a different branch.
8850 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
8851 #[allow(unreachable_patterns)]
8852 self.filter.as_ref().and_then(|v| match v {
8853 crate::model::repository_event_config::Filter::Push(v) => std::option::Option::Some(v),
8854 _ => std::option::Option::None,
8855 })
8856 }
8857
8858 /// Sets the value of [filter][crate::model::RepositoryEventConfig::filter]
8859 /// to hold a `Push`.
8860 ///
8861 /// Note that all the setters affecting `filter` are
8862 /// mutually exclusive.
8863 ///
8864 /// # Example
8865 /// ```ignore,no_run
8866 /// # use google_cloud_build_v1::model::RepositoryEventConfig;
8867 /// use google_cloud_build_v1::model::PushFilter;
8868 /// let x = RepositoryEventConfig::new().set_push(PushFilter::default()/* use setters */);
8869 /// assert!(x.push().is_some());
8870 /// assert!(x.pull_request().is_none());
8871 /// ```
8872 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
8873 mut self,
8874 v: T,
8875 ) -> Self {
8876 self.filter = std::option::Option::Some(
8877 crate::model::repository_event_config::Filter::Push(v.into()),
8878 );
8879 self
8880 }
8881}
8882
8883impl wkt::message::Message for RepositoryEventConfig {
8884 fn typename() -> &'static str {
8885 "type.googleapis.com/google.devtools.cloudbuild.v1.RepositoryEventConfig"
8886 }
8887}
8888
8889/// Defines additional types related to [RepositoryEventConfig].
8890pub mod repository_event_config {
8891 #[allow(unused_imports)]
8892 use super::*;
8893
8894 /// All possible SCM repo types from Repo API.
8895 ///
8896 /// # Working with unknown values
8897 ///
8898 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8899 /// additional enum variants at any time. Adding new variants is not considered
8900 /// a breaking change. Applications should write their code in anticipation of:
8901 ///
8902 /// - New values appearing in future releases of the client library, **and**
8903 /// - New values received dynamically, without application changes.
8904 ///
8905 /// Please consult the [Working with enums] section in the user guide for some
8906 /// guidelines.
8907 ///
8908 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8909 #[derive(Clone, Debug, PartialEq)]
8910 #[non_exhaustive]
8911 pub enum RepositoryType {
8912 /// If unspecified, RepositoryType defaults to GITHUB.
8913 Unspecified,
8914 /// The SCM repo is GITHUB.
8915 Github,
8916 /// The SCM repo is GITHUB Enterprise.
8917 GithubEnterprise,
8918 /// The SCM repo is GITLAB Enterprise.
8919 GitlabEnterprise,
8920 /// If set, the enum was initialized with an unknown value.
8921 ///
8922 /// Applications can examine the value using [RepositoryType::value] or
8923 /// [RepositoryType::name].
8924 UnknownValue(repository_type::UnknownValue),
8925 }
8926
8927 #[doc(hidden)]
8928 pub mod repository_type {
8929 #[allow(unused_imports)]
8930 use super::*;
8931 #[derive(Clone, Debug, PartialEq)]
8932 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8933 }
8934
8935 impl RepositoryType {
8936 /// Gets the enum value.
8937 ///
8938 /// Returns `None` if the enum contains an unknown value deserialized from
8939 /// the string representation of enums.
8940 pub fn value(&self) -> std::option::Option<i32> {
8941 match self {
8942 Self::Unspecified => std::option::Option::Some(0),
8943 Self::Github => std::option::Option::Some(1),
8944 Self::GithubEnterprise => std::option::Option::Some(2),
8945 Self::GitlabEnterprise => std::option::Option::Some(3),
8946 Self::UnknownValue(u) => u.0.value(),
8947 }
8948 }
8949
8950 /// Gets the enum value as a string.
8951 ///
8952 /// Returns `None` if the enum contains an unknown value deserialized from
8953 /// the integer representation of enums.
8954 pub fn name(&self) -> std::option::Option<&str> {
8955 match self {
8956 Self::Unspecified => std::option::Option::Some("REPOSITORY_TYPE_UNSPECIFIED"),
8957 Self::Github => std::option::Option::Some("GITHUB"),
8958 Self::GithubEnterprise => std::option::Option::Some("GITHUB_ENTERPRISE"),
8959 Self::GitlabEnterprise => std::option::Option::Some("GITLAB_ENTERPRISE"),
8960 Self::UnknownValue(u) => u.0.name(),
8961 }
8962 }
8963 }
8964
8965 impl std::default::Default for RepositoryType {
8966 fn default() -> Self {
8967 use std::convert::From;
8968 Self::from(0)
8969 }
8970 }
8971
8972 impl std::fmt::Display for RepositoryType {
8973 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8974 wkt::internal::display_enum(f, self.name(), self.value())
8975 }
8976 }
8977
8978 impl std::convert::From<i32> for RepositoryType {
8979 fn from(value: i32) -> Self {
8980 match value {
8981 0 => Self::Unspecified,
8982 1 => Self::Github,
8983 2 => Self::GithubEnterprise,
8984 3 => Self::GitlabEnterprise,
8985 _ => Self::UnknownValue(repository_type::UnknownValue(
8986 wkt::internal::UnknownEnumValue::Integer(value),
8987 )),
8988 }
8989 }
8990 }
8991
8992 impl std::convert::From<&str> for RepositoryType {
8993 fn from(value: &str) -> Self {
8994 use std::string::ToString;
8995 match value {
8996 "REPOSITORY_TYPE_UNSPECIFIED" => Self::Unspecified,
8997 "GITHUB" => Self::Github,
8998 "GITHUB_ENTERPRISE" => Self::GithubEnterprise,
8999 "GITLAB_ENTERPRISE" => Self::GitlabEnterprise,
9000 _ => Self::UnknownValue(repository_type::UnknownValue(
9001 wkt::internal::UnknownEnumValue::String(value.to_string()),
9002 )),
9003 }
9004 }
9005 }
9006
9007 impl serde::ser::Serialize for RepositoryType {
9008 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9009 where
9010 S: serde::Serializer,
9011 {
9012 match self {
9013 Self::Unspecified => serializer.serialize_i32(0),
9014 Self::Github => serializer.serialize_i32(1),
9015 Self::GithubEnterprise => serializer.serialize_i32(2),
9016 Self::GitlabEnterprise => serializer.serialize_i32(3),
9017 Self::UnknownValue(u) => u.0.serialize(serializer),
9018 }
9019 }
9020 }
9021
9022 impl<'de> serde::de::Deserialize<'de> for RepositoryType {
9023 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9024 where
9025 D: serde::Deserializer<'de>,
9026 {
9027 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepositoryType>::new(
9028 ".google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType",
9029 ))
9030 }
9031 }
9032
9033 /// The types of filter to trigger a build.
9034 #[derive(Clone, Debug, PartialEq)]
9035 #[non_exhaustive]
9036 pub enum Filter {
9037 /// Filter to match changes in pull requests.
9038 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9039 /// Filter to match changes in refs like branches, tags.
9040 Push(std::boxed::Box<crate::model::PushFilter>),
9041 }
9042}
9043
9044/// GitHubEventsConfig describes the configuration of a trigger that creates a
9045/// build whenever a GitHub event is received.
9046#[derive(Clone, Default, PartialEq)]
9047#[non_exhaustive]
9048pub struct GitHubEventsConfig {
9049 /// The installationID that emits the GitHub event.
9050 #[deprecated]
9051 pub installation_id: i64,
9052
9053 /// Owner of the repository. For example: The owner for
9054 /// <https://github.com/googlecloudplatform/cloud-builders> is
9055 /// "googlecloudplatform".
9056 pub owner: std::string::String,
9057
9058 /// Name of the repository. For example: The name for
9059 /// <https://github.com/googlecloudplatform/cloud-builders> is "cloud-builders".
9060 pub name: std::string::String,
9061
9062 /// Filter describing the types of events to trigger a build.
9063 /// Currently supported event types: push, pull_request.
9064 pub event: std::option::Option<crate::model::git_hub_events_config::Event>,
9065
9066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9067}
9068
9069impl GitHubEventsConfig {
9070 /// Creates a new default instance.
9071 pub fn new() -> Self {
9072 std::default::Default::default()
9073 }
9074
9075 /// Sets the value of [installation_id][crate::model::GitHubEventsConfig::installation_id].
9076 ///
9077 /// # Example
9078 /// ```ignore,no_run
9079 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9080 /// let x = GitHubEventsConfig::new().set_installation_id(42);
9081 /// ```
9082 #[deprecated]
9083 pub fn set_installation_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9084 self.installation_id = v.into();
9085 self
9086 }
9087
9088 /// Sets the value of [owner][crate::model::GitHubEventsConfig::owner].
9089 ///
9090 /// # Example
9091 /// ```ignore,no_run
9092 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9093 /// let x = GitHubEventsConfig::new().set_owner("example");
9094 /// ```
9095 pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9096 self.owner = v.into();
9097 self
9098 }
9099
9100 /// Sets the value of [name][crate::model::GitHubEventsConfig::name].
9101 ///
9102 /// # Example
9103 /// ```ignore,no_run
9104 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9105 /// let x = GitHubEventsConfig::new().set_name("example");
9106 /// ```
9107 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9108 self.name = v.into();
9109 self
9110 }
9111
9112 /// Sets the value of [event][crate::model::GitHubEventsConfig::event].
9113 ///
9114 /// Note that all the setters affecting `event` are mutually
9115 /// exclusive.
9116 ///
9117 /// # Example
9118 /// ```ignore,no_run
9119 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9120 /// use google_cloud_build_v1::model::PullRequestFilter;
9121 /// let x = GitHubEventsConfig::new().set_event(Some(
9122 /// google_cloud_build_v1::model::git_hub_events_config::Event::PullRequest(PullRequestFilter::default().into())));
9123 /// ```
9124 pub fn set_event<
9125 T: std::convert::Into<std::option::Option<crate::model::git_hub_events_config::Event>>,
9126 >(
9127 mut self,
9128 v: T,
9129 ) -> Self {
9130 self.event = v.into();
9131 self
9132 }
9133
9134 /// The value of [event][crate::model::GitHubEventsConfig::event]
9135 /// if it holds a `PullRequest`, `None` if the field is not set or
9136 /// holds a different branch.
9137 pub fn pull_request(
9138 &self,
9139 ) -> std::option::Option<&std::boxed::Box<crate::model::PullRequestFilter>> {
9140 #[allow(unreachable_patterns)]
9141 self.event.as_ref().and_then(|v| match v {
9142 crate::model::git_hub_events_config::Event::PullRequest(v) => {
9143 std::option::Option::Some(v)
9144 }
9145 _ => std::option::Option::None,
9146 })
9147 }
9148
9149 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9150 /// to hold a `PullRequest`.
9151 ///
9152 /// Note that all the setters affecting `event` are
9153 /// mutually exclusive.
9154 ///
9155 /// # Example
9156 /// ```ignore,no_run
9157 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9158 /// use google_cloud_build_v1::model::PullRequestFilter;
9159 /// let x = GitHubEventsConfig::new().set_pull_request(PullRequestFilter::default()/* use setters */);
9160 /// assert!(x.pull_request().is_some());
9161 /// assert!(x.push().is_none());
9162 /// ```
9163 pub fn set_pull_request<
9164 T: std::convert::Into<std::boxed::Box<crate::model::PullRequestFilter>>,
9165 >(
9166 mut self,
9167 v: T,
9168 ) -> Self {
9169 self.event = std::option::Option::Some(
9170 crate::model::git_hub_events_config::Event::PullRequest(v.into()),
9171 );
9172 self
9173 }
9174
9175 /// The value of [event][crate::model::GitHubEventsConfig::event]
9176 /// if it holds a `Push`, `None` if the field is not set or
9177 /// holds a different branch.
9178 pub fn push(&self) -> std::option::Option<&std::boxed::Box<crate::model::PushFilter>> {
9179 #[allow(unreachable_patterns)]
9180 self.event.as_ref().and_then(|v| match v {
9181 crate::model::git_hub_events_config::Event::Push(v) => std::option::Option::Some(v),
9182 _ => std::option::Option::None,
9183 })
9184 }
9185
9186 /// Sets the value of [event][crate::model::GitHubEventsConfig::event]
9187 /// to hold a `Push`.
9188 ///
9189 /// Note that all the setters affecting `event` are
9190 /// mutually exclusive.
9191 ///
9192 /// # Example
9193 /// ```ignore,no_run
9194 /// # use google_cloud_build_v1::model::GitHubEventsConfig;
9195 /// use google_cloud_build_v1::model::PushFilter;
9196 /// let x = GitHubEventsConfig::new().set_push(PushFilter::default()/* use setters */);
9197 /// assert!(x.push().is_some());
9198 /// assert!(x.pull_request().is_none());
9199 /// ```
9200 pub fn set_push<T: std::convert::Into<std::boxed::Box<crate::model::PushFilter>>>(
9201 mut self,
9202 v: T,
9203 ) -> Self {
9204 self.event =
9205 std::option::Option::Some(crate::model::git_hub_events_config::Event::Push(v.into()));
9206 self
9207 }
9208}
9209
9210impl wkt::message::Message for GitHubEventsConfig {
9211 fn typename() -> &'static str {
9212 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEventsConfig"
9213 }
9214}
9215
9216/// Defines additional types related to [GitHubEventsConfig].
9217pub mod git_hub_events_config {
9218 #[allow(unused_imports)]
9219 use super::*;
9220
9221 /// Filter describing the types of events to trigger a build.
9222 /// Currently supported event types: push, pull_request.
9223 #[derive(Clone, Debug, PartialEq)]
9224 #[non_exhaustive]
9225 pub enum Event {
9226 /// filter to match changes in pull requests.
9227 PullRequest(std::boxed::Box<crate::model::PullRequestFilter>),
9228 /// filter to match changes in refs like branches, tags.
9229 Push(std::boxed::Box<crate::model::PushFilter>),
9230 }
9231}
9232
9233/// PubsubConfig describes the configuration of a trigger that
9234/// creates a build whenever a Pub/Sub message is published.
9235#[derive(Clone, Default, PartialEq)]
9236#[non_exhaustive]
9237pub struct PubsubConfig {
9238 /// Output only. Name of the subscription. Format is
9239 /// `projects/{project}/subscriptions/{subscription}`.
9240 pub subscription: std::string::String,
9241
9242 /// Optional. The name of the topic from which this subscription is receiving
9243 /// messages. Format is `projects/{project}/topics/{topic}`.
9244 pub topic: std::string::String,
9245
9246 /// Service account that will make the push request.
9247 pub service_account_email: std::string::String,
9248
9249 /// Potential issues with the underlying Pub/Sub subscription configuration.
9250 /// Only populated on get requests.
9251 pub state: crate::model::pubsub_config::State,
9252
9253 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9254}
9255
9256impl PubsubConfig {
9257 /// Creates a new default instance.
9258 pub fn new() -> Self {
9259 std::default::Default::default()
9260 }
9261
9262 /// Sets the value of [subscription][crate::model::PubsubConfig::subscription].
9263 ///
9264 /// # Example
9265 /// ```ignore,no_run
9266 /// # use google_cloud_build_v1::model::PubsubConfig;
9267 /// let x = PubsubConfig::new().set_subscription("example");
9268 /// ```
9269 pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9270 self.subscription = v.into();
9271 self
9272 }
9273
9274 /// Sets the value of [topic][crate::model::PubsubConfig::topic].
9275 ///
9276 /// # Example
9277 /// ```ignore,no_run
9278 /// # use google_cloud_build_v1::model::PubsubConfig;
9279 /// let x = PubsubConfig::new().set_topic("example");
9280 /// ```
9281 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9282 self.topic = v.into();
9283 self
9284 }
9285
9286 /// Sets the value of [service_account_email][crate::model::PubsubConfig::service_account_email].
9287 ///
9288 /// # Example
9289 /// ```ignore,no_run
9290 /// # use google_cloud_build_v1::model::PubsubConfig;
9291 /// let x = PubsubConfig::new().set_service_account_email("example");
9292 /// ```
9293 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
9294 mut self,
9295 v: T,
9296 ) -> Self {
9297 self.service_account_email = v.into();
9298 self
9299 }
9300
9301 /// Sets the value of [state][crate::model::PubsubConfig::state].
9302 ///
9303 /// # Example
9304 /// ```ignore,no_run
9305 /// # use google_cloud_build_v1::model::PubsubConfig;
9306 /// use google_cloud_build_v1::model::pubsub_config::State;
9307 /// let x0 = PubsubConfig::new().set_state(State::Ok);
9308 /// let x1 = PubsubConfig::new().set_state(State::SubscriptionDeleted);
9309 /// let x2 = PubsubConfig::new().set_state(State::TopicDeleted);
9310 /// ```
9311 pub fn set_state<T: std::convert::Into<crate::model::pubsub_config::State>>(
9312 mut self,
9313 v: T,
9314 ) -> Self {
9315 self.state = v.into();
9316 self
9317 }
9318}
9319
9320impl wkt::message::Message for PubsubConfig {
9321 fn typename() -> &'static str {
9322 "type.googleapis.com/google.devtools.cloudbuild.v1.PubsubConfig"
9323 }
9324}
9325
9326/// Defines additional types related to [PubsubConfig].
9327pub mod pubsub_config {
9328 #[allow(unused_imports)]
9329 use super::*;
9330
9331 /// Enumerates potential issues with the underlying Pub/Sub subscription
9332 /// configuration.
9333 ///
9334 /// # Working with unknown values
9335 ///
9336 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9337 /// additional enum variants at any time. Adding new variants is not considered
9338 /// a breaking change. Applications should write their code in anticipation of:
9339 ///
9340 /// - New values appearing in future releases of the client library, **and**
9341 /// - New values received dynamically, without application changes.
9342 ///
9343 /// Please consult the [Working with enums] section in the user guide for some
9344 /// guidelines.
9345 ///
9346 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9347 #[derive(Clone, Debug, PartialEq)]
9348 #[non_exhaustive]
9349 pub enum State {
9350 /// The subscription configuration has not been checked.
9351 Unspecified,
9352 /// The Pub/Sub subscription is properly configured.
9353 Ok,
9354 /// The subscription has been deleted.
9355 SubscriptionDeleted,
9356 /// The topic has been deleted.
9357 TopicDeleted,
9358 /// Some of the subscription's field are misconfigured.
9359 SubscriptionMisconfigured,
9360 /// If set, the enum was initialized with an unknown value.
9361 ///
9362 /// Applications can examine the value using [State::value] or
9363 /// [State::name].
9364 UnknownValue(state::UnknownValue),
9365 }
9366
9367 #[doc(hidden)]
9368 pub mod state {
9369 #[allow(unused_imports)]
9370 use super::*;
9371 #[derive(Clone, Debug, PartialEq)]
9372 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9373 }
9374
9375 impl State {
9376 /// Gets the enum value.
9377 ///
9378 /// Returns `None` if the enum contains an unknown value deserialized from
9379 /// the string representation of enums.
9380 pub fn value(&self) -> std::option::Option<i32> {
9381 match self {
9382 Self::Unspecified => std::option::Option::Some(0),
9383 Self::Ok => std::option::Option::Some(1),
9384 Self::SubscriptionDeleted => std::option::Option::Some(2),
9385 Self::TopicDeleted => std::option::Option::Some(3),
9386 Self::SubscriptionMisconfigured => std::option::Option::Some(4),
9387 Self::UnknownValue(u) => u.0.value(),
9388 }
9389 }
9390
9391 /// Gets the enum value as a string.
9392 ///
9393 /// Returns `None` if the enum contains an unknown value deserialized from
9394 /// the integer representation of enums.
9395 pub fn name(&self) -> std::option::Option<&str> {
9396 match self {
9397 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9398 Self::Ok => std::option::Option::Some("OK"),
9399 Self::SubscriptionDeleted => std::option::Option::Some("SUBSCRIPTION_DELETED"),
9400 Self::TopicDeleted => std::option::Option::Some("TOPIC_DELETED"),
9401 Self::SubscriptionMisconfigured => {
9402 std::option::Option::Some("SUBSCRIPTION_MISCONFIGURED")
9403 }
9404 Self::UnknownValue(u) => u.0.name(),
9405 }
9406 }
9407 }
9408
9409 impl std::default::Default for State {
9410 fn default() -> Self {
9411 use std::convert::From;
9412 Self::from(0)
9413 }
9414 }
9415
9416 impl std::fmt::Display for State {
9417 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9418 wkt::internal::display_enum(f, self.name(), self.value())
9419 }
9420 }
9421
9422 impl std::convert::From<i32> for State {
9423 fn from(value: i32) -> Self {
9424 match value {
9425 0 => Self::Unspecified,
9426 1 => Self::Ok,
9427 2 => Self::SubscriptionDeleted,
9428 3 => Self::TopicDeleted,
9429 4 => Self::SubscriptionMisconfigured,
9430 _ => Self::UnknownValue(state::UnknownValue(
9431 wkt::internal::UnknownEnumValue::Integer(value),
9432 )),
9433 }
9434 }
9435 }
9436
9437 impl std::convert::From<&str> for State {
9438 fn from(value: &str) -> Self {
9439 use std::string::ToString;
9440 match value {
9441 "STATE_UNSPECIFIED" => Self::Unspecified,
9442 "OK" => Self::Ok,
9443 "SUBSCRIPTION_DELETED" => Self::SubscriptionDeleted,
9444 "TOPIC_DELETED" => Self::TopicDeleted,
9445 "SUBSCRIPTION_MISCONFIGURED" => Self::SubscriptionMisconfigured,
9446 _ => Self::UnknownValue(state::UnknownValue(
9447 wkt::internal::UnknownEnumValue::String(value.to_string()),
9448 )),
9449 }
9450 }
9451 }
9452
9453 impl serde::ser::Serialize for State {
9454 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9455 where
9456 S: serde::Serializer,
9457 {
9458 match self {
9459 Self::Unspecified => serializer.serialize_i32(0),
9460 Self::Ok => serializer.serialize_i32(1),
9461 Self::SubscriptionDeleted => serializer.serialize_i32(2),
9462 Self::TopicDeleted => serializer.serialize_i32(3),
9463 Self::SubscriptionMisconfigured => serializer.serialize_i32(4),
9464 Self::UnknownValue(u) => u.0.serialize(serializer),
9465 }
9466 }
9467 }
9468
9469 impl<'de> serde::de::Deserialize<'de> for State {
9470 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9471 where
9472 D: serde::Deserializer<'de>,
9473 {
9474 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9475 ".google.devtools.cloudbuild.v1.PubsubConfig.State",
9476 ))
9477 }
9478 }
9479}
9480
9481/// WebhookConfig describes the configuration of a trigger that
9482/// creates a build whenever a webhook is sent to a trigger's webhook URL.
9483#[derive(Clone, Default, PartialEq)]
9484#[non_exhaustive]
9485pub struct WebhookConfig {
9486 /// Potential issues with the underlying Pub/Sub subscription configuration.
9487 /// Only populated on get requests.
9488 pub state: crate::model::webhook_config::State,
9489
9490 /// Auth method specifies how the webhook authenticates with GCP.
9491 pub auth_method: std::option::Option<crate::model::webhook_config::AuthMethod>,
9492
9493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9494}
9495
9496impl WebhookConfig {
9497 /// Creates a new default instance.
9498 pub fn new() -> Self {
9499 std::default::Default::default()
9500 }
9501
9502 /// Sets the value of [state][crate::model::WebhookConfig::state].
9503 ///
9504 /// # Example
9505 /// ```ignore,no_run
9506 /// # use google_cloud_build_v1::model::WebhookConfig;
9507 /// use google_cloud_build_v1::model::webhook_config::State;
9508 /// let x0 = WebhookConfig::new().set_state(State::Ok);
9509 /// let x1 = WebhookConfig::new().set_state(State::SecretDeleted);
9510 /// ```
9511 pub fn set_state<T: std::convert::Into<crate::model::webhook_config::State>>(
9512 mut self,
9513 v: T,
9514 ) -> Self {
9515 self.state = v.into();
9516 self
9517 }
9518
9519 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method].
9520 ///
9521 /// Note that all the setters affecting `auth_method` are mutually
9522 /// exclusive.
9523 ///
9524 /// # Example
9525 /// ```ignore,no_run
9526 /// # use google_cloud_build_v1::model::WebhookConfig;
9527 /// use google_cloud_build_v1::model::webhook_config::AuthMethod;
9528 /// let x = WebhookConfig::new().set_auth_method(Some(AuthMethod::Secret("example".to_string())));
9529 /// ```
9530 pub fn set_auth_method<
9531 T: std::convert::Into<std::option::Option<crate::model::webhook_config::AuthMethod>>,
9532 >(
9533 mut self,
9534 v: T,
9535 ) -> Self {
9536 self.auth_method = v.into();
9537 self
9538 }
9539
9540 /// The value of [auth_method][crate::model::WebhookConfig::auth_method]
9541 /// if it holds a `Secret`, `None` if the field is not set or
9542 /// holds a different branch.
9543 pub fn secret(&self) -> std::option::Option<&std::string::String> {
9544 #[allow(unreachable_patterns)]
9545 self.auth_method.as_ref().and_then(|v| match v {
9546 crate::model::webhook_config::AuthMethod::Secret(v) => std::option::Option::Some(v),
9547 _ => std::option::Option::None,
9548 })
9549 }
9550
9551 /// Sets the value of [auth_method][crate::model::WebhookConfig::auth_method]
9552 /// to hold a `Secret`.
9553 ///
9554 /// Note that all the setters affecting `auth_method` are
9555 /// mutually exclusive.
9556 ///
9557 /// # Example
9558 /// ```ignore,no_run
9559 /// # use google_cloud_build_v1::model::WebhookConfig;
9560 /// let x = WebhookConfig::new().set_secret("example");
9561 /// assert!(x.secret().is_some());
9562 /// ```
9563 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9564 self.auth_method =
9565 std::option::Option::Some(crate::model::webhook_config::AuthMethod::Secret(v.into()));
9566 self
9567 }
9568}
9569
9570impl wkt::message::Message for WebhookConfig {
9571 fn typename() -> &'static str {
9572 "type.googleapis.com/google.devtools.cloudbuild.v1.WebhookConfig"
9573 }
9574}
9575
9576/// Defines additional types related to [WebhookConfig].
9577pub mod webhook_config {
9578 #[allow(unused_imports)]
9579 use super::*;
9580
9581 /// Enumerates potential issues with the Secret Manager secret provided by the
9582 /// user.
9583 ///
9584 /// # Working with unknown values
9585 ///
9586 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9587 /// additional enum variants at any time. Adding new variants is not considered
9588 /// a breaking change. Applications should write their code in anticipation of:
9589 ///
9590 /// - New values appearing in future releases of the client library, **and**
9591 /// - New values received dynamically, without application changes.
9592 ///
9593 /// Please consult the [Working with enums] section in the user guide for some
9594 /// guidelines.
9595 ///
9596 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9597 #[derive(Clone, Debug, PartialEq)]
9598 #[non_exhaustive]
9599 pub enum State {
9600 /// The webhook auth configuration not been checked.
9601 Unspecified,
9602 /// The auth configuration is properly setup.
9603 Ok,
9604 /// The secret provided in auth_method has been deleted.
9605 SecretDeleted,
9606 /// If set, the enum was initialized with an unknown value.
9607 ///
9608 /// Applications can examine the value using [State::value] or
9609 /// [State::name].
9610 UnknownValue(state::UnknownValue),
9611 }
9612
9613 #[doc(hidden)]
9614 pub mod state {
9615 #[allow(unused_imports)]
9616 use super::*;
9617 #[derive(Clone, Debug, PartialEq)]
9618 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9619 }
9620
9621 impl State {
9622 /// Gets the enum value.
9623 ///
9624 /// Returns `None` if the enum contains an unknown value deserialized from
9625 /// the string representation of enums.
9626 pub fn value(&self) -> std::option::Option<i32> {
9627 match self {
9628 Self::Unspecified => std::option::Option::Some(0),
9629 Self::Ok => std::option::Option::Some(1),
9630 Self::SecretDeleted => std::option::Option::Some(2),
9631 Self::UnknownValue(u) => u.0.value(),
9632 }
9633 }
9634
9635 /// Gets the enum value as a string.
9636 ///
9637 /// Returns `None` if the enum contains an unknown value deserialized from
9638 /// the integer representation of enums.
9639 pub fn name(&self) -> std::option::Option<&str> {
9640 match self {
9641 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9642 Self::Ok => std::option::Option::Some("OK"),
9643 Self::SecretDeleted => std::option::Option::Some("SECRET_DELETED"),
9644 Self::UnknownValue(u) => u.0.name(),
9645 }
9646 }
9647 }
9648
9649 impl std::default::Default for State {
9650 fn default() -> Self {
9651 use std::convert::From;
9652 Self::from(0)
9653 }
9654 }
9655
9656 impl std::fmt::Display for State {
9657 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9658 wkt::internal::display_enum(f, self.name(), self.value())
9659 }
9660 }
9661
9662 impl std::convert::From<i32> for State {
9663 fn from(value: i32) -> Self {
9664 match value {
9665 0 => Self::Unspecified,
9666 1 => Self::Ok,
9667 2 => Self::SecretDeleted,
9668 _ => Self::UnknownValue(state::UnknownValue(
9669 wkt::internal::UnknownEnumValue::Integer(value),
9670 )),
9671 }
9672 }
9673 }
9674
9675 impl std::convert::From<&str> for State {
9676 fn from(value: &str) -> Self {
9677 use std::string::ToString;
9678 match value {
9679 "STATE_UNSPECIFIED" => Self::Unspecified,
9680 "OK" => Self::Ok,
9681 "SECRET_DELETED" => Self::SecretDeleted,
9682 _ => Self::UnknownValue(state::UnknownValue(
9683 wkt::internal::UnknownEnumValue::String(value.to_string()),
9684 )),
9685 }
9686 }
9687 }
9688
9689 impl serde::ser::Serialize for State {
9690 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9691 where
9692 S: serde::Serializer,
9693 {
9694 match self {
9695 Self::Unspecified => serializer.serialize_i32(0),
9696 Self::Ok => serializer.serialize_i32(1),
9697 Self::SecretDeleted => serializer.serialize_i32(2),
9698 Self::UnknownValue(u) => u.0.serialize(serializer),
9699 }
9700 }
9701 }
9702
9703 impl<'de> serde::de::Deserialize<'de> for State {
9704 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9705 where
9706 D: serde::Deserializer<'de>,
9707 {
9708 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9709 ".google.devtools.cloudbuild.v1.WebhookConfig.State",
9710 ))
9711 }
9712 }
9713
9714 /// Auth method specifies how the webhook authenticates with GCP.
9715 #[derive(Clone, Debug, PartialEq)]
9716 #[non_exhaustive]
9717 pub enum AuthMethod {
9718 /// Required. Resource name for the secret required as a URL parameter.
9719 Secret(std::string::String),
9720 }
9721}
9722
9723/// PullRequestFilter contains filter properties for matching GitHub Pull
9724/// Requests.
9725#[derive(Clone, Default, PartialEq)]
9726#[non_exhaustive]
9727pub struct PullRequestFilter {
9728 /// If CommentControl is enabled, depending on the setting, builds may not
9729 /// fire until a repository writer comments `/gcbrun` on a pull
9730 /// request or `/gcbrun` is in the pull request description.
9731 /// Only PR comments that contain `/gcbrun` will trigger builds.
9732 ///
9733 /// If CommentControl is set to disabled, comments with `/gcbrun` from a user
9734 /// with repository write permission or above will
9735 /// still trigger builds to run.
9736 pub comment_control: crate::model::pull_request_filter::CommentControl,
9737
9738 /// If true, branches that do NOT match the git_ref will trigger a build.
9739 pub invert_regex: bool,
9740
9741 /// Target refs to match.
9742 /// A target ref is the git reference where the pull request will be applied.
9743 pub git_ref: std::option::Option<crate::model::pull_request_filter::GitRef>,
9744
9745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9746}
9747
9748impl PullRequestFilter {
9749 /// Creates a new default instance.
9750 pub fn new() -> Self {
9751 std::default::Default::default()
9752 }
9753
9754 /// Sets the value of [comment_control][crate::model::PullRequestFilter::comment_control].
9755 ///
9756 /// # Example
9757 /// ```ignore,no_run
9758 /// # use google_cloud_build_v1::model::PullRequestFilter;
9759 /// use google_cloud_build_v1::model::pull_request_filter::CommentControl;
9760 /// let x0 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabled);
9761 /// let x1 = PullRequestFilter::new().set_comment_control(CommentControl::CommentsEnabledForExternalContributorsOnly);
9762 /// ```
9763 pub fn set_comment_control<
9764 T: std::convert::Into<crate::model::pull_request_filter::CommentControl>,
9765 >(
9766 mut self,
9767 v: T,
9768 ) -> Self {
9769 self.comment_control = v.into();
9770 self
9771 }
9772
9773 /// Sets the value of [invert_regex][crate::model::PullRequestFilter::invert_regex].
9774 ///
9775 /// # Example
9776 /// ```ignore,no_run
9777 /// # use google_cloud_build_v1::model::PullRequestFilter;
9778 /// let x = PullRequestFilter::new().set_invert_regex(true);
9779 /// ```
9780 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9781 self.invert_regex = v.into();
9782 self
9783 }
9784
9785 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref].
9786 ///
9787 /// Note that all the setters affecting `git_ref` are mutually
9788 /// exclusive.
9789 ///
9790 /// # Example
9791 /// ```ignore,no_run
9792 /// # use google_cloud_build_v1::model::PullRequestFilter;
9793 /// use google_cloud_build_v1::model::pull_request_filter::GitRef;
9794 /// let x = PullRequestFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
9795 /// ```
9796 pub fn set_git_ref<
9797 T: std::convert::Into<std::option::Option<crate::model::pull_request_filter::GitRef>>,
9798 >(
9799 mut self,
9800 v: T,
9801 ) -> Self {
9802 self.git_ref = v.into();
9803 self
9804 }
9805
9806 /// The value of [git_ref][crate::model::PullRequestFilter::git_ref]
9807 /// if it holds a `Branch`, `None` if the field is not set or
9808 /// holds a different branch.
9809 pub fn branch(&self) -> std::option::Option<&std::string::String> {
9810 #[allow(unreachable_patterns)]
9811 self.git_ref.as_ref().and_then(|v| match v {
9812 crate::model::pull_request_filter::GitRef::Branch(v) => std::option::Option::Some(v),
9813 _ => std::option::Option::None,
9814 })
9815 }
9816
9817 /// Sets the value of [git_ref][crate::model::PullRequestFilter::git_ref]
9818 /// to hold a `Branch`.
9819 ///
9820 /// Note that all the setters affecting `git_ref` are
9821 /// mutually exclusive.
9822 ///
9823 /// # Example
9824 /// ```ignore,no_run
9825 /// # use google_cloud_build_v1::model::PullRequestFilter;
9826 /// let x = PullRequestFilter::new().set_branch("example");
9827 /// assert!(x.branch().is_some());
9828 /// ```
9829 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9830 self.git_ref =
9831 std::option::Option::Some(crate::model::pull_request_filter::GitRef::Branch(v.into()));
9832 self
9833 }
9834}
9835
9836impl wkt::message::Message for PullRequestFilter {
9837 fn typename() -> &'static str {
9838 "type.googleapis.com/google.devtools.cloudbuild.v1.PullRequestFilter"
9839 }
9840}
9841
9842/// Defines additional types related to [PullRequestFilter].
9843pub mod pull_request_filter {
9844 #[allow(unused_imports)]
9845 use super::*;
9846
9847 /// Controls whether or not a `/gcbrun` comment is required from a user with
9848 /// repository write permission or above in order to
9849 /// trigger Build runs for pull requests. Pull Request update events differ
9850 /// between repo types.
9851 /// Check repo specific guides
9852 /// ([GitHub](https://cloud.google.com/build/docs/automating-builds/github/build-repos-from-github-enterprise#creating_a_github_enterprise_trigger),
9853 /// [Bitbucket](https://cloud.google.com/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-server#creating_a_bitbucket_server_trigger),
9854 /// [GitLab](https://cloud.google.com/build/docs/automating-builds/gitlab/build-repos-from-gitlab#creating_a_gitlab_trigger)
9855 /// for details.
9856 ///
9857 /// # Working with unknown values
9858 ///
9859 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9860 /// additional enum variants at any time. Adding new variants is not considered
9861 /// a breaking change. Applications should write their code in anticipation of:
9862 ///
9863 /// - New values appearing in future releases of the client library, **and**
9864 /// - New values received dynamically, without application changes.
9865 ///
9866 /// Please consult the [Working with enums] section in the user guide for some
9867 /// guidelines.
9868 ///
9869 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9870 #[derive(Clone, Debug, PartialEq)]
9871 #[non_exhaustive]
9872 pub enum CommentControl {
9873 /// Do not require `/gcbrun` comments from a user with repository write
9874 /// permission or above on pull requests before builds are triggered.
9875 /// Comments that contain `/gcbrun` will still fire builds so this should
9876 /// be thought of as comments not required.
9877 CommentsDisabled,
9878 /// Builds will only fire in response to pull requests if:
9879 ///
9880 /// 1. The pull request author has repository write permission or above and
9881 /// `/gcbrun` is in the PR description.
9882 /// 1. A user with repository writer permissions or above comments `/gcbrun`
9883 /// on a pull request authored by any user.
9884 CommentsEnabled,
9885 /// Builds will only fire in response to pull requests if:
9886 ///
9887 /// 1. The pull request author is a repository writer or above.
9888 /// 1. If the author does not have write permissions, a user with write
9889 /// permissions or above must comment `/gcbrun` in order to fire a build.
9890 CommentsEnabledForExternalContributorsOnly,
9891 /// If set, the enum was initialized with an unknown value.
9892 ///
9893 /// Applications can examine the value using [CommentControl::value] or
9894 /// [CommentControl::name].
9895 UnknownValue(comment_control::UnknownValue),
9896 }
9897
9898 #[doc(hidden)]
9899 pub mod comment_control {
9900 #[allow(unused_imports)]
9901 use super::*;
9902 #[derive(Clone, Debug, PartialEq)]
9903 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9904 }
9905
9906 impl CommentControl {
9907 /// Gets the enum value.
9908 ///
9909 /// Returns `None` if the enum contains an unknown value deserialized from
9910 /// the string representation of enums.
9911 pub fn value(&self) -> std::option::Option<i32> {
9912 match self {
9913 Self::CommentsDisabled => std::option::Option::Some(0),
9914 Self::CommentsEnabled => std::option::Option::Some(1),
9915 Self::CommentsEnabledForExternalContributorsOnly => std::option::Option::Some(2),
9916 Self::UnknownValue(u) => u.0.value(),
9917 }
9918 }
9919
9920 /// Gets the enum value as a string.
9921 ///
9922 /// Returns `None` if the enum contains an unknown value deserialized from
9923 /// the integer representation of enums.
9924 pub fn name(&self) -> std::option::Option<&str> {
9925 match self {
9926 Self::CommentsDisabled => std::option::Option::Some("COMMENTS_DISABLED"),
9927 Self::CommentsEnabled => std::option::Option::Some("COMMENTS_ENABLED"),
9928 Self::CommentsEnabledForExternalContributorsOnly => {
9929 std::option::Option::Some("COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY")
9930 }
9931 Self::UnknownValue(u) => u.0.name(),
9932 }
9933 }
9934 }
9935
9936 impl std::default::Default for CommentControl {
9937 fn default() -> Self {
9938 use std::convert::From;
9939 Self::from(0)
9940 }
9941 }
9942
9943 impl std::fmt::Display for CommentControl {
9944 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9945 wkt::internal::display_enum(f, self.name(), self.value())
9946 }
9947 }
9948
9949 impl std::convert::From<i32> for CommentControl {
9950 fn from(value: i32) -> Self {
9951 match value {
9952 0 => Self::CommentsDisabled,
9953 1 => Self::CommentsEnabled,
9954 2 => Self::CommentsEnabledForExternalContributorsOnly,
9955 _ => Self::UnknownValue(comment_control::UnknownValue(
9956 wkt::internal::UnknownEnumValue::Integer(value),
9957 )),
9958 }
9959 }
9960 }
9961
9962 impl std::convert::From<&str> for CommentControl {
9963 fn from(value: &str) -> Self {
9964 use std::string::ToString;
9965 match value {
9966 "COMMENTS_DISABLED" => Self::CommentsDisabled,
9967 "COMMENTS_ENABLED" => Self::CommentsEnabled,
9968 "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY" => {
9969 Self::CommentsEnabledForExternalContributorsOnly
9970 }
9971 _ => Self::UnknownValue(comment_control::UnknownValue(
9972 wkt::internal::UnknownEnumValue::String(value.to_string()),
9973 )),
9974 }
9975 }
9976 }
9977
9978 impl serde::ser::Serialize for CommentControl {
9979 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9980 where
9981 S: serde::Serializer,
9982 {
9983 match self {
9984 Self::CommentsDisabled => serializer.serialize_i32(0),
9985 Self::CommentsEnabled => serializer.serialize_i32(1),
9986 Self::CommentsEnabledForExternalContributorsOnly => serializer.serialize_i32(2),
9987 Self::UnknownValue(u) => u.0.serialize(serializer),
9988 }
9989 }
9990 }
9991
9992 impl<'de> serde::de::Deserialize<'de> for CommentControl {
9993 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9994 where
9995 D: serde::Deserializer<'de>,
9996 {
9997 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommentControl>::new(
9998 ".google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl",
9999 ))
10000 }
10001 }
10002
10003 /// Target refs to match.
10004 /// A target ref is the git reference where the pull request will be applied.
10005 #[derive(Clone, Debug, PartialEq)]
10006 #[non_exhaustive]
10007 pub enum GitRef {
10008 /// Regex of branches to match.
10009 ///
10010 /// The syntax of the regular expressions accepted is the syntax accepted by
10011 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10012 Branch(std::string::String),
10013 }
10014}
10015
10016/// Push contains filter properties for matching GitHub git pushes.
10017#[derive(Clone, Default, PartialEq)]
10018#[non_exhaustive]
10019pub struct PushFilter {
10020 /// When true, only trigger a build if the revision regex does NOT match the
10021 /// git_ref regex.
10022 pub invert_regex: bool,
10023
10024 /// Modified refs to match.
10025 /// A modified refs are the refs modified by a git push operation.
10026 pub git_ref: std::option::Option<crate::model::push_filter::GitRef>,
10027
10028 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10029}
10030
10031impl PushFilter {
10032 /// Creates a new default instance.
10033 pub fn new() -> Self {
10034 std::default::Default::default()
10035 }
10036
10037 /// Sets the value of [invert_regex][crate::model::PushFilter::invert_regex].
10038 ///
10039 /// # Example
10040 /// ```ignore,no_run
10041 /// # use google_cloud_build_v1::model::PushFilter;
10042 /// let x = PushFilter::new().set_invert_regex(true);
10043 /// ```
10044 pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10045 self.invert_regex = v.into();
10046 self
10047 }
10048
10049 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref].
10050 ///
10051 /// Note that all the setters affecting `git_ref` are mutually
10052 /// exclusive.
10053 ///
10054 /// # Example
10055 /// ```ignore,no_run
10056 /// # use google_cloud_build_v1::model::PushFilter;
10057 /// use google_cloud_build_v1::model::push_filter::GitRef;
10058 /// let x = PushFilter::new().set_git_ref(Some(GitRef::Branch("example".to_string())));
10059 /// ```
10060 pub fn set_git_ref<
10061 T: std::convert::Into<std::option::Option<crate::model::push_filter::GitRef>>,
10062 >(
10063 mut self,
10064 v: T,
10065 ) -> Self {
10066 self.git_ref = v.into();
10067 self
10068 }
10069
10070 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10071 /// if it holds a `Branch`, `None` if the field is not set or
10072 /// holds a different branch.
10073 pub fn branch(&self) -> std::option::Option<&std::string::String> {
10074 #[allow(unreachable_patterns)]
10075 self.git_ref.as_ref().and_then(|v| match v {
10076 crate::model::push_filter::GitRef::Branch(v) => std::option::Option::Some(v),
10077 _ => std::option::Option::None,
10078 })
10079 }
10080
10081 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10082 /// to hold a `Branch`.
10083 ///
10084 /// Note that all the setters affecting `git_ref` are
10085 /// mutually exclusive.
10086 ///
10087 /// # Example
10088 /// ```ignore,no_run
10089 /// # use google_cloud_build_v1::model::PushFilter;
10090 /// let x = PushFilter::new().set_branch("example");
10091 /// assert!(x.branch().is_some());
10092 /// assert!(x.tag().is_none());
10093 /// ```
10094 pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10095 self.git_ref =
10096 std::option::Option::Some(crate::model::push_filter::GitRef::Branch(v.into()));
10097 self
10098 }
10099
10100 /// The value of [git_ref][crate::model::PushFilter::git_ref]
10101 /// if it holds a `Tag`, `None` if the field is not set or
10102 /// holds a different branch.
10103 pub fn tag(&self) -> std::option::Option<&std::string::String> {
10104 #[allow(unreachable_patterns)]
10105 self.git_ref.as_ref().and_then(|v| match v {
10106 crate::model::push_filter::GitRef::Tag(v) => std::option::Option::Some(v),
10107 _ => std::option::Option::None,
10108 })
10109 }
10110
10111 /// Sets the value of [git_ref][crate::model::PushFilter::git_ref]
10112 /// to hold a `Tag`.
10113 ///
10114 /// Note that all the setters affecting `git_ref` are
10115 /// mutually exclusive.
10116 ///
10117 /// # Example
10118 /// ```ignore,no_run
10119 /// # use google_cloud_build_v1::model::PushFilter;
10120 /// let x = PushFilter::new().set_tag("example");
10121 /// assert!(x.tag().is_some());
10122 /// assert!(x.branch().is_none());
10123 /// ```
10124 pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10125 self.git_ref = std::option::Option::Some(crate::model::push_filter::GitRef::Tag(v.into()));
10126 self
10127 }
10128}
10129
10130impl wkt::message::Message for PushFilter {
10131 fn typename() -> &'static str {
10132 "type.googleapis.com/google.devtools.cloudbuild.v1.PushFilter"
10133 }
10134}
10135
10136/// Defines additional types related to [PushFilter].
10137pub mod push_filter {
10138 #[allow(unused_imports)]
10139 use super::*;
10140
10141 /// Modified refs to match.
10142 /// A modified refs are the refs modified by a git push operation.
10143 #[derive(Clone, Debug, PartialEq)]
10144 #[non_exhaustive]
10145 pub enum GitRef {
10146 /// Regexes matching branches to build.
10147 ///
10148 /// The syntax of the regular expressions accepted is the syntax accepted by
10149 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10150 Branch(std::string::String),
10151 /// Regexes matching tags to build.
10152 ///
10153 /// The syntax of the regular expressions accepted is the syntax accepted by
10154 /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
10155 Tag(std::string::String),
10156 }
10157}
10158
10159/// Request to create a new `BuildTrigger`.
10160#[derive(Clone, Default, PartialEq)]
10161#[non_exhaustive]
10162pub struct CreateBuildTriggerRequest {
10163 /// The parent resource where this trigger will be created.
10164 /// Format: `projects/{project}/locations/{location}`
10165 pub parent: std::string::String,
10166
10167 /// Required. ID of the project for which to configure automatic builds.
10168 pub project_id: std::string::String,
10169
10170 /// Required. `BuildTrigger` to create.
10171 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10172
10173 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10174}
10175
10176impl CreateBuildTriggerRequest {
10177 /// Creates a new default instance.
10178 pub fn new() -> Self {
10179 std::default::Default::default()
10180 }
10181
10182 /// Sets the value of [parent][crate::model::CreateBuildTriggerRequest::parent].
10183 ///
10184 /// # Example
10185 /// ```ignore,no_run
10186 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10187 /// # let project_id = "project_id";
10188 /// let x = CreateBuildTriggerRequest::new().set_parent(format!("projects/{project_id}"));
10189 /// ```
10190 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10191 self.parent = v.into();
10192 self
10193 }
10194
10195 /// Sets the value of [project_id][crate::model::CreateBuildTriggerRequest::project_id].
10196 ///
10197 /// # Example
10198 /// ```ignore,no_run
10199 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10200 /// let x = CreateBuildTriggerRequest::new().set_project_id("example");
10201 /// ```
10202 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10203 self.project_id = v.into();
10204 self
10205 }
10206
10207 /// Sets the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10208 ///
10209 /// # Example
10210 /// ```ignore,no_run
10211 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10212 /// use google_cloud_build_v1::model::BuildTrigger;
10213 /// let x = CreateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10214 /// ```
10215 pub fn set_trigger<T>(mut self, v: T) -> Self
10216 where
10217 T: std::convert::Into<crate::model::BuildTrigger>,
10218 {
10219 self.trigger = std::option::Option::Some(v.into());
10220 self
10221 }
10222
10223 /// Sets or clears the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
10224 ///
10225 /// # Example
10226 /// ```ignore,no_run
10227 /// # use google_cloud_build_v1::model::CreateBuildTriggerRequest;
10228 /// use google_cloud_build_v1::model::BuildTrigger;
10229 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10230 /// let x = CreateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10231 /// ```
10232 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10233 where
10234 T: std::convert::Into<crate::model::BuildTrigger>,
10235 {
10236 self.trigger = v.map(|x| x.into());
10237 self
10238 }
10239}
10240
10241impl wkt::message::Message for CreateBuildTriggerRequest {
10242 fn typename() -> &'static str {
10243 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateBuildTriggerRequest"
10244 }
10245}
10246
10247/// Returns the `BuildTrigger` with the specified ID.
10248#[derive(Clone, Default, PartialEq)]
10249#[non_exhaustive]
10250pub struct GetBuildTriggerRequest {
10251 /// The name of the `Trigger` to retrieve.
10252 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10253 pub name: std::string::String,
10254
10255 /// Required. ID of the project that owns the trigger.
10256 pub project_id: std::string::String,
10257
10258 /// Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
10259 pub trigger_id: std::string::String,
10260
10261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10262}
10263
10264impl GetBuildTriggerRequest {
10265 /// Creates a new default instance.
10266 pub fn new() -> Self {
10267 std::default::Default::default()
10268 }
10269
10270 /// Sets the value of [name][crate::model::GetBuildTriggerRequest::name].
10271 ///
10272 /// # Example
10273 /// ```ignore,no_run
10274 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10275 /// # let project_id = "project_id";
10276 /// # let trigger_id = "trigger_id";
10277 /// let x = GetBuildTriggerRequest::new().set_name(format!("projects/{project_id}/triggers/{trigger_id}"));
10278 /// ```
10279 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10280 self.name = v.into();
10281 self
10282 }
10283
10284 /// Sets the value of [project_id][crate::model::GetBuildTriggerRequest::project_id].
10285 ///
10286 /// # Example
10287 /// ```ignore,no_run
10288 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10289 /// let x = GetBuildTriggerRequest::new().set_project_id("example");
10290 /// ```
10291 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10292 self.project_id = v.into();
10293 self
10294 }
10295
10296 /// Sets the value of [trigger_id][crate::model::GetBuildTriggerRequest::trigger_id].
10297 ///
10298 /// # Example
10299 /// ```ignore,no_run
10300 /// # use google_cloud_build_v1::model::GetBuildTriggerRequest;
10301 /// let x = GetBuildTriggerRequest::new().set_trigger_id("example");
10302 /// ```
10303 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10304 self.trigger_id = v.into();
10305 self
10306 }
10307}
10308
10309impl wkt::message::Message for GetBuildTriggerRequest {
10310 fn typename() -> &'static str {
10311 "type.googleapis.com/google.devtools.cloudbuild.v1.GetBuildTriggerRequest"
10312 }
10313}
10314
10315/// Request to list existing `BuildTriggers`.
10316#[derive(Clone, Default, PartialEq)]
10317#[non_exhaustive]
10318pub struct ListBuildTriggersRequest {
10319 /// The parent of the collection of `Triggers`.
10320 /// Format: `projects/{project}/locations/{location}`
10321 pub parent: std::string::String,
10322
10323 /// Required. ID of the project for which to list BuildTriggers.
10324 pub project_id: std::string::String,
10325
10326 /// Number of results to return in the list.
10327 pub page_size: i32,
10328
10329 /// Token to provide to skip to a particular spot in the list.
10330 pub page_token: std::string::String,
10331
10332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10333}
10334
10335impl ListBuildTriggersRequest {
10336 /// Creates a new default instance.
10337 pub fn new() -> Self {
10338 std::default::Default::default()
10339 }
10340
10341 /// Sets the value of [parent][crate::model::ListBuildTriggersRequest::parent].
10342 ///
10343 /// # Example
10344 /// ```ignore,no_run
10345 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10346 /// # let project_id = "project_id";
10347 /// let x = ListBuildTriggersRequest::new().set_parent(format!("projects/{project_id}"));
10348 /// ```
10349 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10350 self.parent = v.into();
10351 self
10352 }
10353
10354 /// Sets the value of [project_id][crate::model::ListBuildTriggersRequest::project_id].
10355 ///
10356 /// # Example
10357 /// ```ignore,no_run
10358 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10359 /// let x = ListBuildTriggersRequest::new().set_project_id("example");
10360 /// ```
10361 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10362 self.project_id = v.into();
10363 self
10364 }
10365
10366 /// Sets the value of [page_size][crate::model::ListBuildTriggersRequest::page_size].
10367 ///
10368 /// # Example
10369 /// ```ignore,no_run
10370 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10371 /// let x = ListBuildTriggersRequest::new().set_page_size(42);
10372 /// ```
10373 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10374 self.page_size = v.into();
10375 self
10376 }
10377
10378 /// Sets the value of [page_token][crate::model::ListBuildTriggersRequest::page_token].
10379 ///
10380 /// # Example
10381 /// ```ignore,no_run
10382 /// # use google_cloud_build_v1::model::ListBuildTriggersRequest;
10383 /// let x = ListBuildTriggersRequest::new().set_page_token("example");
10384 /// ```
10385 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10386 self.page_token = v.into();
10387 self
10388 }
10389}
10390
10391impl wkt::message::Message for ListBuildTriggersRequest {
10392 fn typename() -> &'static str {
10393 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersRequest"
10394 }
10395}
10396
10397/// Response containing existing `BuildTriggers`.
10398#[derive(Clone, Default, PartialEq)]
10399#[non_exhaustive]
10400pub struct ListBuildTriggersResponse {
10401 /// `BuildTriggers` for the project, sorted by `create_time` descending.
10402 pub triggers: std::vec::Vec<crate::model::BuildTrigger>,
10403
10404 /// Token to receive the next page of results.
10405 pub next_page_token: std::string::String,
10406
10407 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10408}
10409
10410impl ListBuildTriggersResponse {
10411 /// Creates a new default instance.
10412 pub fn new() -> Self {
10413 std::default::Default::default()
10414 }
10415
10416 /// Sets the value of [triggers][crate::model::ListBuildTriggersResponse::triggers].
10417 ///
10418 /// # Example
10419 /// ```ignore,no_run
10420 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10421 /// use google_cloud_build_v1::model::BuildTrigger;
10422 /// let x = ListBuildTriggersResponse::new()
10423 /// .set_triggers([
10424 /// BuildTrigger::default()/* use setters */,
10425 /// BuildTrigger::default()/* use (different) setters */,
10426 /// ]);
10427 /// ```
10428 pub fn set_triggers<T, V>(mut self, v: T) -> Self
10429 where
10430 T: std::iter::IntoIterator<Item = V>,
10431 V: std::convert::Into<crate::model::BuildTrigger>,
10432 {
10433 use std::iter::Iterator;
10434 self.triggers = v.into_iter().map(|i| i.into()).collect();
10435 self
10436 }
10437
10438 /// Sets the value of [next_page_token][crate::model::ListBuildTriggersResponse::next_page_token].
10439 ///
10440 /// # Example
10441 /// ```ignore,no_run
10442 /// # use google_cloud_build_v1::model::ListBuildTriggersResponse;
10443 /// let x = ListBuildTriggersResponse::new().set_next_page_token("example");
10444 /// ```
10445 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10446 self.next_page_token = v.into();
10447 self
10448 }
10449}
10450
10451impl wkt::message::Message for ListBuildTriggersResponse {
10452 fn typename() -> &'static str {
10453 "type.googleapis.com/google.devtools.cloudbuild.v1.ListBuildTriggersResponse"
10454 }
10455}
10456
10457#[doc(hidden)]
10458impl google_cloud_gax::paginator::internal::PageableResponse for ListBuildTriggersResponse {
10459 type PageItem = crate::model::BuildTrigger;
10460
10461 fn items(self) -> std::vec::Vec<Self::PageItem> {
10462 self.triggers
10463 }
10464
10465 fn next_page_token(&self) -> std::string::String {
10466 use std::clone::Clone;
10467 self.next_page_token.clone()
10468 }
10469}
10470
10471/// Request to delete a `BuildTrigger`.
10472#[derive(Clone, Default, PartialEq)]
10473#[non_exhaustive]
10474pub struct DeleteBuildTriggerRequest {
10475 /// The name of the `Trigger` to delete.
10476 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
10477 pub name: std::string::String,
10478
10479 /// Required. ID of the project that owns the trigger.
10480 pub project_id: std::string::String,
10481
10482 /// Required. ID of the `BuildTrigger` to delete.
10483 pub trigger_id: std::string::String,
10484
10485 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10486}
10487
10488impl DeleteBuildTriggerRequest {
10489 /// Creates a new default instance.
10490 pub fn new() -> Self {
10491 std::default::Default::default()
10492 }
10493
10494 /// Sets the value of [name][crate::model::DeleteBuildTriggerRequest::name].
10495 ///
10496 /// # Example
10497 /// ```ignore,no_run
10498 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10499 /// # let project_id = "project_id";
10500 /// # let trigger_id = "trigger_id";
10501 /// let x = DeleteBuildTriggerRequest::new().set_name(format!("projects/{project_id}/triggers/{trigger_id}"));
10502 /// ```
10503 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10504 self.name = v.into();
10505 self
10506 }
10507
10508 /// Sets the value of [project_id][crate::model::DeleteBuildTriggerRequest::project_id].
10509 ///
10510 /// # Example
10511 /// ```ignore,no_run
10512 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10513 /// let x = DeleteBuildTriggerRequest::new().set_project_id("example");
10514 /// ```
10515 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10516 self.project_id = v.into();
10517 self
10518 }
10519
10520 /// Sets the value of [trigger_id][crate::model::DeleteBuildTriggerRequest::trigger_id].
10521 ///
10522 /// # Example
10523 /// ```ignore,no_run
10524 /// # use google_cloud_build_v1::model::DeleteBuildTriggerRequest;
10525 /// let x = DeleteBuildTriggerRequest::new().set_trigger_id("example");
10526 /// ```
10527 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10528 self.trigger_id = v.into();
10529 self
10530 }
10531}
10532
10533impl wkt::message::Message for DeleteBuildTriggerRequest {
10534 fn typename() -> &'static str {
10535 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest"
10536 }
10537}
10538
10539/// Request to update an existing `BuildTrigger`.
10540#[derive(Clone, Default, PartialEq)]
10541#[non_exhaustive]
10542pub struct UpdateBuildTriggerRequest {
10543 /// Required. ID of the project that owns the trigger.
10544 pub project_id: std::string::String,
10545
10546 /// Required. ID of the `BuildTrigger` to update.
10547 pub trigger_id: std::string::String,
10548
10549 /// Required. `BuildTrigger` to update.
10550 pub trigger: std::option::Option<crate::model::BuildTrigger>,
10551
10552 /// Update mask for the resource. If this is set,
10553 /// the server will only update the fields specified in the field mask.
10554 /// Otherwise, a full update of the mutable resource fields will be performed.
10555 pub update_mask: std::option::Option<wkt::FieldMask>,
10556
10557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10558}
10559
10560impl UpdateBuildTriggerRequest {
10561 /// Creates a new default instance.
10562 pub fn new() -> Self {
10563 std::default::Default::default()
10564 }
10565
10566 /// Sets the value of [project_id][crate::model::UpdateBuildTriggerRequest::project_id].
10567 ///
10568 /// # Example
10569 /// ```ignore,no_run
10570 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10571 /// let x = UpdateBuildTriggerRequest::new().set_project_id("example");
10572 /// ```
10573 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10574 self.project_id = v.into();
10575 self
10576 }
10577
10578 /// Sets the value of [trigger_id][crate::model::UpdateBuildTriggerRequest::trigger_id].
10579 ///
10580 /// # Example
10581 /// ```ignore,no_run
10582 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10583 /// let x = UpdateBuildTriggerRequest::new().set_trigger_id("example");
10584 /// ```
10585 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10586 self.trigger_id = v.into();
10587 self
10588 }
10589
10590 /// Sets the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10591 ///
10592 /// # Example
10593 /// ```ignore,no_run
10594 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10595 /// use google_cloud_build_v1::model::BuildTrigger;
10596 /// let x = UpdateBuildTriggerRequest::new().set_trigger(BuildTrigger::default()/* use setters */);
10597 /// ```
10598 pub fn set_trigger<T>(mut self, v: T) -> Self
10599 where
10600 T: std::convert::Into<crate::model::BuildTrigger>,
10601 {
10602 self.trigger = std::option::Option::Some(v.into());
10603 self
10604 }
10605
10606 /// Sets or clears the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
10607 ///
10608 /// # Example
10609 /// ```ignore,no_run
10610 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10611 /// use google_cloud_build_v1::model::BuildTrigger;
10612 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(Some(BuildTrigger::default()/* use setters */));
10613 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_trigger(None::<BuildTrigger>);
10614 /// ```
10615 pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
10616 where
10617 T: std::convert::Into<crate::model::BuildTrigger>,
10618 {
10619 self.trigger = v.map(|x| x.into());
10620 self
10621 }
10622
10623 /// Sets the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10624 ///
10625 /// # Example
10626 /// ```ignore,no_run
10627 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10628 /// use wkt::FieldMask;
10629 /// let x = UpdateBuildTriggerRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10630 /// ```
10631 pub fn set_update_mask<T>(mut self, v: T) -> Self
10632 where
10633 T: std::convert::Into<wkt::FieldMask>,
10634 {
10635 self.update_mask = std::option::Option::Some(v.into());
10636 self
10637 }
10638
10639 /// Sets or clears the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
10640 ///
10641 /// # Example
10642 /// ```ignore,no_run
10643 /// # use google_cloud_build_v1::model::UpdateBuildTriggerRequest;
10644 /// use wkt::FieldMask;
10645 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10646 /// let x = UpdateBuildTriggerRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10647 /// ```
10648 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10649 where
10650 T: std::convert::Into<wkt::FieldMask>,
10651 {
10652 self.update_mask = v.map(|x| x.into());
10653 self
10654 }
10655}
10656
10657impl wkt::message::Message for UpdateBuildTriggerRequest {
10658 fn typename() -> &'static str {
10659 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest"
10660 }
10661}
10662
10663/// Optional arguments to enable specific features of builds.
10664#[derive(Clone, Default, PartialEq)]
10665#[non_exhaustive]
10666pub struct BuildOptions {
10667 /// Requested hash for SourceProvenance.
10668 pub source_provenance_hash: std::vec::Vec<crate::model::hash::HashType>,
10669
10670 /// Requested verifiability options.
10671 pub requested_verify_option: crate::model::build_options::VerifyOption,
10672
10673 /// Compute Engine machine type on which to run the build.
10674 pub machine_type: crate::model::build_options::MachineType,
10675
10676 /// Requested disk size for the VM that runs the build. Note that this is *NOT*
10677 /// "disk free"; some of the space will be used by the operating system and
10678 /// build utilities. Also note that this is the minimum disk size that will be
10679 /// allocated for the build -- the build may run with a larger disk than
10680 /// requested. At present, the maximum disk size is 4000GB; builds that request
10681 /// more than the maximum are rejected with an error.
10682 pub disk_size_gb: i64,
10683
10684 /// Option to specify behavior when there is an error in the substitution
10685 /// checks.
10686 ///
10687 /// NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot
10688 /// be overridden in the build configuration file.
10689 pub substitution_option: crate::model::build_options::SubstitutionOption,
10690
10691 /// Option to specify whether or not to apply bash style string
10692 /// operations to the substitutions.
10693 ///
10694 /// NOTE: this is always enabled for triggered builds and cannot be
10695 /// overridden in the build configuration file.
10696 pub dynamic_substitutions: bool,
10697
10698 /// Option to include built-in and custom substitutions as env variables
10699 /// for all build steps.
10700 pub automap_substitutions: bool,
10701
10702 /// Option to define build log streaming behavior to Cloud
10703 /// Storage.
10704 pub log_streaming_option: crate::model::build_options::LogStreamingOption,
10705
10706 /// This field deprecated; please use `pool.name` instead.
10707 #[deprecated]
10708 pub worker_pool: std::string::String,
10709
10710 /// Optional. Specification for execution on a `WorkerPool`.
10711 ///
10712 /// See [running builds in a private
10713 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
10714 /// for more information.
10715 pub pool: std::option::Option<crate::model::build_options::PoolOption>,
10716
10717 /// Option to specify the logging mode, which determines if and where build
10718 /// logs are stored.
10719 pub logging: crate::model::build_options::LoggingMode,
10720
10721 /// A list of global environment variable definitions that will exist for all
10722 /// build steps in this build. If a variable is defined in both globally and in
10723 /// a build step, the variable will use the build step value.
10724 ///
10725 /// The elements are of the form "KEY=VALUE" for the environment variable "KEY"
10726 /// being given the value "VALUE".
10727 pub env: std::vec::Vec<std::string::String>,
10728
10729 /// A list of global environment variables, which are encrypted using a Cloud
10730 /// Key Management Service crypto key. These values must be specified in the
10731 /// build's `Secret`. These variables will be available to all build steps
10732 /// in this build.
10733 pub secret_env: std::vec::Vec<std::string::String>,
10734
10735 /// Global list of volumes to mount for ALL build steps
10736 ///
10737 /// Each volume is created as an empty volume prior to starting the build
10738 /// process. Upon completion of the build, volumes and their contents are
10739 /// discarded. Global volume names and paths cannot conflict with the volumes
10740 /// defined a build step.
10741 ///
10742 /// Using a global volume in a build with only one step is not valid as
10743 /// it is indicative of a build request with an incorrect configuration.
10744 pub volumes: std::vec::Vec<crate::model::Volume>,
10745
10746 /// Optional. Option to specify how default logs buckets are setup.
10747 pub default_logs_bucket_behavior: crate::model::build_options::DefaultLogsBucketBehavior,
10748
10749 /// Optional. Option to specify whether structured logging is enabled.
10750 ///
10751 /// If true, JSON-formatted logs are parsed as structured logs.
10752 pub enable_structured_logging: bool,
10753
10754 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10755}
10756
10757impl BuildOptions {
10758 /// Creates a new default instance.
10759 pub fn new() -> Self {
10760 std::default::Default::default()
10761 }
10762
10763 /// Sets the value of [source_provenance_hash][crate::model::BuildOptions::source_provenance_hash].
10764 ///
10765 /// # Example
10766 /// ```ignore,no_run
10767 /// # use google_cloud_build_v1::model::BuildOptions;
10768 /// use google_cloud_build_v1::model::hash::HashType;
10769 /// let x = BuildOptions::new().set_source_provenance_hash([
10770 /// HashType::Sha256,
10771 /// HashType::Md5,
10772 /// HashType::GoModuleH1,
10773 /// ]);
10774 /// ```
10775 pub fn set_source_provenance_hash<T, V>(mut self, v: T) -> Self
10776 where
10777 T: std::iter::IntoIterator<Item = V>,
10778 V: std::convert::Into<crate::model::hash::HashType>,
10779 {
10780 use std::iter::Iterator;
10781 self.source_provenance_hash = v.into_iter().map(|i| i.into()).collect();
10782 self
10783 }
10784
10785 /// Sets the value of [requested_verify_option][crate::model::BuildOptions::requested_verify_option].
10786 ///
10787 /// # Example
10788 /// ```ignore,no_run
10789 /// # use google_cloud_build_v1::model::BuildOptions;
10790 /// use google_cloud_build_v1::model::build_options::VerifyOption;
10791 /// let x0 = BuildOptions::new().set_requested_verify_option(VerifyOption::Verified);
10792 /// ```
10793 pub fn set_requested_verify_option<
10794 T: std::convert::Into<crate::model::build_options::VerifyOption>,
10795 >(
10796 mut self,
10797 v: T,
10798 ) -> Self {
10799 self.requested_verify_option = v.into();
10800 self
10801 }
10802
10803 /// Sets the value of [machine_type][crate::model::BuildOptions::machine_type].
10804 ///
10805 /// # Example
10806 /// ```ignore,no_run
10807 /// # use google_cloud_build_v1::model::BuildOptions;
10808 /// use google_cloud_build_v1::model::build_options::MachineType;
10809 /// let x0 = BuildOptions::new().set_machine_type(MachineType::E2Highcpu8);
10810 /// let x1 = BuildOptions::new().set_machine_type(MachineType::E2Highcpu32);
10811 /// let x2 = BuildOptions::new().set_machine_type(MachineType::E2Medium);
10812 /// ```
10813 pub fn set_machine_type<T: std::convert::Into<crate::model::build_options::MachineType>>(
10814 mut self,
10815 v: T,
10816 ) -> Self {
10817 self.machine_type = v.into();
10818 self
10819 }
10820
10821 /// Sets the value of [disk_size_gb][crate::model::BuildOptions::disk_size_gb].
10822 ///
10823 /// # Example
10824 /// ```ignore,no_run
10825 /// # use google_cloud_build_v1::model::BuildOptions;
10826 /// let x = BuildOptions::new().set_disk_size_gb(42);
10827 /// ```
10828 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10829 self.disk_size_gb = v.into();
10830 self
10831 }
10832
10833 /// Sets the value of [substitution_option][crate::model::BuildOptions::substitution_option].
10834 ///
10835 /// # Example
10836 /// ```ignore,no_run
10837 /// # use google_cloud_build_v1::model::BuildOptions;
10838 /// use google_cloud_build_v1::model::build_options::SubstitutionOption;
10839 /// let x0 = BuildOptions::new().set_substitution_option(SubstitutionOption::AllowLoose);
10840 /// ```
10841 pub fn set_substitution_option<
10842 T: std::convert::Into<crate::model::build_options::SubstitutionOption>,
10843 >(
10844 mut self,
10845 v: T,
10846 ) -> Self {
10847 self.substitution_option = v.into();
10848 self
10849 }
10850
10851 /// Sets the value of [dynamic_substitutions][crate::model::BuildOptions::dynamic_substitutions].
10852 ///
10853 /// # Example
10854 /// ```ignore,no_run
10855 /// # use google_cloud_build_v1::model::BuildOptions;
10856 /// let x = BuildOptions::new().set_dynamic_substitutions(true);
10857 /// ```
10858 pub fn set_dynamic_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10859 self.dynamic_substitutions = v.into();
10860 self
10861 }
10862
10863 /// Sets the value of [automap_substitutions][crate::model::BuildOptions::automap_substitutions].
10864 ///
10865 /// # Example
10866 /// ```ignore,no_run
10867 /// # use google_cloud_build_v1::model::BuildOptions;
10868 /// let x = BuildOptions::new().set_automap_substitutions(true);
10869 /// ```
10870 pub fn set_automap_substitutions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10871 self.automap_substitutions = v.into();
10872 self
10873 }
10874
10875 /// Sets the value of [log_streaming_option][crate::model::BuildOptions::log_streaming_option].
10876 ///
10877 /// # Example
10878 /// ```ignore,no_run
10879 /// # use google_cloud_build_v1::model::BuildOptions;
10880 /// use google_cloud_build_v1::model::build_options::LogStreamingOption;
10881 /// let x0 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOn);
10882 /// let x1 = BuildOptions::new().set_log_streaming_option(LogStreamingOption::StreamOff);
10883 /// ```
10884 pub fn set_log_streaming_option<
10885 T: std::convert::Into<crate::model::build_options::LogStreamingOption>,
10886 >(
10887 mut self,
10888 v: T,
10889 ) -> Self {
10890 self.log_streaming_option = v.into();
10891 self
10892 }
10893
10894 /// Sets the value of [worker_pool][crate::model::BuildOptions::worker_pool].
10895 ///
10896 /// # Example
10897 /// ```ignore,no_run
10898 /// # use google_cloud_build_v1::model::BuildOptions;
10899 /// let x = BuildOptions::new().set_worker_pool("example");
10900 /// ```
10901 #[deprecated]
10902 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10903 self.worker_pool = v.into();
10904 self
10905 }
10906
10907 /// Sets the value of [pool][crate::model::BuildOptions::pool].
10908 ///
10909 /// # Example
10910 /// ```ignore,no_run
10911 /// # use google_cloud_build_v1::model::BuildOptions;
10912 /// use google_cloud_build_v1::model::build_options::PoolOption;
10913 /// let x = BuildOptions::new().set_pool(PoolOption::default()/* use setters */);
10914 /// ```
10915 pub fn set_pool<T>(mut self, v: T) -> Self
10916 where
10917 T: std::convert::Into<crate::model::build_options::PoolOption>,
10918 {
10919 self.pool = std::option::Option::Some(v.into());
10920 self
10921 }
10922
10923 /// Sets or clears the value of [pool][crate::model::BuildOptions::pool].
10924 ///
10925 /// # Example
10926 /// ```ignore,no_run
10927 /// # use google_cloud_build_v1::model::BuildOptions;
10928 /// use google_cloud_build_v1::model::build_options::PoolOption;
10929 /// let x = BuildOptions::new().set_or_clear_pool(Some(PoolOption::default()/* use setters */));
10930 /// let x = BuildOptions::new().set_or_clear_pool(None::<PoolOption>);
10931 /// ```
10932 pub fn set_or_clear_pool<T>(mut self, v: std::option::Option<T>) -> Self
10933 where
10934 T: std::convert::Into<crate::model::build_options::PoolOption>,
10935 {
10936 self.pool = v.map(|x| x.into());
10937 self
10938 }
10939
10940 /// Sets the value of [logging][crate::model::BuildOptions::logging].
10941 ///
10942 /// # Example
10943 /// ```ignore,no_run
10944 /// # use google_cloud_build_v1::model::BuildOptions;
10945 /// use google_cloud_build_v1::model::build_options::LoggingMode;
10946 /// let x0 = BuildOptions::new().set_logging(LoggingMode::Legacy);
10947 /// let x1 = BuildOptions::new().set_logging(LoggingMode::GcsOnly);
10948 /// let x2 = BuildOptions::new().set_logging(LoggingMode::CloudLoggingOnly);
10949 /// ```
10950 pub fn set_logging<T: std::convert::Into<crate::model::build_options::LoggingMode>>(
10951 mut self,
10952 v: T,
10953 ) -> Self {
10954 self.logging = v.into();
10955 self
10956 }
10957
10958 /// Sets the value of [env][crate::model::BuildOptions::env].
10959 ///
10960 /// # Example
10961 /// ```ignore,no_run
10962 /// # use google_cloud_build_v1::model::BuildOptions;
10963 /// let x = BuildOptions::new().set_env(["a", "b", "c"]);
10964 /// ```
10965 pub fn set_env<T, V>(mut self, v: T) -> Self
10966 where
10967 T: std::iter::IntoIterator<Item = V>,
10968 V: std::convert::Into<std::string::String>,
10969 {
10970 use std::iter::Iterator;
10971 self.env = v.into_iter().map(|i| i.into()).collect();
10972 self
10973 }
10974
10975 /// Sets the value of [secret_env][crate::model::BuildOptions::secret_env].
10976 ///
10977 /// # Example
10978 /// ```ignore,no_run
10979 /// # use google_cloud_build_v1::model::BuildOptions;
10980 /// let x = BuildOptions::new().set_secret_env(["a", "b", "c"]);
10981 /// ```
10982 pub fn set_secret_env<T, V>(mut self, v: T) -> Self
10983 where
10984 T: std::iter::IntoIterator<Item = V>,
10985 V: std::convert::Into<std::string::String>,
10986 {
10987 use std::iter::Iterator;
10988 self.secret_env = v.into_iter().map(|i| i.into()).collect();
10989 self
10990 }
10991
10992 /// Sets the value of [volumes][crate::model::BuildOptions::volumes].
10993 ///
10994 /// # Example
10995 /// ```ignore,no_run
10996 /// # use google_cloud_build_v1::model::BuildOptions;
10997 /// use google_cloud_build_v1::model::Volume;
10998 /// let x = BuildOptions::new()
10999 /// .set_volumes([
11000 /// Volume::default()/* use setters */,
11001 /// Volume::default()/* use (different) setters */,
11002 /// ]);
11003 /// ```
11004 pub fn set_volumes<T, V>(mut self, v: T) -> Self
11005 where
11006 T: std::iter::IntoIterator<Item = V>,
11007 V: std::convert::Into<crate::model::Volume>,
11008 {
11009 use std::iter::Iterator;
11010 self.volumes = v.into_iter().map(|i| i.into()).collect();
11011 self
11012 }
11013
11014 /// Sets the value of [default_logs_bucket_behavior][crate::model::BuildOptions::default_logs_bucket_behavior].
11015 ///
11016 /// # Example
11017 /// ```ignore,no_run
11018 /// # use google_cloud_build_v1::model::BuildOptions;
11019 /// use google_cloud_build_v1::model::build_options::DefaultLogsBucketBehavior;
11020 /// let x0 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::RegionalUserOwnedBucket);
11021 /// let x1 = BuildOptions::new().set_default_logs_bucket_behavior(DefaultLogsBucketBehavior::LegacyBucket);
11022 /// ```
11023 pub fn set_default_logs_bucket_behavior<
11024 T: std::convert::Into<crate::model::build_options::DefaultLogsBucketBehavior>,
11025 >(
11026 mut self,
11027 v: T,
11028 ) -> Self {
11029 self.default_logs_bucket_behavior = v.into();
11030 self
11031 }
11032
11033 /// Sets the value of [enable_structured_logging][crate::model::BuildOptions::enable_structured_logging].
11034 ///
11035 /// # Example
11036 /// ```ignore,no_run
11037 /// # use google_cloud_build_v1::model::BuildOptions;
11038 /// let x = BuildOptions::new().set_enable_structured_logging(true);
11039 /// ```
11040 pub fn set_enable_structured_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11041 self.enable_structured_logging = v.into();
11042 self
11043 }
11044}
11045
11046impl wkt::message::Message for BuildOptions {
11047 fn typename() -> &'static str {
11048 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions"
11049 }
11050}
11051
11052/// Defines additional types related to [BuildOptions].
11053pub mod build_options {
11054 #[allow(unused_imports)]
11055 use super::*;
11056
11057 /// Details about how a build should be executed on a `WorkerPool`.
11058 ///
11059 /// See [running builds in a private
11060 /// pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool)
11061 /// for more information.
11062 #[derive(Clone, Default, PartialEq)]
11063 #[non_exhaustive]
11064 pub struct PoolOption {
11065 /// The `WorkerPool` resource to execute the build on.
11066 /// You must have `cloudbuild.workerpools.use` on the project hosting the
11067 /// WorkerPool.
11068 ///
11069 /// Format projects/{project}/locations/{location}/workerPools/{workerPoolId}
11070 pub name: std::string::String,
11071
11072 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11073 }
11074
11075 impl PoolOption {
11076 /// Creates a new default instance.
11077 pub fn new() -> Self {
11078 std::default::Default::default()
11079 }
11080
11081 /// Sets the value of [name][crate::model::build_options::PoolOption::name].
11082 ///
11083 /// # Example
11084 /// ```ignore,no_run
11085 /// # use google_cloud_build_v1::model::build_options::PoolOption;
11086 /// # let project_id = "project_id";
11087 /// # let location_id = "location_id";
11088 /// # let worker_pool_id = "worker_pool_id";
11089 /// let x = PoolOption::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
11090 /// ```
11091 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11092 self.name = v.into();
11093 self
11094 }
11095 }
11096
11097 impl wkt::message::Message for PoolOption {
11098 fn typename() -> &'static str {
11099 "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOptions.PoolOption"
11100 }
11101 }
11102
11103 /// Specifies the manner in which the build should be verified, if at all.
11104 ///
11105 /// If a verified build is requested, and any part of the process to generate
11106 /// and upload provenance fails, the build will also fail.
11107 ///
11108 /// If the build does not request verification then that process may occur, but
11109 /// is not guaranteed to. If it does occur and fails, the build will not fail.
11110 ///
11111 /// For more information, see [Viewing Build
11112 /// Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance).
11113 ///
11114 /// # Working with unknown values
11115 ///
11116 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11117 /// additional enum variants at any time. Adding new variants is not considered
11118 /// a breaking change. Applications should write their code in anticipation of:
11119 ///
11120 /// - New values appearing in future releases of the client library, **and**
11121 /// - New values received dynamically, without application changes.
11122 ///
11123 /// Please consult the [Working with enums] section in the user guide for some
11124 /// guidelines.
11125 ///
11126 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11127 #[derive(Clone, Debug, PartialEq)]
11128 #[non_exhaustive]
11129 pub enum VerifyOption {
11130 /// Not a verifiable build (the default).
11131 NotVerified,
11132 /// Build must be verified.
11133 Verified,
11134 /// If set, the enum was initialized with an unknown value.
11135 ///
11136 /// Applications can examine the value using [VerifyOption::value] or
11137 /// [VerifyOption::name].
11138 UnknownValue(verify_option::UnknownValue),
11139 }
11140
11141 #[doc(hidden)]
11142 pub mod verify_option {
11143 #[allow(unused_imports)]
11144 use super::*;
11145 #[derive(Clone, Debug, PartialEq)]
11146 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11147 }
11148
11149 impl VerifyOption {
11150 /// Gets the enum value.
11151 ///
11152 /// Returns `None` if the enum contains an unknown value deserialized from
11153 /// the string representation of enums.
11154 pub fn value(&self) -> std::option::Option<i32> {
11155 match self {
11156 Self::NotVerified => std::option::Option::Some(0),
11157 Self::Verified => std::option::Option::Some(1),
11158 Self::UnknownValue(u) => u.0.value(),
11159 }
11160 }
11161
11162 /// Gets the enum value as a string.
11163 ///
11164 /// Returns `None` if the enum contains an unknown value deserialized from
11165 /// the integer representation of enums.
11166 pub fn name(&self) -> std::option::Option<&str> {
11167 match self {
11168 Self::NotVerified => std::option::Option::Some("NOT_VERIFIED"),
11169 Self::Verified => std::option::Option::Some("VERIFIED"),
11170 Self::UnknownValue(u) => u.0.name(),
11171 }
11172 }
11173 }
11174
11175 impl std::default::Default for VerifyOption {
11176 fn default() -> Self {
11177 use std::convert::From;
11178 Self::from(0)
11179 }
11180 }
11181
11182 impl std::fmt::Display for VerifyOption {
11183 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11184 wkt::internal::display_enum(f, self.name(), self.value())
11185 }
11186 }
11187
11188 impl std::convert::From<i32> for VerifyOption {
11189 fn from(value: i32) -> Self {
11190 match value {
11191 0 => Self::NotVerified,
11192 1 => Self::Verified,
11193 _ => Self::UnknownValue(verify_option::UnknownValue(
11194 wkt::internal::UnknownEnumValue::Integer(value),
11195 )),
11196 }
11197 }
11198 }
11199
11200 impl std::convert::From<&str> for VerifyOption {
11201 fn from(value: &str) -> Self {
11202 use std::string::ToString;
11203 match value {
11204 "NOT_VERIFIED" => Self::NotVerified,
11205 "VERIFIED" => Self::Verified,
11206 _ => Self::UnknownValue(verify_option::UnknownValue(
11207 wkt::internal::UnknownEnumValue::String(value.to_string()),
11208 )),
11209 }
11210 }
11211 }
11212
11213 impl serde::ser::Serialize for VerifyOption {
11214 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11215 where
11216 S: serde::Serializer,
11217 {
11218 match self {
11219 Self::NotVerified => serializer.serialize_i32(0),
11220 Self::Verified => serializer.serialize_i32(1),
11221 Self::UnknownValue(u) => u.0.serialize(serializer),
11222 }
11223 }
11224 }
11225
11226 impl<'de> serde::de::Deserialize<'de> for VerifyOption {
11227 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11228 where
11229 D: serde::Deserializer<'de>,
11230 {
11231 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerifyOption>::new(
11232 ".google.devtools.cloudbuild.v1.BuildOptions.VerifyOption",
11233 ))
11234 }
11235 }
11236
11237 /// Supported Compute Engine machine types.
11238 /// For more information, see [Machine
11239 /// types](https://cloud.google.com/compute/docs/machine-types).
11240 ///
11241 /// # Working with unknown values
11242 ///
11243 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11244 /// additional enum variants at any time. Adding new variants is not considered
11245 /// a breaking change. Applications should write their code in anticipation of:
11246 ///
11247 /// - New values appearing in future releases of the client library, **and**
11248 /// - New values received dynamically, without application changes.
11249 ///
11250 /// Please consult the [Working with enums] section in the user guide for some
11251 /// guidelines.
11252 ///
11253 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11254 #[derive(Clone, Debug, PartialEq)]
11255 #[non_exhaustive]
11256 pub enum MachineType {
11257 /// Standard machine type.
11258 Unspecified,
11259 /// Highcpu machine with 8 CPUs.
11260 #[deprecated]
11261 N1Highcpu8,
11262 /// Highcpu machine with 32 CPUs.
11263 #[deprecated]
11264 N1Highcpu32,
11265 /// Highcpu e2 machine with 8 CPUs.
11266 E2Highcpu8,
11267 /// Highcpu e2 machine with 32 CPUs.
11268 E2Highcpu32,
11269 /// E2 machine with 1 CPU.
11270 E2Medium,
11271 /// E2 machine with 2 CPUs.
11272 E2Standard2,
11273 /// If set, the enum was initialized with an unknown value.
11274 ///
11275 /// Applications can examine the value using [MachineType::value] or
11276 /// [MachineType::name].
11277 UnknownValue(machine_type::UnknownValue),
11278 }
11279
11280 #[doc(hidden)]
11281 pub mod machine_type {
11282 #[allow(unused_imports)]
11283 use super::*;
11284 #[derive(Clone, Debug, PartialEq)]
11285 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11286 }
11287
11288 impl MachineType {
11289 /// Gets the enum value.
11290 ///
11291 /// Returns `None` if the enum contains an unknown value deserialized from
11292 /// the string representation of enums.
11293 pub fn value(&self) -> std::option::Option<i32> {
11294 match self {
11295 Self::Unspecified => std::option::Option::Some(0),
11296 Self::N1Highcpu8 => std::option::Option::Some(1),
11297 Self::N1Highcpu32 => std::option::Option::Some(2),
11298 Self::E2Highcpu8 => std::option::Option::Some(5),
11299 Self::E2Highcpu32 => std::option::Option::Some(6),
11300 Self::E2Medium => std::option::Option::Some(7),
11301 Self::E2Standard2 => std::option::Option::Some(11),
11302 Self::UnknownValue(u) => u.0.value(),
11303 }
11304 }
11305
11306 /// Gets the enum value as a string.
11307 ///
11308 /// Returns `None` if the enum contains an unknown value deserialized from
11309 /// the integer representation of enums.
11310 pub fn name(&self) -> std::option::Option<&str> {
11311 match self {
11312 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
11313 Self::N1Highcpu8 => std::option::Option::Some("N1_HIGHCPU_8"),
11314 Self::N1Highcpu32 => std::option::Option::Some("N1_HIGHCPU_32"),
11315 Self::E2Highcpu8 => std::option::Option::Some("E2_HIGHCPU_8"),
11316 Self::E2Highcpu32 => std::option::Option::Some("E2_HIGHCPU_32"),
11317 Self::E2Medium => std::option::Option::Some("E2_MEDIUM"),
11318 Self::E2Standard2 => std::option::Option::Some("E2_STANDARD_2"),
11319 Self::UnknownValue(u) => u.0.name(),
11320 }
11321 }
11322 }
11323
11324 impl std::default::Default for MachineType {
11325 fn default() -> Self {
11326 use std::convert::From;
11327 Self::from(0)
11328 }
11329 }
11330
11331 impl std::fmt::Display for MachineType {
11332 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11333 wkt::internal::display_enum(f, self.name(), self.value())
11334 }
11335 }
11336
11337 impl std::convert::From<i32> for MachineType {
11338 fn from(value: i32) -> Self {
11339 match value {
11340 0 => Self::Unspecified,
11341 1 => Self::N1Highcpu8,
11342 2 => Self::N1Highcpu32,
11343 5 => Self::E2Highcpu8,
11344 6 => Self::E2Highcpu32,
11345 7 => Self::E2Medium,
11346 11 => Self::E2Standard2,
11347 _ => Self::UnknownValue(machine_type::UnknownValue(
11348 wkt::internal::UnknownEnumValue::Integer(value),
11349 )),
11350 }
11351 }
11352 }
11353
11354 impl std::convert::From<&str> for MachineType {
11355 fn from(value: &str) -> Self {
11356 use std::string::ToString;
11357 match value {
11358 "UNSPECIFIED" => Self::Unspecified,
11359 "N1_HIGHCPU_8" => Self::N1Highcpu8,
11360 "N1_HIGHCPU_32" => Self::N1Highcpu32,
11361 "E2_HIGHCPU_8" => Self::E2Highcpu8,
11362 "E2_HIGHCPU_32" => Self::E2Highcpu32,
11363 "E2_MEDIUM" => Self::E2Medium,
11364 "E2_STANDARD_2" => Self::E2Standard2,
11365 _ => Self::UnknownValue(machine_type::UnknownValue(
11366 wkt::internal::UnknownEnumValue::String(value.to_string()),
11367 )),
11368 }
11369 }
11370 }
11371
11372 impl serde::ser::Serialize for MachineType {
11373 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11374 where
11375 S: serde::Serializer,
11376 {
11377 match self {
11378 Self::Unspecified => serializer.serialize_i32(0),
11379 Self::N1Highcpu8 => serializer.serialize_i32(1),
11380 Self::N1Highcpu32 => serializer.serialize_i32(2),
11381 Self::E2Highcpu8 => serializer.serialize_i32(5),
11382 Self::E2Highcpu32 => serializer.serialize_i32(6),
11383 Self::E2Medium => serializer.serialize_i32(7),
11384 Self::E2Standard2 => serializer.serialize_i32(11),
11385 Self::UnknownValue(u) => u.0.serialize(serializer),
11386 }
11387 }
11388 }
11389
11390 impl<'de> serde::de::Deserialize<'de> for MachineType {
11391 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11392 where
11393 D: serde::Deserializer<'de>,
11394 {
11395 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MachineType>::new(
11396 ".google.devtools.cloudbuild.v1.BuildOptions.MachineType",
11397 ))
11398 }
11399 }
11400
11401 /// Specifies the behavior when there is an error in the substitution checks.
11402 ///
11403 /// # Working with unknown values
11404 ///
11405 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11406 /// additional enum variants at any time. Adding new variants is not considered
11407 /// a breaking change. Applications should write their code in anticipation of:
11408 ///
11409 /// - New values appearing in future releases of the client library, **and**
11410 /// - New values received dynamically, without application changes.
11411 ///
11412 /// Please consult the [Working with enums] section in the user guide for some
11413 /// guidelines.
11414 ///
11415 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11416 #[derive(Clone, Debug, PartialEq)]
11417 #[non_exhaustive]
11418 pub enum SubstitutionOption {
11419 /// Fails the build if error in substitutions checks, like missing
11420 /// a substitution in the template or in the map.
11421 MustMatch,
11422 /// Do not fail the build if error in substitutions checks.
11423 AllowLoose,
11424 /// If set, the enum was initialized with an unknown value.
11425 ///
11426 /// Applications can examine the value using [SubstitutionOption::value] or
11427 /// [SubstitutionOption::name].
11428 UnknownValue(substitution_option::UnknownValue),
11429 }
11430
11431 #[doc(hidden)]
11432 pub mod substitution_option {
11433 #[allow(unused_imports)]
11434 use super::*;
11435 #[derive(Clone, Debug, PartialEq)]
11436 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11437 }
11438
11439 impl SubstitutionOption {
11440 /// Gets the enum value.
11441 ///
11442 /// Returns `None` if the enum contains an unknown value deserialized from
11443 /// the string representation of enums.
11444 pub fn value(&self) -> std::option::Option<i32> {
11445 match self {
11446 Self::MustMatch => std::option::Option::Some(0),
11447 Self::AllowLoose => std::option::Option::Some(1),
11448 Self::UnknownValue(u) => u.0.value(),
11449 }
11450 }
11451
11452 /// Gets the enum value as a string.
11453 ///
11454 /// Returns `None` if the enum contains an unknown value deserialized from
11455 /// the integer representation of enums.
11456 pub fn name(&self) -> std::option::Option<&str> {
11457 match self {
11458 Self::MustMatch => std::option::Option::Some("MUST_MATCH"),
11459 Self::AllowLoose => std::option::Option::Some("ALLOW_LOOSE"),
11460 Self::UnknownValue(u) => u.0.name(),
11461 }
11462 }
11463 }
11464
11465 impl std::default::Default for SubstitutionOption {
11466 fn default() -> Self {
11467 use std::convert::From;
11468 Self::from(0)
11469 }
11470 }
11471
11472 impl std::fmt::Display for SubstitutionOption {
11473 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11474 wkt::internal::display_enum(f, self.name(), self.value())
11475 }
11476 }
11477
11478 impl std::convert::From<i32> for SubstitutionOption {
11479 fn from(value: i32) -> Self {
11480 match value {
11481 0 => Self::MustMatch,
11482 1 => Self::AllowLoose,
11483 _ => Self::UnknownValue(substitution_option::UnknownValue(
11484 wkt::internal::UnknownEnumValue::Integer(value),
11485 )),
11486 }
11487 }
11488 }
11489
11490 impl std::convert::From<&str> for SubstitutionOption {
11491 fn from(value: &str) -> Self {
11492 use std::string::ToString;
11493 match value {
11494 "MUST_MATCH" => Self::MustMatch,
11495 "ALLOW_LOOSE" => Self::AllowLoose,
11496 _ => Self::UnknownValue(substitution_option::UnknownValue(
11497 wkt::internal::UnknownEnumValue::String(value.to_string()),
11498 )),
11499 }
11500 }
11501 }
11502
11503 impl serde::ser::Serialize for SubstitutionOption {
11504 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11505 where
11506 S: serde::Serializer,
11507 {
11508 match self {
11509 Self::MustMatch => serializer.serialize_i32(0),
11510 Self::AllowLoose => serializer.serialize_i32(1),
11511 Self::UnknownValue(u) => u.0.serialize(serializer),
11512 }
11513 }
11514 }
11515
11516 impl<'de> serde::de::Deserialize<'de> for SubstitutionOption {
11517 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11518 where
11519 D: serde::Deserializer<'de>,
11520 {
11521 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SubstitutionOption>::new(
11522 ".google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption",
11523 ))
11524 }
11525 }
11526
11527 /// Specifies the behavior when writing build logs to Cloud Storage.
11528 ///
11529 /// # Working with unknown values
11530 ///
11531 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11532 /// additional enum variants at any time. Adding new variants is not considered
11533 /// a breaking change. Applications should write their code in anticipation of:
11534 ///
11535 /// - New values appearing in future releases of the client library, **and**
11536 /// - New values received dynamically, without application changes.
11537 ///
11538 /// Please consult the [Working with enums] section in the user guide for some
11539 /// guidelines.
11540 ///
11541 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11542 #[derive(Clone, Debug, PartialEq)]
11543 #[non_exhaustive]
11544 pub enum LogStreamingOption {
11545 /// Service may automatically determine build log streaming behavior.
11546 StreamDefault,
11547 /// Build logs should be streamed to Cloud Storage.
11548 StreamOn,
11549 /// Build logs should not be streamed to Cloud Storage; they will be
11550 /// written when the build is completed.
11551 StreamOff,
11552 /// If set, the enum was initialized with an unknown value.
11553 ///
11554 /// Applications can examine the value using [LogStreamingOption::value] or
11555 /// [LogStreamingOption::name].
11556 UnknownValue(log_streaming_option::UnknownValue),
11557 }
11558
11559 #[doc(hidden)]
11560 pub mod log_streaming_option {
11561 #[allow(unused_imports)]
11562 use super::*;
11563 #[derive(Clone, Debug, PartialEq)]
11564 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11565 }
11566
11567 impl LogStreamingOption {
11568 /// Gets the enum value.
11569 ///
11570 /// Returns `None` if the enum contains an unknown value deserialized from
11571 /// the string representation of enums.
11572 pub fn value(&self) -> std::option::Option<i32> {
11573 match self {
11574 Self::StreamDefault => std::option::Option::Some(0),
11575 Self::StreamOn => std::option::Option::Some(1),
11576 Self::StreamOff => std::option::Option::Some(2),
11577 Self::UnknownValue(u) => u.0.value(),
11578 }
11579 }
11580
11581 /// Gets the enum value as a string.
11582 ///
11583 /// Returns `None` if the enum contains an unknown value deserialized from
11584 /// the integer representation of enums.
11585 pub fn name(&self) -> std::option::Option<&str> {
11586 match self {
11587 Self::StreamDefault => std::option::Option::Some("STREAM_DEFAULT"),
11588 Self::StreamOn => std::option::Option::Some("STREAM_ON"),
11589 Self::StreamOff => std::option::Option::Some("STREAM_OFF"),
11590 Self::UnknownValue(u) => u.0.name(),
11591 }
11592 }
11593 }
11594
11595 impl std::default::Default for LogStreamingOption {
11596 fn default() -> Self {
11597 use std::convert::From;
11598 Self::from(0)
11599 }
11600 }
11601
11602 impl std::fmt::Display for LogStreamingOption {
11603 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11604 wkt::internal::display_enum(f, self.name(), self.value())
11605 }
11606 }
11607
11608 impl std::convert::From<i32> for LogStreamingOption {
11609 fn from(value: i32) -> Self {
11610 match value {
11611 0 => Self::StreamDefault,
11612 1 => Self::StreamOn,
11613 2 => Self::StreamOff,
11614 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11615 wkt::internal::UnknownEnumValue::Integer(value),
11616 )),
11617 }
11618 }
11619 }
11620
11621 impl std::convert::From<&str> for LogStreamingOption {
11622 fn from(value: &str) -> Self {
11623 use std::string::ToString;
11624 match value {
11625 "STREAM_DEFAULT" => Self::StreamDefault,
11626 "STREAM_ON" => Self::StreamOn,
11627 "STREAM_OFF" => Self::StreamOff,
11628 _ => Self::UnknownValue(log_streaming_option::UnknownValue(
11629 wkt::internal::UnknownEnumValue::String(value.to_string()),
11630 )),
11631 }
11632 }
11633 }
11634
11635 impl serde::ser::Serialize for LogStreamingOption {
11636 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11637 where
11638 S: serde::Serializer,
11639 {
11640 match self {
11641 Self::StreamDefault => serializer.serialize_i32(0),
11642 Self::StreamOn => serializer.serialize_i32(1),
11643 Self::StreamOff => serializer.serialize_i32(2),
11644 Self::UnknownValue(u) => u.0.serialize(serializer),
11645 }
11646 }
11647 }
11648
11649 impl<'de> serde::de::Deserialize<'de> for LogStreamingOption {
11650 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11651 where
11652 D: serde::Deserializer<'de>,
11653 {
11654 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogStreamingOption>::new(
11655 ".google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption",
11656 ))
11657 }
11658 }
11659
11660 /// Specifies the logging mode.
11661 ///
11662 /// # Working with unknown values
11663 ///
11664 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11665 /// additional enum variants at any time. Adding new variants is not considered
11666 /// a breaking change. Applications should write their code in anticipation of:
11667 ///
11668 /// - New values appearing in future releases of the client library, **and**
11669 /// - New values received dynamically, without application changes.
11670 ///
11671 /// Please consult the [Working with enums] section in the user guide for some
11672 /// guidelines.
11673 ///
11674 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11675 #[derive(Clone, Debug, PartialEq)]
11676 #[non_exhaustive]
11677 pub enum LoggingMode {
11678 /// The service determines the logging mode. The default is `LEGACY`. Do not
11679 /// rely on the default logging behavior as it may change in the future.
11680 LoggingUnspecified,
11681 /// Build logs are stored in Cloud Logging and Cloud Storage.
11682 Legacy,
11683 /// Build logs are stored in Cloud Storage.
11684 GcsOnly,
11685 /// This option is the same as CLOUD_LOGGING_ONLY.
11686 #[deprecated]
11687 StackdriverOnly,
11688 /// Build logs are stored in Cloud Logging. Selecting this option will not
11689 /// allow [logs
11690 /// streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log).
11691 CloudLoggingOnly,
11692 /// Turn off all logging. No build logs will be captured.
11693 None,
11694 /// If set, the enum was initialized with an unknown value.
11695 ///
11696 /// Applications can examine the value using [LoggingMode::value] or
11697 /// [LoggingMode::name].
11698 UnknownValue(logging_mode::UnknownValue),
11699 }
11700
11701 #[doc(hidden)]
11702 pub mod logging_mode {
11703 #[allow(unused_imports)]
11704 use super::*;
11705 #[derive(Clone, Debug, PartialEq)]
11706 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11707 }
11708
11709 impl LoggingMode {
11710 /// Gets the enum value.
11711 ///
11712 /// Returns `None` if the enum contains an unknown value deserialized from
11713 /// the string representation of enums.
11714 pub fn value(&self) -> std::option::Option<i32> {
11715 match self {
11716 Self::LoggingUnspecified => std::option::Option::Some(0),
11717 Self::Legacy => std::option::Option::Some(1),
11718 Self::GcsOnly => std::option::Option::Some(2),
11719 Self::StackdriverOnly => std::option::Option::Some(3),
11720 Self::CloudLoggingOnly => std::option::Option::Some(5),
11721 Self::None => std::option::Option::Some(4),
11722 Self::UnknownValue(u) => u.0.value(),
11723 }
11724 }
11725
11726 /// Gets the enum value as a string.
11727 ///
11728 /// Returns `None` if the enum contains an unknown value deserialized from
11729 /// the integer representation of enums.
11730 pub fn name(&self) -> std::option::Option<&str> {
11731 match self {
11732 Self::LoggingUnspecified => std::option::Option::Some("LOGGING_UNSPECIFIED"),
11733 Self::Legacy => std::option::Option::Some("LEGACY"),
11734 Self::GcsOnly => std::option::Option::Some("GCS_ONLY"),
11735 Self::StackdriverOnly => std::option::Option::Some("STACKDRIVER_ONLY"),
11736 Self::CloudLoggingOnly => std::option::Option::Some("CLOUD_LOGGING_ONLY"),
11737 Self::None => std::option::Option::Some("NONE"),
11738 Self::UnknownValue(u) => u.0.name(),
11739 }
11740 }
11741 }
11742
11743 impl std::default::Default for LoggingMode {
11744 fn default() -> Self {
11745 use std::convert::From;
11746 Self::from(0)
11747 }
11748 }
11749
11750 impl std::fmt::Display for LoggingMode {
11751 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11752 wkt::internal::display_enum(f, self.name(), self.value())
11753 }
11754 }
11755
11756 impl std::convert::From<i32> for LoggingMode {
11757 fn from(value: i32) -> Self {
11758 match value {
11759 0 => Self::LoggingUnspecified,
11760 1 => Self::Legacy,
11761 2 => Self::GcsOnly,
11762 3 => Self::StackdriverOnly,
11763 4 => Self::None,
11764 5 => Self::CloudLoggingOnly,
11765 _ => Self::UnknownValue(logging_mode::UnknownValue(
11766 wkt::internal::UnknownEnumValue::Integer(value),
11767 )),
11768 }
11769 }
11770 }
11771
11772 impl std::convert::From<&str> for LoggingMode {
11773 fn from(value: &str) -> Self {
11774 use std::string::ToString;
11775 match value {
11776 "LOGGING_UNSPECIFIED" => Self::LoggingUnspecified,
11777 "LEGACY" => Self::Legacy,
11778 "GCS_ONLY" => Self::GcsOnly,
11779 "STACKDRIVER_ONLY" => Self::StackdriverOnly,
11780 "CLOUD_LOGGING_ONLY" => Self::CloudLoggingOnly,
11781 "NONE" => Self::None,
11782 _ => Self::UnknownValue(logging_mode::UnknownValue(
11783 wkt::internal::UnknownEnumValue::String(value.to_string()),
11784 )),
11785 }
11786 }
11787 }
11788
11789 impl serde::ser::Serialize for LoggingMode {
11790 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11791 where
11792 S: serde::Serializer,
11793 {
11794 match self {
11795 Self::LoggingUnspecified => serializer.serialize_i32(0),
11796 Self::Legacy => serializer.serialize_i32(1),
11797 Self::GcsOnly => serializer.serialize_i32(2),
11798 Self::StackdriverOnly => serializer.serialize_i32(3),
11799 Self::CloudLoggingOnly => serializer.serialize_i32(5),
11800 Self::None => serializer.serialize_i32(4),
11801 Self::UnknownValue(u) => u.0.serialize(serializer),
11802 }
11803 }
11804 }
11805
11806 impl<'de> serde::de::Deserialize<'de> for LoggingMode {
11807 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11808 where
11809 D: serde::Deserializer<'de>,
11810 {
11811 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggingMode>::new(
11812 ".google.devtools.cloudbuild.v1.BuildOptions.LoggingMode",
11813 ))
11814 }
11815 }
11816
11817 /// Default Cloud Storage log bucket behavior options.
11818 ///
11819 /// # Working with unknown values
11820 ///
11821 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11822 /// additional enum variants at any time. Adding new variants is not considered
11823 /// a breaking change. Applications should write their code in anticipation of:
11824 ///
11825 /// - New values appearing in future releases of the client library, **and**
11826 /// - New values received dynamically, without application changes.
11827 ///
11828 /// Please consult the [Working with enums] section in the user guide for some
11829 /// guidelines.
11830 ///
11831 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11832 #[derive(Clone, Debug, PartialEq)]
11833 #[non_exhaustive]
11834 pub enum DefaultLogsBucketBehavior {
11835 /// Unspecified.
11836 Unspecified,
11837 /// Bucket is located in user-owned project in the same region as the
11838 /// build. The builder service account must have access to create and write
11839 /// to Cloud Storage buckets in the build project.
11840 RegionalUserOwnedBucket,
11841 /// Bucket is located in a Google-owned project and is not regionalized.
11842 LegacyBucket,
11843 /// If set, the enum was initialized with an unknown value.
11844 ///
11845 /// Applications can examine the value using [DefaultLogsBucketBehavior::value] or
11846 /// [DefaultLogsBucketBehavior::name].
11847 UnknownValue(default_logs_bucket_behavior::UnknownValue),
11848 }
11849
11850 #[doc(hidden)]
11851 pub mod default_logs_bucket_behavior {
11852 #[allow(unused_imports)]
11853 use super::*;
11854 #[derive(Clone, Debug, PartialEq)]
11855 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11856 }
11857
11858 impl DefaultLogsBucketBehavior {
11859 /// Gets the enum value.
11860 ///
11861 /// Returns `None` if the enum contains an unknown value deserialized from
11862 /// the string representation of enums.
11863 pub fn value(&self) -> std::option::Option<i32> {
11864 match self {
11865 Self::Unspecified => std::option::Option::Some(0),
11866 Self::RegionalUserOwnedBucket => std::option::Option::Some(1),
11867 Self::LegacyBucket => std::option::Option::Some(2),
11868 Self::UnknownValue(u) => u.0.value(),
11869 }
11870 }
11871
11872 /// Gets the enum value as a string.
11873 ///
11874 /// Returns `None` if the enum contains an unknown value deserialized from
11875 /// the integer representation of enums.
11876 pub fn name(&self) -> std::option::Option<&str> {
11877 match self {
11878 Self::Unspecified => {
11879 std::option::Option::Some("DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED")
11880 }
11881 Self::RegionalUserOwnedBucket => {
11882 std::option::Option::Some("REGIONAL_USER_OWNED_BUCKET")
11883 }
11884 Self::LegacyBucket => std::option::Option::Some("LEGACY_BUCKET"),
11885 Self::UnknownValue(u) => u.0.name(),
11886 }
11887 }
11888 }
11889
11890 impl std::default::Default for DefaultLogsBucketBehavior {
11891 fn default() -> Self {
11892 use std::convert::From;
11893 Self::from(0)
11894 }
11895 }
11896
11897 impl std::fmt::Display for DefaultLogsBucketBehavior {
11898 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11899 wkt::internal::display_enum(f, self.name(), self.value())
11900 }
11901 }
11902
11903 impl std::convert::From<i32> for DefaultLogsBucketBehavior {
11904 fn from(value: i32) -> Self {
11905 match value {
11906 0 => Self::Unspecified,
11907 1 => Self::RegionalUserOwnedBucket,
11908 2 => Self::LegacyBucket,
11909 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11910 wkt::internal::UnknownEnumValue::Integer(value),
11911 )),
11912 }
11913 }
11914 }
11915
11916 impl std::convert::From<&str> for DefaultLogsBucketBehavior {
11917 fn from(value: &str) -> Self {
11918 use std::string::ToString;
11919 match value {
11920 "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
11921 "REGIONAL_USER_OWNED_BUCKET" => Self::RegionalUserOwnedBucket,
11922 "LEGACY_BUCKET" => Self::LegacyBucket,
11923 _ => Self::UnknownValue(default_logs_bucket_behavior::UnknownValue(
11924 wkt::internal::UnknownEnumValue::String(value.to_string()),
11925 )),
11926 }
11927 }
11928 }
11929
11930 impl serde::ser::Serialize for DefaultLogsBucketBehavior {
11931 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11932 where
11933 S: serde::Serializer,
11934 {
11935 match self {
11936 Self::Unspecified => serializer.serialize_i32(0),
11937 Self::RegionalUserOwnedBucket => serializer.serialize_i32(1),
11938 Self::LegacyBucket => serializer.serialize_i32(2),
11939 Self::UnknownValue(u) => u.0.serialize(serializer),
11940 }
11941 }
11942 }
11943
11944 impl<'de> serde::de::Deserialize<'de> for DefaultLogsBucketBehavior {
11945 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11946 where
11947 D: serde::Deserializer<'de>,
11948 {
11949 deserializer.deserialize_any(
11950 wkt::internal::EnumVisitor::<DefaultLogsBucketBehavior>::new(
11951 ".google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior",
11952 ),
11953 )
11954 }
11955 }
11956}
11957
11958/// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by
11959/// the ReceiveTriggerWebhook method.
11960#[derive(Clone, Default, PartialEq)]
11961#[non_exhaustive]
11962pub struct ReceiveTriggerWebhookRequest {
11963 /// The name of the `ReceiveTriggerWebhook` to retrieve.
11964 /// Format: `projects/{project}/locations/{location}/triggers/{trigger}`
11965 pub name: std::string::String,
11966
11967 /// HTTP request body.
11968 pub body: std::option::Option<google_cloud_api::model::HttpBody>,
11969
11970 /// Project in which the specified trigger lives
11971 pub project_id: std::string::String,
11972
11973 /// Name of the trigger to run the payload against
11974 pub trigger: std::string::String,
11975
11976 /// Secret token used for authorization if an OAuth token isn't provided.
11977 pub secret: std::string::String,
11978
11979 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11980}
11981
11982impl ReceiveTriggerWebhookRequest {
11983 /// Creates a new default instance.
11984 pub fn new() -> Self {
11985 std::default::Default::default()
11986 }
11987
11988 /// Sets the value of [name][crate::model::ReceiveTriggerWebhookRequest::name].
11989 ///
11990 /// # Example
11991 /// ```ignore,no_run
11992 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
11993 /// let x = ReceiveTriggerWebhookRequest::new().set_name("example");
11994 /// ```
11995 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11996 self.name = v.into();
11997 self
11998 }
11999
12000 /// Sets the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
12001 ///
12002 /// # Example
12003 /// ```ignore,no_run
12004 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12005 /// use google_cloud_api::model::HttpBody;
12006 /// let x = ReceiveTriggerWebhookRequest::new().set_body(HttpBody::default()/* use setters */);
12007 /// ```
12008 pub fn set_body<T>(mut self, v: T) -> Self
12009 where
12010 T: std::convert::Into<google_cloud_api::model::HttpBody>,
12011 {
12012 self.body = std::option::Option::Some(v.into());
12013 self
12014 }
12015
12016 /// Sets or clears the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
12017 ///
12018 /// # Example
12019 /// ```ignore,no_run
12020 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12021 /// use google_cloud_api::model::HttpBody;
12022 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(Some(HttpBody::default()/* use setters */));
12023 /// let x = ReceiveTriggerWebhookRequest::new().set_or_clear_body(None::<HttpBody>);
12024 /// ```
12025 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
12026 where
12027 T: std::convert::Into<google_cloud_api::model::HttpBody>,
12028 {
12029 self.body = v.map(|x| x.into());
12030 self
12031 }
12032
12033 /// Sets the value of [project_id][crate::model::ReceiveTriggerWebhookRequest::project_id].
12034 ///
12035 /// # Example
12036 /// ```ignore,no_run
12037 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12038 /// let x = ReceiveTriggerWebhookRequest::new().set_project_id("example");
12039 /// ```
12040 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12041 self.project_id = v.into();
12042 self
12043 }
12044
12045 /// Sets the value of [trigger][crate::model::ReceiveTriggerWebhookRequest::trigger].
12046 ///
12047 /// # Example
12048 /// ```ignore,no_run
12049 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12050 /// let x = ReceiveTriggerWebhookRequest::new().set_trigger("example");
12051 /// ```
12052 pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12053 self.trigger = v.into();
12054 self
12055 }
12056
12057 /// Sets the value of [secret][crate::model::ReceiveTriggerWebhookRequest::secret].
12058 ///
12059 /// # Example
12060 /// ```ignore,no_run
12061 /// # use google_cloud_build_v1::model::ReceiveTriggerWebhookRequest;
12062 /// let x = ReceiveTriggerWebhookRequest::new().set_secret("example");
12063 /// ```
12064 pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12065 self.secret = v.into();
12066 self
12067 }
12068}
12069
12070impl wkt::message::Message for ReceiveTriggerWebhookRequest {
12071 fn typename() -> &'static str {
12072 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest"
12073 }
12074}
12075
12076/// ReceiveTriggerWebhookResponse [Experimental] is the response object for the
12077/// ReceiveTriggerWebhook method.
12078#[derive(Clone, Default, PartialEq)]
12079#[non_exhaustive]
12080pub struct ReceiveTriggerWebhookResponse {
12081 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12082}
12083
12084impl ReceiveTriggerWebhookResponse {
12085 /// Creates a new default instance.
12086 pub fn new() -> Self {
12087 std::default::Default::default()
12088 }
12089}
12090
12091impl wkt::message::Message for ReceiveTriggerWebhookResponse {
12092 fn typename() -> &'static str {
12093 "type.googleapis.com/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse"
12094 }
12095}
12096
12097/// GitHubEnterpriseConfig represents a configuration for a GitHub Enterprise
12098/// server.
12099#[derive(Clone, Default, PartialEq)]
12100#[non_exhaustive]
12101pub struct GitHubEnterpriseConfig {
12102 /// The full resource name for the GitHubEnterpriseConfig
12103 /// For example:
12104 /// "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}"
12105 pub name: std::string::String,
12106
12107 /// The URL of the github enterprise host the configuration is for.
12108 pub host_url: std::string::String,
12109
12110 /// Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise
12111 /// server.
12112 pub app_id: i64,
12113
12114 /// Output only. Time when the installation was associated with the project.
12115 pub create_time: std::option::Option<wkt::Timestamp>,
12116
12117 /// The key that should be attached to webhook calls to the ReceiveWebhook
12118 /// endpoint.
12119 pub webhook_key: std::string::String,
12120
12121 /// Optional. The network to be used when reaching out to the GitHub
12122 /// Enterprise server. The VPC network must be enabled for private
12123 /// service connection. This should be set if the GitHub Enterprise server is
12124 /// hosted on-premises and not reachable by public internet.
12125 /// If this field is left empty, no network peering will occur and calls to
12126 /// the GitHub Enterprise server will be made over the public internet.
12127 /// Must be in the format
12128 /// `projects/{project}/global/networks/{network}`, where {project}
12129 /// is a project number or id and {network} is the name of a
12130 /// VPC network in the project.
12131 pub peered_network: std::string::String,
12132
12133 /// Optional. Names of secrets in Secret Manager.
12134 pub secrets: std::option::Option<crate::model::GitHubEnterpriseSecrets>,
12135
12136 /// Optional. Name to display for this config.
12137 pub display_name: std::string::String,
12138
12139 /// Optional. SSL certificate to use for requests to GitHub Enterprise.
12140 pub ssl_ca: std::string::String,
12141
12142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12143}
12144
12145impl GitHubEnterpriseConfig {
12146 /// Creates a new default instance.
12147 pub fn new() -> Self {
12148 std::default::Default::default()
12149 }
12150
12151 /// Sets the value of [name][crate::model::GitHubEnterpriseConfig::name].
12152 ///
12153 /// # Example
12154 /// ```ignore,no_run
12155 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12156 /// # let project_id = "project_id";
12157 /// # let config_id = "config_id";
12158 /// let x = GitHubEnterpriseConfig::new().set_name(format!("projects/{project_id}/githubEnterpriseConfigs/{config_id}"));
12159 /// ```
12160 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12161 self.name = v.into();
12162 self
12163 }
12164
12165 /// Sets the value of [host_url][crate::model::GitHubEnterpriseConfig::host_url].
12166 ///
12167 /// # Example
12168 /// ```ignore,no_run
12169 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12170 /// let x = GitHubEnterpriseConfig::new().set_host_url("example");
12171 /// ```
12172 pub fn set_host_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12173 self.host_url = v.into();
12174 self
12175 }
12176
12177 /// Sets the value of [app_id][crate::model::GitHubEnterpriseConfig::app_id].
12178 ///
12179 /// # Example
12180 /// ```ignore,no_run
12181 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12182 /// let x = GitHubEnterpriseConfig::new().set_app_id(42);
12183 /// ```
12184 pub fn set_app_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12185 self.app_id = v.into();
12186 self
12187 }
12188
12189 /// Sets the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12190 ///
12191 /// # Example
12192 /// ```ignore,no_run
12193 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12194 /// use wkt::Timestamp;
12195 /// let x = GitHubEnterpriseConfig::new().set_create_time(Timestamp::default()/* use setters */);
12196 /// ```
12197 pub fn set_create_time<T>(mut self, v: T) -> Self
12198 where
12199 T: std::convert::Into<wkt::Timestamp>,
12200 {
12201 self.create_time = std::option::Option::Some(v.into());
12202 self
12203 }
12204
12205 /// Sets or clears the value of [create_time][crate::model::GitHubEnterpriseConfig::create_time].
12206 ///
12207 /// # Example
12208 /// ```ignore,no_run
12209 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12210 /// use wkt::Timestamp;
12211 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12212 /// let x = GitHubEnterpriseConfig::new().set_or_clear_create_time(None::<Timestamp>);
12213 /// ```
12214 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12215 where
12216 T: std::convert::Into<wkt::Timestamp>,
12217 {
12218 self.create_time = v.map(|x| x.into());
12219 self
12220 }
12221
12222 /// Sets the value of [webhook_key][crate::model::GitHubEnterpriseConfig::webhook_key].
12223 ///
12224 /// # Example
12225 /// ```ignore,no_run
12226 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12227 /// let x = GitHubEnterpriseConfig::new().set_webhook_key("example");
12228 /// ```
12229 pub fn set_webhook_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12230 self.webhook_key = v.into();
12231 self
12232 }
12233
12234 /// Sets the value of [peered_network][crate::model::GitHubEnterpriseConfig::peered_network].
12235 ///
12236 /// # Example
12237 /// ```ignore,no_run
12238 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12239 /// let x = GitHubEnterpriseConfig::new().set_peered_network("example");
12240 /// ```
12241 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12242 self.peered_network = v.into();
12243 self
12244 }
12245
12246 /// Sets the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12247 ///
12248 /// # Example
12249 /// ```ignore,no_run
12250 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12251 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12252 /// let x = GitHubEnterpriseConfig::new().set_secrets(GitHubEnterpriseSecrets::default()/* use setters */);
12253 /// ```
12254 pub fn set_secrets<T>(mut self, v: T) -> Self
12255 where
12256 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12257 {
12258 self.secrets = std::option::Option::Some(v.into());
12259 self
12260 }
12261
12262 /// Sets or clears the value of [secrets][crate::model::GitHubEnterpriseConfig::secrets].
12263 ///
12264 /// # Example
12265 /// ```ignore,no_run
12266 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12267 /// use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12268 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(Some(GitHubEnterpriseSecrets::default()/* use setters */));
12269 /// let x = GitHubEnterpriseConfig::new().set_or_clear_secrets(None::<GitHubEnterpriseSecrets>);
12270 /// ```
12271 pub fn set_or_clear_secrets<T>(mut self, v: std::option::Option<T>) -> Self
12272 where
12273 T: std::convert::Into<crate::model::GitHubEnterpriseSecrets>,
12274 {
12275 self.secrets = v.map(|x| x.into());
12276 self
12277 }
12278
12279 /// Sets the value of [display_name][crate::model::GitHubEnterpriseConfig::display_name].
12280 ///
12281 /// # Example
12282 /// ```ignore,no_run
12283 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12284 /// let x = GitHubEnterpriseConfig::new().set_display_name("example");
12285 /// ```
12286 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12287 self.display_name = v.into();
12288 self
12289 }
12290
12291 /// Sets the value of [ssl_ca][crate::model::GitHubEnterpriseConfig::ssl_ca].
12292 ///
12293 /// # Example
12294 /// ```ignore,no_run
12295 /// # use google_cloud_build_v1::model::GitHubEnterpriseConfig;
12296 /// let x = GitHubEnterpriseConfig::new().set_ssl_ca("example");
12297 /// ```
12298 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12299 self.ssl_ca = v.into();
12300 self
12301 }
12302}
12303
12304impl wkt::message::Message for GitHubEnterpriseConfig {
12305 fn typename() -> &'static str {
12306 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseConfig"
12307 }
12308}
12309
12310/// GitHubEnterpriseSecrets represents the names of all necessary secrets in
12311/// Secret Manager for a GitHub Enterprise server.
12312/// Format is: projects/\<project number\>/secrets/\<secret name\>.
12313#[derive(Clone, Default, PartialEq)]
12314#[non_exhaustive]
12315pub struct GitHubEnterpriseSecrets {
12316 /// The resource name for the private key secret version.
12317 pub private_key_version_name: std::string::String,
12318
12319 /// The resource name for the webhook secret secret version in Secret Manager.
12320 pub webhook_secret_version_name: std::string::String,
12321
12322 /// The resource name for the OAuth secret secret version in Secret Manager.
12323 pub oauth_secret_version_name: std::string::String,
12324
12325 /// The resource name for the OAuth client ID secret version in Secret Manager.
12326 pub oauth_client_id_version_name: std::string::String,
12327
12328 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12329}
12330
12331impl GitHubEnterpriseSecrets {
12332 /// Creates a new default instance.
12333 pub fn new() -> Self {
12334 std::default::Default::default()
12335 }
12336
12337 /// Sets the value of [private_key_version_name][crate::model::GitHubEnterpriseSecrets::private_key_version_name].
12338 ///
12339 /// # Example
12340 /// ```ignore,no_run
12341 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12342 /// let x = GitHubEnterpriseSecrets::new().set_private_key_version_name("example");
12343 /// ```
12344 pub fn set_private_key_version_name<T: std::convert::Into<std::string::String>>(
12345 mut self,
12346 v: T,
12347 ) -> Self {
12348 self.private_key_version_name = v.into();
12349 self
12350 }
12351
12352 /// Sets the value of [webhook_secret_version_name][crate::model::GitHubEnterpriseSecrets::webhook_secret_version_name].
12353 ///
12354 /// # Example
12355 /// ```ignore,no_run
12356 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12357 /// let x = GitHubEnterpriseSecrets::new().set_webhook_secret_version_name("example");
12358 /// ```
12359 pub fn set_webhook_secret_version_name<T: std::convert::Into<std::string::String>>(
12360 mut self,
12361 v: T,
12362 ) -> Self {
12363 self.webhook_secret_version_name = v.into();
12364 self
12365 }
12366
12367 /// Sets the value of [oauth_secret_version_name][crate::model::GitHubEnterpriseSecrets::oauth_secret_version_name].
12368 ///
12369 /// # Example
12370 /// ```ignore,no_run
12371 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12372 /// let x = GitHubEnterpriseSecrets::new().set_oauth_secret_version_name("example");
12373 /// ```
12374 pub fn set_oauth_secret_version_name<T: std::convert::Into<std::string::String>>(
12375 mut self,
12376 v: T,
12377 ) -> Self {
12378 self.oauth_secret_version_name = v.into();
12379 self
12380 }
12381
12382 /// Sets the value of [oauth_client_id_version_name][crate::model::GitHubEnterpriseSecrets::oauth_client_id_version_name].
12383 ///
12384 /// # Example
12385 /// ```ignore,no_run
12386 /// # use google_cloud_build_v1::model::GitHubEnterpriseSecrets;
12387 /// let x = GitHubEnterpriseSecrets::new().set_oauth_client_id_version_name("example");
12388 /// ```
12389 pub fn set_oauth_client_id_version_name<T: std::convert::Into<std::string::String>>(
12390 mut self,
12391 v: T,
12392 ) -> Self {
12393 self.oauth_client_id_version_name = v.into();
12394 self
12395 }
12396}
12397
12398impl wkt::message::Message for GitHubEnterpriseSecrets {
12399 fn typename() -> &'static str {
12400 "type.googleapis.com/google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets"
12401 }
12402}
12403
12404/// Configuration for a `WorkerPool`.
12405///
12406/// Cloud Build owns and maintains a pool of workers for general use and have no
12407/// access to a project's private network. By default, builds submitted to
12408/// Cloud Build will use a worker from this pool.
12409///
12410/// If your build needs access to resources on a private network,
12411/// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give
12412/// your builds access to any single VPC network that you
12413/// administer, including any on-prem resources connected to that VPC
12414/// network. For an overview of private pools, see
12415/// [Private pools
12416/// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview).
12417#[derive(Clone, Default, PartialEq)]
12418#[non_exhaustive]
12419pub struct WorkerPool {
12420 /// Output only. The resource name of the `WorkerPool`, with format
12421 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
12422 /// The value of `{worker_pool}` is provided by `worker_pool_id` in
12423 /// `CreateWorkerPool` request and the value of `{location}` is determined by
12424 /// the endpoint accessed.
12425 pub name: std::string::String,
12426
12427 /// A user-specified, human-readable name for the `WorkerPool`. If provided,
12428 /// this value must be 1-63 characters.
12429 pub display_name: std::string::String,
12430
12431 /// Output only. A unique identifier for the `WorkerPool`.
12432 pub uid: std::string::String,
12433
12434 /// User specified annotations. See <https://google.aip.dev/128#annotations>
12435 /// for more details such as format and size limitations.
12436 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
12437
12438 /// Output only. Time at which the request to create the `WorkerPool` was
12439 /// received.
12440 pub create_time: std::option::Option<wkt::Timestamp>,
12441
12442 /// Output only. Time at which the request to update the `WorkerPool` was
12443 /// received.
12444 pub update_time: std::option::Option<wkt::Timestamp>,
12445
12446 /// Output only. Time at which the request to delete the `WorkerPool` was
12447 /// received.
12448 pub delete_time: std::option::Option<wkt::Timestamp>,
12449
12450 /// Output only. `WorkerPool` state.
12451 pub state: crate::model::worker_pool::State,
12452
12453 /// Output only. Checksum computed by the server. May be sent on update and
12454 /// delete requests to ensure that the client has an up-to-date value before
12455 /// proceeding.
12456 pub etag: std::string::String,
12457
12458 /// Configuration for the `WorkerPool`.
12459 pub config: std::option::Option<crate::model::worker_pool::Config>,
12460
12461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12462}
12463
12464impl WorkerPool {
12465 /// Creates a new default instance.
12466 pub fn new() -> Self {
12467 std::default::Default::default()
12468 }
12469
12470 /// Sets the value of [name][crate::model::WorkerPool::name].
12471 ///
12472 /// # Example
12473 /// ```ignore,no_run
12474 /// # use google_cloud_build_v1::model::WorkerPool;
12475 /// # let project_id = "project_id";
12476 /// # let location_id = "location_id";
12477 /// # let worker_pool_id = "worker_pool_id";
12478 /// let x = WorkerPool::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
12479 /// ```
12480 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12481 self.name = v.into();
12482 self
12483 }
12484
12485 /// Sets the value of [display_name][crate::model::WorkerPool::display_name].
12486 ///
12487 /// # Example
12488 /// ```ignore,no_run
12489 /// # use google_cloud_build_v1::model::WorkerPool;
12490 /// let x = WorkerPool::new().set_display_name("example");
12491 /// ```
12492 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12493 self.display_name = v.into();
12494 self
12495 }
12496
12497 /// Sets the value of [uid][crate::model::WorkerPool::uid].
12498 ///
12499 /// # Example
12500 /// ```ignore,no_run
12501 /// # use google_cloud_build_v1::model::WorkerPool;
12502 /// let x = WorkerPool::new().set_uid("example");
12503 /// ```
12504 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12505 self.uid = v.into();
12506 self
12507 }
12508
12509 /// Sets the value of [annotations][crate::model::WorkerPool::annotations].
12510 ///
12511 /// # Example
12512 /// ```ignore,no_run
12513 /// # use google_cloud_build_v1::model::WorkerPool;
12514 /// let x = WorkerPool::new().set_annotations([
12515 /// ("key0", "abc"),
12516 /// ("key1", "xyz"),
12517 /// ]);
12518 /// ```
12519 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
12520 where
12521 T: std::iter::IntoIterator<Item = (K, V)>,
12522 K: std::convert::Into<std::string::String>,
12523 V: std::convert::Into<std::string::String>,
12524 {
12525 use std::iter::Iterator;
12526 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12527 self
12528 }
12529
12530 /// Sets the value of [create_time][crate::model::WorkerPool::create_time].
12531 ///
12532 /// # Example
12533 /// ```ignore,no_run
12534 /// # use google_cloud_build_v1::model::WorkerPool;
12535 /// use wkt::Timestamp;
12536 /// let x = WorkerPool::new().set_create_time(Timestamp::default()/* use setters */);
12537 /// ```
12538 pub fn set_create_time<T>(mut self, v: T) -> Self
12539 where
12540 T: std::convert::Into<wkt::Timestamp>,
12541 {
12542 self.create_time = std::option::Option::Some(v.into());
12543 self
12544 }
12545
12546 /// Sets or clears the value of [create_time][crate::model::WorkerPool::create_time].
12547 ///
12548 /// # Example
12549 /// ```ignore,no_run
12550 /// # use google_cloud_build_v1::model::WorkerPool;
12551 /// use wkt::Timestamp;
12552 /// let x = WorkerPool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12553 /// let x = WorkerPool::new().set_or_clear_create_time(None::<Timestamp>);
12554 /// ```
12555 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12556 where
12557 T: std::convert::Into<wkt::Timestamp>,
12558 {
12559 self.create_time = v.map(|x| x.into());
12560 self
12561 }
12562
12563 /// Sets the value of [update_time][crate::model::WorkerPool::update_time].
12564 ///
12565 /// # Example
12566 /// ```ignore,no_run
12567 /// # use google_cloud_build_v1::model::WorkerPool;
12568 /// use wkt::Timestamp;
12569 /// let x = WorkerPool::new().set_update_time(Timestamp::default()/* use setters */);
12570 /// ```
12571 pub fn set_update_time<T>(mut self, v: T) -> Self
12572 where
12573 T: std::convert::Into<wkt::Timestamp>,
12574 {
12575 self.update_time = std::option::Option::Some(v.into());
12576 self
12577 }
12578
12579 /// Sets or clears the value of [update_time][crate::model::WorkerPool::update_time].
12580 ///
12581 /// # Example
12582 /// ```ignore,no_run
12583 /// # use google_cloud_build_v1::model::WorkerPool;
12584 /// use wkt::Timestamp;
12585 /// let x = WorkerPool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12586 /// let x = WorkerPool::new().set_or_clear_update_time(None::<Timestamp>);
12587 /// ```
12588 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12589 where
12590 T: std::convert::Into<wkt::Timestamp>,
12591 {
12592 self.update_time = v.map(|x| x.into());
12593 self
12594 }
12595
12596 /// Sets the value of [delete_time][crate::model::WorkerPool::delete_time].
12597 ///
12598 /// # Example
12599 /// ```ignore,no_run
12600 /// # use google_cloud_build_v1::model::WorkerPool;
12601 /// use wkt::Timestamp;
12602 /// let x = WorkerPool::new().set_delete_time(Timestamp::default()/* use setters */);
12603 /// ```
12604 pub fn set_delete_time<T>(mut self, v: T) -> Self
12605 where
12606 T: std::convert::Into<wkt::Timestamp>,
12607 {
12608 self.delete_time = std::option::Option::Some(v.into());
12609 self
12610 }
12611
12612 /// Sets or clears the value of [delete_time][crate::model::WorkerPool::delete_time].
12613 ///
12614 /// # Example
12615 /// ```ignore,no_run
12616 /// # use google_cloud_build_v1::model::WorkerPool;
12617 /// use wkt::Timestamp;
12618 /// let x = WorkerPool::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
12619 /// let x = WorkerPool::new().set_or_clear_delete_time(None::<Timestamp>);
12620 /// ```
12621 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
12622 where
12623 T: std::convert::Into<wkt::Timestamp>,
12624 {
12625 self.delete_time = v.map(|x| x.into());
12626 self
12627 }
12628
12629 /// Sets the value of [state][crate::model::WorkerPool::state].
12630 ///
12631 /// # Example
12632 /// ```ignore,no_run
12633 /// # use google_cloud_build_v1::model::WorkerPool;
12634 /// use google_cloud_build_v1::model::worker_pool::State;
12635 /// let x0 = WorkerPool::new().set_state(State::Creating);
12636 /// let x1 = WorkerPool::new().set_state(State::Running);
12637 /// let x2 = WorkerPool::new().set_state(State::Deleting);
12638 /// ```
12639 pub fn set_state<T: std::convert::Into<crate::model::worker_pool::State>>(
12640 mut self,
12641 v: T,
12642 ) -> Self {
12643 self.state = v.into();
12644 self
12645 }
12646
12647 /// Sets the value of [etag][crate::model::WorkerPool::etag].
12648 ///
12649 /// # Example
12650 /// ```ignore,no_run
12651 /// # use google_cloud_build_v1::model::WorkerPool;
12652 /// let x = WorkerPool::new().set_etag("example");
12653 /// ```
12654 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12655 self.etag = v.into();
12656 self
12657 }
12658
12659 /// Sets the value of [config][crate::model::WorkerPool::config].
12660 ///
12661 /// Note that all the setters affecting `config` are mutually
12662 /// exclusive.
12663 ///
12664 /// # Example
12665 /// ```ignore,no_run
12666 /// # use google_cloud_build_v1::model::WorkerPool;
12667 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12668 /// let x = WorkerPool::new().set_config(Some(
12669 /// google_cloud_build_v1::model::worker_pool::Config::PrivatePoolV1Config(PrivatePoolV1Config::default().into())));
12670 /// ```
12671 pub fn set_config<
12672 T: std::convert::Into<std::option::Option<crate::model::worker_pool::Config>>,
12673 >(
12674 mut self,
12675 v: T,
12676 ) -> Self {
12677 self.config = v.into();
12678 self
12679 }
12680
12681 /// The value of [config][crate::model::WorkerPool::config]
12682 /// if it holds a `PrivatePoolV1Config`, `None` if the field is not set or
12683 /// holds a different branch.
12684 pub fn private_pool_v1_config(
12685 &self,
12686 ) -> std::option::Option<&std::boxed::Box<crate::model::PrivatePoolV1Config>> {
12687 #[allow(unreachable_patterns)]
12688 self.config.as_ref().and_then(|v| match v {
12689 crate::model::worker_pool::Config::PrivatePoolV1Config(v) => {
12690 std::option::Option::Some(v)
12691 }
12692 _ => std::option::Option::None,
12693 })
12694 }
12695
12696 /// Sets the value of [config][crate::model::WorkerPool::config]
12697 /// to hold a `PrivatePoolV1Config`.
12698 ///
12699 /// Note that all the setters affecting `config` are
12700 /// mutually exclusive.
12701 ///
12702 /// # Example
12703 /// ```ignore,no_run
12704 /// # use google_cloud_build_v1::model::WorkerPool;
12705 /// use google_cloud_build_v1::model::PrivatePoolV1Config;
12706 /// let x = WorkerPool::new().set_private_pool_v1_config(PrivatePoolV1Config::default()/* use setters */);
12707 /// assert!(x.private_pool_v1_config().is_some());
12708 /// ```
12709 pub fn set_private_pool_v1_config<
12710 T: std::convert::Into<std::boxed::Box<crate::model::PrivatePoolV1Config>>,
12711 >(
12712 mut self,
12713 v: T,
12714 ) -> Self {
12715 self.config = std::option::Option::Some(
12716 crate::model::worker_pool::Config::PrivatePoolV1Config(v.into()),
12717 );
12718 self
12719 }
12720}
12721
12722impl wkt::message::Message for WorkerPool {
12723 fn typename() -> &'static str {
12724 "type.googleapis.com/google.devtools.cloudbuild.v1.WorkerPool"
12725 }
12726}
12727
12728/// Defines additional types related to [WorkerPool].
12729pub mod worker_pool {
12730 #[allow(unused_imports)]
12731 use super::*;
12732
12733 /// State of the `WorkerPool`.
12734 ///
12735 /// # Working with unknown values
12736 ///
12737 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12738 /// additional enum variants at any time. Adding new variants is not considered
12739 /// a breaking change. Applications should write their code in anticipation of:
12740 ///
12741 /// - New values appearing in future releases of the client library, **and**
12742 /// - New values received dynamically, without application changes.
12743 ///
12744 /// Please consult the [Working with enums] section in the user guide for some
12745 /// guidelines.
12746 ///
12747 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12748 #[derive(Clone, Debug, PartialEq)]
12749 #[non_exhaustive]
12750 pub enum State {
12751 /// State of the `WorkerPool` is unknown.
12752 Unspecified,
12753 /// `WorkerPool` is being created.
12754 Creating,
12755 /// `WorkerPool` is running.
12756 Running,
12757 /// `WorkerPool` is being deleted: cancelling builds and draining workers.
12758 Deleting,
12759 /// `WorkerPool` is deleted.
12760 Deleted,
12761 /// `WorkerPool` is being updated; new builds cannot be run.
12762 Updating,
12763 /// If set, the enum was initialized with an unknown value.
12764 ///
12765 /// Applications can examine the value using [State::value] or
12766 /// [State::name].
12767 UnknownValue(state::UnknownValue),
12768 }
12769
12770 #[doc(hidden)]
12771 pub mod state {
12772 #[allow(unused_imports)]
12773 use super::*;
12774 #[derive(Clone, Debug, PartialEq)]
12775 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12776 }
12777
12778 impl State {
12779 /// Gets the enum value.
12780 ///
12781 /// Returns `None` if the enum contains an unknown value deserialized from
12782 /// the string representation of enums.
12783 pub fn value(&self) -> std::option::Option<i32> {
12784 match self {
12785 Self::Unspecified => std::option::Option::Some(0),
12786 Self::Creating => std::option::Option::Some(1),
12787 Self::Running => std::option::Option::Some(2),
12788 Self::Deleting => std::option::Option::Some(3),
12789 Self::Deleted => std::option::Option::Some(4),
12790 Self::Updating => std::option::Option::Some(5),
12791 Self::UnknownValue(u) => u.0.value(),
12792 }
12793 }
12794
12795 /// Gets the enum value as a string.
12796 ///
12797 /// Returns `None` if the enum contains an unknown value deserialized from
12798 /// the integer representation of enums.
12799 pub fn name(&self) -> std::option::Option<&str> {
12800 match self {
12801 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12802 Self::Creating => std::option::Option::Some("CREATING"),
12803 Self::Running => std::option::Option::Some("RUNNING"),
12804 Self::Deleting => std::option::Option::Some("DELETING"),
12805 Self::Deleted => std::option::Option::Some("DELETED"),
12806 Self::Updating => std::option::Option::Some("UPDATING"),
12807 Self::UnknownValue(u) => u.0.name(),
12808 }
12809 }
12810 }
12811
12812 impl std::default::Default for State {
12813 fn default() -> Self {
12814 use std::convert::From;
12815 Self::from(0)
12816 }
12817 }
12818
12819 impl std::fmt::Display for State {
12820 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12821 wkt::internal::display_enum(f, self.name(), self.value())
12822 }
12823 }
12824
12825 impl std::convert::From<i32> for State {
12826 fn from(value: i32) -> Self {
12827 match value {
12828 0 => Self::Unspecified,
12829 1 => Self::Creating,
12830 2 => Self::Running,
12831 3 => Self::Deleting,
12832 4 => Self::Deleted,
12833 5 => Self::Updating,
12834 _ => Self::UnknownValue(state::UnknownValue(
12835 wkt::internal::UnknownEnumValue::Integer(value),
12836 )),
12837 }
12838 }
12839 }
12840
12841 impl std::convert::From<&str> for State {
12842 fn from(value: &str) -> Self {
12843 use std::string::ToString;
12844 match value {
12845 "STATE_UNSPECIFIED" => Self::Unspecified,
12846 "CREATING" => Self::Creating,
12847 "RUNNING" => Self::Running,
12848 "DELETING" => Self::Deleting,
12849 "DELETED" => Self::Deleted,
12850 "UPDATING" => Self::Updating,
12851 _ => Self::UnknownValue(state::UnknownValue(
12852 wkt::internal::UnknownEnumValue::String(value.to_string()),
12853 )),
12854 }
12855 }
12856 }
12857
12858 impl serde::ser::Serialize for State {
12859 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12860 where
12861 S: serde::Serializer,
12862 {
12863 match self {
12864 Self::Unspecified => serializer.serialize_i32(0),
12865 Self::Creating => serializer.serialize_i32(1),
12866 Self::Running => serializer.serialize_i32(2),
12867 Self::Deleting => serializer.serialize_i32(3),
12868 Self::Deleted => serializer.serialize_i32(4),
12869 Self::Updating => serializer.serialize_i32(5),
12870 Self::UnknownValue(u) => u.0.serialize(serializer),
12871 }
12872 }
12873 }
12874
12875 impl<'de> serde::de::Deserialize<'de> for State {
12876 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12877 where
12878 D: serde::Deserializer<'de>,
12879 {
12880 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12881 ".google.devtools.cloudbuild.v1.WorkerPool.State",
12882 ))
12883 }
12884 }
12885
12886 /// Configuration for the `WorkerPool`.
12887 #[derive(Clone, Debug, PartialEq)]
12888 #[non_exhaustive]
12889 pub enum Config {
12890 /// Private Pool configuration.
12891 PrivatePoolV1Config(std::boxed::Box<crate::model::PrivatePoolV1Config>),
12892 }
12893}
12894
12895/// Configuration for a V1 `PrivatePool`.
12896#[derive(Clone, Default, PartialEq)]
12897#[non_exhaustive]
12898pub struct PrivatePoolV1Config {
12899 /// Machine configuration for the workers in the pool.
12900 pub worker_config: std::option::Option<crate::model::private_pool_v_1_config::WorkerConfig>,
12901
12902 /// Network configuration for the pool.
12903 pub network_config: std::option::Option<crate::model::private_pool_v_1_config::NetworkConfig>,
12904
12905 /// Immutable. Private Service Connect(PSC) Network configuration for the pool.
12906 pub private_service_connect:
12907 std::option::Option<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12908
12909 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12910}
12911
12912impl PrivatePoolV1Config {
12913 /// Creates a new default instance.
12914 pub fn new() -> Self {
12915 std::default::Default::default()
12916 }
12917
12918 /// Sets the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12919 ///
12920 /// # Example
12921 /// ```ignore,no_run
12922 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12923 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12924 /// let x = PrivatePoolV1Config::new().set_worker_config(WorkerConfig::default()/* use setters */);
12925 /// ```
12926 pub fn set_worker_config<T>(mut self, v: T) -> Self
12927 where
12928 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12929 {
12930 self.worker_config = std::option::Option::Some(v.into());
12931 self
12932 }
12933
12934 /// Sets or clears the value of [worker_config][crate::model::PrivatePoolV1Config::worker_config].
12935 ///
12936 /// # Example
12937 /// ```ignore,no_run
12938 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12939 /// use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
12940 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(Some(WorkerConfig::default()/* use setters */));
12941 /// let x = PrivatePoolV1Config::new().set_or_clear_worker_config(None::<WorkerConfig>);
12942 /// ```
12943 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
12944 where
12945 T: std::convert::Into<crate::model::private_pool_v_1_config::WorkerConfig>,
12946 {
12947 self.worker_config = v.map(|x| x.into());
12948 self
12949 }
12950
12951 /// Sets the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12952 ///
12953 /// # Example
12954 /// ```ignore,no_run
12955 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12956 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12957 /// let x = PrivatePoolV1Config::new().set_network_config(NetworkConfig::default()/* use setters */);
12958 /// ```
12959 pub fn set_network_config<T>(mut self, v: T) -> Self
12960 where
12961 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12962 {
12963 self.network_config = std::option::Option::Some(v.into());
12964 self
12965 }
12966
12967 /// Sets or clears the value of [network_config][crate::model::PrivatePoolV1Config::network_config].
12968 ///
12969 /// # Example
12970 /// ```ignore,no_run
12971 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12972 /// use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
12973 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(Some(NetworkConfig::default()/* use setters */));
12974 /// let x = PrivatePoolV1Config::new().set_or_clear_network_config(None::<NetworkConfig>);
12975 /// ```
12976 pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
12977 where
12978 T: std::convert::Into<crate::model::private_pool_v_1_config::NetworkConfig>,
12979 {
12980 self.network_config = v.map(|x| x.into());
12981 self
12982 }
12983
12984 /// Sets the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
12985 ///
12986 /// # Example
12987 /// ```ignore,no_run
12988 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
12989 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
12990 /// let x = PrivatePoolV1Config::new().set_private_service_connect(PrivateServiceConnect::default()/* use setters */);
12991 /// ```
12992 pub fn set_private_service_connect<T>(mut self, v: T) -> Self
12993 where
12994 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
12995 {
12996 self.private_service_connect = std::option::Option::Some(v.into());
12997 self
12998 }
12999
13000 /// Sets or clears the value of [private_service_connect][crate::model::PrivatePoolV1Config::private_service_connect].
13001 ///
13002 /// # Example
13003 /// ```ignore,no_run
13004 /// # use google_cloud_build_v1::model::PrivatePoolV1Config;
13005 /// use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13006 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(Some(PrivateServiceConnect::default()/* use setters */));
13007 /// let x = PrivatePoolV1Config::new().set_or_clear_private_service_connect(None::<PrivateServiceConnect>);
13008 /// ```
13009 pub fn set_or_clear_private_service_connect<T>(mut self, v: std::option::Option<T>) -> Self
13010 where
13011 T: std::convert::Into<crate::model::private_pool_v_1_config::PrivateServiceConnect>,
13012 {
13013 self.private_service_connect = v.map(|x| x.into());
13014 self
13015 }
13016}
13017
13018impl wkt::message::Message for PrivatePoolV1Config {
13019 fn typename() -> &'static str {
13020 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config"
13021 }
13022}
13023
13024/// Defines additional types related to [PrivatePoolV1Config].
13025pub mod private_pool_v_1_config {
13026 #[allow(unused_imports)]
13027 use super::*;
13028
13029 /// Defines the configuration to be used for creating workers in
13030 /// the pool.
13031 #[derive(Clone, Default, PartialEq)]
13032 #[non_exhaustive]
13033 pub struct WorkerConfig {
13034 /// Optional. Machine type of a worker, such as `e2-medium`.
13035 /// See [Worker pool config
13036 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
13037 /// If left blank, Cloud Build will use a sensible default.
13038 pub machine_type: std::string::String,
13039
13040 /// Size of the disk attached to the worker, in GB.
13041 /// See [Worker pool config
13042 /// file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema).
13043 /// Specify a value of up to 4000. If `0` is specified, Cloud Build will use
13044 /// a standard disk size.
13045 pub disk_size_gb: i64,
13046
13047 /// Optional. Enable nested virtualization on the worker, if supported by the
13048 /// machine type. By default, nested virtualization is disabled.
13049 pub enable_nested_virtualization: std::option::Option<bool>,
13050
13051 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13052 }
13053
13054 impl WorkerConfig {
13055 /// Creates a new default instance.
13056 pub fn new() -> Self {
13057 std::default::Default::default()
13058 }
13059
13060 /// Sets the value of [machine_type][crate::model::private_pool_v_1_config::WorkerConfig::machine_type].
13061 ///
13062 /// # Example
13063 /// ```ignore,no_run
13064 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13065 /// let x = WorkerConfig::new().set_machine_type("example");
13066 /// ```
13067 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
13068 mut self,
13069 v: T,
13070 ) -> Self {
13071 self.machine_type = v.into();
13072 self
13073 }
13074
13075 /// Sets the value of [disk_size_gb][crate::model::private_pool_v_1_config::WorkerConfig::disk_size_gb].
13076 ///
13077 /// # Example
13078 /// ```ignore,no_run
13079 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13080 /// let x = WorkerConfig::new().set_disk_size_gb(42);
13081 /// ```
13082 pub fn set_disk_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13083 self.disk_size_gb = v.into();
13084 self
13085 }
13086
13087 /// Sets the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
13088 ///
13089 /// # Example
13090 /// ```ignore,no_run
13091 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13092 /// let x = WorkerConfig::new().set_enable_nested_virtualization(true);
13093 /// ```
13094 pub fn set_enable_nested_virtualization<T>(mut self, v: T) -> Self
13095 where
13096 T: std::convert::Into<bool>,
13097 {
13098 self.enable_nested_virtualization = std::option::Option::Some(v.into());
13099 self
13100 }
13101
13102 /// Sets or clears the value of [enable_nested_virtualization][crate::model::private_pool_v_1_config::WorkerConfig::enable_nested_virtualization].
13103 ///
13104 /// # Example
13105 /// ```ignore,no_run
13106 /// # use google_cloud_build_v1::model::private_pool_v_1_config::WorkerConfig;
13107 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(Some(false));
13108 /// let x = WorkerConfig::new().set_or_clear_enable_nested_virtualization(None::<bool>);
13109 /// ```
13110 pub fn set_or_clear_enable_nested_virtualization<T>(
13111 mut self,
13112 v: std::option::Option<T>,
13113 ) -> Self
13114 where
13115 T: std::convert::Into<bool>,
13116 {
13117 self.enable_nested_virtualization = v.map(|x| x.into());
13118 self
13119 }
13120 }
13121
13122 impl wkt::message::Message for WorkerConfig {
13123 fn typename() -> &'static str {
13124 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.WorkerConfig"
13125 }
13126 }
13127
13128 /// Defines the network configuration for the pool.
13129 #[derive(Clone, Default, PartialEq)]
13130 #[non_exhaustive]
13131 pub struct NetworkConfig {
13132 /// Required. Immutable. The network definition that the workers are peered
13133 /// to. If this section is left empty, the workers will be peered to
13134 /// `WorkerPool.project_id` on the service producer network. Must be in the
13135 /// format `projects/{project}/global/networks/{network}`, where `{project}`
13136 /// is a project number, such as `12345`, and `{network}` is the name of a
13137 /// VPC network in the project. See
13138 /// [Understanding network configuration
13139 /// options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment)
13140 pub peered_network: std::string::String,
13141
13142 /// Option to configure network egress for the workers.
13143 pub egress_option: crate::model::private_pool_v_1_config::network_config::EgressOption,
13144
13145 /// Immutable. Subnet IP range within the peered network. This is specified
13146 /// in CIDR notation with a slash and the subnet prefix size. You can
13147 /// optionally specify an IP address before the subnet prefix value. e.g.
13148 /// `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a
13149 /// prefix size of 29 bits.
13150 /// `/16` would specify a prefix size of 16 bits, with an automatically
13151 /// determined IP within the peered VPC.
13152 /// If unspecified, a value of `/24` will be used.
13153 pub peered_network_ip_range: std::string::String,
13154
13155 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13156 }
13157
13158 impl NetworkConfig {
13159 /// Creates a new default instance.
13160 pub fn new() -> Self {
13161 std::default::Default::default()
13162 }
13163
13164 /// Sets the value of [peered_network][crate::model::private_pool_v_1_config::NetworkConfig::peered_network].
13165 ///
13166 /// # Example
13167 /// ```ignore,no_run
13168 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13169 /// let x = NetworkConfig::new().set_peered_network("example");
13170 /// ```
13171 pub fn set_peered_network<T: std::convert::Into<std::string::String>>(
13172 mut self,
13173 v: T,
13174 ) -> Self {
13175 self.peered_network = v.into();
13176 self
13177 }
13178
13179 /// Sets the value of [egress_option][crate::model::private_pool_v_1_config::NetworkConfig::egress_option].
13180 ///
13181 /// # Example
13182 /// ```ignore,no_run
13183 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13184 /// use google_cloud_build_v1::model::private_pool_v_1_config::network_config::EgressOption;
13185 /// let x0 = NetworkConfig::new().set_egress_option(EgressOption::NoPublicEgress);
13186 /// let x1 = NetworkConfig::new().set_egress_option(EgressOption::PublicEgress);
13187 /// ```
13188 pub fn set_egress_option<
13189 T: std::convert::Into<crate::model::private_pool_v_1_config::network_config::EgressOption>,
13190 >(
13191 mut self,
13192 v: T,
13193 ) -> Self {
13194 self.egress_option = v.into();
13195 self
13196 }
13197
13198 /// Sets the value of [peered_network_ip_range][crate::model::private_pool_v_1_config::NetworkConfig::peered_network_ip_range].
13199 ///
13200 /// # Example
13201 /// ```ignore,no_run
13202 /// # use google_cloud_build_v1::model::private_pool_v_1_config::NetworkConfig;
13203 /// let x = NetworkConfig::new().set_peered_network_ip_range("example");
13204 /// ```
13205 pub fn set_peered_network_ip_range<T: std::convert::Into<std::string::String>>(
13206 mut self,
13207 v: T,
13208 ) -> Self {
13209 self.peered_network_ip_range = v.into();
13210 self
13211 }
13212 }
13213
13214 impl wkt::message::Message for NetworkConfig {
13215 fn typename() -> &'static str {
13216 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig"
13217 }
13218 }
13219
13220 /// Defines additional types related to [NetworkConfig].
13221 pub mod network_config {
13222 #[allow(unused_imports)]
13223 use super::*;
13224
13225 /// Defines the egress option for the pool.
13226 ///
13227 /// # Working with unknown values
13228 ///
13229 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13230 /// additional enum variants at any time. Adding new variants is not considered
13231 /// a breaking change. Applications should write their code in anticipation of:
13232 ///
13233 /// - New values appearing in future releases of the client library, **and**
13234 /// - New values received dynamically, without application changes.
13235 ///
13236 /// Please consult the [Working with enums] section in the user guide for some
13237 /// guidelines.
13238 ///
13239 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13240 #[derive(Clone, Debug, PartialEq)]
13241 #[non_exhaustive]
13242 pub enum EgressOption {
13243 /// If set, defaults to PUBLIC_EGRESS.
13244 Unspecified,
13245 /// If set, workers are created without any public address, which prevents
13246 /// network egress to public IPs unless a network proxy is configured.
13247 NoPublicEgress,
13248 /// If set, workers are created with a public address which allows for
13249 /// public internet egress.
13250 PublicEgress,
13251 /// If set, the enum was initialized with an unknown value.
13252 ///
13253 /// Applications can examine the value using [EgressOption::value] or
13254 /// [EgressOption::name].
13255 UnknownValue(egress_option::UnknownValue),
13256 }
13257
13258 #[doc(hidden)]
13259 pub mod egress_option {
13260 #[allow(unused_imports)]
13261 use super::*;
13262 #[derive(Clone, Debug, PartialEq)]
13263 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13264 }
13265
13266 impl EgressOption {
13267 /// Gets the enum value.
13268 ///
13269 /// Returns `None` if the enum contains an unknown value deserialized from
13270 /// the string representation of enums.
13271 pub fn value(&self) -> std::option::Option<i32> {
13272 match self {
13273 Self::Unspecified => std::option::Option::Some(0),
13274 Self::NoPublicEgress => std::option::Option::Some(1),
13275 Self::PublicEgress => std::option::Option::Some(2),
13276 Self::UnknownValue(u) => u.0.value(),
13277 }
13278 }
13279
13280 /// Gets the enum value as a string.
13281 ///
13282 /// Returns `None` if the enum contains an unknown value deserialized from
13283 /// the integer representation of enums.
13284 pub fn name(&self) -> std::option::Option<&str> {
13285 match self {
13286 Self::Unspecified => std::option::Option::Some("EGRESS_OPTION_UNSPECIFIED"),
13287 Self::NoPublicEgress => std::option::Option::Some("NO_PUBLIC_EGRESS"),
13288 Self::PublicEgress => std::option::Option::Some("PUBLIC_EGRESS"),
13289 Self::UnknownValue(u) => u.0.name(),
13290 }
13291 }
13292 }
13293
13294 impl std::default::Default for EgressOption {
13295 fn default() -> Self {
13296 use std::convert::From;
13297 Self::from(0)
13298 }
13299 }
13300
13301 impl std::fmt::Display for EgressOption {
13302 fn fmt(
13303 &self,
13304 f: &mut std::fmt::Formatter<'_>,
13305 ) -> std::result::Result<(), std::fmt::Error> {
13306 wkt::internal::display_enum(f, self.name(), self.value())
13307 }
13308 }
13309
13310 impl std::convert::From<i32> for EgressOption {
13311 fn from(value: i32) -> Self {
13312 match value {
13313 0 => Self::Unspecified,
13314 1 => Self::NoPublicEgress,
13315 2 => Self::PublicEgress,
13316 _ => Self::UnknownValue(egress_option::UnknownValue(
13317 wkt::internal::UnknownEnumValue::Integer(value),
13318 )),
13319 }
13320 }
13321 }
13322
13323 impl std::convert::From<&str> for EgressOption {
13324 fn from(value: &str) -> Self {
13325 use std::string::ToString;
13326 match value {
13327 "EGRESS_OPTION_UNSPECIFIED" => Self::Unspecified,
13328 "NO_PUBLIC_EGRESS" => Self::NoPublicEgress,
13329 "PUBLIC_EGRESS" => Self::PublicEgress,
13330 _ => Self::UnknownValue(egress_option::UnknownValue(
13331 wkt::internal::UnknownEnumValue::String(value.to_string()),
13332 )),
13333 }
13334 }
13335 }
13336
13337 impl serde::ser::Serialize for EgressOption {
13338 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13339 where
13340 S: serde::Serializer,
13341 {
13342 match self {
13343 Self::Unspecified => serializer.serialize_i32(0),
13344 Self::NoPublicEgress => serializer.serialize_i32(1),
13345 Self::PublicEgress => serializer.serialize_i32(2),
13346 Self::UnknownValue(u) => u.0.serialize(serializer),
13347 }
13348 }
13349 }
13350
13351 impl<'de> serde::de::Deserialize<'de> for EgressOption {
13352 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13353 where
13354 D: serde::Deserializer<'de>,
13355 {
13356 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EgressOption>::new(
13357 ".google.devtools.cloudbuild.v1.PrivatePoolV1Config.NetworkConfig.EgressOption",
13358 ))
13359 }
13360 }
13361 }
13362
13363 /// Defines the Private Service Connect network configuration for the pool.
13364 #[derive(Clone, Default, PartialEq)]
13365 #[non_exhaustive]
13366 pub struct PrivateServiceConnect {
13367 /// Required. Immutable. The network attachment that the worker network
13368 /// interface is peered to. Must be in the format
13369 /// `projects/{project}/regions/{region}/networkAttachments/{networkAttachment}`.
13370 /// The region of network attachment must be the same as the worker pool.
13371 /// See [Network
13372 /// Attachments](https://cloud.google.com/vpc/docs/about-network-attachments)
13373 pub network_attachment: std::string::String,
13374
13375 /// Required. Immutable. Disable public IP on the primary network interface.
13376 ///
13377 /// If true, workers are created without any public address, which prevents
13378 /// network egress to public IPs unless a network proxy is configured.
13379 /// If false, workers are created with a public address which allows for
13380 /// public internet egress. The public address only applies to traffic
13381 /// through the primary network interface.
13382 /// If `route_all_traffic` is set to true, all traffic will go through the
13383 /// non-primary network interface, this boolean has no effect.
13384 pub public_ip_address_disabled: bool,
13385
13386 /// Immutable. Route all traffic through PSC interface. Enable this if you
13387 /// want full control of traffic in the private pool. Configure Cloud NAT for
13388 /// the subnet of network attachment if you need to access public Internet.
13389 ///
13390 /// If false, Only route RFC 1918 (10.0.0.0/8, 172.16.0.0/12, and
13391 /// 192.168.0.0/16) and RFC 6598 (100.64.0.0/10) through PSC interface.
13392 pub route_all_traffic: bool,
13393
13394 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13395 }
13396
13397 impl PrivateServiceConnect {
13398 /// Creates a new default instance.
13399 pub fn new() -> Self {
13400 std::default::Default::default()
13401 }
13402
13403 /// Sets the value of [network_attachment][crate::model::private_pool_v_1_config::PrivateServiceConnect::network_attachment].
13404 ///
13405 /// # Example
13406 /// ```ignore,no_run
13407 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13408 /// let x = PrivateServiceConnect::new().set_network_attachment("example");
13409 /// ```
13410 pub fn set_network_attachment<T: std::convert::Into<std::string::String>>(
13411 mut self,
13412 v: T,
13413 ) -> Self {
13414 self.network_attachment = v.into();
13415 self
13416 }
13417
13418 /// Sets the value of [public_ip_address_disabled][crate::model::private_pool_v_1_config::PrivateServiceConnect::public_ip_address_disabled].
13419 ///
13420 /// # Example
13421 /// ```ignore,no_run
13422 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13423 /// let x = PrivateServiceConnect::new().set_public_ip_address_disabled(true);
13424 /// ```
13425 pub fn set_public_ip_address_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13426 self.public_ip_address_disabled = v.into();
13427 self
13428 }
13429
13430 /// Sets the value of [route_all_traffic][crate::model::private_pool_v_1_config::PrivateServiceConnect::route_all_traffic].
13431 ///
13432 /// # Example
13433 /// ```ignore,no_run
13434 /// # use google_cloud_build_v1::model::private_pool_v_1_config::PrivateServiceConnect;
13435 /// let x = PrivateServiceConnect::new().set_route_all_traffic(true);
13436 /// ```
13437 pub fn set_route_all_traffic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13438 self.route_all_traffic = v.into();
13439 self
13440 }
13441 }
13442
13443 impl wkt::message::Message for PrivateServiceConnect {
13444 fn typename() -> &'static str {
13445 "type.googleapis.com/google.devtools.cloudbuild.v1.PrivatePoolV1Config.PrivateServiceConnect"
13446 }
13447 }
13448}
13449
13450/// Request to create a new `WorkerPool`.
13451#[derive(Clone, Default, PartialEq)]
13452#[non_exhaustive]
13453pub struct CreateWorkerPoolRequest {
13454 /// Required. The parent resource where this worker pool will be created.
13455 /// Format: `projects/{project}/locations/{location}`.
13456 pub parent: std::string::String,
13457
13458 /// Required. `WorkerPool` resource to create.
13459 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13460
13461 /// Required. Immutable. The ID to use for the `WorkerPool`, which will become
13462 /// the final component of the resource name.
13463 ///
13464 /// This value should be 1-63 characters, and valid characters
13465 /// are /[a-z][0-9]-/.
13466 pub worker_pool_id: std::string::String,
13467
13468 /// If set, validate the request and preview the response, but do not actually
13469 /// post it.
13470 pub validate_only: bool,
13471
13472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13473}
13474
13475impl CreateWorkerPoolRequest {
13476 /// Creates a new default instance.
13477 pub fn new() -> Self {
13478 std::default::Default::default()
13479 }
13480
13481 /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
13482 ///
13483 /// # Example
13484 /// ```ignore,no_run
13485 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13486 /// let x = CreateWorkerPoolRequest::new().set_parent("example");
13487 /// ```
13488 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13489 self.parent = v.into();
13490 self
13491 }
13492
13493 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13494 ///
13495 /// # Example
13496 /// ```ignore,no_run
13497 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13498 /// use google_cloud_build_v1::model::WorkerPool;
13499 /// let x = CreateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13500 /// ```
13501 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13502 where
13503 T: std::convert::Into<crate::model::WorkerPool>,
13504 {
13505 self.worker_pool = std::option::Option::Some(v.into());
13506 self
13507 }
13508
13509 /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
13510 ///
13511 /// # Example
13512 /// ```ignore,no_run
13513 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13514 /// use google_cloud_build_v1::model::WorkerPool;
13515 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13516 /// let x = CreateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13517 /// ```
13518 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13519 where
13520 T: std::convert::Into<crate::model::WorkerPool>,
13521 {
13522 self.worker_pool = v.map(|x| x.into());
13523 self
13524 }
13525
13526 /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
13527 ///
13528 /// # Example
13529 /// ```ignore,no_run
13530 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13531 /// let x = CreateWorkerPoolRequest::new().set_worker_pool_id("example");
13532 /// ```
13533 pub fn set_worker_pool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13534 self.worker_pool_id = v.into();
13535 self
13536 }
13537
13538 /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
13539 ///
13540 /// # Example
13541 /// ```ignore,no_run
13542 /// # use google_cloud_build_v1::model::CreateWorkerPoolRequest;
13543 /// let x = CreateWorkerPoolRequest::new().set_validate_only(true);
13544 /// ```
13545 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13546 self.validate_only = v.into();
13547 self
13548 }
13549}
13550
13551impl wkt::message::Message for CreateWorkerPoolRequest {
13552 fn typename() -> &'static str {
13553 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolRequest"
13554 }
13555}
13556
13557/// Request to get a `WorkerPool` with the specified name.
13558#[derive(Clone, Default, PartialEq)]
13559#[non_exhaustive]
13560pub struct GetWorkerPoolRequest {
13561 /// Required. The name of the `WorkerPool` to retrieve.
13562 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13563 pub name: std::string::String,
13564
13565 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13566}
13567
13568impl GetWorkerPoolRequest {
13569 /// Creates a new default instance.
13570 pub fn new() -> Self {
13571 std::default::Default::default()
13572 }
13573
13574 /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
13575 ///
13576 /// # Example
13577 /// ```ignore,no_run
13578 /// # use google_cloud_build_v1::model::GetWorkerPoolRequest;
13579 /// # let project_id = "project_id";
13580 /// # let location_id = "location_id";
13581 /// # let worker_pool_id = "worker_pool_id";
13582 /// let x = GetWorkerPoolRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
13583 /// ```
13584 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13585 self.name = v.into();
13586 self
13587 }
13588}
13589
13590impl wkt::message::Message for GetWorkerPoolRequest {
13591 fn typename() -> &'static str {
13592 "type.googleapis.com/google.devtools.cloudbuild.v1.GetWorkerPoolRequest"
13593 }
13594}
13595
13596/// Request to delete a `WorkerPool`.
13597#[derive(Clone, Default, PartialEq)]
13598#[non_exhaustive]
13599pub struct DeleteWorkerPoolRequest {
13600 /// Required. The name of the `WorkerPool` to delete.
13601 /// Format:
13602 /// `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13603 pub name: std::string::String,
13604
13605 /// Optional. If provided, it must match the server's etag on the workerpool
13606 /// for the request to be processed.
13607 pub etag: std::string::String,
13608
13609 /// If set to true, and the `WorkerPool` is not found, the request will succeed
13610 /// but no action will be taken on the server.
13611 pub allow_missing: bool,
13612
13613 /// If set, validate the request and preview the response, but do not actually
13614 /// post it.
13615 pub validate_only: bool,
13616
13617 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13618}
13619
13620impl DeleteWorkerPoolRequest {
13621 /// Creates a new default instance.
13622 pub fn new() -> Self {
13623 std::default::Default::default()
13624 }
13625
13626 /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
13627 ///
13628 /// # Example
13629 /// ```ignore,no_run
13630 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13631 /// # let project_id = "project_id";
13632 /// # let location_id = "location_id";
13633 /// # let worker_pool_id = "worker_pool_id";
13634 /// let x = DeleteWorkerPoolRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
13635 /// ```
13636 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13637 self.name = v.into();
13638 self
13639 }
13640
13641 /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
13642 ///
13643 /// # Example
13644 /// ```ignore,no_run
13645 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13646 /// let x = DeleteWorkerPoolRequest::new().set_etag("example");
13647 /// ```
13648 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13649 self.etag = v.into();
13650 self
13651 }
13652
13653 /// Sets the value of [allow_missing][crate::model::DeleteWorkerPoolRequest::allow_missing].
13654 ///
13655 /// # Example
13656 /// ```ignore,no_run
13657 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13658 /// let x = DeleteWorkerPoolRequest::new().set_allow_missing(true);
13659 /// ```
13660 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13661 self.allow_missing = v.into();
13662 self
13663 }
13664
13665 /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
13666 ///
13667 /// # Example
13668 /// ```ignore,no_run
13669 /// # use google_cloud_build_v1::model::DeleteWorkerPoolRequest;
13670 /// let x = DeleteWorkerPoolRequest::new().set_validate_only(true);
13671 /// ```
13672 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13673 self.validate_only = v.into();
13674 self
13675 }
13676}
13677
13678impl wkt::message::Message for DeleteWorkerPoolRequest {
13679 fn typename() -> &'static str {
13680 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest"
13681 }
13682}
13683
13684/// Request to update a `WorkerPool`.
13685#[derive(Clone, Default, PartialEq)]
13686#[non_exhaustive]
13687pub struct UpdateWorkerPoolRequest {
13688 /// Required. The `WorkerPool` to update.
13689 ///
13690 /// The `name` field is used to identify the `WorkerPool` to update.
13691 /// Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
13692 pub worker_pool: std::option::Option<crate::model::WorkerPool>,
13693
13694 /// Optional. A mask specifying which fields in `worker_pool` to update.
13695 pub update_mask: std::option::Option<wkt::FieldMask>,
13696
13697 /// If set, validate the request and preview the response, but do not actually
13698 /// post it.
13699 pub validate_only: bool,
13700
13701 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13702}
13703
13704impl UpdateWorkerPoolRequest {
13705 /// Creates a new default instance.
13706 pub fn new() -> Self {
13707 std::default::Default::default()
13708 }
13709
13710 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13711 ///
13712 /// # Example
13713 /// ```ignore,no_run
13714 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13715 /// use google_cloud_build_v1::model::WorkerPool;
13716 /// let x = UpdateWorkerPoolRequest::new().set_worker_pool(WorkerPool::default()/* use setters */);
13717 /// ```
13718 pub fn set_worker_pool<T>(mut self, v: T) -> Self
13719 where
13720 T: std::convert::Into<crate::model::WorkerPool>,
13721 {
13722 self.worker_pool = std::option::Option::Some(v.into());
13723 self
13724 }
13725
13726 /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
13727 ///
13728 /// # Example
13729 /// ```ignore,no_run
13730 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13731 /// use google_cloud_build_v1::model::WorkerPool;
13732 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(Some(WorkerPool::default()/* use setters */));
13733 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_worker_pool(None::<WorkerPool>);
13734 /// ```
13735 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
13736 where
13737 T: std::convert::Into<crate::model::WorkerPool>,
13738 {
13739 self.worker_pool = v.map(|x| x.into());
13740 self
13741 }
13742
13743 /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13744 ///
13745 /// # Example
13746 /// ```ignore,no_run
13747 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13748 /// use wkt::FieldMask;
13749 /// let x = UpdateWorkerPoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13750 /// ```
13751 pub fn set_update_mask<T>(mut self, v: T) -> Self
13752 where
13753 T: std::convert::Into<wkt::FieldMask>,
13754 {
13755 self.update_mask = std::option::Option::Some(v.into());
13756 self
13757 }
13758
13759 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
13760 ///
13761 /// # Example
13762 /// ```ignore,no_run
13763 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13764 /// use wkt::FieldMask;
13765 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13766 /// let x = UpdateWorkerPoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13767 /// ```
13768 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13769 where
13770 T: std::convert::Into<wkt::FieldMask>,
13771 {
13772 self.update_mask = v.map(|x| x.into());
13773 self
13774 }
13775
13776 /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
13777 ///
13778 /// # Example
13779 /// ```ignore,no_run
13780 /// # use google_cloud_build_v1::model::UpdateWorkerPoolRequest;
13781 /// let x = UpdateWorkerPoolRequest::new().set_validate_only(true);
13782 /// ```
13783 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13784 self.validate_only = v.into();
13785 self
13786 }
13787}
13788
13789impl wkt::message::Message for UpdateWorkerPoolRequest {
13790 fn typename() -> &'static str {
13791 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest"
13792 }
13793}
13794
13795/// Request to list `WorkerPool`s.
13796#[derive(Clone, Default, PartialEq)]
13797#[non_exhaustive]
13798pub struct ListWorkerPoolsRequest {
13799 /// Required. The parent of the collection of `WorkerPools`.
13800 /// Format: `projects/{project}/locations/{location}`.
13801 pub parent: std::string::String,
13802
13803 /// The maximum number of `WorkerPool`s to return. The service may return
13804 /// fewer than this value. If omitted, the server will use a sensible default.
13805 pub page_size: i32,
13806
13807 /// A page token, received from a previous `ListWorkerPools` call. Provide this
13808 /// to retrieve the subsequent page.
13809 pub page_token: std::string::String,
13810
13811 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13812}
13813
13814impl ListWorkerPoolsRequest {
13815 /// Creates a new default instance.
13816 pub fn new() -> Self {
13817 std::default::Default::default()
13818 }
13819
13820 /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
13821 ///
13822 /// # Example
13823 /// ```ignore,no_run
13824 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13825 /// let x = ListWorkerPoolsRequest::new().set_parent("example");
13826 /// ```
13827 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13828 self.parent = v.into();
13829 self
13830 }
13831
13832 /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
13833 ///
13834 /// # Example
13835 /// ```ignore,no_run
13836 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13837 /// let x = ListWorkerPoolsRequest::new().set_page_size(42);
13838 /// ```
13839 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13840 self.page_size = v.into();
13841 self
13842 }
13843
13844 /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
13845 ///
13846 /// # Example
13847 /// ```ignore,no_run
13848 /// # use google_cloud_build_v1::model::ListWorkerPoolsRequest;
13849 /// let x = ListWorkerPoolsRequest::new().set_page_token("example");
13850 /// ```
13851 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13852 self.page_token = v.into();
13853 self
13854 }
13855}
13856
13857impl wkt::message::Message for ListWorkerPoolsRequest {
13858 fn typename() -> &'static str {
13859 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsRequest"
13860 }
13861}
13862
13863/// Response containing existing `WorkerPools`.
13864#[derive(Clone, Default, PartialEq)]
13865#[non_exhaustive]
13866pub struct ListWorkerPoolsResponse {
13867 /// `WorkerPools` for the specified project.
13868 pub worker_pools: std::vec::Vec<crate::model::WorkerPool>,
13869
13870 /// Continuation token used to page through large result sets. Provide this
13871 /// value in a subsequent ListWorkerPoolsRequest to return the next page of
13872 /// results.
13873 pub next_page_token: std::string::String,
13874
13875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13876}
13877
13878impl ListWorkerPoolsResponse {
13879 /// Creates a new default instance.
13880 pub fn new() -> Self {
13881 std::default::Default::default()
13882 }
13883
13884 /// Sets the value of [worker_pools][crate::model::ListWorkerPoolsResponse::worker_pools].
13885 ///
13886 /// # Example
13887 /// ```ignore,no_run
13888 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13889 /// use google_cloud_build_v1::model::WorkerPool;
13890 /// let x = ListWorkerPoolsResponse::new()
13891 /// .set_worker_pools([
13892 /// WorkerPool::default()/* use setters */,
13893 /// WorkerPool::default()/* use (different) setters */,
13894 /// ]);
13895 /// ```
13896 pub fn set_worker_pools<T, V>(mut self, v: T) -> Self
13897 where
13898 T: std::iter::IntoIterator<Item = V>,
13899 V: std::convert::Into<crate::model::WorkerPool>,
13900 {
13901 use std::iter::Iterator;
13902 self.worker_pools = v.into_iter().map(|i| i.into()).collect();
13903 self
13904 }
13905
13906 /// Sets the value of [next_page_token][crate::model::ListWorkerPoolsResponse::next_page_token].
13907 ///
13908 /// # Example
13909 /// ```ignore,no_run
13910 /// # use google_cloud_build_v1::model::ListWorkerPoolsResponse;
13911 /// let x = ListWorkerPoolsResponse::new().set_next_page_token("example");
13912 /// ```
13913 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13914 self.next_page_token = v.into();
13915 self
13916 }
13917}
13918
13919impl wkt::message::Message for ListWorkerPoolsResponse {
13920 fn typename() -> &'static str {
13921 "type.googleapis.com/google.devtools.cloudbuild.v1.ListWorkerPoolsResponse"
13922 }
13923}
13924
13925#[doc(hidden)]
13926impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkerPoolsResponse {
13927 type PageItem = crate::model::WorkerPool;
13928
13929 fn items(self) -> std::vec::Vec<Self::PageItem> {
13930 self.worker_pools
13931 }
13932
13933 fn next_page_token(&self) -> std::string::String {
13934 use std::clone::Clone;
13935 self.next_page_token.clone()
13936 }
13937}
13938
13939/// Metadata for the `CreateWorkerPool` operation.
13940#[derive(Clone, Default, PartialEq)]
13941#[non_exhaustive]
13942pub struct CreateWorkerPoolOperationMetadata {
13943 /// The resource name of the `WorkerPool` to create.
13944 /// Format:
13945 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
13946 pub worker_pool: std::string::String,
13947
13948 /// Time the operation was created.
13949 pub create_time: std::option::Option<wkt::Timestamp>,
13950
13951 /// Time the operation was completed.
13952 pub complete_time: std::option::Option<wkt::Timestamp>,
13953
13954 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13955}
13956
13957impl CreateWorkerPoolOperationMetadata {
13958 /// Creates a new default instance.
13959 pub fn new() -> Self {
13960 std::default::Default::default()
13961 }
13962
13963 /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolOperationMetadata::worker_pool].
13964 ///
13965 /// # Example
13966 /// ```ignore,no_run
13967 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13968 /// # let project_id = "project_id";
13969 /// # let location_id = "location_id";
13970 /// # let worker_pool_id = "worker_pool_id";
13971 /// let x = CreateWorkerPoolOperationMetadata::new().set_worker_pool(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
13972 /// ```
13973 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13974 self.worker_pool = v.into();
13975 self
13976 }
13977
13978 /// Sets the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13979 ///
13980 /// # Example
13981 /// ```ignore,no_run
13982 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13983 /// use wkt::Timestamp;
13984 /// let x = CreateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
13985 /// ```
13986 pub fn set_create_time<T>(mut self, v: T) -> Self
13987 where
13988 T: std::convert::Into<wkt::Timestamp>,
13989 {
13990 self.create_time = std::option::Option::Some(v.into());
13991 self
13992 }
13993
13994 /// Sets or clears the value of [create_time][crate::model::CreateWorkerPoolOperationMetadata::create_time].
13995 ///
13996 /// # Example
13997 /// ```ignore,no_run
13998 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
13999 /// use wkt::Timestamp;
14000 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14001 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14002 /// ```
14003 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14004 where
14005 T: std::convert::Into<wkt::Timestamp>,
14006 {
14007 self.create_time = v.map(|x| x.into());
14008 self
14009 }
14010
14011 /// Sets the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
14012 ///
14013 /// # Example
14014 /// ```ignore,no_run
14015 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
14016 /// use wkt::Timestamp;
14017 /// let x = CreateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14018 /// ```
14019 pub fn set_complete_time<T>(mut self, v: T) -> Self
14020 where
14021 T: std::convert::Into<wkt::Timestamp>,
14022 {
14023 self.complete_time = std::option::Option::Some(v.into());
14024 self
14025 }
14026
14027 /// Sets or clears the value of [complete_time][crate::model::CreateWorkerPoolOperationMetadata::complete_time].
14028 ///
14029 /// # Example
14030 /// ```ignore,no_run
14031 /// # use google_cloud_build_v1::model::CreateWorkerPoolOperationMetadata;
14032 /// use wkt::Timestamp;
14033 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14034 /// let x = CreateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14035 /// ```
14036 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14037 where
14038 T: std::convert::Into<wkt::Timestamp>,
14039 {
14040 self.complete_time = v.map(|x| x.into());
14041 self
14042 }
14043}
14044
14045impl wkt::message::Message for CreateWorkerPoolOperationMetadata {
14046 fn typename() -> &'static str {
14047 "type.googleapis.com/google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata"
14048 }
14049}
14050
14051/// Metadata for the `UpdateWorkerPool` operation.
14052#[derive(Clone, Default, PartialEq)]
14053#[non_exhaustive]
14054pub struct UpdateWorkerPoolOperationMetadata {
14055 /// The resource name of the `WorkerPool` being updated.
14056 /// Format:
14057 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14058 pub worker_pool: std::string::String,
14059
14060 /// Time the operation was created.
14061 pub create_time: std::option::Option<wkt::Timestamp>,
14062
14063 /// Time the operation was completed.
14064 pub complete_time: std::option::Option<wkt::Timestamp>,
14065
14066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14067}
14068
14069impl UpdateWorkerPoolOperationMetadata {
14070 /// Creates a new default instance.
14071 pub fn new() -> Self {
14072 std::default::Default::default()
14073 }
14074
14075 /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolOperationMetadata::worker_pool].
14076 ///
14077 /// # Example
14078 /// ```ignore,no_run
14079 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14080 /// # let project_id = "project_id";
14081 /// # let location_id = "location_id";
14082 /// # let worker_pool_id = "worker_pool_id";
14083 /// let x = UpdateWorkerPoolOperationMetadata::new().set_worker_pool(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
14084 /// ```
14085 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14086 self.worker_pool = v.into();
14087 self
14088 }
14089
14090 /// Sets the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
14091 ///
14092 /// # Example
14093 /// ```ignore,no_run
14094 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14095 /// use wkt::Timestamp;
14096 /// let x = UpdateWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14097 /// ```
14098 pub fn set_create_time<T>(mut self, v: T) -> Self
14099 where
14100 T: std::convert::Into<wkt::Timestamp>,
14101 {
14102 self.create_time = std::option::Option::Some(v.into());
14103 self
14104 }
14105
14106 /// Sets or clears the value of [create_time][crate::model::UpdateWorkerPoolOperationMetadata::create_time].
14107 ///
14108 /// # Example
14109 /// ```ignore,no_run
14110 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14111 /// use wkt::Timestamp;
14112 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14113 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14114 /// ```
14115 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14116 where
14117 T: std::convert::Into<wkt::Timestamp>,
14118 {
14119 self.create_time = v.map(|x| x.into());
14120 self
14121 }
14122
14123 /// Sets the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
14124 ///
14125 /// # Example
14126 /// ```ignore,no_run
14127 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14128 /// use wkt::Timestamp;
14129 /// let x = UpdateWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14130 /// ```
14131 pub fn set_complete_time<T>(mut self, v: T) -> Self
14132 where
14133 T: std::convert::Into<wkt::Timestamp>,
14134 {
14135 self.complete_time = std::option::Option::Some(v.into());
14136 self
14137 }
14138
14139 /// Sets or clears the value of [complete_time][crate::model::UpdateWorkerPoolOperationMetadata::complete_time].
14140 ///
14141 /// # Example
14142 /// ```ignore,no_run
14143 /// # use google_cloud_build_v1::model::UpdateWorkerPoolOperationMetadata;
14144 /// use wkt::Timestamp;
14145 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14146 /// let x = UpdateWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14147 /// ```
14148 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14149 where
14150 T: std::convert::Into<wkt::Timestamp>,
14151 {
14152 self.complete_time = v.map(|x| x.into());
14153 self
14154 }
14155}
14156
14157impl wkt::message::Message for UpdateWorkerPoolOperationMetadata {
14158 fn typename() -> &'static str {
14159 "type.googleapis.com/google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata"
14160 }
14161}
14162
14163/// Metadata for the `DeleteWorkerPool` operation.
14164#[derive(Clone, Default, PartialEq)]
14165#[non_exhaustive]
14166pub struct DeleteWorkerPoolOperationMetadata {
14167 /// The resource name of the `WorkerPool` being deleted.
14168 /// Format:
14169 /// `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
14170 pub worker_pool: std::string::String,
14171
14172 /// Time the operation was created.
14173 pub create_time: std::option::Option<wkt::Timestamp>,
14174
14175 /// Time the operation was completed.
14176 pub complete_time: std::option::Option<wkt::Timestamp>,
14177
14178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14179}
14180
14181impl DeleteWorkerPoolOperationMetadata {
14182 /// Creates a new default instance.
14183 pub fn new() -> Self {
14184 std::default::Default::default()
14185 }
14186
14187 /// Sets the value of [worker_pool][crate::model::DeleteWorkerPoolOperationMetadata::worker_pool].
14188 ///
14189 /// # Example
14190 /// ```ignore,no_run
14191 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14192 /// # let project_id = "project_id";
14193 /// # let location_id = "location_id";
14194 /// # let worker_pool_id = "worker_pool_id";
14195 /// let x = DeleteWorkerPoolOperationMetadata::new().set_worker_pool(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"));
14196 /// ```
14197 pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14198 self.worker_pool = v.into();
14199 self
14200 }
14201
14202 /// Sets the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14203 ///
14204 /// # Example
14205 /// ```ignore,no_run
14206 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14207 /// use wkt::Timestamp;
14208 /// let x = DeleteWorkerPoolOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
14209 /// ```
14210 pub fn set_create_time<T>(mut self, v: T) -> Self
14211 where
14212 T: std::convert::Into<wkt::Timestamp>,
14213 {
14214 self.create_time = std::option::Option::Some(v.into());
14215 self
14216 }
14217
14218 /// Sets or clears the value of [create_time][crate::model::DeleteWorkerPoolOperationMetadata::create_time].
14219 ///
14220 /// # Example
14221 /// ```ignore,no_run
14222 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14223 /// use wkt::Timestamp;
14224 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14225 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
14226 /// ```
14227 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14228 where
14229 T: std::convert::Into<wkt::Timestamp>,
14230 {
14231 self.create_time = v.map(|x| x.into());
14232 self
14233 }
14234
14235 /// Sets the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14236 ///
14237 /// # Example
14238 /// ```ignore,no_run
14239 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14240 /// use wkt::Timestamp;
14241 /// let x = DeleteWorkerPoolOperationMetadata::new().set_complete_time(Timestamp::default()/* use setters */);
14242 /// ```
14243 pub fn set_complete_time<T>(mut self, v: T) -> Self
14244 where
14245 T: std::convert::Into<wkt::Timestamp>,
14246 {
14247 self.complete_time = std::option::Option::Some(v.into());
14248 self
14249 }
14250
14251 /// Sets or clears the value of [complete_time][crate::model::DeleteWorkerPoolOperationMetadata::complete_time].
14252 ///
14253 /// # Example
14254 /// ```ignore,no_run
14255 /// # use google_cloud_build_v1::model::DeleteWorkerPoolOperationMetadata;
14256 /// use wkt::Timestamp;
14257 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
14258 /// let x = DeleteWorkerPoolOperationMetadata::new().set_or_clear_complete_time(None::<Timestamp>);
14259 /// ```
14260 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
14261 where
14262 T: std::convert::Into<wkt::Timestamp>,
14263 {
14264 self.complete_time = v.map(|x| x.into());
14265 self
14266 }
14267}
14268
14269impl wkt::message::Message for DeleteWorkerPoolOperationMetadata {
14270 fn typename() -> &'static str {
14271 "type.googleapis.com/google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata"
14272 }
14273}