google_cloud_storagebatchoperations_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate location;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate rpc;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Message for request to list Jobs
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct ListJobsRequest {
45 /// Required. Format: projects/{project_id}/locations/global.
46 pub parent: std::string::String,
47
48 /// Optional. Filters results as defined by <https://google.aip.dev/160>.
49 pub filter: std::string::String,
50
51 /// Optional. The list page size. default page size is 100.
52 pub page_size: i32,
53
54 /// Optional. The list page token.
55 pub page_token: std::string::String,
56
57 /// Optional. Field to sort by. Supported fields are name, create_time.
58 pub order_by: std::string::String,
59
60 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
61}
62
63impl ListJobsRequest {
64 pub fn new() -> Self {
65 std::default::Default::default()
66 }
67
68 /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
69 ///
70 /// # Example
71 /// ```ignore,no_run
72 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
73 /// let x = ListJobsRequest::new().set_parent("example");
74 /// ```
75 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
76 self.parent = v.into();
77 self
78 }
79
80 /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
81 ///
82 /// # Example
83 /// ```ignore,no_run
84 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
85 /// let x = ListJobsRequest::new().set_filter("example");
86 /// ```
87 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
88 self.filter = v.into();
89 self
90 }
91
92 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
93 ///
94 /// # Example
95 /// ```ignore,no_run
96 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
97 /// let x = ListJobsRequest::new().set_page_size(42);
98 /// ```
99 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
100 self.page_size = v.into();
101 self
102 }
103
104 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
105 ///
106 /// # Example
107 /// ```ignore,no_run
108 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
109 /// let x = ListJobsRequest::new().set_page_token("example");
110 /// ```
111 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
112 self.page_token = v.into();
113 self
114 }
115
116 /// Sets the value of [order_by][crate::model::ListJobsRequest::order_by].
117 ///
118 /// # Example
119 /// ```ignore,no_run
120 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsRequest;
121 /// let x = ListJobsRequest::new().set_order_by("example");
122 /// ```
123 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
124 self.order_by = v.into();
125 self
126 }
127}
128
129impl wkt::message::Message for ListJobsRequest {
130 fn typename() -> &'static str {
131 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ListJobsRequest"
132 }
133}
134
135/// Message for response to listing Jobs
136#[derive(Clone, Default, PartialEq)]
137#[non_exhaustive]
138pub struct ListJobsResponse {
139 /// A list of storage batch jobs.
140 pub jobs: std::vec::Vec<crate::model::Job>,
141
142 /// A token identifying a page of results.
143 pub next_page_token: std::string::String,
144
145 /// Locations that could not be reached.
146 pub unreachable: std::vec::Vec<std::string::String>,
147
148 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
149}
150
151impl ListJobsResponse {
152 pub fn new() -> Self {
153 std::default::Default::default()
154 }
155
156 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
157 ///
158 /// # Example
159 /// ```ignore,no_run
160 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
161 /// use google_cloud_storagebatchoperations_v1::model::Job;
162 /// let x = ListJobsResponse::new()
163 /// .set_jobs([
164 /// Job::default()/* use setters */,
165 /// Job::default()/* use (different) setters */,
166 /// ]);
167 /// ```
168 pub fn set_jobs<T, V>(mut self, v: T) -> Self
169 where
170 T: std::iter::IntoIterator<Item = V>,
171 V: std::convert::Into<crate::model::Job>,
172 {
173 use std::iter::Iterator;
174 self.jobs = v.into_iter().map(|i| i.into()).collect();
175 self
176 }
177
178 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
179 ///
180 /// # Example
181 /// ```ignore,no_run
182 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
183 /// let x = ListJobsResponse::new().set_next_page_token("example");
184 /// ```
185 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
186 self.next_page_token = v.into();
187 self
188 }
189
190 /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
191 ///
192 /// # Example
193 /// ```ignore,no_run
194 /// # use google_cloud_storagebatchoperations_v1::model::ListJobsResponse;
195 /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
196 /// ```
197 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
198 where
199 T: std::iter::IntoIterator<Item = V>,
200 V: std::convert::Into<std::string::String>,
201 {
202 use std::iter::Iterator;
203 self.unreachable = v.into_iter().map(|i| i.into()).collect();
204 self
205 }
206}
207
208impl wkt::message::Message for ListJobsResponse {
209 fn typename() -> &'static str {
210 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ListJobsResponse"
211 }
212}
213
214#[doc(hidden)]
215impl gax::paginator::internal::PageableResponse for ListJobsResponse {
216 type PageItem = crate::model::Job;
217
218 fn items(self) -> std::vec::Vec<Self::PageItem> {
219 self.jobs
220 }
221
222 fn next_page_token(&self) -> std::string::String {
223 use std::clone::Clone;
224 self.next_page_token.clone()
225 }
226}
227
228/// Message for getting a Job
229#[derive(Clone, Default, PartialEq)]
230#[non_exhaustive]
231pub struct GetJobRequest {
232 /// Required. `name` of the job to retrieve.
233 /// Format: projects/{project_id}/locations/global/jobs/{job_id} .
234 pub name: std::string::String,
235
236 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
237}
238
239impl GetJobRequest {
240 pub fn new() -> Self {
241 std::default::Default::default()
242 }
243
244 /// Sets the value of [name][crate::model::GetJobRequest::name].
245 ///
246 /// # Example
247 /// ```ignore,no_run
248 /// # use google_cloud_storagebatchoperations_v1::model::GetJobRequest;
249 /// let x = GetJobRequest::new().set_name("example");
250 /// ```
251 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
252 self.name = v.into();
253 self
254 }
255}
256
257impl wkt::message::Message for GetJobRequest {
258 fn typename() -> &'static str {
259 "type.googleapis.com/google.cloud.storagebatchoperations.v1.GetJobRequest"
260 }
261}
262
263/// Message for creating a Job
264#[derive(Clone, Default, PartialEq)]
265#[non_exhaustive]
266pub struct CreateJobRequest {
267 /// Required. Value for parent.
268 pub parent: std::string::String,
269
270 /// Required. The optional `job_id` for this Job . If not
271 /// specified, an id is generated. `job_id` should be no more than 128
272 /// characters and must include only characters available in DNS names, as
273 /// defined by RFC-1123.
274 pub job_id: std::string::String,
275
276 /// Required. The resource being created
277 pub job: std::option::Option<crate::model::Job>,
278
279 /// Optional. An optional request ID to identify requests. Specify a unique
280 /// request ID in case you need to retry your request. Requests with same
281 /// `request_id` will be ignored for at least 60 minutes since the first
282 /// request. The request ID must be a valid UUID with the exception that zero
283 /// UUID is not supported (00000000-0000-0000-0000-000000000000).
284 pub request_id: std::string::String,
285
286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
287}
288
289impl CreateJobRequest {
290 pub fn new() -> Self {
291 std::default::Default::default()
292 }
293
294 /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
295 ///
296 /// # Example
297 /// ```ignore,no_run
298 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
299 /// let x = CreateJobRequest::new().set_parent("example");
300 /// ```
301 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
302 self.parent = v.into();
303 self
304 }
305
306 /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
307 ///
308 /// # Example
309 /// ```ignore,no_run
310 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
311 /// let x = CreateJobRequest::new().set_job_id("example");
312 /// ```
313 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
314 self.job_id = v.into();
315 self
316 }
317
318 /// Sets the value of [job][crate::model::CreateJobRequest::job].
319 ///
320 /// # Example
321 /// ```ignore,no_run
322 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
323 /// use google_cloud_storagebatchoperations_v1::model::Job;
324 /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
325 /// ```
326 pub fn set_job<T>(mut self, v: T) -> Self
327 where
328 T: std::convert::Into<crate::model::Job>,
329 {
330 self.job = std::option::Option::Some(v.into());
331 self
332 }
333
334 /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
335 ///
336 /// # Example
337 /// ```ignore,no_run
338 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
339 /// use google_cloud_storagebatchoperations_v1::model::Job;
340 /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
341 /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
342 /// ```
343 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
344 where
345 T: std::convert::Into<crate::model::Job>,
346 {
347 self.job = v.map(|x| x.into());
348 self
349 }
350
351 /// Sets the value of [request_id][crate::model::CreateJobRequest::request_id].
352 ///
353 /// # Example
354 /// ```ignore,no_run
355 /// # use google_cloud_storagebatchoperations_v1::model::CreateJobRequest;
356 /// let x = CreateJobRequest::new().set_request_id("example");
357 /// ```
358 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
359 self.request_id = v.into();
360 self
361 }
362}
363
364impl wkt::message::Message for CreateJobRequest {
365 fn typename() -> &'static str {
366 "type.googleapis.com/google.cloud.storagebatchoperations.v1.CreateJobRequest"
367 }
368}
369
370/// Message for Job to Cancel
371#[derive(Clone, Default, PartialEq)]
372#[non_exhaustive]
373pub struct CancelJobRequest {
374 /// Required. The `name` of the job to cancel.
375 /// Format: projects/{project_id}/locations/global/jobs/{job_id}.
376 pub name: std::string::String,
377
378 /// Optional. An optional request ID to identify requests. Specify a unique
379 /// request ID in case you need to retry your request. Requests with same
380 /// `request_id` will be ignored for at least 60 minutes since the first
381 /// request. The request ID must be a valid UUID with the exception that zero
382 /// UUID is not supported (00000000-0000-0000-0000-000000000000).
383 pub request_id: std::string::String,
384
385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
386}
387
388impl CancelJobRequest {
389 pub fn new() -> Self {
390 std::default::Default::default()
391 }
392
393 /// Sets the value of [name][crate::model::CancelJobRequest::name].
394 ///
395 /// # Example
396 /// ```ignore,no_run
397 /// # use google_cloud_storagebatchoperations_v1::model::CancelJobRequest;
398 /// let x = CancelJobRequest::new().set_name("example");
399 /// ```
400 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
401 self.name = v.into();
402 self
403 }
404
405 /// Sets the value of [request_id][crate::model::CancelJobRequest::request_id].
406 ///
407 /// # Example
408 /// ```ignore,no_run
409 /// # use google_cloud_storagebatchoperations_v1::model::CancelJobRequest;
410 /// let x = CancelJobRequest::new().set_request_id("example");
411 /// ```
412 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
413 self.request_id = v.into();
414 self
415 }
416}
417
418impl wkt::message::Message for CancelJobRequest {
419 fn typename() -> &'static str {
420 "type.googleapis.com/google.cloud.storagebatchoperations.v1.CancelJobRequest"
421 }
422}
423
424/// Message for deleting a Job
425#[derive(Clone, Default, PartialEq)]
426#[non_exhaustive]
427pub struct DeleteJobRequest {
428 /// Required. The `name` of the job to delete.
429 /// Format: projects/{project_id}/locations/global/jobs/{job_id} .
430 pub name: std::string::String,
431
432 /// Optional. An optional request ID to identify requests. Specify a unique
433 /// request ID in case you need to retry your request. Requests with same
434 /// `request_id` will be ignored for at least 60 minutes since the first
435 /// request. The request ID must be a valid UUID with the exception that zero
436 /// UUID is not supported (00000000-0000-0000-0000-000000000000).
437 pub request_id: std::string::String,
438
439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
440}
441
442impl DeleteJobRequest {
443 pub fn new() -> Self {
444 std::default::Default::default()
445 }
446
447 /// Sets the value of [name][crate::model::DeleteJobRequest::name].
448 ///
449 /// # Example
450 /// ```ignore,no_run
451 /// # use google_cloud_storagebatchoperations_v1::model::DeleteJobRequest;
452 /// let x = DeleteJobRequest::new().set_name("example");
453 /// ```
454 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
455 self.name = v.into();
456 self
457 }
458
459 /// Sets the value of [request_id][crate::model::DeleteJobRequest::request_id].
460 ///
461 /// # Example
462 /// ```ignore,no_run
463 /// # use google_cloud_storagebatchoperations_v1::model::DeleteJobRequest;
464 /// let x = DeleteJobRequest::new().set_request_id("example");
465 /// ```
466 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
467 self.request_id = v.into();
468 self
469 }
470}
471
472impl wkt::message::Message for DeleteJobRequest {
473 fn typename() -> &'static str {
474 "type.googleapis.com/google.cloud.storagebatchoperations.v1.DeleteJobRequest"
475 }
476}
477
478/// Message for response to cancel Job.
479#[derive(Clone, Default, PartialEq)]
480#[non_exhaustive]
481pub struct CancelJobResponse {
482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
483}
484
485impl CancelJobResponse {
486 pub fn new() -> Self {
487 std::default::Default::default()
488 }
489}
490
491impl wkt::message::Message for CancelJobResponse {
492 fn typename() -> &'static str {
493 "type.googleapis.com/google.cloud.storagebatchoperations.v1.CancelJobResponse"
494 }
495}
496
497/// Represents the metadata of the long-running operation.
498#[derive(Clone, Default, PartialEq)]
499#[non_exhaustive]
500pub struct OperationMetadata {
501 /// Output only. The unique operation resource name.
502 /// Format: projects/{project}/locations/global/operations/{operation}.
503 pub operation: std::string::String,
504
505 /// Output only. The time the operation was created.
506 pub create_time: std::option::Option<wkt::Timestamp>,
507
508 /// Output only. The time the operation finished running.
509 pub end_time: std::option::Option<wkt::Timestamp>,
510
511 /// Output only. Identifies whether the user has requested cancellation
512 /// of the operation. Operations that have been cancelled successfully
513 /// have
514 /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
515 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
516 /// corresponding to
517 /// `[Code.CANCELLED][google.rpc.Code.CANCELLED]`.
518 ///
519 /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
520 /// [google.rpc.Code.CANCELLED]: rpc::model::Code::Cancelled
521 /// [google.rpc.Status.code]: rpc::model::Status::code
522 pub requested_cancellation: bool,
523
524 /// Output only. API version used to start the operation.
525 pub api_version: std::string::String,
526
527 /// Output only. The Job associated with the operation.
528 pub job: std::option::Option<crate::model::Job>,
529
530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
531}
532
533impl OperationMetadata {
534 pub fn new() -> Self {
535 std::default::Default::default()
536 }
537
538 /// Sets the value of [operation][crate::model::OperationMetadata::operation].
539 ///
540 /// # Example
541 /// ```ignore,no_run
542 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
543 /// let x = OperationMetadata::new().set_operation("example");
544 /// ```
545 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
546 self.operation = v.into();
547 self
548 }
549
550 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
551 ///
552 /// # Example
553 /// ```ignore,no_run
554 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
555 /// use wkt::Timestamp;
556 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
557 /// ```
558 pub fn set_create_time<T>(mut self, v: T) -> Self
559 where
560 T: std::convert::Into<wkt::Timestamp>,
561 {
562 self.create_time = std::option::Option::Some(v.into());
563 self
564 }
565
566 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
567 ///
568 /// # Example
569 /// ```ignore,no_run
570 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
571 /// use wkt::Timestamp;
572 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
573 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
574 /// ```
575 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
576 where
577 T: std::convert::Into<wkt::Timestamp>,
578 {
579 self.create_time = v.map(|x| x.into());
580 self
581 }
582
583 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
584 ///
585 /// # Example
586 /// ```ignore,no_run
587 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
588 /// use wkt::Timestamp;
589 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
590 /// ```
591 pub fn set_end_time<T>(mut self, v: T) -> Self
592 where
593 T: std::convert::Into<wkt::Timestamp>,
594 {
595 self.end_time = std::option::Option::Some(v.into());
596 self
597 }
598
599 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
600 ///
601 /// # Example
602 /// ```ignore,no_run
603 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
604 /// use wkt::Timestamp;
605 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
606 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
607 /// ```
608 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
609 where
610 T: std::convert::Into<wkt::Timestamp>,
611 {
612 self.end_time = v.map(|x| x.into());
613 self
614 }
615
616 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
617 ///
618 /// # Example
619 /// ```ignore,no_run
620 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
621 /// let x = OperationMetadata::new().set_requested_cancellation(true);
622 /// ```
623 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
624 self.requested_cancellation = v.into();
625 self
626 }
627
628 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
629 ///
630 /// # Example
631 /// ```ignore,no_run
632 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
633 /// let x = OperationMetadata::new().set_api_version("example");
634 /// ```
635 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
636 self.api_version = v.into();
637 self
638 }
639
640 /// Sets the value of [job][crate::model::OperationMetadata::job].
641 ///
642 /// # Example
643 /// ```ignore,no_run
644 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
645 /// use google_cloud_storagebatchoperations_v1::model::Job;
646 /// let x = OperationMetadata::new().set_job(Job::default()/* use setters */);
647 /// ```
648 pub fn set_job<T>(mut self, v: T) -> Self
649 where
650 T: std::convert::Into<crate::model::Job>,
651 {
652 self.job = std::option::Option::Some(v.into());
653 self
654 }
655
656 /// Sets or clears the value of [job][crate::model::OperationMetadata::job].
657 ///
658 /// # Example
659 /// ```ignore,no_run
660 /// # use google_cloud_storagebatchoperations_v1::model::OperationMetadata;
661 /// use google_cloud_storagebatchoperations_v1::model::Job;
662 /// let x = OperationMetadata::new().set_or_clear_job(Some(Job::default()/* use setters */));
663 /// let x = OperationMetadata::new().set_or_clear_job(None::<Job>);
664 /// ```
665 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
666 where
667 T: std::convert::Into<crate::model::Job>,
668 {
669 self.job = v.map(|x| x.into());
670 self
671 }
672}
673
674impl wkt::message::Message for OperationMetadata {
675 fn typename() -> &'static str {
676 "type.googleapis.com/google.cloud.storagebatchoperations.v1.OperationMetadata"
677 }
678}
679
680/// The Storage Batch Operations Job description.
681#[derive(Clone, Default, PartialEq)]
682#[non_exhaustive]
683pub struct Job {
684 /// Identifier. The resource name of the Job. job_id is unique
685 /// within the project, that is either set by the customer or
686 /// defined by the service. Format:
687 /// projects/{project}/locations/global/jobs/{job_id} .
688 /// For example: "projects/123456/locations/global/jobs/job01".
689 pub name: std::string::String,
690
691 /// Optional. A description provided by the user for the job. Its max length is
692 /// 1024 bytes when Unicode-encoded.
693 pub description: std::string::String,
694
695 /// Optional. Logging configuration.
696 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
697
698 /// Output only. The time that the job was created.
699 pub create_time: std::option::Option<wkt::Timestamp>,
700
701 /// Output only. The time that the job was scheduled.
702 pub schedule_time: std::option::Option<wkt::Timestamp>,
703
704 /// Output only. The time that the job was completed.
705 pub complete_time: std::option::Option<wkt::Timestamp>,
706
707 /// Output only. Information about the progress of the job.
708 pub counters: std::option::Option<crate::model::Counters>,
709
710 /// Output only. Summarizes errors encountered with sample error log entries.
711 pub error_summaries: std::vec::Vec<crate::model::ErrorSummary>,
712
713 /// Output only. State of the job.
714 pub state: crate::model::job::State,
715
716 /// Specifies objects to be transformed.
717 pub source: std::option::Option<crate::model::job::Source>,
718
719 /// Operation to be performed on the objects.
720 pub transformation: std::option::Option<crate::model::job::Transformation>,
721
722 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
723}
724
725impl Job {
726 pub fn new() -> Self {
727 std::default::Default::default()
728 }
729
730 /// Sets the value of [name][crate::model::Job::name].
731 ///
732 /// # Example
733 /// ```ignore,no_run
734 /// # use google_cloud_storagebatchoperations_v1::model::Job;
735 /// let x = Job::new().set_name("example");
736 /// ```
737 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
738 self.name = v.into();
739 self
740 }
741
742 /// Sets the value of [description][crate::model::Job::description].
743 ///
744 /// # Example
745 /// ```ignore,no_run
746 /// # use google_cloud_storagebatchoperations_v1::model::Job;
747 /// let x = Job::new().set_description("example");
748 /// ```
749 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
750 self.description = v.into();
751 self
752 }
753
754 /// Sets the value of [logging_config][crate::model::Job::logging_config].
755 ///
756 /// # Example
757 /// ```ignore,no_run
758 /// # use google_cloud_storagebatchoperations_v1::model::Job;
759 /// use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
760 /// let x = Job::new().set_logging_config(LoggingConfig::default()/* use setters */);
761 /// ```
762 pub fn set_logging_config<T>(mut self, v: T) -> Self
763 where
764 T: std::convert::Into<crate::model::LoggingConfig>,
765 {
766 self.logging_config = std::option::Option::Some(v.into());
767 self
768 }
769
770 /// Sets or clears the value of [logging_config][crate::model::Job::logging_config].
771 ///
772 /// # Example
773 /// ```ignore,no_run
774 /// # use google_cloud_storagebatchoperations_v1::model::Job;
775 /// use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
776 /// let x = Job::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
777 /// let x = Job::new().set_or_clear_logging_config(None::<LoggingConfig>);
778 /// ```
779 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
780 where
781 T: std::convert::Into<crate::model::LoggingConfig>,
782 {
783 self.logging_config = v.map(|x| x.into());
784 self
785 }
786
787 /// Sets the value of [create_time][crate::model::Job::create_time].
788 ///
789 /// # Example
790 /// ```ignore,no_run
791 /// # use google_cloud_storagebatchoperations_v1::model::Job;
792 /// use wkt::Timestamp;
793 /// let x = Job::new().set_create_time(Timestamp::default()/* use setters */);
794 /// ```
795 pub fn set_create_time<T>(mut self, v: T) -> Self
796 where
797 T: std::convert::Into<wkt::Timestamp>,
798 {
799 self.create_time = std::option::Option::Some(v.into());
800 self
801 }
802
803 /// Sets or clears the value of [create_time][crate::model::Job::create_time].
804 ///
805 /// # Example
806 /// ```ignore,no_run
807 /// # use google_cloud_storagebatchoperations_v1::model::Job;
808 /// use wkt::Timestamp;
809 /// let x = Job::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
810 /// let x = Job::new().set_or_clear_create_time(None::<Timestamp>);
811 /// ```
812 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
813 where
814 T: std::convert::Into<wkt::Timestamp>,
815 {
816 self.create_time = v.map(|x| x.into());
817 self
818 }
819
820 /// Sets the value of [schedule_time][crate::model::Job::schedule_time].
821 ///
822 /// # Example
823 /// ```ignore,no_run
824 /// # use google_cloud_storagebatchoperations_v1::model::Job;
825 /// use wkt::Timestamp;
826 /// let x = Job::new().set_schedule_time(Timestamp::default()/* use setters */);
827 /// ```
828 pub fn set_schedule_time<T>(mut self, v: T) -> Self
829 where
830 T: std::convert::Into<wkt::Timestamp>,
831 {
832 self.schedule_time = std::option::Option::Some(v.into());
833 self
834 }
835
836 /// Sets or clears the value of [schedule_time][crate::model::Job::schedule_time].
837 ///
838 /// # Example
839 /// ```ignore,no_run
840 /// # use google_cloud_storagebatchoperations_v1::model::Job;
841 /// use wkt::Timestamp;
842 /// let x = Job::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
843 /// let x = Job::new().set_or_clear_schedule_time(None::<Timestamp>);
844 /// ```
845 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
846 where
847 T: std::convert::Into<wkt::Timestamp>,
848 {
849 self.schedule_time = v.map(|x| x.into());
850 self
851 }
852
853 /// Sets the value of [complete_time][crate::model::Job::complete_time].
854 ///
855 /// # Example
856 /// ```ignore,no_run
857 /// # use google_cloud_storagebatchoperations_v1::model::Job;
858 /// use wkt::Timestamp;
859 /// let x = Job::new().set_complete_time(Timestamp::default()/* use setters */);
860 /// ```
861 pub fn set_complete_time<T>(mut self, v: T) -> Self
862 where
863 T: std::convert::Into<wkt::Timestamp>,
864 {
865 self.complete_time = std::option::Option::Some(v.into());
866 self
867 }
868
869 /// Sets or clears the value of [complete_time][crate::model::Job::complete_time].
870 ///
871 /// # Example
872 /// ```ignore,no_run
873 /// # use google_cloud_storagebatchoperations_v1::model::Job;
874 /// use wkt::Timestamp;
875 /// let x = Job::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
876 /// let x = Job::new().set_or_clear_complete_time(None::<Timestamp>);
877 /// ```
878 pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
879 where
880 T: std::convert::Into<wkt::Timestamp>,
881 {
882 self.complete_time = v.map(|x| x.into());
883 self
884 }
885
886 /// Sets the value of [counters][crate::model::Job::counters].
887 ///
888 /// # Example
889 /// ```ignore,no_run
890 /// # use google_cloud_storagebatchoperations_v1::model::Job;
891 /// use google_cloud_storagebatchoperations_v1::model::Counters;
892 /// let x = Job::new().set_counters(Counters::default()/* use setters */);
893 /// ```
894 pub fn set_counters<T>(mut self, v: T) -> Self
895 where
896 T: std::convert::Into<crate::model::Counters>,
897 {
898 self.counters = std::option::Option::Some(v.into());
899 self
900 }
901
902 /// Sets or clears the value of [counters][crate::model::Job::counters].
903 ///
904 /// # Example
905 /// ```ignore,no_run
906 /// # use google_cloud_storagebatchoperations_v1::model::Job;
907 /// use google_cloud_storagebatchoperations_v1::model::Counters;
908 /// let x = Job::new().set_or_clear_counters(Some(Counters::default()/* use setters */));
909 /// let x = Job::new().set_or_clear_counters(None::<Counters>);
910 /// ```
911 pub fn set_or_clear_counters<T>(mut self, v: std::option::Option<T>) -> Self
912 where
913 T: std::convert::Into<crate::model::Counters>,
914 {
915 self.counters = v.map(|x| x.into());
916 self
917 }
918
919 /// Sets the value of [error_summaries][crate::model::Job::error_summaries].
920 ///
921 /// # Example
922 /// ```ignore,no_run
923 /// # use google_cloud_storagebatchoperations_v1::model::Job;
924 /// use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
925 /// let x = Job::new()
926 /// .set_error_summaries([
927 /// ErrorSummary::default()/* use setters */,
928 /// ErrorSummary::default()/* use (different) setters */,
929 /// ]);
930 /// ```
931 pub fn set_error_summaries<T, V>(mut self, v: T) -> Self
932 where
933 T: std::iter::IntoIterator<Item = V>,
934 V: std::convert::Into<crate::model::ErrorSummary>,
935 {
936 use std::iter::Iterator;
937 self.error_summaries = v.into_iter().map(|i| i.into()).collect();
938 self
939 }
940
941 /// Sets the value of [state][crate::model::Job::state].
942 ///
943 /// # Example
944 /// ```ignore,no_run
945 /// # use google_cloud_storagebatchoperations_v1::model::Job;
946 /// use google_cloud_storagebatchoperations_v1::model::job::State;
947 /// let x0 = Job::new().set_state(State::Running);
948 /// let x1 = Job::new().set_state(State::Succeeded);
949 /// let x2 = Job::new().set_state(State::Canceled);
950 /// ```
951 pub fn set_state<T: std::convert::Into<crate::model::job::State>>(mut self, v: T) -> Self {
952 self.state = v.into();
953 self
954 }
955
956 /// Sets the value of [source][crate::model::Job::source].
957 ///
958 /// Note that all the setters affecting `source` are mutually
959 /// exclusive.
960 ///
961 /// # Example
962 /// ```ignore,no_run
963 /// # use google_cloud_storagebatchoperations_v1::model::Job;
964 /// use google_cloud_storagebatchoperations_v1::model::BucketList;
965 /// let x = Job::new().set_source(Some(
966 /// google_cloud_storagebatchoperations_v1::model::job::Source::BucketList(BucketList::default().into())));
967 /// ```
968 pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::job::Source>>>(
969 mut self,
970 v: T,
971 ) -> Self {
972 self.source = v.into();
973 self
974 }
975
976 /// The value of [source][crate::model::Job::source]
977 /// if it holds a `BucketList`, `None` if the field is not set or
978 /// holds a different branch.
979 pub fn bucket_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::BucketList>> {
980 #[allow(unreachable_patterns)]
981 self.source.as_ref().and_then(|v| match v {
982 crate::model::job::Source::BucketList(v) => std::option::Option::Some(v),
983 _ => std::option::Option::None,
984 })
985 }
986
987 /// Sets the value of [source][crate::model::Job::source]
988 /// to hold a `BucketList`.
989 ///
990 /// Note that all the setters affecting `source` are
991 /// mutually exclusive.
992 ///
993 /// # Example
994 /// ```ignore,no_run
995 /// # use google_cloud_storagebatchoperations_v1::model::Job;
996 /// use google_cloud_storagebatchoperations_v1::model::BucketList;
997 /// let x = Job::new().set_bucket_list(BucketList::default()/* use setters */);
998 /// assert!(x.bucket_list().is_some());
999 /// ```
1000 pub fn set_bucket_list<T: std::convert::Into<std::boxed::Box<crate::model::BucketList>>>(
1001 mut self,
1002 v: T,
1003 ) -> Self {
1004 self.source = std::option::Option::Some(crate::model::job::Source::BucketList(v.into()));
1005 self
1006 }
1007
1008 /// Sets the value of [transformation][crate::model::Job::transformation].
1009 ///
1010 /// Note that all the setters affecting `transformation` are mutually
1011 /// exclusive.
1012 ///
1013 /// # Example
1014 /// ```ignore,no_run
1015 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1016 /// use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1017 /// let x = Job::new().set_transformation(Some(
1018 /// google_cloud_storagebatchoperations_v1::model::job::Transformation::PutObjectHold(PutObjectHold::default().into())));
1019 /// ```
1020 pub fn set_transformation<
1021 T: std::convert::Into<std::option::Option<crate::model::job::Transformation>>,
1022 >(
1023 mut self,
1024 v: T,
1025 ) -> Self {
1026 self.transformation = v.into();
1027 self
1028 }
1029
1030 /// The value of [transformation][crate::model::Job::transformation]
1031 /// if it holds a `PutObjectHold`, `None` if the field is not set or
1032 /// holds a different branch.
1033 pub fn put_object_hold(
1034 &self,
1035 ) -> std::option::Option<&std::boxed::Box<crate::model::PutObjectHold>> {
1036 #[allow(unreachable_patterns)]
1037 self.transformation.as_ref().and_then(|v| match v {
1038 crate::model::job::Transformation::PutObjectHold(v) => std::option::Option::Some(v),
1039 _ => std::option::Option::None,
1040 })
1041 }
1042
1043 /// Sets the value of [transformation][crate::model::Job::transformation]
1044 /// to hold a `PutObjectHold`.
1045 ///
1046 /// Note that all the setters affecting `transformation` are
1047 /// mutually exclusive.
1048 ///
1049 /// # Example
1050 /// ```ignore,no_run
1051 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1052 /// use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1053 /// let x = Job::new().set_put_object_hold(PutObjectHold::default()/* use setters */);
1054 /// assert!(x.put_object_hold().is_some());
1055 /// assert!(x.delete_object().is_none());
1056 /// assert!(x.put_metadata().is_none());
1057 /// assert!(x.rewrite_object().is_none());
1058 /// ```
1059 pub fn set_put_object_hold<
1060 T: std::convert::Into<std::boxed::Box<crate::model::PutObjectHold>>,
1061 >(
1062 mut self,
1063 v: T,
1064 ) -> Self {
1065 self.transformation =
1066 std::option::Option::Some(crate::model::job::Transformation::PutObjectHold(v.into()));
1067 self
1068 }
1069
1070 /// The value of [transformation][crate::model::Job::transformation]
1071 /// if it holds a `DeleteObject`, `None` if the field is not set or
1072 /// holds a different branch.
1073 pub fn delete_object(
1074 &self,
1075 ) -> std::option::Option<&std::boxed::Box<crate::model::DeleteObject>> {
1076 #[allow(unreachable_patterns)]
1077 self.transformation.as_ref().and_then(|v| match v {
1078 crate::model::job::Transformation::DeleteObject(v) => std::option::Option::Some(v),
1079 _ => std::option::Option::None,
1080 })
1081 }
1082
1083 /// Sets the value of [transformation][crate::model::Job::transformation]
1084 /// to hold a `DeleteObject`.
1085 ///
1086 /// Note that all the setters affecting `transformation` are
1087 /// mutually exclusive.
1088 ///
1089 /// # Example
1090 /// ```ignore,no_run
1091 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1092 /// use google_cloud_storagebatchoperations_v1::model::DeleteObject;
1093 /// let x = Job::new().set_delete_object(DeleteObject::default()/* use setters */);
1094 /// assert!(x.delete_object().is_some());
1095 /// assert!(x.put_object_hold().is_none());
1096 /// assert!(x.put_metadata().is_none());
1097 /// assert!(x.rewrite_object().is_none());
1098 /// ```
1099 pub fn set_delete_object<T: std::convert::Into<std::boxed::Box<crate::model::DeleteObject>>>(
1100 mut self,
1101 v: T,
1102 ) -> Self {
1103 self.transformation =
1104 std::option::Option::Some(crate::model::job::Transformation::DeleteObject(v.into()));
1105 self
1106 }
1107
1108 /// The value of [transformation][crate::model::Job::transformation]
1109 /// if it holds a `PutMetadata`, `None` if the field is not set or
1110 /// holds a different branch.
1111 pub fn put_metadata(&self) -> std::option::Option<&std::boxed::Box<crate::model::PutMetadata>> {
1112 #[allow(unreachable_patterns)]
1113 self.transformation.as_ref().and_then(|v| match v {
1114 crate::model::job::Transformation::PutMetadata(v) => std::option::Option::Some(v),
1115 _ => std::option::Option::None,
1116 })
1117 }
1118
1119 /// Sets the value of [transformation][crate::model::Job::transformation]
1120 /// to hold a `PutMetadata`.
1121 ///
1122 /// Note that all the setters affecting `transformation` are
1123 /// mutually exclusive.
1124 ///
1125 /// # Example
1126 /// ```ignore,no_run
1127 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1128 /// use google_cloud_storagebatchoperations_v1::model::PutMetadata;
1129 /// let x = Job::new().set_put_metadata(PutMetadata::default()/* use setters */);
1130 /// assert!(x.put_metadata().is_some());
1131 /// assert!(x.put_object_hold().is_none());
1132 /// assert!(x.delete_object().is_none());
1133 /// assert!(x.rewrite_object().is_none());
1134 /// ```
1135 pub fn set_put_metadata<T: std::convert::Into<std::boxed::Box<crate::model::PutMetadata>>>(
1136 mut self,
1137 v: T,
1138 ) -> Self {
1139 self.transformation =
1140 std::option::Option::Some(crate::model::job::Transformation::PutMetadata(v.into()));
1141 self
1142 }
1143
1144 /// The value of [transformation][crate::model::Job::transformation]
1145 /// if it holds a `RewriteObject`, `None` if the field is not set or
1146 /// holds a different branch.
1147 pub fn rewrite_object(
1148 &self,
1149 ) -> std::option::Option<&std::boxed::Box<crate::model::RewriteObject>> {
1150 #[allow(unreachable_patterns)]
1151 self.transformation.as_ref().and_then(|v| match v {
1152 crate::model::job::Transformation::RewriteObject(v) => std::option::Option::Some(v),
1153 _ => std::option::Option::None,
1154 })
1155 }
1156
1157 /// Sets the value of [transformation][crate::model::Job::transformation]
1158 /// to hold a `RewriteObject`.
1159 ///
1160 /// Note that all the setters affecting `transformation` are
1161 /// mutually exclusive.
1162 ///
1163 /// # Example
1164 /// ```ignore,no_run
1165 /// # use google_cloud_storagebatchoperations_v1::model::Job;
1166 /// use google_cloud_storagebatchoperations_v1::model::RewriteObject;
1167 /// let x = Job::new().set_rewrite_object(RewriteObject::default()/* use setters */);
1168 /// assert!(x.rewrite_object().is_some());
1169 /// assert!(x.put_object_hold().is_none());
1170 /// assert!(x.delete_object().is_none());
1171 /// assert!(x.put_metadata().is_none());
1172 /// ```
1173 pub fn set_rewrite_object<
1174 T: std::convert::Into<std::boxed::Box<crate::model::RewriteObject>>,
1175 >(
1176 mut self,
1177 v: T,
1178 ) -> Self {
1179 self.transformation =
1180 std::option::Option::Some(crate::model::job::Transformation::RewriteObject(v.into()));
1181 self
1182 }
1183}
1184
1185impl wkt::message::Message for Job {
1186 fn typename() -> &'static str {
1187 "type.googleapis.com/google.cloud.storagebatchoperations.v1.Job"
1188 }
1189}
1190
1191/// Defines additional types related to [Job].
1192pub mod job {
1193 #[allow(unused_imports)]
1194 use super::*;
1195
1196 /// Describes state of a job.
1197 ///
1198 /// # Working with unknown values
1199 ///
1200 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1201 /// additional enum variants at any time. Adding new variants is not considered
1202 /// a breaking change. Applications should write their code in anticipation of:
1203 ///
1204 /// - New values appearing in future releases of the client library, **and**
1205 /// - New values received dynamically, without application changes.
1206 ///
1207 /// Please consult the [Working with enums] section in the user guide for some
1208 /// guidelines.
1209 ///
1210 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1211 #[derive(Clone, Debug, PartialEq)]
1212 #[non_exhaustive]
1213 pub enum State {
1214 /// Default value. This value is unused.
1215 Unspecified,
1216 /// In progress.
1217 Running,
1218 /// Completed successfully.
1219 Succeeded,
1220 /// Cancelled by the user.
1221 Canceled,
1222 /// Terminated due to an unrecoverable failure.
1223 Failed,
1224 /// If set, the enum was initialized with an unknown value.
1225 ///
1226 /// Applications can examine the value using [State::value] or
1227 /// [State::name].
1228 UnknownValue(state::UnknownValue),
1229 }
1230
1231 #[doc(hidden)]
1232 pub mod state {
1233 #[allow(unused_imports)]
1234 use super::*;
1235 #[derive(Clone, Debug, PartialEq)]
1236 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1237 }
1238
1239 impl State {
1240 /// Gets the enum value.
1241 ///
1242 /// Returns `None` if the enum contains an unknown value deserialized from
1243 /// the string representation of enums.
1244 pub fn value(&self) -> std::option::Option<i32> {
1245 match self {
1246 Self::Unspecified => std::option::Option::Some(0),
1247 Self::Running => std::option::Option::Some(1),
1248 Self::Succeeded => std::option::Option::Some(2),
1249 Self::Canceled => std::option::Option::Some(3),
1250 Self::Failed => std::option::Option::Some(4),
1251 Self::UnknownValue(u) => u.0.value(),
1252 }
1253 }
1254
1255 /// Gets the enum value as a string.
1256 ///
1257 /// Returns `None` if the enum contains an unknown value deserialized from
1258 /// the integer representation of enums.
1259 pub fn name(&self) -> std::option::Option<&str> {
1260 match self {
1261 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1262 Self::Running => std::option::Option::Some("RUNNING"),
1263 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1264 Self::Canceled => std::option::Option::Some("CANCELED"),
1265 Self::Failed => std::option::Option::Some("FAILED"),
1266 Self::UnknownValue(u) => u.0.name(),
1267 }
1268 }
1269 }
1270
1271 impl std::default::Default for State {
1272 fn default() -> Self {
1273 use std::convert::From;
1274 Self::from(0)
1275 }
1276 }
1277
1278 impl std::fmt::Display for State {
1279 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1280 wkt::internal::display_enum(f, self.name(), self.value())
1281 }
1282 }
1283
1284 impl std::convert::From<i32> for State {
1285 fn from(value: i32) -> Self {
1286 match value {
1287 0 => Self::Unspecified,
1288 1 => Self::Running,
1289 2 => Self::Succeeded,
1290 3 => Self::Canceled,
1291 4 => Self::Failed,
1292 _ => Self::UnknownValue(state::UnknownValue(
1293 wkt::internal::UnknownEnumValue::Integer(value),
1294 )),
1295 }
1296 }
1297 }
1298
1299 impl std::convert::From<&str> for State {
1300 fn from(value: &str) -> Self {
1301 use std::string::ToString;
1302 match value {
1303 "STATE_UNSPECIFIED" => Self::Unspecified,
1304 "RUNNING" => Self::Running,
1305 "SUCCEEDED" => Self::Succeeded,
1306 "CANCELED" => Self::Canceled,
1307 "FAILED" => Self::Failed,
1308 _ => Self::UnknownValue(state::UnknownValue(
1309 wkt::internal::UnknownEnumValue::String(value.to_string()),
1310 )),
1311 }
1312 }
1313 }
1314
1315 impl serde::ser::Serialize for State {
1316 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1317 where
1318 S: serde::Serializer,
1319 {
1320 match self {
1321 Self::Unspecified => serializer.serialize_i32(0),
1322 Self::Running => serializer.serialize_i32(1),
1323 Self::Succeeded => serializer.serialize_i32(2),
1324 Self::Canceled => serializer.serialize_i32(3),
1325 Self::Failed => serializer.serialize_i32(4),
1326 Self::UnknownValue(u) => u.0.serialize(serializer),
1327 }
1328 }
1329 }
1330
1331 impl<'de> serde::de::Deserialize<'de> for State {
1332 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1333 where
1334 D: serde::Deserializer<'de>,
1335 {
1336 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1337 ".google.cloud.storagebatchoperations.v1.Job.State",
1338 ))
1339 }
1340 }
1341
1342 /// Specifies objects to be transformed.
1343 #[derive(Clone, Debug, PartialEq)]
1344 #[non_exhaustive]
1345 pub enum Source {
1346 /// Specifies a list of buckets and their objects to be transformed.
1347 BucketList(std::boxed::Box<crate::model::BucketList>),
1348 }
1349
1350 /// Operation to be performed on the objects.
1351 #[derive(Clone, Debug, PartialEq)]
1352 #[non_exhaustive]
1353 pub enum Transformation {
1354 /// Changes object hold status.
1355 PutObjectHold(std::boxed::Box<crate::model::PutObjectHold>),
1356 /// Delete objects.
1357 DeleteObject(std::boxed::Box<crate::model::DeleteObject>),
1358 /// Updates object metadata. Allows updating fixed-key and custom metadata
1359 /// and fixed-key metadata i.e. Cache-Control, Content-Disposition,
1360 /// Content-Encoding, Content-Language, Content-Type, Custom-Time.
1361 PutMetadata(std::boxed::Box<crate::model::PutMetadata>),
1362 /// Rewrite the object and updates metadata like KMS key.
1363 RewriteObject(std::boxed::Box<crate::model::RewriteObject>),
1364 }
1365}
1366
1367/// Describes list of buckets and their objects to be transformed.
1368#[derive(Clone, Default, PartialEq)]
1369#[non_exhaustive]
1370pub struct BucketList {
1371 /// Required. List of buckets and their objects to be transformed. Currently,
1372 /// only one bucket configuration is supported. If multiple buckets are
1373 /// specified, an error will be returned.
1374 pub buckets: std::vec::Vec<crate::model::bucket_list::Bucket>,
1375
1376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1377}
1378
1379impl BucketList {
1380 pub fn new() -> Self {
1381 std::default::Default::default()
1382 }
1383
1384 /// Sets the value of [buckets][crate::model::BucketList::buckets].
1385 ///
1386 /// # Example
1387 /// ```ignore,no_run
1388 /// # use google_cloud_storagebatchoperations_v1::model::BucketList;
1389 /// use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1390 /// let x = BucketList::new()
1391 /// .set_buckets([
1392 /// Bucket::default()/* use setters */,
1393 /// Bucket::default()/* use (different) setters */,
1394 /// ]);
1395 /// ```
1396 pub fn set_buckets<T, V>(mut self, v: T) -> Self
1397 where
1398 T: std::iter::IntoIterator<Item = V>,
1399 V: std::convert::Into<crate::model::bucket_list::Bucket>,
1400 {
1401 use std::iter::Iterator;
1402 self.buckets = v.into_iter().map(|i| i.into()).collect();
1403 self
1404 }
1405}
1406
1407impl wkt::message::Message for BucketList {
1408 fn typename() -> &'static str {
1409 "type.googleapis.com/google.cloud.storagebatchoperations.v1.BucketList"
1410 }
1411}
1412
1413/// Defines additional types related to [BucketList].
1414pub mod bucket_list {
1415 #[allow(unused_imports)]
1416 use super::*;
1417
1418 /// Describes configuration of a single bucket and its objects to be
1419 /// transformed.
1420 #[derive(Clone, Default, PartialEq)]
1421 #[non_exhaustive]
1422 pub struct Bucket {
1423 /// Required. Bucket name for the objects to be transformed.
1424 pub bucket: std::string::String,
1425
1426 /// Specifies objects to be transformed.
1427 pub object_configuration:
1428 std::option::Option<crate::model::bucket_list::bucket::ObjectConfiguration>,
1429
1430 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1431 }
1432
1433 impl Bucket {
1434 pub fn new() -> Self {
1435 std::default::Default::default()
1436 }
1437
1438 /// Sets the value of [bucket][crate::model::bucket_list::Bucket::bucket].
1439 ///
1440 /// # Example
1441 /// ```ignore,no_run
1442 /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1443 /// let x = Bucket::new().set_bucket("example");
1444 /// ```
1445 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1446 self.bucket = v.into();
1447 self
1448 }
1449
1450 /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration].
1451 ///
1452 /// Note that all the setters affecting `object_configuration` are mutually
1453 /// exclusive.
1454 ///
1455 /// # Example
1456 /// ```ignore,no_run
1457 /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1458 /// use google_cloud_storagebatchoperations_v1::model::PrefixList;
1459 /// let x = Bucket::new().set_object_configuration(Some(
1460 /// google_cloud_storagebatchoperations_v1::model::bucket_list::bucket::ObjectConfiguration::PrefixList(PrefixList::default().into())));
1461 /// ```
1462 pub fn set_object_configuration<
1463 T: std::convert::Into<
1464 std::option::Option<crate::model::bucket_list::bucket::ObjectConfiguration>,
1465 >,
1466 >(
1467 mut self,
1468 v: T,
1469 ) -> Self {
1470 self.object_configuration = v.into();
1471 self
1472 }
1473
1474 /// The value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
1475 /// if it holds a `PrefixList`, `None` if the field is not set or
1476 /// holds a different branch.
1477 pub fn prefix_list(
1478 &self,
1479 ) -> std::option::Option<&std::boxed::Box<crate::model::PrefixList>> {
1480 #[allow(unreachable_patterns)]
1481 self.object_configuration.as_ref().and_then(|v| match v {
1482 crate::model::bucket_list::bucket::ObjectConfiguration::PrefixList(v) => {
1483 std::option::Option::Some(v)
1484 }
1485 _ => std::option::Option::None,
1486 })
1487 }
1488
1489 /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
1490 /// to hold a `PrefixList`.
1491 ///
1492 /// Note that all the setters affecting `object_configuration` are
1493 /// mutually exclusive.
1494 ///
1495 /// # Example
1496 /// ```ignore,no_run
1497 /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1498 /// use google_cloud_storagebatchoperations_v1::model::PrefixList;
1499 /// let x = Bucket::new().set_prefix_list(PrefixList::default()/* use setters */);
1500 /// assert!(x.prefix_list().is_some());
1501 /// assert!(x.manifest().is_none());
1502 /// ```
1503 pub fn set_prefix_list<T: std::convert::Into<std::boxed::Box<crate::model::PrefixList>>>(
1504 mut self,
1505 v: T,
1506 ) -> Self {
1507 self.object_configuration = std::option::Option::Some(
1508 crate::model::bucket_list::bucket::ObjectConfiguration::PrefixList(v.into()),
1509 );
1510 self
1511 }
1512
1513 /// The value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
1514 /// if it holds a `Manifest`, `None` if the field is not set or
1515 /// holds a different branch.
1516 pub fn manifest(&self) -> std::option::Option<&std::boxed::Box<crate::model::Manifest>> {
1517 #[allow(unreachable_patterns)]
1518 self.object_configuration.as_ref().and_then(|v| match v {
1519 crate::model::bucket_list::bucket::ObjectConfiguration::Manifest(v) => {
1520 std::option::Option::Some(v)
1521 }
1522 _ => std::option::Option::None,
1523 })
1524 }
1525
1526 /// Sets the value of [object_configuration][crate::model::bucket_list::Bucket::object_configuration]
1527 /// to hold a `Manifest`.
1528 ///
1529 /// Note that all the setters affecting `object_configuration` are
1530 /// mutually exclusive.
1531 ///
1532 /// # Example
1533 /// ```ignore,no_run
1534 /// # use google_cloud_storagebatchoperations_v1::model::bucket_list::Bucket;
1535 /// use google_cloud_storagebatchoperations_v1::model::Manifest;
1536 /// let x = Bucket::new().set_manifest(Manifest::default()/* use setters */);
1537 /// assert!(x.manifest().is_some());
1538 /// assert!(x.prefix_list().is_none());
1539 /// ```
1540 pub fn set_manifest<T: std::convert::Into<std::boxed::Box<crate::model::Manifest>>>(
1541 mut self,
1542 v: T,
1543 ) -> Self {
1544 self.object_configuration = std::option::Option::Some(
1545 crate::model::bucket_list::bucket::ObjectConfiguration::Manifest(v.into()),
1546 );
1547 self
1548 }
1549 }
1550
1551 impl wkt::message::Message for Bucket {
1552 fn typename() -> &'static str {
1553 "type.googleapis.com/google.cloud.storagebatchoperations.v1.BucketList.Bucket"
1554 }
1555 }
1556
1557 /// Defines additional types related to [Bucket].
1558 pub mod bucket {
1559 #[allow(unused_imports)]
1560 use super::*;
1561
1562 /// Specifies objects to be transformed.
1563 #[derive(Clone, Debug, PartialEq)]
1564 #[non_exhaustive]
1565 pub enum ObjectConfiguration {
1566 /// Specifies objects matching a prefix set.
1567 PrefixList(std::boxed::Box<crate::model::PrefixList>),
1568 /// Specifies objects in a manifest file.
1569 Manifest(std::boxed::Box<crate::model::Manifest>),
1570 }
1571 }
1572}
1573
1574/// Describes list of objects to be transformed.
1575#[derive(Clone, Default, PartialEq)]
1576#[non_exhaustive]
1577pub struct Manifest {
1578 /// Required. `manifest_location` must contain the manifest source file that is
1579 /// a CSV file in a Google Cloud Storage bucket. Each row in the file must
1580 /// include the object details i.e. BucketId and Name. Generation may
1581 /// optionally be specified. When it is not specified the live object is acted
1582 /// upon.
1583 /// `manifest_location` should either be
1584 ///
1585 /// 1. An absolute path to the object in the format of
1586 /// `gs://bucket_name/path/file_name.csv`.
1587 /// 1. An absolute path with a single wildcard character in the file name, for
1588 /// example `gs://bucket_name/path/file_name*.csv`.
1589 /// If manifest location is specified with a wildcard, objects in all manifest
1590 /// files matching the pattern will be acted upon.
1591 pub manifest_location: std::string::String,
1592
1593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1594}
1595
1596impl Manifest {
1597 pub fn new() -> Self {
1598 std::default::Default::default()
1599 }
1600
1601 /// Sets the value of [manifest_location][crate::model::Manifest::manifest_location].
1602 ///
1603 /// # Example
1604 /// ```ignore,no_run
1605 /// # use google_cloud_storagebatchoperations_v1::model::Manifest;
1606 /// let x = Manifest::new().set_manifest_location("example");
1607 /// ```
1608 pub fn set_manifest_location<T: std::convert::Into<std::string::String>>(
1609 mut self,
1610 v: T,
1611 ) -> Self {
1612 self.manifest_location = v.into();
1613 self
1614 }
1615}
1616
1617impl wkt::message::Message for Manifest {
1618 fn typename() -> &'static str {
1619 "type.googleapis.com/google.cloud.storagebatchoperations.v1.Manifest"
1620 }
1621}
1622
1623/// Describes prefixes of objects to be transformed.
1624#[derive(Clone, Default, PartialEq)]
1625#[non_exhaustive]
1626pub struct PrefixList {
1627 /// Optional. Include prefixes of the objects to be transformed.
1628 ///
1629 /// * Supports full object name
1630 /// * Supports prefix of the object name
1631 /// * Wildcards are not supported
1632 /// * Supports empty string for all objects in a bucket.
1633 pub included_object_prefixes: std::vec::Vec<std::string::String>,
1634
1635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1636}
1637
1638impl PrefixList {
1639 pub fn new() -> Self {
1640 std::default::Default::default()
1641 }
1642
1643 /// Sets the value of [included_object_prefixes][crate::model::PrefixList::included_object_prefixes].
1644 ///
1645 /// # Example
1646 /// ```ignore,no_run
1647 /// # use google_cloud_storagebatchoperations_v1::model::PrefixList;
1648 /// let x = PrefixList::new().set_included_object_prefixes(["a", "b", "c"]);
1649 /// ```
1650 pub fn set_included_object_prefixes<T, V>(mut self, v: T) -> Self
1651 where
1652 T: std::iter::IntoIterator<Item = V>,
1653 V: std::convert::Into<std::string::String>,
1654 {
1655 use std::iter::Iterator;
1656 self.included_object_prefixes = v.into_iter().map(|i| i.into()).collect();
1657 self
1658 }
1659}
1660
1661impl wkt::message::Message for PrefixList {
1662 fn typename() -> &'static str {
1663 "type.googleapis.com/google.cloud.storagebatchoperations.v1.PrefixList"
1664 }
1665}
1666
1667/// Describes options to update object hold.
1668#[derive(Clone, Default, PartialEq)]
1669#[non_exhaustive]
1670pub struct PutObjectHold {
1671 /// Required. Updates object temporary holds state. When object temporary hold
1672 /// is set, object cannot be deleted or replaced.
1673 pub temporary_hold: crate::model::put_object_hold::HoldStatus,
1674
1675 /// Required. Updates object event based holds state. When object event based
1676 /// hold is set, object cannot be deleted or replaced. Resets object's time in
1677 /// the bucket for the purposes of the retention period.
1678 pub event_based_hold: crate::model::put_object_hold::HoldStatus,
1679
1680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1681}
1682
1683impl PutObjectHold {
1684 pub fn new() -> Self {
1685 std::default::Default::default()
1686 }
1687
1688 /// Sets the value of [temporary_hold][crate::model::PutObjectHold::temporary_hold].
1689 ///
1690 /// # Example
1691 /// ```ignore,no_run
1692 /// # use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1693 /// use google_cloud_storagebatchoperations_v1::model::put_object_hold::HoldStatus;
1694 /// let x0 = PutObjectHold::new().set_temporary_hold(HoldStatus::Set);
1695 /// let x1 = PutObjectHold::new().set_temporary_hold(HoldStatus::Unset);
1696 /// ```
1697 pub fn set_temporary_hold<T: std::convert::Into<crate::model::put_object_hold::HoldStatus>>(
1698 mut self,
1699 v: T,
1700 ) -> Self {
1701 self.temporary_hold = v.into();
1702 self
1703 }
1704
1705 /// Sets the value of [event_based_hold][crate::model::PutObjectHold::event_based_hold].
1706 ///
1707 /// # Example
1708 /// ```ignore,no_run
1709 /// # use google_cloud_storagebatchoperations_v1::model::PutObjectHold;
1710 /// use google_cloud_storagebatchoperations_v1::model::put_object_hold::HoldStatus;
1711 /// let x0 = PutObjectHold::new().set_event_based_hold(HoldStatus::Set);
1712 /// let x1 = PutObjectHold::new().set_event_based_hold(HoldStatus::Unset);
1713 /// ```
1714 pub fn set_event_based_hold<
1715 T: std::convert::Into<crate::model::put_object_hold::HoldStatus>,
1716 >(
1717 mut self,
1718 v: T,
1719 ) -> Self {
1720 self.event_based_hold = v.into();
1721 self
1722 }
1723}
1724
1725impl wkt::message::Message for PutObjectHold {
1726 fn typename() -> &'static str {
1727 "type.googleapis.com/google.cloud.storagebatchoperations.v1.PutObjectHold"
1728 }
1729}
1730
1731/// Defines additional types related to [PutObjectHold].
1732pub mod put_object_hold {
1733 #[allow(unused_imports)]
1734 use super::*;
1735
1736 /// Describes the status of the hold.
1737 ///
1738 /// # Working with unknown values
1739 ///
1740 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1741 /// additional enum variants at any time. Adding new variants is not considered
1742 /// a breaking change. Applications should write their code in anticipation of:
1743 ///
1744 /// - New values appearing in future releases of the client library, **and**
1745 /// - New values received dynamically, without application changes.
1746 ///
1747 /// Please consult the [Working with enums] section in the user guide for some
1748 /// guidelines.
1749 ///
1750 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1751 #[derive(Clone, Debug, PartialEq)]
1752 #[non_exhaustive]
1753 pub enum HoldStatus {
1754 /// Default value, Object hold status will not be changed.
1755 Unspecified,
1756 /// Places the hold.
1757 Set,
1758 /// Releases the hold.
1759 Unset,
1760 /// If set, the enum was initialized with an unknown value.
1761 ///
1762 /// Applications can examine the value using [HoldStatus::value] or
1763 /// [HoldStatus::name].
1764 UnknownValue(hold_status::UnknownValue),
1765 }
1766
1767 #[doc(hidden)]
1768 pub mod hold_status {
1769 #[allow(unused_imports)]
1770 use super::*;
1771 #[derive(Clone, Debug, PartialEq)]
1772 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1773 }
1774
1775 impl HoldStatus {
1776 /// Gets the enum value.
1777 ///
1778 /// Returns `None` if the enum contains an unknown value deserialized from
1779 /// the string representation of enums.
1780 pub fn value(&self) -> std::option::Option<i32> {
1781 match self {
1782 Self::Unspecified => std::option::Option::Some(0),
1783 Self::Set => std::option::Option::Some(1),
1784 Self::Unset => std::option::Option::Some(2),
1785 Self::UnknownValue(u) => u.0.value(),
1786 }
1787 }
1788
1789 /// Gets the enum value as a string.
1790 ///
1791 /// Returns `None` if the enum contains an unknown value deserialized from
1792 /// the integer representation of enums.
1793 pub fn name(&self) -> std::option::Option<&str> {
1794 match self {
1795 Self::Unspecified => std::option::Option::Some("HOLD_STATUS_UNSPECIFIED"),
1796 Self::Set => std::option::Option::Some("SET"),
1797 Self::Unset => std::option::Option::Some("UNSET"),
1798 Self::UnknownValue(u) => u.0.name(),
1799 }
1800 }
1801 }
1802
1803 impl std::default::Default for HoldStatus {
1804 fn default() -> Self {
1805 use std::convert::From;
1806 Self::from(0)
1807 }
1808 }
1809
1810 impl std::fmt::Display for HoldStatus {
1811 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1812 wkt::internal::display_enum(f, self.name(), self.value())
1813 }
1814 }
1815
1816 impl std::convert::From<i32> for HoldStatus {
1817 fn from(value: i32) -> Self {
1818 match value {
1819 0 => Self::Unspecified,
1820 1 => Self::Set,
1821 2 => Self::Unset,
1822 _ => Self::UnknownValue(hold_status::UnknownValue(
1823 wkt::internal::UnknownEnumValue::Integer(value),
1824 )),
1825 }
1826 }
1827 }
1828
1829 impl std::convert::From<&str> for HoldStatus {
1830 fn from(value: &str) -> Self {
1831 use std::string::ToString;
1832 match value {
1833 "HOLD_STATUS_UNSPECIFIED" => Self::Unspecified,
1834 "SET" => Self::Set,
1835 "UNSET" => Self::Unset,
1836 _ => Self::UnknownValue(hold_status::UnknownValue(
1837 wkt::internal::UnknownEnumValue::String(value.to_string()),
1838 )),
1839 }
1840 }
1841 }
1842
1843 impl serde::ser::Serialize for HoldStatus {
1844 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1845 where
1846 S: serde::Serializer,
1847 {
1848 match self {
1849 Self::Unspecified => serializer.serialize_i32(0),
1850 Self::Set => serializer.serialize_i32(1),
1851 Self::Unset => serializer.serialize_i32(2),
1852 Self::UnknownValue(u) => u.0.serialize(serializer),
1853 }
1854 }
1855 }
1856
1857 impl<'de> serde::de::Deserialize<'de> for HoldStatus {
1858 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1859 where
1860 D: serde::Deserializer<'de>,
1861 {
1862 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HoldStatus>::new(
1863 ".google.cloud.storagebatchoperations.v1.PutObjectHold.HoldStatus",
1864 ))
1865 }
1866 }
1867}
1868
1869/// Describes options to delete an object.
1870#[derive(Clone, Default, PartialEq)]
1871#[non_exhaustive]
1872pub struct DeleteObject {
1873 /// Required. Controls deletion behavior when versioning is enabled for the
1874 /// object's bucket. If true both live and noncurrent objects will be
1875 /// permanently deleted. Otherwise live objects in versioned buckets will
1876 /// become noncurrent and objects that were already noncurrent will be skipped.
1877 /// This setting doesn't have any impact on the Soft Delete feature. All
1878 /// objects deleted by this service can be be restored for the duration of the
1879 /// Soft Delete retention duration if enabled. If enabled and the manifest
1880 /// doesn't specify an object's generation, a GetObjectMetadata call (a Class B
1881 /// operation) will be made to determine the live object generation.
1882 pub permanent_object_deletion_enabled: bool,
1883
1884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1885}
1886
1887impl DeleteObject {
1888 pub fn new() -> Self {
1889 std::default::Default::default()
1890 }
1891
1892 /// Sets the value of [permanent_object_deletion_enabled][crate::model::DeleteObject::permanent_object_deletion_enabled].
1893 ///
1894 /// # Example
1895 /// ```ignore,no_run
1896 /// # use google_cloud_storagebatchoperations_v1::model::DeleteObject;
1897 /// let x = DeleteObject::new().set_permanent_object_deletion_enabled(true);
1898 /// ```
1899 pub fn set_permanent_object_deletion_enabled<T: std::convert::Into<bool>>(
1900 mut self,
1901 v: T,
1902 ) -> Self {
1903 self.permanent_object_deletion_enabled = v.into();
1904 self
1905 }
1906}
1907
1908impl wkt::message::Message for DeleteObject {
1909 fn typename() -> &'static str {
1910 "type.googleapis.com/google.cloud.storagebatchoperations.v1.DeleteObject"
1911 }
1912}
1913
1914/// Describes options for object rewrite.
1915#[derive(Clone, Default, PartialEq)]
1916#[non_exhaustive]
1917pub struct RewriteObject {
1918 /// Required. Resource name of the Cloud KMS key that will be used to encrypt
1919 /// the object. The Cloud KMS key must be located in same location as the
1920 /// object. Refer to
1921 /// <https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key>
1922 /// for additional documentation. Format:
1923 /// projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}
1924 /// For example:
1925 /// "projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key".
1926 /// The object will be rewritten and set with the specified KMS key.
1927 pub kms_key: std::option::Option<std::string::String>,
1928
1929 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1930}
1931
1932impl RewriteObject {
1933 pub fn new() -> Self {
1934 std::default::Default::default()
1935 }
1936
1937 /// Sets the value of [kms_key][crate::model::RewriteObject::kms_key].
1938 ///
1939 /// # Example
1940 /// ```ignore,no_run
1941 /// # use google_cloud_storagebatchoperations_v1::model::RewriteObject;
1942 /// let x = RewriteObject::new().set_kms_key("example");
1943 /// ```
1944 pub fn set_kms_key<T>(mut self, v: T) -> Self
1945 where
1946 T: std::convert::Into<std::string::String>,
1947 {
1948 self.kms_key = std::option::Option::Some(v.into());
1949 self
1950 }
1951
1952 /// Sets or clears the value of [kms_key][crate::model::RewriteObject::kms_key].
1953 ///
1954 /// # Example
1955 /// ```ignore,no_run
1956 /// # use google_cloud_storagebatchoperations_v1::model::RewriteObject;
1957 /// let x = RewriteObject::new().set_or_clear_kms_key(Some("example"));
1958 /// let x = RewriteObject::new().set_or_clear_kms_key(None::<String>);
1959 /// ```
1960 pub fn set_or_clear_kms_key<T>(mut self, v: std::option::Option<T>) -> Self
1961 where
1962 T: std::convert::Into<std::string::String>,
1963 {
1964 self.kms_key = v.map(|x| x.into());
1965 self
1966 }
1967}
1968
1969impl wkt::message::Message for RewriteObject {
1970 fn typename() -> &'static str {
1971 "type.googleapis.com/google.cloud.storagebatchoperations.v1.RewriteObject"
1972 }
1973}
1974
1975/// Describes options for object metadata update.
1976#[derive(Clone, Default, PartialEq)]
1977#[non_exhaustive]
1978pub struct PutMetadata {
1979 /// Optional. Updates objects Content-Disposition fixed metadata. Unset values
1980 /// will be ignored. Set empty values to clear the metadata. Refer
1981 /// <https://cloud.google.com/storage/docs/metadata#content-disposition> for
1982 /// additional documentation.
1983 pub content_disposition: std::option::Option<std::string::String>,
1984
1985 /// Optional. Updates objects Content-Encoding fixed metadata. Unset values
1986 /// will be ignored. Set empty values to clear the metadata. Refer to
1987 /// documentation in
1988 /// <https://cloud.google.com/storage/docs/metadata#content-encoding>.
1989 pub content_encoding: std::option::Option<std::string::String>,
1990
1991 /// Optional. Updates objects Content-Language fixed metadata. Refer to ISO
1992 /// 639-1 language codes for typical values of this metadata. Max length 100
1993 /// characters. Unset values will be ignored. Set empty values to clear the
1994 /// metadata. Refer to documentation in
1995 /// <https://cloud.google.com/storage/docs/metadata#content-language>.
1996 pub content_language: std::option::Option<std::string::String>,
1997
1998 /// Optional. Updates objects Content-Type fixed metadata. Unset values will be
1999 /// ignored.
2000 /// Set empty values to clear the metadata. Refer to documentation in
2001 /// <https://cloud.google.com/storage/docs/metadata#content-type>
2002 pub content_type: std::option::Option<std::string::String>,
2003
2004 /// Optional. Updates objects Cache-Control fixed metadata. Unset values will
2005 /// be
2006 /// ignored. Set empty values to clear the metadata.
2007 /// Additionally, the value for Custom-Time cannot decrease. Refer to
2008 /// documentation in
2009 /// <https://cloud.google.com/storage/docs/metadata#caching_data>.
2010 pub cache_control: std::option::Option<std::string::String>,
2011
2012 /// Optional. Updates objects Custom-Time fixed metadata. Unset values will be
2013 /// ignored. Set empty values to clear the metadata. Refer to documentation in
2014 /// <https://cloud.google.com/storage/docs/metadata#custom-time>.
2015 pub custom_time: std::option::Option<std::string::String>,
2016
2017 /// Optional. Updates objects custom metadata. Adds or sets individual custom
2018 /// metadata key value pairs on objects. Keys that are set with empty custom
2019 /// metadata values will have its value cleared. Existing custom metadata not
2020 /// specified with this flag is not changed. Refer to documentation in
2021 /// <https://cloud.google.com/storage/docs/metadata#custom-metadata>
2022 pub custom_metadata: std::collections::HashMap<std::string::String, std::string::String>,
2023
2024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2025}
2026
2027impl PutMetadata {
2028 pub fn new() -> Self {
2029 std::default::Default::default()
2030 }
2031
2032 /// Sets the value of [content_disposition][crate::model::PutMetadata::content_disposition].
2033 ///
2034 /// # Example
2035 /// ```ignore,no_run
2036 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2037 /// let x = PutMetadata::new().set_content_disposition("example");
2038 /// ```
2039 pub fn set_content_disposition<T>(mut self, v: T) -> Self
2040 where
2041 T: std::convert::Into<std::string::String>,
2042 {
2043 self.content_disposition = std::option::Option::Some(v.into());
2044 self
2045 }
2046
2047 /// Sets or clears the value of [content_disposition][crate::model::PutMetadata::content_disposition].
2048 ///
2049 /// # Example
2050 /// ```ignore,no_run
2051 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2052 /// let x = PutMetadata::new().set_or_clear_content_disposition(Some("example"));
2053 /// let x = PutMetadata::new().set_or_clear_content_disposition(None::<String>);
2054 /// ```
2055 pub fn set_or_clear_content_disposition<T>(mut self, v: std::option::Option<T>) -> Self
2056 where
2057 T: std::convert::Into<std::string::String>,
2058 {
2059 self.content_disposition = v.map(|x| x.into());
2060 self
2061 }
2062
2063 /// Sets the value of [content_encoding][crate::model::PutMetadata::content_encoding].
2064 ///
2065 /// # Example
2066 /// ```ignore,no_run
2067 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2068 /// let x = PutMetadata::new().set_content_encoding("example");
2069 /// ```
2070 pub fn set_content_encoding<T>(mut self, v: T) -> Self
2071 where
2072 T: std::convert::Into<std::string::String>,
2073 {
2074 self.content_encoding = std::option::Option::Some(v.into());
2075 self
2076 }
2077
2078 /// Sets or clears the value of [content_encoding][crate::model::PutMetadata::content_encoding].
2079 ///
2080 /// # Example
2081 /// ```ignore,no_run
2082 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2083 /// let x = PutMetadata::new().set_or_clear_content_encoding(Some("example"));
2084 /// let x = PutMetadata::new().set_or_clear_content_encoding(None::<String>);
2085 /// ```
2086 pub fn set_or_clear_content_encoding<T>(mut self, v: std::option::Option<T>) -> Self
2087 where
2088 T: std::convert::Into<std::string::String>,
2089 {
2090 self.content_encoding = v.map(|x| x.into());
2091 self
2092 }
2093
2094 /// Sets the value of [content_language][crate::model::PutMetadata::content_language].
2095 ///
2096 /// # Example
2097 /// ```ignore,no_run
2098 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2099 /// let x = PutMetadata::new().set_content_language("example");
2100 /// ```
2101 pub fn set_content_language<T>(mut self, v: T) -> Self
2102 where
2103 T: std::convert::Into<std::string::String>,
2104 {
2105 self.content_language = std::option::Option::Some(v.into());
2106 self
2107 }
2108
2109 /// Sets or clears the value of [content_language][crate::model::PutMetadata::content_language].
2110 ///
2111 /// # Example
2112 /// ```ignore,no_run
2113 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2114 /// let x = PutMetadata::new().set_or_clear_content_language(Some("example"));
2115 /// let x = PutMetadata::new().set_or_clear_content_language(None::<String>);
2116 /// ```
2117 pub fn set_or_clear_content_language<T>(mut self, v: std::option::Option<T>) -> Self
2118 where
2119 T: std::convert::Into<std::string::String>,
2120 {
2121 self.content_language = v.map(|x| x.into());
2122 self
2123 }
2124
2125 /// Sets the value of [content_type][crate::model::PutMetadata::content_type].
2126 ///
2127 /// # Example
2128 /// ```ignore,no_run
2129 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2130 /// let x = PutMetadata::new().set_content_type("example");
2131 /// ```
2132 pub fn set_content_type<T>(mut self, v: T) -> Self
2133 where
2134 T: std::convert::Into<std::string::String>,
2135 {
2136 self.content_type = std::option::Option::Some(v.into());
2137 self
2138 }
2139
2140 /// Sets or clears the value of [content_type][crate::model::PutMetadata::content_type].
2141 ///
2142 /// # Example
2143 /// ```ignore,no_run
2144 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2145 /// let x = PutMetadata::new().set_or_clear_content_type(Some("example"));
2146 /// let x = PutMetadata::new().set_or_clear_content_type(None::<String>);
2147 /// ```
2148 pub fn set_or_clear_content_type<T>(mut self, v: std::option::Option<T>) -> Self
2149 where
2150 T: std::convert::Into<std::string::String>,
2151 {
2152 self.content_type = v.map(|x| x.into());
2153 self
2154 }
2155
2156 /// Sets the value of [cache_control][crate::model::PutMetadata::cache_control].
2157 ///
2158 /// # Example
2159 /// ```ignore,no_run
2160 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2161 /// let x = PutMetadata::new().set_cache_control("example");
2162 /// ```
2163 pub fn set_cache_control<T>(mut self, v: T) -> Self
2164 where
2165 T: std::convert::Into<std::string::String>,
2166 {
2167 self.cache_control = std::option::Option::Some(v.into());
2168 self
2169 }
2170
2171 /// Sets or clears the value of [cache_control][crate::model::PutMetadata::cache_control].
2172 ///
2173 /// # Example
2174 /// ```ignore,no_run
2175 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2176 /// let x = PutMetadata::new().set_or_clear_cache_control(Some("example"));
2177 /// let x = PutMetadata::new().set_or_clear_cache_control(None::<String>);
2178 /// ```
2179 pub fn set_or_clear_cache_control<T>(mut self, v: std::option::Option<T>) -> Self
2180 where
2181 T: std::convert::Into<std::string::String>,
2182 {
2183 self.cache_control = v.map(|x| x.into());
2184 self
2185 }
2186
2187 /// Sets the value of [custom_time][crate::model::PutMetadata::custom_time].
2188 ///
2189 /// # Example
2190 /// ```ignore,no_run
2191 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2192 /// let x = PutMetadata::new().set_custom_time("example");
2193 /// ```
2194 pub fn set_custom_time<T>(mut self, v: T) -> Self
2195 where
2196 T: std::convert::Into<std::string::String>,
2197 {
2198 self.custom_time = std::option::Option::Some(v.into());
2199 self
2200 }
2201
2202 /// Sets or clears the value of [custom_time][crate::model::PutMetadata::custom_time].
2203 ///
2204 /// # Example
2205 /// ```ignore,no_run
2206 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2207 /// let x = PutMetadata::new().set_or_clear_custom_time(Some("example"));
2208 /// let x = PutMetadata::new().set_or_clear_custom_time(None::<String>);
2209 /// ```
2210 pub fn set_or_clear_custom_time<T>(mut self, v: std::option::Option<T>) -> Self
2211 where
2212 T: std::convert::Into<std::string::String>,
2213 {
2214 self.custom_time = v.map(|x| x.into());
2215 self
2216 }
2217
2218 /// Sets the value of [custom_metadata][crate::model::PutMetadata::custom_metadata].
2219 ///
2220 /// # Example
2221 /// ```ignore,no_run
2222 /// # use google_cloud_storagebatchoperations_v1::model::PutMetadata;
2223 /// let x = PutMetadata::new().set_custom_metadata([
2224 /// ("key0", "abc"),
2225 /// ("key1", "xyz"),
2226 /// ]);
2227 /// ```
2228 pub fn set_custom_metadata<T, K, V>(mut self, v: T) -> Self
2229 where
2230 T: std::iter::IntoIterator<Item = (K, V)>,
2231 K: std::convert::Into<std::string::String>,
2232 V: std::convert::Into<std::string::String>,
2233 {
2234 use std::iter::Iterator;
2235 self.custom_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2236 self
2237 }
2238}
2239
2240impl wkt::message::Message for PutMetadata {
2241 fn typename() -> &'static str {
2242 "type.googleapis.com/google.cloud.storagebatchoperations.v1.PutMetadata"
2243 }
2244}
2245
2246/// A summary of errors by error code, plus a count and sample error log
2247/// entries.
2248#[derive(Clone, Default, PartialEq)]
2249#[non_exhaustive]
2250pub struct ErrorSummary {
2251 /// Required. The canonical error code.
2252 pub error_code: rpc::model::Code,
2253
2254 /// Required. Number of errors encountered per `error_code`.
2255 pub error_count: i64,
2256
2257 /// Required. Sample error logs.
2258 pub error_log_entries: std::vec::Vec<crate::model::ErrorLogEntry>,
2259
2260 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2261}
2262
2263impl ErrorSummary {
2264 pub fn new() -> Self {
2265 std::default::Default::default()
2266 }
2267
2268 /// Sets the value of [error_code][crate::model::ErrorSummary::error_code].
2269 ///
2270 /// # Example
2271 /// ```ignore,no_run
2272 /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
2273 /// use rpc::model::Code;
2274 /// let x0 = ErrorSummary::new().set_error_code(Code::Cancelled);
2275 /// let x1 = ErrorSummary::new().set_error_code(Code::Unknown);
2276 /// let x2 = ErrorSummary::new().set_error_code(Code::InvalidArgument);
2277 /// ```
2278 pub fn set_error_code<T: std::convert::Into<rpc::model::Code>>(mut self, v: T) -> Self {
2279 self.error_code = v.into();
2280 self
2281 }
2282
2283 /// Sets the value of [error_count][crate::model::ErrorSummary::error_count].
2284 ///
2285 /// # Example
2286 /// ```ignore,no_run
2287 /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
2288 /// let x = ErrorSummary::new().set_error_count(42);
2289 /// ```
2290 pub fn set_error_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2291 self.error_count = v.into();
2292 self
2293 }
2294
2295 /// Sets the value of [error_log_entries][crate::model::ErrorSummary::error_log_entries].
2296 ///
2297 /// # Example
2298 /// ```ignore,no_run
2299 /// # use google_cloud_storagebatchoperations_v1::model::ErrorSummary;
2300 /// use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
2301 /// let x = ErrorSummary::new()
2302 /// .set_error_log_entries([
2303 /// ErrorLogEntry::default()/* use setters */,
2304 /// ErrorLogEntry::default()/* use (different) setters */,
2305 /// ]);
2306 /// ```
2307 pub fn set_error_log_entries<T, V>(mut self, v: T) -> Self
2308 where
2309 T: std::iter::IntoIterator<Item = V>,
2310 V: std::convert::Into<crate::model::ErrorLogEntry>,
2311 {
2312 use std::iter::Iterator;
2313 self.error_log_entries = v.into_iter().map(|i| i.into()).collect();
2314 self
2315 }
2316}
2317
2318impl wkt::message::Message for ErrorSummary {
2319 fn typename() -> &'static str {
2320 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ErrorSummary"
2321 }
2322}
2323
2324/// An entry describing an error that has occurred.
2325#[derive(Clone, Default, PartialEq)]
2326#[non_exhaustive]
2327pub struct ErrorLogEntry {
2328 /// Required. Output only. Object URL. e.g. gs://my_bucket/object.txt
2329 pub object_uri: std::string::String,
2330
2331 /// Optional. Output only. At most 5 error log entries are recorded for a given
2332 /// error code for a job.
2333 pub error_details: std::vec::Vec<std::string::String>,
2334
2335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2336}
2337
2338impl ErrorLogEntry {
2339 pub fn new() -> Self {
2340 std::default::Default::default()
2341 }
2342
2343 /// Sets the value of [object_uri][crate::model::ErrorLogEntry::object_uri].
2344 ///
2345 /// # Example
2346 /// ```ignore,no_run
2347 /// # use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
2348 /// let x = ErrorLogEntry::new().set_object_uri("example");
2349 /// ```
2350 pub fn set_object_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2351 self.object_uri = v.into();
2352 self
2353 }
2354
2355 /// Sets the value of [error_details][crate::model::ErrorLogEntry::error_details].
2356 ///
2357 /// # Example
2358 /// ```ignore,no_run
2359 /// # use google_cloud_storagebatchoperations_v1::model::ErrorLogEntry;
2360 /// let x = ErrorLogEntry::new().set_error_details(["a", "b", "c"]);
2361 /// ```
2362 pub fn set_error_details<T, V>(mut self, v: T) -> Self
2363 where
2364 T: std::iter::IntoIterator<Item = V>,
2365 V: std::convert::Into<std::string::String>,
2366 {
2367 use std::iter::Iterator;
2368 self.error_details = v.into_iter().map(|i| i.into()).collect();
2369 self
2370 }
2371}
2372
2373impl wkt::message::Message for ErrorLogEntry {
2374 fn typename() -> &'static str {
2375 "type.googleapis.com/google.cloud.storagebatchoperations.v1.ErrorLogEntry"
2376 }
2377}
2378
2379/// Describes details about the progress of the job.
2380#[derive(Clone, Default, PartialEq)]
2381#[non_exhaustive]
2382pub struct Counters {
2383 /// Output only. Number of objects listed.
2384 pub total_object_count: i64,
2385
2386 /// Output only. Number of objects completed.
2387 pub succeeded_object_count: i64,
2388
2389 /// Output only. Number of objects failed.
2390 pub failed_object_count: i64,
2391
2392 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2393}
2394
2395impl Counters {
2396 pub fn new() -> Self {
2397 std::default::Default::default()
2398 }
2399
2400 /// Sets the value of [total_object_count][crate::model::Counters::total_object_count].
2401 ///
2402 /// # Example
2403 /// ```ignore,no_run
2404 /// # use google_cloud_storagebatchoperations_v1::model::Counters;
2405 /// let x = Counters::new().set_total_object_count(42);
2406 /// ```
2407 pub fn set_total_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2408 self.total_object_count = v.into();
2409 self
2410 }
2411
2412 /// Sets the value of [succeeded_object_count][crate::model::Counters::succeeded_object_count].
2413 ///
2414 /// # Example
2415 /// ```ignore,no_run
2416 /// # use google_cloud_storagebatchoperations_v1::model::Counters;
2417 /// let x = Counters::new().set_succeeded_object_count(42);
2418 /// ```
2419 pub fn set_succeeded_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2420 self.succeeded_object_count = v.into();
2421 self
2422 }
2423
2424 /// Sets the value of [failed_object_count][crate::model::Counters::failed_object_count].
2425 ///
2426 /// # Example
2427 /// ```ignore,no_run
2428 /// # use google_cloud_storagebatchoperations_v1::model::Counters;
2429 /// let x = Counters::new().set_failed_object_count(42);
2430 /// ```
2431 pub fn set_failed_object_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2432 self.failed_object_count = v.into();
2433 self
2434 }
2435}
2436
2437impl wkt::message::Message for Counters {
2438 fn typename() -> &'static str {
2439 "type.googleapis.com/google.cloud.storagebatchoperations.v1.Counters"
2440 }
2441}
2442
2443/// Specifies the Cloud Logging behavior.
2444#[derive(Clone, Default, PartialEq)]
2445#[non_exhaustive]
2446pub struct LoggingConfig {
2447 /// Required. Specifies the actions to be logged.
2448 pub log_actions: std::vec::Vec<crate::model::logging_config::LoggableAction>,
2449
2450 /// Required. States in which Action are logged.If empty, no logs are
2451 /// generated.
2452 pub log_action_states: std::vec::Vec<crate::model::logging_config::LoggableActionState>,
2453
2454 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2455}
2456
2457impl LoggingConfig {
2458 pub fn new() -> Self {
2459 std::default::Default::default()
2460 }
2461
2462 /// Sets the value of [log_actions][crate::model::LoggingConfig::log_actions].
2463 ///
2464 /// # Example
2465 /// ```ignore,no_run
2466 /// # use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
2467 /// use google_cloud_storagebatchoperations_v1::model::logging_config::LoggableAction;
2468 /// let x = LoggingConfig::new().set_log_actions([
2469 /// LoggableAction::Transform,
2470 /// ]);
2471 /// ```
2472 pub fn set_log_actions<T, V>(mut self, v: T) -> Self
2473 where
2474 T: std::iter::IntoIterator<Item = V>,
2475 V: std::convert::Into<crate::model::logging_config::LoggableAction>,
2476 {
2477 use std::iter::Iterator;
2478 self.log_actions = v.into_iter().map(|i| i.into()).collect();
2479 self
2480 }
2481
2482 /// Sets the value of [log_action_states][crate::model::LoggingConfig::log_action_states].
2483 ///
2484 /// # Example
2485 /// ```ignore,no_run
2486 /// # use google_cloud_storagebatchoperations_v1::model::LoggingConfig;
2487 /// use google_cloud_storagebatchoperations_v1::model::logging_config::LoggableActionState;
2488 /// let x = LoggingConfig::new().set_log_action_states([
2489 /// LoggableActionState::Succeeded,
2490 /// LoggableActionState::Failed,
2491 /// ]);
2492 /// ```
2493 pub fn set_log_action_states<T, V>(mut self, v: T) -> Self
2494 where
2495 T: std::iter::IntoIterator<Item = V>,
2496 V: std::convert::Into<crate::model::logging_config::LoggableActionState>,
2497 {
2498 use std::iter::Iterator;
2499 self.log_action_states = v.into_iter().map(|i| i.into()).collect();
2500 self
2501 }
2502}
2503
2504impl wkt::message::Message for LoggingConfig {
2505 fn typename() -> &'static str {
2506 "type.googleapis.com/google.cloud.storagebatchoperations.v1.LoggingConfig"
2507 }
2508}
2509
2510/// Defines additional types related to [LoggingConfig].
2511pub mod logging_config {
2512 #[allow(unused_imports)]
2513 use super::*;
2514
2515 /// Loggable actions types.
2516 ///
2517 /// # Working with unknown values
2518 ///
2519 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2520 /// additional enum variants at any time. Adding new variants is not considered
2521 /// a breaking change. Applications should write their code in anticipation of:
2522 ///
2523 /// - New values appearing in future releases of the client library, **and**
2524 /// - New values received dynamically, without application changes.
2525 ///
2526 /// Please consult the [Working with enums] section in the user guide for some
2527 /// guidelines.
2528 ///
2529 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2530 #[derive(Clone, Debug, PartialEq)]
2531 #[non_exhaustive]
2532 pub enum LoggableAction {
2533 /// Illegal value, to avoid allowing a default.
2534 Unspecified,
2535 /// The corresponding transform action in this job.
2536 Transform,
2537 /// If set, the enum was initialized with an unknown value.
2538 ///
2539 /// Applications can examine the value using [LoggableAction::value] or
2540 /// [LoggableAction::name].
2541 UnknownValue(loggable_action::UnknownValue),
2542 }
2543
2544 #[doc(hidden)]
2545 pub mod loggable_action {
2546 #[allow(unused_imports)]
2547 use super::*;
2548 #[derive(Clone, Debug, PartialEq)]
2549 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2550 }
2551
2552 impl LoggableAction {
2553 /// Gets the enum value.
2554 ///
2555 /// Returns `None` if the enum contains an unknown value deserialized from
2556 /// the string representation of enums.
2557 pub fn value(&self) -> std::option::Option<i32> {
2558 match self {
2559 Self::Unspecified => std::option::Option::Some(0),
2560 Self::Transform => std::option::Option::Some(6),
2561 Self::UnknownValue(u) => u.0.value(),
2562 }
2563 }
2564
2565 /// Gets the enum value as a string.
2566 ///
2567 /// Returns `None` if the enum contains an unknown value deserialized from
2568 /// the integer representation of enums.
2569 pub fn name(&self) -> std::option::Option<&str> {
2570 match self {
2571 Self::Unspecified => std::option::Option::Some("LOGGABLE_ACTION_UNSPECIFIED"),
2572 Self::Transform => std::option::Option::Some("TRANSFORM"),
2573 Self::UnknownValue(u) => u.0.name(),
2574 }
2575 }
2576 }
2577
2578 impl std::default::Default for LoggableAction {
2579 fn default() -> Self {
2580 use std::convert::From;
2581 Self::from(0)
2582 }
2583 }
2584
2585 impl std::fmt::Display for LoggableAction {
2586 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2587 wkt::internal::display_enum(f, self.name(), self.value())
2588 }
2589 }
2590
2591 impl std::convert::From<i32> for LoggableAction {
2592 fn from(value: i32) -> Self {
2593 match value {
2594 0 => Self::Unspecified,
2595 6 => Self::Transform,
2596 _ => Self::UnknownValue(loggable_action::UnknownValue(
2597 wkt::internal::UnknownEnumValue::Integer(value),
2598 )),
2599 }
2600 }
2601 }
2602
2603 impl std::convert::From<&str> for LoggableAction {
2604 fn from(value: &str) -> Self {
2605 use std::string::ToString;
2606 match value {
2607 "LOGGABLE_ACTION_UNSPECIFIED" => Self::Unspecified,
2608 "TRANSFORM" => Self::Transform,
2609 _ => Self::UnknownValue(loggable_action::UnknownValue(
2610 wkt::internal::UnknownEnumValue::String(value.to_string()),
2611 )),
2612 }
2613 }
2614 }
2615
2616 impl serde::ser::Serialize for LoggableAction {
2617 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2618 where
2619 S: serde::Serializer,
2620 {
2621 match self {
2622 Self::Unspecified => serializer.serialize_i32(0),
2623 Self::Transform => serializer.serialize_i32(6),
2624 Self::UnknownValue(u) => u.0.serialize(serializer),
2625 }
2626 }
2627 }
2628
2629 impl<'de> serde::de::Deserialize<'de> for LoggableAction {
2630 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2631 where
2632 D: serde::Deserializer<'de>,
2633 {
2634 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggableAction>::new(
2635 ".google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableAction",
2636 ))
2637 }
2638 }
2639
2640 /// Loggable action states filter.
2641 ///
2642 /// # Working with unknown values
2643 ///
2644 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2645 /// additional enum variants at any time. Adding new variants is not considered
2646 /// a breaking change. Applications should write their code in anticipation of:
2647 ///
2648 /// - New values appearing in future releases of the client library, **and**
2649 /// - New values received dynamically, without application changes.
2650 ///
2651 /// Please consult the [Working with enums] section in the user guide for some
2652 /// guidelines.
2653 ///
2654 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2655 #[derive(Clone, Debug, PartialEq)]
2656 #[non_exhaustive]
2657 pub enum LoggableActionState {
2658 /// Illegal value, to avoid allowing a default.
2659 Unspecified,
2660 /// `LoggableAction` completed successfully. `SUCCEEDED` actions are
2661 /// logged as [INFO][google.logging.type.LogSeverity.INFO].
2662 Succeeded,
2663 /// `LoggableAction` terminated in an error state. `FAILED` actions
2664 /// are logged as [ERROR][google.logging.type.LogSeverity.ERROR].
2665 Failed,
2666 /// If set, the enum was initialized with an unknown value.
2667 ///
2668 /// Applications can examine the value using [LoggableActionState::value] or
2669 /// [LoggableActionState::name].
2670 UnknownValue(loggable_action_state::UnknownValue),
2671 }
2672
2673 #[doc(hidden)]
2674 pub mod loggable_action_state {
2675 #[allow(unused_imports)]
2676 use super::*;
2677 #[derive(Clone, Debug, PartialEq)]
2678 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2679 }
2680
2681 impl LoggableActionState {
2682 /// Gets the enum value.
2683 ///
2684 /// Returns `None` if the enum contains an unknown value deserialized from
2685 /// the string representation of enums.
2686 pub fn value(&self) -> std::option::Option<i32> {
2687 match self {
2688 Self::Unspecified => std::option::Option::Some(0),
2689 Self::Succeeded => std::option::Option::Some(1),
2690 Self::Failed => std::option::Option::Some(2),
2691 Self::UnknownValue(u) => u.0.value(),
2692 }
2693 }
2694
2695 /// Gets the enum value as a string.
2696 ///
2697 /// Returns `None` if the enum contains an unknown value deserialized from
2698 /// the integer representation of enums.
2699 pub fn name(&self) -> std::option::Option<&str> {
2700 match self {
2701 Self::Unspecified => std::option::Option::Some("LOGGABLE_ACTION_STATE_UNSPECIFIED"),
2702 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2703 Self::Failed => std::option::Option::Some("FAILED"),
2704 Self::UnknownValue(u) => u.0.name(),
2705 }
2706 }
2707 }
2708
2709 impl std::default::Default for LoggableActionState {
2710 fn default() -> Self {
2711 use std::convert::From;
2712 Self::from(0)
2713 }
2714 }
2715
2716 impl std::fmt::Display for LoggableActionState {
2717 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2718 wkt::internal::display_enum(f, self.name(), self.value())
2719 }
2720 }
2721
2722 impl std::convert::From<i32> for LoggableActionState {
2723 fn from(value: i32) -> Self {
2724 match value {
2725 0 => Self::Unspecified,
2726 1 => Self::Succeeded,
2727 2 => Self::Failed,
2728 _ => Self::UnknownValue(loggable_action_state::UnknownValue(
2729 wkt::internal::UnknownEnumValue::Integer(value),
2730 )),
2731 }
2732 }
2733 }
2734
2735 impl std::convert::From<&str> for LoggableActionState {
2736 fn from(value: &str) -> Self {
2737 use std::string::ToString;
2738 match value {
2739 "LOGGABLE_ACTION_STATE_UNSPECIFIED" => Self::Unspecified,
2740 "SUCCEEDED" => Self::Succeeded,
2741 "FAILED" => Self::Failed,
2742 _ => Self::UnknownValue(loggable_action_state::UnknownValue(
2743 wkt::internal::UnknownEnumValue::String(value.to_string()),
2744 )),
2745 }
2746 }
2747 }
2748
2749 impl serde::ser::Serialize for LoggableActionState {
2750 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2751 where
2752 S: serde::Serializer,
2753 {
2754 match self {
2755 Self::Unspecified => serializer.serialize_i32(0),
2756 Self::Succeeded => serializer.serialize_i32(1),
2757 Self::Failed => serializer.serialize_i32(2),
2758 Self::UnknownValue(u) => u.0.serialize(serializer),
2759 }
2760 }
2761 }
2762
2763 impl<'de> serde::de::Deserialize<'de> for LoggableActionState {
2764 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2765 where
2766 D: serde::Deserializer<'de>,
2767 {
2768 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoggableActionState>::new(
2769 ".google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableActionState",
2770 ))
2771 }
2772 }
2773}