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