google_cloud_cloudcontrolspartner_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate gtype;
25extern crate lazy_static;
26extern crate reqwest;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Details about the Access request.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct AccessApprovalRequest {
42 /// Identifier. Format:
43 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/accessApprovalRequests/{access_approval_request}`
44 pub name: std::string::String,
45
46 /// The time at which approval was requested.
47 pub request_time: std::option::Option<wkt::Timestamp>,
48
49 /// The justification for which approval is being requested.
50 pub requested_reason: std::option::Option<crate::model::AccessReason>,
51
52 /// The requested expiration for the approval. If the request is approved,
53 /// access will be granted from the time of approval until the expiration time.
54 pub requested_expiration_time: std::option::Option<wkt::Timestamp>,
55
56 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
57}
58
59impl AccessApprovalRequest {
60 pub fn new() -> Self {
61 std::default::Default::default()
62 }
63
64 /// Sets the value of [name][crate::model::AccessApprovalRequest::name].
65 ///
66 /// # Example
67 /// ```ignore,no_run
68 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessApprovalRequest;
69 /// let x = AccessApprovalRequest::new().set_name("example");
70 /// ```
71 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
72 self.name = v.into();
73 self
74 }
75
76 /// Sets the value of [request_time][crate::model::AccessApprovalRequest::request_time].
77 ///
78 /// # Example
79 /// ```ignore,no_run
80 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessApprovalRequest;
81 /// use wkt::Timestamp;
82 /// let x = AccessApprovalRequest::new().set_request_time(Timestamp::default()/* use setters */);
83 /// ```
84 pub fn set_request_time<T>(mut self, v: T) -> Self
85 where
86 T: std::convert::Into<wkt::Timestamp>,
87 {
88 self.request_time = std::option::Option::Some(v.into());
89 self
90 }
91
92 /// Sets or clears the value of [request_time][crate::model::AccessApprovalRequest::request_time].
93 ///
94 /// # Example
95 /// ```ignore,no_run
96 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessApprovalRequest;
97 /// use wkt::Timestamp;
98 /// let x = AccessApprovalRequest::new().set_or_clear_request_time(Some(Timestamp::default()/* use setters */));
99 /// let x = AccessApprovalRequest::new().set_or_clear_request_time(None::<Timestamp>);
100 /// ```
101 pub fn set_or_clear_request_time<T>(mut self, v: std::option::Option<T>) -> Self
102 where
103 T: std::convert::Into<wkt::Timestamp>,
104 {
105 self.request_time = v.map(|x| x.into());
106 self
107 }
108
109 /// Sets the value of [requested_reason][crate::model::AccessApprovalRequest::requested_reason].
110 ///
111 /// # Example
112 /// ```ignore,no_run
113 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessApprovalRequest;
114 /// use google_cloud_cloudcontrolspartner_v1::model::AccessReason;
115 /// let x = AccessApprovalRequest::new().set_requested_reason(AccessReason::default()/* use setters */);
116 /// ```
117 pub fn set_requested_reason<T>(mut self, v: T) -> Self
118 where
119 T: std::convert::Into<crate::model::AccessReason>,
120 {
121 self.requested_reason = std::option::Option::Some(v.into());
122 self
123 }
124
125 /// Sets or clears the value of [requested_reason][crate::model::AccessApprovalRequest::requested_reason].
126 ///
127 /// # Example
128 /// ```ignore,no_run
129 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessApprovalRequest;
130 /// use google_cloud_cloudcontrolspartner_v1::model::AccessReason;
131 /// let x = AccessApprovalRequest::new().set_or_clear_requested_reason(Some(AccessReason::default()/* use setters */));
132 /// let x = AccessApprovalRequest::new().set_or_clear_requested_reason(None::<AccessReason>);
133 /// ```
134 pub fn set_or_clear_requested_reason<T>(mut self, v: std::option::Option<T>) -> Self
135 where
136 T: std::convert::Into<crate::model::AccessReason>,
137 {
138 self.requested_reason = v.map(|x| x.into());
139 self
140 }
141
142 /// Sets the value of [requested_expiration_time][crate::model::AccessApprovalRequest::requested_expiration_time].
143 ///
144 /// # Example
145 /// ```ignore,no_run
146 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessApprovalRequest;
147 /// use wkt::Timestamp;
148 /// let x = AccessApprovalRequest::new().set_requested_expiration_time(Timestamp::default()/* use setters */);
149 /// ```
150 pub fn set_requested_expiration_time<T>(mut self, v: T) -> Self
151 where
152 T: std::convert::Into<wkt::Timestamp>,
153 {
154 self.requested_expiration_time = std::option::Option::Some(v.into());
155 self
156 }
157
158 /// Sets or clears the value of [requested_expiration_time][crate::model::AccessApprovalRequest::requested_expiration_time].
159 ///
160 /// # Example
161 /// ```ignore,no_run
162 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessApprovalRequest;
163 /// use wkt::Timestamp;
164 /// let x = AccessApprovalRequest::new().set_or_clear_requested_expiration_time(Some(Timestamp::default()/* use setters */));
165 /// let x = AccessApprovalRequest::new().set_or_clear_requested_expiration_time(None::<Timestamp>);
166 /// ```
167 pub fn set_or_clear_requested_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
168 where
169 T: std::convert::Into<wkt::Timestamp>,
170 {
171 self.requested_expiration_time = v.map(|x| x.into());
172 self
173 }
174}
175
176impl wkt::message::Message for AccessApprovalRequest {
177 fn typename() -> &'static str {
178 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.AccessApprovalRequest"
179 }
180}
181
182/// Request for getting the access requests associated with a workload.
183#[derive(Clone, Default, PartialEq)]
184#[non_exhaustive]
185pub struct ListAccessApprovalRequestsRequest {
186 /// Required. Parent resource
187 /// Format:
188 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
189 pub parent: std::string::String,
190
191 /// Optional. The maximum number of access requests to return. The service may
192 /// return fewer than this value. If unspecified, at most 500 access requests
193 /// will be returned.
194 pub page_size: i32,
195
196 /// Optional. A page token, received from a previous
197 /// `ListAccessApprovalRequests` call. Provide this to retrieve the subsequent
198 /// page.
199 pub page_token: std::string::String,
200
201 /// Optional. Filtering results.
202 pub filter: std::string::String,
203
204 /// Optional. Hint for how to order the results.
205 pub order_by: std::string::String,
206
207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
208}
209
210impl ListAccessApprovalRequestsRequest {
211 pub fn new() -> Self {
212 std::default::Default::default()
213 }
214
215 /// Sets the value of [parent][crate::model::ListAccessApprovalRequestsRequest::parent].
216 ///
217 /// # Example
218 /// ```ignore,no_run
219 /// # use google_cloud_cloudcontrolspartner_v1::model::ListAccessApprovalRequestsRequest;
220 /// let x = ListAccessApprovalRequestsRequest::new().set_parent("example");
221 /// ```
222 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
223 self.parent = v.into();
224 self
225 }
226
227 /// Sets the value of [page_size][crate::model::ListAccessApprovalRequestsRequest::page_size].
228 ///
229 /// # Example
230 /// ```ignore,no_run
231 /// # use google_cloud_cloudcontrolspartner_v1::model::ListAccessApprovalRequestsRequest;
232 /// let x = ListAccessApprovalRequestsRequest::new().set_page_size(42);
233 /// ```
234 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
235 self.page_size = v.into();
236 self
237 }
238
239 /// Sets the value of [page_token][crate::model::ListAccessApprovalRequestsRequest::page_token].
240 ///
241 /// # Example
242 /// ```ignore,no_run
243 /// # use google_cloud_cloudcontrolspartner_v1::model::ListAccessApprovalRequestsRequest;
244 /// let x = ListAccessApprovalRequestsRequest::new().set_page_token("example");
245 /// ```
246 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
247 self.page_token = v.into();
248 self
249 }
250
251 /// Sets the value of [filter][crate::model::ListAccessApprovalRequestsRequest::filter].
252 ///
253 /// # Example
254 /// ```ignore,no_run
255 /// # use google_cloud_cloudcontrolspartner_v1::model::ListAccessApprovalRequestsRequest;
256 /// let x = ListAccessApprovalRequestsRequest::new().set_filter("example");
257 /// ```
258 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
259 self.filter = v.into();
260 self
261 }
262
263 /// Sets the value of [order_by][crate::model::ListAccessApprovalRequestsRequest::order_by].
264 ///
265 /// # Example
266 /// ```ignore,no_run
267 /// # use google_cloud_cloudcontrolspartner_v1::model::ListAccessApprovalRequestsRequest;
268 /// let x = ListAccessApprovalRequestsRequest::new().set_order_by("example");
269 /// ```
270 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
271 self.order_by = v.into();
272 self
273 }
274}
275
276impl wkt::message::Message for ListAccessApprovalRequestsRequest {
277 fn typename() -> &'static str {
278 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.ListAccessApprovalRequestsRequest"
279 }
280}
281
282/// Response message for list access requests.
283#[derive(Clone, Default, PartialEq)]
284#[non_exhaustive]
285pub struct ListAccessApprovalRequestsResponse {
286 /// List of access approval requests
287 pub access_approval_requests: std::vec::Vec<crate::model::AccessApprovalRequest>,
288
289 /// A token that can be sent as `page_token` to retrieve the next page.
290 /// If this field is omitted, there are no subsequent pages.
291 pub next_page_token: std::string::String,
292
293 /// Locations that could not be reached.
294 pub unreachable: std::vec::Vec<std::string::String>,
295
296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
297}
298
299impl ListAccessApprovalRequestsResponse {
300 pub fn new() -> Self {
301 std::default::Default::default()
302 }
303
304 /// Sets the value of [access_approval_requests][crate::model::ListAccessApprovalRequestsResponse::access_approval_requests].
305 ///
306 /// # Example
307 /// ```ignore,no_run
308 /// # use google_cloud_cloudcontrolspartner_v1::model::ListAccessApprovalRequestsResponse;
309 /// use google_cloud_cloudcontrolspartner_v1::model::AccessApprovalRequest;
310 /// let x = ListAccessApprovalRequestsResponse::new()
311 /// .set_access_approval_requests([
312 /// AccessApprovalRequest::default()/* use setters */,
313 /// AccessApprovalRequest::default()/* use (different) setters */,
314 /// ]);
315 /// ```
316 pub fn set_access_approval_requests<T, V>(mut self, v: T) -> Self
317 where
318 T: std::iter::IntoIterator<Item = V>,
319 V: std::convert::Into<crate::model::AccessApprovalRequest>,
320 {
321 use std::iter::Iterator;
322 self.access_approval_requests = v.into_iter().map(|i| i.into()).collect();
323 self
324 }
325
326 /// Sets the value of [next_page_token][crate::model::ListAccessApprovalRequestsResponse::next_page_token].
327 ///
328 /// # Example
329 /// ```ignore,no_run
330 /// # use google_cloud_cloudcontrolspartner_v1::model::ListAccessApprovalRequestsResponse;
331 /// let x = ListAccessApprovalRequestsResponse::new().set_next_page_token("example");
332 /// ```
333 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
334 self.next_page_token = v.into();
335 self
336 }
337
338 /// Sets the value of [unreachable][crate::model::ListAccessApprovalRequestsResponse::unreachable].
339 ///
340 /// # Example
341 /// ```ignore,no_run
342 /// # use google_cloud_cloudcontrolspartner_v1::model::ListAccessApprovalRequestsResponse;
343 /// let x = ListAccessApprovalRequestsResponse::new().set_unreachable(["a", "b", "c"]);
344 /// ```
345 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
346 where
347 T: std::iter::IntoIterator<Item = V>,
348 V: std::convert::Into<std::string::String>,
349 {
350 use std::iter::Iterator;
351 self.unreachable = v.into_iter().map(|i| i.into()).collect();
352 self
353 }
354}
355
356impl wkt::message::Message for ListAccessApprovalRequestsResponse {
357 fn typename() -> &'static str {
358 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.ListAccessApprovalRequestsResponse"
359 }
360}
361
362#[doc(hidden)]
363impl gax::paginator::internal::PageableResponse for ListAccessApprovalRequestsResponse {
364 type PageItem = crate::model::AccessApprovalRequest;
365
366 fn items(self) -> std::vec::Vec<Self::PageItem> {
367 self.access_approval_requests
368 }
369
370 fn next_page_token(&self) -> std::string::String {
371 use std::clone::Clone;
372 self.next_page_token.clone()
373 }
374}
375
376/// Reason for the access.
377#[derive(Clone, Default, PartialEq)]
378#[non_exhaustive]
379pub struct AccessReason {
380 /// Type of access justification.
381 pub r#type: crate::model::access_reason::Type,
382
383 /// More detail about certain reason types. See comments for each type above.
384 pub detail: std::string::String,
385
386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
387}
388
389impl AccessReason {
390 pub fn new() -> Self {
391 std::default::Default::default()
392 }
393
394 /// Sets the value of [r#type][crate::model::AccessReason::type].
395 ///
396 /// # Example
397 /// ```ignore,no_run
398 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessReason;
399 /// use google_cloud_cloudcontrolspartner_v1::model::access_reason::Type;
400 /// let x0 = AccessReason::new().set_type(Type::CustomerInitiatedSupport);
401 /// let x1 = AccessReason::new().set_type(Type::GoogleInitiatedService);
402 /// let x2 = AccessReason::new().set_type(Type::GoogleInitiatedReview);
403 /// ```
404 pub fn set_type<T: std::convert::Into<crate::model::access_reason::Type>>(
405 mut self,
406 v: T,
407 ) -> Self {
408 self.r#type = v.into();
409 self
410 }
411
412 /// Sets the value of [detail][crate::model::AccessReason::detail].
413 ///
414 /// # Example
415 /// ```ignore,no_run
416 /// # use google_cloud_cloudcontrolspartner_v1::model::AccessReason;
417 /// let x = AccessReason::new().set_detail("example");
418 /// ```
419 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
420 self.detail = v.into();
421 self
422 }
423}
424
425impl wkt::message::Message for AccessReason {
426 fn typename() -> &'static str {
427 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.AccessReason"
428 }
429}
430
431/// Defines additional types related to [AccessReason].
432pub mod access_reason {
433 #[allow(unused_imports)]
434 use super::*;
435
436 /// Type of access justification.
437 ///
438 /// # Working with unknown values
439 ///
440 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
441 /// additional enum variants at any time. Adding new variants is not considered
442 /// a breaking change. Applications should write their code in anticipation of:
443 ///
444 /// - New values appearing in future releases of the client library, **and**
445 /// - New values received dynamically, without application changes.
446 ///
447 /// Please consult the [Working with enums] section in the user guide for some
448 /// guidelines.
449 ///
450 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
451 #[derive(Clone, Debug, PartialEq)]
452 #[non_exhaustive]
453 pub enum Type {
454 /// Default value for proto, shouldn't be used.
455 Unspecified,
456 /// Customer made a request or raised an issue that required the principal to
457 /// access customer data. `detail` is of the form ("#####" is the issue ID):
458 ///
459 /// - "Feedback Report: #####"
460 /// - "Case Number: #####"
461 /// - "Case ID: #####"
462 /// - "E-PIN Reference: #####"
463 /// - "Google-#####"
464 /// - "T-#####"
465 CustomerInitiatedSupport,
466 /// The principal accessed customer data in order to diagnose or resolve a
467 /// suspected issue in services. Often this access is used to confirm that
468 /// customers are not affected by a suspected service issue or to remediate a
469 /// reversible system issue.
470 GoogleInitiatedService,
471 /// Google initiated service for security, fraud, abuse, or compliance
472 /// purposes.
473 GoogleInitiatedReview,
474 /// The principal was compelled to access customer data in order to respond
475 /// to a legal third party data request or process, including legal processes
476 /// from customers themselves.
477 ThirdPartyDataRequest,
478 /// The principal accessed customer data in order to diagnose or resolve a
479 /// suspected issue in services or a known outage.
480 GoogleResponseToProductionAlert,
481 /// Similar to 'GOOGLE_INITIATED_SERVICE' or 'GOOGLE_INITIATED_REVIEW', but
482 /// with universe agnostic naming. The principal accessed customer data in
483 /// order to diagnose or resolve a suspected issue in services or a known
484 /// outage, or for security, fraud, abuse, or compliance review purposes.
485 CloudInitiatedAccess,
486 /// If set, the enum was initialized with an unknown value.
487 ///
488 /// Applications can examine the value using [Type::value] or
489 /// [Type::name].
490 UnknownValue(r#type::UnknownValue),
491 }
492
493 #[doc(hidden)]
494 pub mod r#type {
495 #[allow(unused_imports)]
496 use super::*;
497 #[derive(Clone, Debug, PartialEq)]
498 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
499 }
500
501 impl Type {
502 /// Gets the enum value.
503 ///
504 /// Returns `None` if the enum contains an unknown value deserialized from
505 /// the string representation of enums.
506 pub fn value(&self) -> std::option::Option<i32> {
507 match self {
508 Self::Unspecified => std::option::Option::Some(0),
509 Self::CustomerInitiatedSupport => std::option::Option::Some(1),
510 Self::GoogleInitiatedService => std::option::Option::Some(2),
511 Self::GoogleInitiatedReview => std::option::Option::Some(3),
512 Self::ThirdPartyDataRequest => std::option::Option::Some(4),
513 Self::GoogleResponseToProductionAlert => std::option::Option::Some(5),
514 Self::CloudInitiatedAccess => std::option::Option::Some(6),
515 Self::UnknownValue(u) => u.0.value(),
516 }
517 }
518
519 /// Gets the enum value as a string.
520 ///
521 /// Returns `None` if the enum contains an unknown value deserialized from
522 /// the integer representation of enums.
523 pub fn name(&self) -> std::option::Option<&str> {
524 match self {
525 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
526 Self::CustomerInitiatedSupport => {
527 std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
528 }
529 Self::GoogleInitiatedService => {
530 std::option::Option::Some("GOOGLE_INITIATED_SERVICE")
531 }
532 Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
533 Self::ThirdPartyDataRequest => {
534 std::option::Option::Some("THIRD_PARTY_DATA_REQUEST")
535 }
536 Self::GoogleResponseToProductionAlert => {
537 std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
538 }
539 Self::CloudInitiatedAccess => std::option::Option::Some("CLOUD_INITIATED_ACCESS"),
540 Self::UnknownValue(u) => u.0.name(),
541 }
542 }
543 }
544
545 impl std::default::Default for Type {
546 fn default() -> Self {
547 use std::convert::From;
548 Self::from(0)
549 }
550 }
551
552 impl std::fmt::Display for Type {
553 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
554 wkt::internal::display_enum(f, self.name(), self.value())
555 }
556 }
557
558 impl std::convert::From<i32> for Type {
559 fn from(value: i32) -> Self {
560 match value {
561 0 => Self::Unspecified,
562 1 => Self::CustomerInitiatedSupport,
563 2 => Self::GoogleInitiatedService,
564 3 => Self::GoogleInitiatedReview,
565 4 => Self::ThirdPartyDataRequest,
566 5 => Self::GoogleResponseToProductionAlert,
567 6 => Self::CloudInitiatedAccess,
568 _ => Self::UnknownValue(r#type::UnknownValue(
569 wkt::internal::UnknownEnumValue::Integer(value),
570 )),
571 }
572 }
573 }
574
575 impl std::convert::From<&str> for Type {
576 fn from(value: &str) -> Self {
577 use std::string::ToString;
578 match value {
579 "TYPE_UNSPECIFIED" => Self::Unspecified,
580 "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
581 "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
582 "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
583 "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
584 "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
585 "CLOUD_INITIATED_ACCESS" => Self::CloudInitiatedAccess,
586 _ => Self::UnknownValue(r#type::UnknownValue(
587 wkt::internal::UnknownEnumValue::String(value.to_string()),
588 )),
589 }
590 }
591 }
592
593 impl serde::ser::Serialize for Type {
594 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
595 where
596 S: serde::Serializer,
597 {
598 match self {
599 Self::Unspecified => serializer.serialize_i32(0),
600 Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
601 Self::GoogleInitiatedService => serializer.serialize_i32(2),
602 Self::GoogleInitiatedReview => serializer.serialize_i32(3),
603 Self::ThirdPartyDataRequest => serializer.serialize_i32(4),
604 Self::GoogleResponseToProductionAlert => serializer.serialize_i32(5),
605 Self::CloudInitiatedAccess => serializer.serialize_i32(6),
606 Self::UnknownValue(u) => u.0.serialize(serializer),
607 }
608 }
609 }
610
611 impl<'de> serde::de::Deserialize<'de> for Type {
612 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
613 where
614 D: serde::Deserializer<'de>,
615 {
616 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
617 ".google.cloud.cloudcontrolspartner.v1.AccessReason.Type",
618 ))
619 }
620 }
621}
622
623/// Represents the metadata of the long-running operation.
624#[derive(Clone, Default, PartialEq)]
625#[non_exhaustive]
626pub struct OperationMetadata {
627 /// Output only. The time the operation was created.
628 pub create_time: std::option::Option<wkt::Timestamp>,
629
630 /// Output only. The time the operation finished running.
631 pub end_time: std::option::Option<wkt::Timestamp>,
632
633 /// Output only. Server-defined resource path for the target of the operation.
634 pub target: std::string::String,
635
636 /// Output only. Name of the verb executed by the operation.
637 pub verb: std::string::String,
638
639 /// Output only. Human-readable status of the operation, if any.
640 pub status_message: std::string::String,
641
642 /// Output only. Identifies whether the user has requested cancellation
643 /// of the operation. Operations that have been cancelled successfully
644 /// have [Operation.error][google.longrunning.Operation.error] value with a
645 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
646 /// `Code.CANCELLED`.
647 pub requested_cancellation: bool,
648
649 /// Output only. API version used to start the operation.
650 pub api_version: std::string::String,
651
652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
653}
654
655impl OperationMetadata {
656 pub fn new() -> Self {
657 std::default::Default::default()
658 }
659
660 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
661 ///
662 /// # Example
663 /// ```ignore,no_run
664 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
665 /// use wkt::Timestamp;
666 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
667 /// ```
668 pub fn set_create_time<T>(mut self, v: T) -> Self
669 where
670 T: std::convert::Into<wkt::Timestamp>,
671 {
672 self.create_time = std::option::Option::Some(v.into());
673 self
674 }
675
676 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
677 ///
678 /// # Example
679 /// ```ignore,no_run
680 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
681 /// use wkt::Timestamp;
682 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
683 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
684 /// ```
685 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
686 where
687 T: std::convert::Into<wkt::Timestamp>,
688 {
689 self.create_time = v.map(|x| x.into());
690 self
691 }
692
693 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
694 ///
695 /// # Example
696 /// ```ignore,no_run
697 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
698 /// use wkt::Timestamp;
699 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
700 /// ```
701 pub fn set_end_time<T>(mut self, v: T) -> Self
702 where
703 T: std::convert::Into<wkt::Timestamp>,
704 {
705 self.end_time = std::option::Option::Some(v.into());
706 self
707 }
708
709 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
710 ///
711 /// # Example
712 /// ```ignore,no_run
713 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
714 /// use wkt::Timestamp;
715 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
716 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
717 /// ```
718 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
719 where
720 T: std::convert::Into<wkt::Timestamp>,
721 {
722 self.end_time = v.map(|x| x.into());
723 self
724 }
725
726 /// Sets the value of [target][crate::model::OperationMetadata::target].
727 ///
728 /// # Example
729 /// ```ignore,no_run
730 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
731 /// let x = OperationMetadata::new().set_target("example");
732 /// ```
733 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
734 self.target = v.into();
735 self
736 }
737
738 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
739 ///
740 /// # Example
741 /// ```ignore,no_run
742 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
743 /// let x = OperationMetadata::new().set_verb("example");
744 /// ```
745 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
746 self.verb = v.into();
747 self
748 }
749
750 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
751 ///
752 /// # Example
753 /// ```ignore,no_run
754 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
755 /// let x = OperationMetadata::new().set_status_message("example");
756 /// ```
757 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
758 self.status_message = v.into();
759 self
760 }
761
762 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
763 ///
764 /// # Example
765 /// ```ignore,no_run
766 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
767 /// let x = OperationMetadata::new().set_requested_cancellation(true);
768 /// ```
769 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
770 self.requested_cancellation = v.into();
771 self
772 }
773
774 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
775 ///
776 /// # Example
777 /// ```ignore,no_run
778 /// # use google_cloud_cloudcontrolspartner_v1::model::OperationMetadata;
779 /// let x = OperationMetadata::new().set_api_version("example");
780 /// ```
781 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
782 self.api_version = v.into();
783 self
784 }
785}
786
787impl wkt::message::Message for OperationMetadata {
788 fn typename() -> &'static str {
789 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.OperationMetadata"
790 }
791}
792
793/// Contains metadata around the [Workload
794/// resource](https://cloud.google.com/assured-workloads/docs/reference/rest/Shared.Types/Workload)
795/// in the Assured Workloads API.
796#[derive(Clone, Default, PartialEq)]
797#[non_exhaustive]
798pub struct Workload {
799 /// Identifier. Format:
800 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
801 pub name: std::string::String,
802
803 /// Output only. Folder id this workload is associated with
804 pub folder_id: i64,
805
806 /// Output only. Time the resource was created.
807 pub create_time: std::option::Option<wkt::Timestamp>,
808
809 /// Output only. The name of container folder of the assured workload
810 pub folder: std::string::String,
811
812 /// Container for workload onboarding steps.
813 pub workload_onboarding_state: std::option::Option<crate::model::WorkloadOnboardingState>,
814
815 /// Indicates whether a workload is fully onboarded.
816 pub is_onboarded: bool,
817
818 /// The project id of the key management project for the workload
819 pub key_management_project_id: std::string::String,
820
821 /// The Google Cloud location of the workload
822 pub location: std::string::String,
823
824 /// Partner associated with this workload.
825 pub partner: crate::model::workload::Partner,
826
827 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
828}
829
830impl Workload {
831 pub fn new() -> Self {
832 std::default::Default::default()
833 }
834
835 /// Sets the value of [name][crate::model::Workload::name].
836 ///
837 /// # Example
838 /// ```ignore,no_run
839 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
840 /// let x = Workload::new().set_name("example");
841 /// ```
842 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
843 self.name = v.into();
844 self
845 }
846
847 /// Sets the value of [folder_id][crate::model::Workload::folder_id].
848 ///
849 /// # Example
850 /// ```ignore,no_run
851 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
852 /// let x = Workload::new().set_folder_id(42);
853 /// ```
854 pub fn set_folder_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
855 self.folder_id = v.into();
856 self
857 }
858
859 /// Sets the value of [create_time][crate::model::Workload::create_time].
860 ///
861 /// # Example
862 /// ```ignore,no_run
863 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
864 /// use wkt::Timestamp;
865 /// let x = Workload::new().set_create_time(Timestamp::default()/* use setters */);
866 /// ```
867 pub fn set_create_time<T>(mut self, v: T) -> Self
868 where
869 T: std::convert::Into<wkt::Timestamp>,
870 {
871 self.create_time = std::option::Option::Some(v.into());
872 self
873 }
874
875 /// Sets or clears the value of [create_time][crate::model::Workload::create_time].
876 ///
877 /// # Example
878 /// ```ignore,no_run
879 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
880 /// use wkt::Timestamp;
881 /// let x = Workload::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
882 /// let x = Workload::new().set_or_clear_create_time(None::<Timestamp>);
883 /// ```
884 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
885 where
886 T: std::convert::Into<wkt::Timestamp>,
887 {
888 self.create_time = v.map(|x| x.into());
889 self
890 }
891
892 /// Sets the value of [folder][crate::model::Workload::folder].
893 ///
894 /// # Example
895 /// ```ignore,no_run
896 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
897 /// let x = Workload::new().set_folder("example");
898 /// ```
899 pub fn set_folder<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
900 self.folder = v.into();
901 self
902 }
903
904 /// Sets the value of [workload_onboarding_state][crate::model::Workload::workload_onboarding_state].
905 ///
906 /// # Example
907 /// ```ignore,no_run
908 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
909 /// use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingState;
910 /// let x = Workload::new().set_workload_onboarding_state(WorkloadOnboardingState::default()/* use setters */);
911 /// ```
912 pub fn set_workload_onboarding_state<T>(mut self, v: T) -> Self
913 where
914 T: std::convert::Into<crate::model::WorkloadOnboardingState>,
915 {
916 self.workload_onboarding_state = std::option::Option::Some(v.into());
917 self
918 }
919
920 /// Sets or clears the value of [workload_onboarding_state][crate::model::Workload::workload_onboarding_state].
921 ///
922 /// # Example
923 /// ```ignore,no_run
924 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
925 /// use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingState;
926 /// let x = Workload::new().set_or_clear_workload_onboarding_state(Some(WorkloadOnboardingState::default()/* use setters */));
927 /// let x = Workload::new().set_or_clear_workload_onboarding_state(None::<WorkloadOnboardingState>);
928 /// ```
929 pub fn set_or_clear_workload_onboarding_state<T>(mut self, v: std::option::Option<T>) -> Self
930 where
931 T: std::convert::Into<crate::model::WorkloadOnboardingState>,
932 {
933 self.workload_onboarding_state = v.map(|x| x.into());
934 self
935 }
936
937 /// Sets the value of [is_onboarded][crate::model::Workload::is_onboarded].
938 ///
939 /// # Example
940 /// ```ignore,no_run
941 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
942 /// let x = Workload::new().set_is_onboarded(true);
943 /// ```
944 pub fn set_is_onboarded<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
945 self.is_onboarded = v.into();
946 self
947 }
948
949 /// Sets the value of [key_management_project_id][crate::model::Workload::key_management_project_id].
950 ///
951 /// # Example
952 /// ```ignore,no_run
953 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
954 /// let x = Workload::new().set_key_management_project_id("example");
955 /// ```
956 pub fn set_key_management_project_id<T: std::convert::Into<std::string::String>>(
957 mut self,
958 v: T,
959 ) -> Self {
960 self.key_management_project_id = v.into();
961 self
962 }
963
964 /// Sets the value of [location][crate::model::Workload::location].
965 ///
966 /// # Example
967 /// ```ignore,no_run
968 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
969 /// let x = Workload::new().set_location("example");
970 /// ```
971 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
972 self.location = v.into();
973 self
974 }
975
976 /// Sets the value of [partner][crate::model::Workload::partner].
977 ///
978 /// # Example
979 /// ```ignore,no_run
980 /// # use google_cloud_cloudcontrolspartner_v1::model::Workload;
981 /// use google_cloud_cloudcontrolspartner_v1::model::workload::Partner;
982 /// let x0 = Workload::new().set_partner(Partner::LocalControlsByS3Ns);
983 /// let x1 = Workload::new().set_partner(Partner::SovereignControlsByTSystems);
984 /// let x2 = Workload::new().set_partner(Partner::SovereignControlsBySiaMinsait);
985 /// ```
986 pub fn set_partner<T: std::convert::Into<crate::model::workload::Partner>>(
987 mut self,
988 v: T,
989 ) -> Self {
990 self.partner = v.into();
991 self
992 }
993}
994
995impl wkt::message::Message for Workload {
996 fn typename() -> &'static str {
997 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Workload"
998 }
999}
1000
1001/// Defines additional types related to [Workload].
1002pub mod workload {
1003 #[allow(unused_imports)]
1004 use super::*;
1005
1006 /// Supported Assured Workloads Partners.
1007 ///
1008 /// # Working with unknown values
1009 ///
1010 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1011 /// additional enum variants at any time. Adding new variants is not considered
1012 /// a breaking change. Applications should write their code in anticipation of:
1013 ///
1014 /// - New values appearing in future releases of the client library, **and**
1015 /// - New values received dynamically, without application changes.
1016 ///
1017 /// Please consult the [Working with enums] section in the user guide for some
1018 /// guidelines.
1019 ///
1020 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1021 #[derive(Clone, Debug, PartialEq)]
1022 #[non_exhaustive]
1023 pub enum Partner {
1024 /// Unknown Partner.
1025 Unspecified,
1026 /// Enum representing S3NS (Thales) partner.
1027 LocalControlsByS3Ns,
1028 /// Enum representing T_SYSTEM (TSI) partner.
1029 SovereignControlsByTSystems,
1030 /// Enum representing SIA_MINSAIT (Indra) partner.
1031 SovereignControlsBySiaMinsait,
1032 /// Enum representing PSN (TIM) partner.
1033 SovereignControlsByPsn,
1034 /// Enum representing CNTXT (Kingdom of Saudi Arabia) partner.
1035 SovereignControlsByCntxt,
1036 /// Enum representing CNXT (Kingdom of Saudi Arabia) partner offering without
1037 /// EKM provisioning.
1038 SovereignControlsByCntxtNoEkm,
1039 /// If set, the enum was initialized with an unknown value.
1040 ///
1041 /// Applications can examine the value using [Partner::value] or
1042 /// [Partner::name].
1043 UnknownValue(partner::UnknownValue),
1044 }
1045
1046 #[doc(hidden)]
1047 pub mod partner {
1048 #[allow(unused_imports)]
1049 use super::*;
1050 #[derive(Clone, Debug, PartialEq)]
1051 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1052 }
1053
1054 impl Partner {
1055 /// Gets the enum value.
1056 ///
1057 /// Returns `None` if the enum contains an unknown value deserialized from
1058 /// the string representation of enums.
1059 pub fn value(&self) -> std::option::Option<i32> {
1060 match self {
1061 Self::Unspecified => std::option::Option::Some(0),
1062 Self::LocalControlsByS3Ns => std::option::Option::Some(1),
1063 Self::SovereignControlsByTSystems => std::option::Option::Some(2),
1064 Self::SovereignControlsBySiaMinsait => std::option::Option::Some(3),
1065 Self::SovereignControlsByPsn => std::option::Option::Some(4),
1066 Self::SovereignControlsByCntxt => std::option::Option::Some(6),
1067 Self::SovereignControlsByCntxtNoEkm => std::option::Option::Some(7),
1068 Self::UnknownValue(u) => u.0.value(),
1069 }
1070 }
1071
1072 /// Gets the enum value as a string.
1073 ///
1074 /// Returns `None` if the enum contains an unknown value deserialized from
1075 /// the integer representation of enums.
1076 pub fn name(&self) -> std::option::Option<&str> {
1077 match self {
1078 Self::Unspecified => std::option::Option::Some("PARTNER_UNSPECIFIED"),
1079 Self::LocalControlsByS3Ns => {
1080 std::option::Option::Some("PARTNER_LOCAL_CONTROLS_BY_S3NS")
1081 }
1082 Self::SovereignControlsByTSystems => {
1083 std::option::Option::Some("PARTNER_SOVEREIGN_CONTROLS_BY_T_SYSTEMS")
1084 }
1085 Self::SovereignControlsBySiaMinsait => {
1086 std::option::Option::Some("PARTNER_SOVEREIGN_CONTROLS_BY_SIA_MINSAIT")
1087 }
1088 Self::SovereignControlsByPsn => {
1089 std::option::Option::Some("PARTNER_SOVEREIGN_CONTROLS_BY_PSN")
1090 }
1091 Self::SovereignControlsByCntxt => {
1092 std::option::Option::Some("PARTNER_SOVEREIGN_CONTROLS_BY_CNTXT")
1093 }
1094 Self::SovereignControlsByCntxtNoEkm => {
1095 std::option::Option::Some("PARTNER_SOVEREIGN_CONTROLS_BY_CNTXT_NO_EKM")
1096 }
1097 Self::UnknownValue(u) => u.0.name(),
1098 }
1099 }
1100 }
1101
1102 impl std::default::Default for Partner {
1103 fn default() -> Self {
1104 use std::convert::From;
1105 Self::from(0)
1106 }
1107 }
1108
1109 impl std::fmt::Display for Partner {
1110 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1111 wkt::internal::display_enum(f, self.name(), self.value())
1112 }
1113 }
1114
1115 impl std::convert::From<i32> for Partner {
1116 fn from(value: i32) -> Self {
1117 match value {
1118 0 => Self::Unspecified,
1119 1 => Self::LocalControlsByS3Ns,
1120 2 => Self::SovereignControlsByTSystems,
1121 3 => Self::SovereignControlsBySiaMinsait,
1122 4 => Self::SovereignControlsByPsn,
1123 6 => Self::SovereignControlsByCntxt,
1124 7 => Self::SovereignControlsByCntxtNoEkm,
1125 _ => Self::UnknownValue(partner::UnknownValue(
1126 wkt::internal::UnknownEnumValue::Integer(value),
1127 )),
1128 }
1129 }
1130 }
1131
1132 impl std::convert::From<&str> for Partner {
1133 fn from(value: &str) -> Self {
1134 use std::string::ToString;
1135 match value {
1136 "PARTNER_UNSPECIFIED" => Self::Unspecified,
1137 "PARTNER_LOCAL_CONTROLS_BY_S3NS" => Self::LocalControlsByS3Ns,
1138 "PARTNER_SOVEREIGN_CONTROLS_BY_T_SYSTEMS" => Self::SovereignControlsByTSystems,
1139 "PARTNER_SOVEREIGN_CONTROLS_BY_SIA_MINSAIT" => Self::SovereignControlsBySiaMinsait,
1140 "PARTNER_SOVEREIGN_CONTROLS_BY_PSN" => Self::SovereignControlsByPsn,
1141 "PARTNER_SOVEREIGN_CONTROLS_BY_CNTXT" => Self::SovereignControlsByCntxt,
1142 "PARTNER_SOVEREIGN_CONTROLS_BY_CNTXT_NO_EKM" => Self::SovereignControlsByCntxtNoEkm,
1143 _ => Self::UnknownValue(partner::UnknownValue(
1144 wkt::internal::UnknownEnumValue::String(value.to_string()),
1145 )),
1146 }
1147 }
1148 }
1149
1150 impl serde::ser::Serialize for Partner {
1151 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1152 where
1153 S: serde::Serializer,
1154 {
1155 match self {
1156 Self::Unspecified => serializer.serialize_i32(0),
1157 Self::LocalControlsByS3Ns => serializer.serialize_i32(1),
1158 Self::SovereignControlsByTSystems => serializer.serialize_i32(2),
1159 Self::SovereignControlsBySiaMinsait => serializer.serialize_i32(3),
1160 Self::SovereignControlsByPsn => serializer.serialize_i32(4),
1161 Self::SovereignControlsByCntxt => serializer.serialize_i32(6),
1162 Self::SovereignControlsByCntxtNoEkm => serializer.serialize_i32(7),
1163 Self::UnknownValue(u) => u.0.serialize(serializer),
1164 }
1165 }
1166 }
1167
1168 impl<'de> serde::de::Deserialize<'de> for Partner {
1169 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1170 where
1171 D: serde::Deserializer<'de>,
1172 {
1173 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Partner>::new(
1174 ".google.cloud.cloudcontrolspartner.v1.Workload.Partner",
1175 ))
1176 }
1177 }
1178}
1179
1180/// Request to list customer workloads.
1181#[derive(Clone, Default, PartialEq)]
1182#[non_exhaustive]
1183pub struct ListWorkloadsRequest {
1184 /// Required. Parent resource
1185 /// Format:
1186 /// `organizations/{organization}/locations/{location}/customers/{customer}`
1187 pub parent: std::string::String,
1188
1189 /// The maximum number of workloads to return. The service may return fewer
1190 /// than this value. If unspecified, at most 500 workloads will be returned.
1191 pub page_size: i32,
1192
1193 /// A page token, received from a previous `ListWorkloads` call.
1194 /// Provide this to retrieve the subsequent page.
1195 pub page_token: std::string::String,
1196
1197 /// Optional. Filtering results.
1198 pub filter: std::string::String,
1199
1200 /// Optional. Hint for how to order the results.
1201 pub order_by: std::string::String,
1202
1203 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1204}
1205
1206impl ListWorkloadsRequest {
1207 pub fn new() -> Self {
1208 std::default::Default::default()
1209 }
1210
1211 /// Sets the value of [parent][crate::model::ListWorkloadsRequest::parent].
1212 ///
1213 /// # Example
1214 /// ```ignore,no_run
1215 /// # use google_cloud_cloudcontrolspartner_v1::model::ListWorkloadsRequest;
1216 /// let x = ListWorkloadsRequest::new().set_parent("example");
1217 /// ```
1218 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1219 self.parent = v.into();
1220 self
1221 }
1222
1223 /// Sets the value of [page_size][crate::model::ListWorkloadsRequest::page_size].
1224 ///
1225 /// # Example
1226 /// ```ignore,no_run
1227 /// # use google_cloud_cloudcontrolspartner_v1::model::ListWorkloadsRequest;
1228 /// let x = ListWorkloadsRequest::new().set_page_size(42);
1229 /// ```
1230 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1231 self.page_size = v.into();
1232 self
1233 }
1234
1235 /// Sets the value of [page_token][crate::model::ListWorkloadsRequest::page_token].
1236 ///
1237 /// # Example
1238 /// ```ignore,no_run
1239 /// # use google_cloud_cloudcontrolspartner_v1::model::ListWorkloadsRequest;
1240 /// let x = ListWorkloadsRequest::new().set_page_token("example");
1241 /// ```
1242 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1243 self.page_token = v.into();
1244 self
1245 }
1246
1247 /// Sets the value of [filter][crate::model::ListWorkloadsRequest::filter].
1248 ///
1249 /// # Example
1250 /// ```ignore,no_run
1251 /// # use google_cloud_cloudcontrolspartner_v1::model::ListWorkloadsRequest;
1252 /// let x = ListWorkloadsRequest::new().set_filter("example");
1253 /// ```
1254 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255 self.filter = v.into();
1256 self
1257 }
1258
1259 /// Sets the value of [order_by][crate::model::ListWorkloadsRequest::order_by].
1260 ///
1261 /// # Example
1262 /// ```ignore,no_run
1263 /// # use google_cloud_cloudcontrolspartner_v1::model::ListWorkloadsRequest;
1264 /// let x = ListWorkloadsRequest::new().set_order_by("example");
1265 /// ```
1266 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1267 self.order_by = v.into();
1268 self
1269 }
1270}
1271
1272impl wkt::message::Message for ListWorkloadsRequest {
1273 fn typename() -> &'static str {
1274 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.ListWorkloadsRequest"
1275 }
1276}
1277
1278/// Response message for list customer workloads requests.
1279#[derive(Clone, Default, PartialEq)]
1280#[non_exhaustive]
1281pub struct ListWorkloadsResponse {
1282 /// List of customer workloads
1283 pub workloads: std::vec::Vec<crate::model::Workload>,
1284
1285 /// A token that can be sent as `page_token` to retrieve the next page.
1286 /// If this field is omitted, there are no subsequent pages.
1287 pub next_page_token: std::string::String,
1288
1289 /// Locations that could not be reached.
1290 pub unreachable: std::vec::Vec<std::string::String>,
1291
1292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1293}
1294
1295impl ListWorkloadsResponse {
1296 pub fn new() -> Self {
1297 std::default::Default::default()
1298 }
1299
1300 /// Sets the value of [workloads][crate::model::ListWorkloadsResponse::workloads].
1301 ///
1302 /// # Example
1303 /// ```ignore,no_run
1304 /// # use google_cloud_cloudcontrolspartner_v1::model::ListWorkloadsResponse;
1305 /// use google_cloud_cloudcontrolspartner_v1::model::Workload;
1306 /// let x = ListWorkloadsResponse::new()
1307 /// .set_workloads([
1308 /// Workload::default()/* use setters */,
1309 /// Workload::default()/* use (different) setters */,
1310 /// ]);
1311 /// ```
1312 pub fn set_workloads<T, V>(mut self, v: T) -> Self
1313 where
1314 T: std::iter::IntoIterator<Item = V>,
1315 V: std::convert::Into<crate::model::Workload>,
1316 {
1317 use std::iter::Iterator;
1318 self.workloads = v.into_iter().map(|i| i.into()).collect();
1319 self
1320 }
1321
1322 /// Sets the value of [next_page_token][crate::model::ListWorkloadsResponse::next_page_token].
1323 ///
1324 /// # Example
1325 /// ```ignore,no_run
1326 /// # use google_cloud_cloudcontrolspartner_v1::model::ListWorkloadsResponse;
1327 /// let x = ListWorkloadsResponse::new().set_next_page_token("example");
1328 /// ```
1329 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1330 self.next_page_token = v.into();
1331 self
1332 }
1333
1334 /// Sets the value of [unreachable][crate::model::ListWorkloadsResponse::unreachable].
1335 ///
1336 /// # Example
1337 /// ```ignore,no_run
1338 /// # use google_cloud_cloudcontrolspartner_v1::model::ListWorkloadsResponse;
1339 /// let x = ListWorkloadsResponse::new().set_unreachable(["a", "b", "c"]);
1340 /// ```
1341 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1342 where
1343 T: std::iter::IntoIterator<Item = V>,
1344 V: std::convert::Into<std::string::String>,
1345 {
1346 use std::iter::Iterator;
1347 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1348 self
1349 }
1350}
1351
1352impl wkt::message::Message for ListWorkloadsResponse {
1353 fn typename() -> &'static str {
1354 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.ListWorkloadsResponse"
1355 }
1356}
1357
1358#[doc(hidden)]
1359impl gax::paginator::internal::PageableResponse for ListWorkloadsResponse {
1360 type PageItem = crate::model::Workload;
1361
1362 fn items(self) -> std::vec::Vec<Self::PageItem> {
1363 self.workloads
1364 }
1365
1366 fn next_page_token(&self) -> std::string::String {
1367 use std::clone::Clone;
1368 self.next_page_token.clone()
1369 }
1370}
1371
1372/// Message for getting a customer workload.
1373#[derive(Clone, Default, PartialEq)]
1374#[non_exhaustive]
1375pub struct GetWorkloadRequest {
1376 /// Required. Format:
1377 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
1378 pub name: std::string::String,
1379
1380 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1381}
1382
1383impl GetWorkloadRequest {
1384 pub fn new() -> Self {
1385 std::default::Default::default()
1386 }
1387
1388 /// Sets the value of [name][crate::model::GetWorkloadRequest::name].
1389 ///
1390 /// # Example
1391 /// ```ignore,no_run
1392 /// # use google_cloud_cloudcontrolspartner_v1::model::GetWorkloadRequest;
1393 /// let x = GetWorkloadRequest::new().set_name("example");
1394 /// ```
1395 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1396 self.name = v.into();
1397 self
1398 }
1399}
1400
1401impl wkt::message::Message for GetWorkloadRequest {
1402 fn typename() -> &'static str {
1403 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.GetWorkloadRequest"
1404 }
1405}
1406
1407/// Container for workload onboarding steps.
1408#[derive(Clone, Default, PartialEq)]
1409#[non_exhaustive]
1410pub struct WorkloadOnboardingState {
1411 /// List of workload onboarding steps.
1412 pub onboarding_steps: std::vec::Vec<crate::model::WorkloadOnboardingStep>,
1413
1414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1415}
1416
1417impl WorkloadOnboardingState {
1418 pub fn new() -> Self {
1419 std::default::Default::default()
1420 }
1421
1422 /// Sets the value of [onboarding_steps][crate::model::WorkloadOnboardingState::onboarding_steps].
1423 ///
1424 /// # Example
1425 /// ```ignore,no_run
1426 /// # use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingState;
1427 /// use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingStep;
1428 /// let x = WorkloadOnboardingState::new()
1429 /// .set_onboarding_steps([
1430 /// WorkloadOnboardingStep::default()/* use setters */,
1431 /// WorkloadOnboardingStep::default()/* use (different) setters */,
1432 /// ]);
1433 /// ```
1434 pub fn set_onboarding_steps<T, V>(mut self, v: T) -> Self
1435 where
1436 T: std::iter::IntoIterator<Item = V>,
1437 V: std::convert::Into<crate::model::WorkloadOnboardingStep>,
1438 {
1439 use std::iter::Iterator;
1440 self.onboarding_steps = v.into_iter().map(|i| i.into()).collect();
1441 self
1442 }
1443}
1444
1445impl wkt::message::Message for WorkloadOnboardingState {
1446 fn typename() -> &'static str {
1447 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.WorkloadOnboardingState"
1448 }
1449}
1450
1451/// Container for workload onboarding information.
1452#[derive(Clone, Default, PartialEq)]
1453#[non_exhaustive]
1454pub struct WorkloadOnboardingStep {
1455 /// The onboarding step.
1456 pub step: crate::model::workload_onboarding_step::Step,
1457
1458 /// The starting time of the onboarding step.
1459 pub start_time: std::option::Option<wkt::Timestamp>,
1460
1461 /// The completion time of the onboarding step.
1462 pub completion_time: std::option::Option<wkt::Timestamp>,
1463
1464 /// Output only. The completion state of the onboarding step.
1465 pub completion_state: crate::model::CompletionState,
1466
1467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1468}
1469
1470impl WorkloadOnboardingStep {
1471 pub fn new() -> Self {
1472 std::default::Default::default()
1473 }
1474
1475 /// Sets the value of [step][crate::model::WorkloadOnboardingStep::step].
1476 ///
1477 /// # Example
1478 /// ```ignore,no_run
1479 /// # use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingStep;
1480 /// use google_cloud_cloudcontrolspartner_v1::model::workload_onboarding_step::Step;
1481 /// let x0 = WorkloadOnboardingStep::new().set_step(Step::EkmProvisioned);
1482 /// let x1 = WorkloadOnboardingStep::new().set_step(Step::SignedAccessApprovalConfigured);
1483 /// ```
1484 pub fn set_step<T: std::convert::Into<crate::model::workload_onboarding_step::Step>>(
1485 mut self,
1486 v: T,
1487 ) -> Self {
1488 self.step = v.into();
1489 self
1490 }
1491
1492 /// Sets the value of [start_time][crate::model::WorkloadOnboardingStep::start_time].
1493 ///
1494 /// # Example
1495 /// ```ignore,no_run
1496 /// # use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingStep;
1497 /// use wkt::Timestamp;
1498 /// let x = WorkloadOnboardingStep::new().set_start_time(Timestamp::default()/* use setters */);
1499 /// ```
1500 pub fn set_start_time<T>(mut self, v: T) -> Self
1501 where
1502 T: std::convert::Into<wkt::Timestamp>,
1503 {
1504 self.start_time = std::option::Option::Some(v.into());
1505 self
1506 }
1507
1508 /// Sets or clears the value of [start_time][crate::model::WorkloadOnboardingStep::start_time].
1509 ///
1510 /// # Example
1511 /// ```ignore,no_run
1512 /// # use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingStep;
1513 /// use wkt::Timestamp;
1514 /// let x = WorkloadOnboardingStep::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
1515 /// let x = WorkloadOnboardingStep::new().set_or_clear_start_time(None::<Timestamp>);
1516 /// ```
1517 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1518 where
1519 T: std::convert::Into<wkt::Timestamp>,
1520 {
1521 self.start_time = v.map(|x| x.into());
1522 self
1523 }
1524
1525 /// Sets the value of [completion_time][crate::model::WorkloadOnboardingStep::completion_time].
1526 ///
1527 /// # Example
1528 /// ```ignore,no_run
1529 /// # use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingStep;
1530 /// use wkt::Timestamp;
1531 /// let x = WorkloadOnboardingStep::new().set_completion_time(Timestamp::default()/* use setters */);
1532 /// ```
1533 pub fn set_completion_time<T>(mut self, v: T) -> Self
1534 where
1535 T: std::convert::Into<wkt::Timestamp>,
1536 {
1537 self.completion_time = std::option::Option::Some(v.into());
1538 self
1539 }
1540
1541 /// Sets or clears the value of [completion_time][crate::model::WorkloadOnboardingStep::completion_time].
1542 ///
1543 /// # Example
1544 /// ```ignore,no_run
1545 /// # use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingStep;
1546 /// use wkt::Timestamp;
1547 /// let x = WorkloadOnboardingStep::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
1548 /// let x = WorkloadOnboardingStep::new().set_or_clear_completion_time(None::<Timestamp>);
1549 /// ```
1550 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
1551 where
1552 T: std::convert::Into<wkt::Timestamp>,
1553 {
1554 self.completion_time = v.map(|x| x.into());
1555 self
1556 }
1557
1558 /// Sets the value of [completion_state][crate::model::WorkloadOnboardingStep::completion_state].
1559 ///
1560 /// # Example
1561 /// ```ignore,no_run
1562 /// # use google_cloud_cloudcontrolspartner_v1::model::WorkloadOnboardingStep;
1563 /// use google_cloud_cloudcontrolspartner_v1::model::CompletionState;
1564 /// let x0 = WorkloadOnboardingStep::new().set_completion_state(CompletionState::Pending);
1565 /// let x1 = WorkloadOnboardingStep::new().set_completion_state(CompletionState::Succeeded);
1566 /// let x2 = WorkloadOnboardingStep::new().set_completion_state(CompletionState::Failed);
1567 /// ```
1568 pub fn set_completion_state<T: std::convert::Into<crate::model::CompletionState>>(
1569 mut self,
1570 v: T,
1571 ) -> Self {
1572 self.completion_state = v.into();
1573 self
1574 }
1575}
1576
1577impl wkt::message::Message for WorkloadOnboardingStep {
1578 fn typename() -> &'static str {
1579 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.WorkloadOnboardingStep"
1580 }
1581}
1582
1583/// Defines additional types related to [WorkloadOnboardingStep].
1584pub mod workload_onboarding_step {
1585 #[allow(unused_imports)]
1586 use super::*;
1587
1588 /// Enum for possible onboarding steps.
1589 ///
1590 /// # Working with unknown values
1591 ///
1592 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1593 /// additional enum variants at any time. Adding new variants is not considered
1594 /// a breaking change. Applications should write their code in anticipation of:
1595 ///
1596 /// - New values appearing in future releases of the client library, **and**
1597 /// - New values received dynamically, without application changes.
1598 ///
1599 /// Please consult the [Working with enums] section in the user guide for some
1600 /// guidelines.
1601 ///
1602 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1603 #[derive(Clone, Debug, PartialEq)]
1604 #[non_exhaustive]
1605 pub enum Step {
1606 /// Unspecified step.
1607 Unspecified,
1608 /// EKM Provisioned step.
1609 EkmProvisioned,
1610 /// Signed Access Approval step.
1611 SignedAccessApprovalConfigured,
1612 /// If set, the enum was initialized with an unknown value.
1613 ///
1614 /// Applications can examine the value using [Step::value] or
1615 /// [Step::name].
1616 UnknownValue(step::UnknownValue),
1617 }
1618
1619 #[doc(hidden)]
1620 pub mod step {
1621 #[allow(unused_imports)]
1622 use super::*;
1623 #[derive(Clone, Debug, PartialEq)]
1624 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1625 }
1626
1627 impl Step {
1628 /// Gets the enum value.
1629 ///
1630 /// Returns `None` if the enum contains an unknown value deserialized from
1631 /// the string representation of enums.
1632 pub fn value(&self) -> std::option::Option<i32> {
1633 match self {
1634 Self::Unspecified => std::option::Option::Some(0),
1635 Self::EkmProvisioned => std::option::Option::Some(1),
1636 Self::SignedAccessApprovalConfigured => std::option::Option::Some(2),
1637 Self::UnknownValue(u) => u.0.value(),
1638 }
1639 }
1640
1641 /// Gets the enum value as a string.
1642 ///
1643 /// Returns `None` if the enum contains an unknown value deserialized from
1644 /// the integer representation of enums.
1645 pub fn name(&self) -> std::option::Option<&str> {
1646 match self {
1647 Self::Unspecified => std::option::Option::Some("STEP_UNSPECIFIED"),
1648 Self::EkmProvisioned => std::option::Option::Some("EKM_PROVISIONED"),
1649 Self::SignedAccessApprovalConfigured => {
1650 std::option::Option::Some("SIGNED_ACCESS_APPROVAL_CONFIGURED")
1651 }
1652 Self::UnknownValue(u) => u.0.name(),
1653 }
1654 }
1655 }
1656
1657 impl std::default::Default for Step {
1658 fn default() -> Self {
1659 use std::convert::From;
1660 Self::from(0)
1661 }
1662 }
1663
1664 impl std::fmt::Display for Step {
1665 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1666 wkt::internal::display_enum(f, self.name(), self.value())
1667 }
1668 }
1669
1670 impl std::convert::From<i32> for Step {
1671 fn from(value: i32) -> Self {
1672 match value {
1673 0 => Self::Unspecified,
1674 1 => Self::EkmProvisioned,
1675 2 => Self::SignedAccessApprovalConfigured,
1676 _ => Self::UnknownValue(step::UnknownValue(
1677 wkt::internal::UnknownEnumValue::Integer(value),
1678 )),
1679 }
1680 }
1681 }
1682
1683 impl std::convert::From<&str> for Step {
1684 fn from(value: &str) -> Self {
1685 use std::string::ToString;
1686 match value {
1687 "STEP_UNSPECIFIED" => Self::Unspecified,
1688 "EKM_PROVISIONED" => Self::EkmProvisioned,
1689 "SIGNED_ACCESS_APPROVAL_CONFIGURED" => Self::SignedAccessApprovalConfigured,
1690 _ => Self::UnknownValue(step::UnknownValue(
1691 wkt::internal::UnknownEnumValue::String(value.to_string()),
1692 )),
1693 }
1694 }
1695 }
1696
1697 impl serde::ser::Serialize for Step {
1698 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1699 where
1700 S: serde::Serializer,
1701 {
1702 match self {
1703 Self::Unspecified => serializer.serialize_i32(0),
1704 Self::EkmProvisioned => serializer.serialize_i32(1),
1705 Self::SignedAccessApprovalConfigured => serializer.serialize_i32(2),
1706 Self::UnknownValue(u) => u.0.serialize(serializer),
1707 }
1708 }
1709 }
1710
1711 impl<'de> serde::de::Deserialize<'de> for Step {
1712 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1713 where
1714 D: serde::Deserializer<'de>,
1715 {
1716 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Step>::new(
1717 ".google.cloud.cloudcontrolspartner.v1.WorkloadOnboardingStep.Step",
1718 ))
1719 }
1720 }
1721}
1722
1723/// Contains metadata around a Cloud Controls Partner Customer
1724#[derive(Clone, Default, PartialEq)]
1725#[non_exhaustive]
1726pub struct Customer {
1727 /// Identifier. Format:
1728 /// `organizations/{organization}/locations/{location}/customers/{customer}`
1729 pub name: std::string::String,
1730
1731 /// Required. Display name for the customer
1732 pub display_name: std::string::String,
1733
1734 /// Output only. Container for customer onboarding steps
1735 pub customer_onboarding_state: std::option::Option<crate::model::CustomerOnboardingState>,
1736
1737 /// Output only. Indicates whether a customer is fully onboarded
1738 pub is_onboarded: bool,
1739
1740 /// Output only. The customer organization domain, extracted from
1741 /// CRM Organization’s display_name field. e.g. "google.com"
1742 pub organization_domain: std::string::String,
1743
1744 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1745}
1746
1747impl Customer {
1748 pub fn new() -> Self {
1749 std::default::Default::default()
1750 }
1751
1752 /// Sets the value of [name][crate::model::Customer::name].
1753 ///
1754 /// # Example
1755 /// ```ignore,no_run
1756 /// # use google_cloud_cloudcontrolspartner_v1::model::Customer;
1757 /// let x = Customer::new().set_name("example");
1758 /// ```
1759 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1760 self.name = v.into();
1761 self
1762 }
1763
1764 /// Sets the value of [display_name][crate::model::Customer::display_name].
1765 ///
1766 /// # Example
1767 /// ```ignore,no_run
1768 /// # use google_cloud_cloudcontrolspartner_v1::model::Customer;
1769 /// let x = Customer::new().set_display_name("example");
1770 /// ```
1771 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1772 self.display_name = v.into();
1773 self
1774 }
1775
1776 /// Sets the value of [customer_onboarding_state][crate::model::Customer::customer_onboarding_state].
1777 ///
1778 /// # Example
1779 /// ```ignore,no_run
1780 /// # use google_cloud_cloudcontrolspartner_v1::model::Customer;
1781 /// use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingState;
1782 /// let x = Customer::new().set_customer_onboarding_state(CustomerOnboardingState::default()/* use setters */);
1783 /// ```
1784 pub fn set_customer_onboarding_state<T>(mut self, v: T) -> Self
1785 where
1786 T: std::convert::Into<crate::model::CustomerOnboardingState>,
1787 {
1788 self.customer_onboarding_state = std::option::Option::Some(v.into());
1789 self
1790 }
1791
1792 /// Sets or clears the value of [customer_onboarding_state][crate::model::Customer::customer_onboarding_state].
1793 ///
1794 /// # Example
1795 /// ```ignore,no_run
1796 /// # use google_cloud_cloudcontrolspartner_v1::model::Customer;
1797 /// use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingState;
1798 /// let x = Customer::new().set_or_clear_customer_onboarding_state(Some(CustomerOnboardingState::default()/* use setters */));
1799 /// let x = Customer::new().set_or_clear_customer_onboarding_state(None::<CustomerOnboardingState>);
1800 /// ```
1801 pub fn set_or_clear_customer_onboarding_state<T>(mut self, v: std::option::Option<T>) -> Self
1802 where
1803 T: std::convert::Into<crate::model::CustomerOnboardingState>,
1804 {
1805 self.customer_onboarding_state = v.map(|x| x.into());
1806 self
1807 }
1808
1809 /// Sets the value of [is_onboarded][crate::model::Customer::is_onboarded].
1810 ///
1811 /// # Example
1812 /// ```ignore,no_run
1813 /// # use google_cloud_cloudcontrolspartner_v1::model::Customer;
1814 /// let x = Customer::new().set_is_onboarded(true);
1815 /// ```
1816 pub fn set_is_onboarded<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1817 self.is_onboarded = v.into();
1818 self
1819 }
1820
1821 /// Sets the value of [organization_domain][crate::model::Customer::organization_domain].
1822 ///
1823 /// # Example
1824 /// ```ignore,no_run
1825 /// # use google_cloud_cloudcontrolspartner_v1::model::Customer;
1826 /// let x = Customer::new().set_organization_domain("example");
1827 /// ```
1828 pub fn set_organization_domain<T: std::convert::Into<std::string::String>>(
1829 mut self,
1830 v: T,
1831 ) -> Self {
1832 self.organization_domain = v.into();
1833 self
1834 }
1835}
1836
1837impl wkt::message::Message for Customer {
1838 fn typename() -> &'static str {
1839 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Customer"
1840 }
1841}
1842
1843/// Request to list customers
1844#[derive(Clone, Default, PartialEq)]
1845#[non_exhaustive]
1846pub struct ListCustomersRequest {
1847 /// Required. Parent resource
1848 /// Format: `organizations/{organization}/locations/{location}`
1849 pub parent: std::string::String,
1850
1851 /// The maximum number of Customers to return. The service may return fewer
1852 /// than this value. If unspecified, at most 500 Customers will be returned.
1853 pub page_size: i32,
1854
1855 /// A page token, received from a previous `ListCustomers` call.
1856 /// Provide this to retrieve the subsequent page.
1857 pub page_token: std::string::String,
1858
1859 /// Optional. Filtering results
1860 pub filter: std::string::String,
1861
1862 /// Optional. Hint for how to order the results
1863 pub order_by: std::string::String,
1864
1865 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1866}
1867
1868impl ListCustomersRequest {
1869 pub fn new() -> Self {
1870 std::default::Default::default()
1871 }
1872
1873 /// Sets the value of [parent][crate::model::ListCustomersRequest::parent].
1874 ///
1875 /// # Example
1876 /// ```ignore,no_run
1877 /// # use google_cloud_cloudcontrolspartner_v1::model::ListCustomersRequest;
1878 /// let x = ListCustomersRequest::new().set_parent("example");
1879 /// ```
1880 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1881 self.parent = v.into();
1882 self
1883 }
1884
1885 /// Sets the value of [page_size][crate::model::ListCustomersRequest::page_size].
1886 ///
1887 /// # Example
1888 /// ```ignore,no_run
1889 /// # use google_cloud_cloudcontrolspartner_v1::model::ListCustomersRequest;
1890 /// let x = ListCustomersRequest::new().set_page_size(42);
1891 /// ```
1892 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1893 self.page_size = v.into();
1894 self
1895 }
1896
1897 /// Sets the value of [page_token][crate::model::ListCustomersRequest::page_token].
1898 ///
1899 /// # Example
1900 /// ```ignore,no_run
1901 /// # use google_cloud_cloudcontrolspartner_v1::model::ListCustomersRequest;
1902 /// let x = ListCustomersRequest::new().set_page_token("example");
1903 /// ```
1904 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1905 self.page_token = v.into();
1906 self
1907 }
1908
1909 /// Sets the value of [filter][crate::model::ListCustomersRequest::filter].
1910 ///
1911 /// # Example
1912 /// ```ignore,no_run
1913 /// # use google_cloud_cloudcontrolspartner_v1::model::ListCustomersRequest;
1914 /// let x = ListCustomersRequest::new().set_filter("example");
1915 /// ```
1916 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1917 self.filter = v.into();
1918 self
1919 }
1920
1921 /// Sets the value of [order_by][crate::model::ListCustomersRequest::order_by].
1922 ///
1923 /// # Example
1924 /// ```ignore,no_run
1925 /// # use google_cloud_cloudcontrolspartner_v1::model::ListCustomersRequest;
1926 /// let x = ListCustomersRequest::new().set_order_by("example");
1927 /// ```
1928 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1929 self.order_by = v.into();
1930 self
1931 }
1932}
1933
1934impl wkt::message::Message for ListCustomersRequest {
1935 fn typename() -> &'static str {
1936 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.ListCustomersRequest"
1937 }
1938}
1939
1940/// Response message for list customer Customers requests
1941#[derive(Clone, Default, PartialEq)]
1942#[non_exhaustive]
1943pub struct ListCustomersResponse {
1944 /// List of customers
1945 pub customers: std::vec::Vec<crate::model::Customer>,
1946
1947 /// A token that can be sent as `page_token` to retrieve the next page.
1948 /// If this field is omitted, there are no subsequent pages.
1949 pub next_page_token: std::string::String,
1950
1951 /// Locations that could not be reached.
1952 pub unreachable: std::vec::Vec<std::string::String>,
1953
1954 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1955}
1956
1957impl ListCustomersResponse {
1958 pub fn new() -> Self {
1959 std::default::Default::default()
1960 }
1961
1962 /// Sets the value of [customers][crate::model::ListCustomersResponse::customers].
1963 ///
1964 /// # Example
1965 /// ```ignore,no_run
1966 /// # use google_cloud_cloudcontrolspartner_v1::model::ListCustomersResponse;
1967 /// use google_cloud_cloudcontrolspartner_v1::model::Customer;
1968 /// let x = ListCustomersResponse::new()
1969 /// .set_customers([
1970 /// Customer::default()/* use setters */,
1971 /// Customer::default()/* use (different) setters */,
1972 /// ]);
1973 /// ```
1974 pub fn set_customers<T, V>(mut self, v: T) -> Self
1975 where
1976 T: std::iter::IntoIterator<Item = V>,
1977 V: std::convert::Into<crate::model::Customer>,
1978 {
1979 use std::iter::Iterator;
1980 self.customers = v.into_iter().map(|i| i.into()).collect();
1981 self
1982 }
1983
1984 /// Sets the value of [next_page_token][crate::model::ListCustomersResponse::next_page_token].
1985 ///
1986 /// # Example
1987 /// ```ignore,no_run
1988 /// # use google_cloud_cloudcontrolspartner_v1::model::ListCustomersResponse;
1989 /// let x = ListCustomersResponse::new().set_next_page_token("example");
1990 /// ```
1991 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1992 self.next_page_token = v.into();
1993 self
1994 }
1995
1996 /// Sets the value of [unreachable][crate::model::ListCustomersResponse::unreachable].
1997 ///
1998 /// # Example
1999 /// ```ignore,no_run
2000 /// # use google_cloud_cloudcontrolspartner_v1::model::ListCustomersResponse;
2001 /// let x = ListCustomersResponse::new().set_unreachable(["a", "b", "c"]);
2002 /// ```
2003 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2004 where
2005 T: std::iter::IntoIterator<Item = V>,
2006 V: std::convert::Into<std::string::String>,
2007 {
2008 use std::iter::Iterator;
2009 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2010 self
2011 }
2012}
2013
2014impl wkt::message::Message for ListCustomersResponse {
2015 fn typename() -> &'static str {
2016 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.ListCustomersResponse"
2017 }
2018}
2019
2020#[doc(hidden)]
2021impl gax::paginator::internal::PageableResponse for ListCustomersResponse {
2022 type PageItem = crate::model::Customer;
2023
2024 fn items(self) -> std::vec::Vec<Self::PageItem> {
2025 self.customers
2026 }
2027
2028 fn next_page_token(&self) -> std::string::String {
2029 use std::clone::Clone;
2030 self.next_page_token.clone()
2031 }
2032}
2033
2034/// Request to create a customer
2035#[derive(Clone, Default, PartialEq)]
2036#[non_exhaustive]
2037pub struct CreateCustomerRequest {
2038 /// Required. Parent resource
2039 /// Format: `organizations/{organization}/locations/{location}`
2040 pub parent: std::string::String,
2041
2042 /// Required. The customer to create.
2043 pub customer: std::option::Option<crate::model::Customer>,
2044
2045 /// Required. The customer id to use for the customer, which will become the
2046 /// final component of the customer's resource name. The specified value must
2047 /// be a valid Google cloud organization id.
2048 pub customer_id: std::string::String,
2049
2050 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2051}
2052
2053impl CreateCustomerRequest {
2054 pub fn new() -> Self {
2055 std::default::Default::default()
2056 }
2057
2058 /// Sets the value of [parent][crate::model::CreateCustomerRequest::parent].
2059 ///
2060 /// # Example
2061 /// ```ignore,no_run
2062 /// # use google_cloud_cloudcontrolspartner_v1::model::CreateCustomerRequest;
2063 /// let x = CreateCustomerRequest::new().set_parent("example");
2064 /// ```
2065 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2066 self.parent = v.into();
2067 self
2068 }
2069
2070 /// Sets the value of [customer][crate::model::CreateCustomerRequest::customer].
2071 ///
2072 /// # Example
2073 /// ```ignore,no_run
2074 /// # use google_cloud_cloudcontrolspartner_v1::model::CreateCustomerRequest;
2075 /// use google_cloud_cloudcontrolspartner_v1::model::Customer;
2076 /// let x = CreateCustomerRequest::new().set_customer(Customer::default()/* use setters */);
2077 /// ```
2078 pub fn set_customer<T>(mut self, v: T) -> Self
2079 where
2080 T: std::convert::Into<crate::model::Customer>,
2081 {
2082 self.customer = std::option::Option::Some(v.into());
2083 self
2084 }
2085
2086 /// Sets or clears the value of [customer][crate::model::CreateCustomerRequest::customer].
2087 ///
2088 /// # Example
2089 /// ```ignore,no_run
2090 /// # use google_cloud_cloudcontrolspartner_v1::model::CreateCustomerRequest;
2091 /// use google_cloud_cloudcontrolspartner_v1::model::Customer;
2092 /// let x = CreateCustomerRequest::new().set_or_clear_customer(Some(Customer::default()/* use setters */));
2093 /// let x = CreateCustomerRequest::new().set_or_clear_customer(None::<Customer>);
2094 /// ```
2095 pub fn set_or_clear_customer<T>(mut self, v: std::option::Option<T>) -> Self
2096 where
2097 T: std::convert::Into<crate::model::Customer>,
2098 {
2099 self.customer = v.map(|x| x.into());
2100 self
2101 }
2102
2103 /// Sets the value of [customer_id][crate::model::CreateCustomerRequest::customer_id].
2104 ///
2105 /// # Example
2106 /// ```ignore,no_run
2107 /// # use google_cloud_cloudcontrolspartner_v1::model::CreateCustomerRequest;
2108 /// let x = CreateCustomerRequest::new().set_customer_id("example");
2109 /// ```
2110 pub fn set_customer_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2111 self.customer_id = v.into();
2112 self
2113 }
2114}
2115
2116impl wkt::message::Message for CreateCustomerRequest {
2117 fn typename() -> &'static str {
2118 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.CreateCustomerRequest"
2119 }
2120}
2121
2122/// Message for getting a customer
2123#[derive(Clone, Default, PartialEq)]
2124#[non_exhaustive]
2125pub struct GetCustomerRequest {
2126 /// Required. Format:
2127 /// `organizations/{organization}/locations/{location}/customers/{customer}`
2128 pub name: std::string::String,
2129
2130 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2131}
2132
2133impl GetCustomerRequest {
2134 pub fn new() -> Self {
2135 std::default::Default::default()
2136 }
2137
2138 /// Sets the value of [name][crate::model::GetCustomerRequest::name].
2139 ///
2140 /// # Example
2141 /// ```ignore,no_run
2142 /// # use google_cloud_cloudcontrolspartner_v1::model::GetCustomerRequest;
2143 /// let x = GetCustomerRequest::new().set_name("example");
2144 /// ```
2145 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2146 self.name = v.into();
2147 self
2148 }
2149}
2150
2151impl wkt::message::Message for GetCustomerRequest {
2152 fn typename() -> &'static str {
2153 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.GetCustomerRequest"
2154 }
2155}
2156
2157/// Container for customer onboarding steps
2158#[derive(Clone, Default, PartialEq)]
2159#[non_exhaustive]
2160pub struct CustomerOnboardingState {
2161 /// List of customer onboarding steps
2162 pub onboarding_steps: std::vec::Vec<crate::model::CustomerOnboardingStep>,
2163
2164 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2165}
2166
2167impl CustomerOnboardingState {
2168 pub fn new() -> Self {
2169 std::default::Default::default()
2170 }
2171
2172 /// Sets the value of [onboarding_steps][crate::model::CustomerOnboardingState::onboarding_steps].
2173 ///
2174 /// # Example
2175 /// ```ignore,no_run
2176 /// # use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingState;
2177 /// use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingStep;
2178 /// let x = CustomerOnboardingState::new()
2179 /// .set_onboarding_steps([
2180 /// CustomerOnboardingStep::default()/* use setters */,
2181 /// CustomerOnboardingStep::default()/* use (different) setters */,
2182 /// ]);
2183 /// ```
2184 pub fn set_onboarding_steps<T, V>(mut self, v: T) -> Self
2185 where
2186 T: std::iter::IntoIterator<Item = V>,
2187 V: std::convert::Into<crate::model::CustomerOnboardingStep>,
2188 {
2189 use std::iter::Iterator;
2190 self.onboarding_steps = v.into_iter().map(|i| i.into()).collect();
2191 self
2192 }
2193}
2194
2195impl wkt::message::Message for CustomerOnboardingState {
2196 fn typename() -> &'static str {
2197 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.CustomerOnboardingState"
2198 }
2199}
2200
2201/// Container for customer onboarding information
2202#[derive(Clone, Default, PartialEq)]
2203#[non_exhaustive]
2204pub struct CustomerOnboardingStep {
2205 /// The onboarding step
2206 pub step: crate::model::customer_onboarding_step::Step,
2207
2208 /// The starting time of the onboarding step
2209 pub start_time: std::option::Option<wkt::Timestamp>,
2210
2211 /// The completion time of the onboarding step
2212 pub completion_time: std::option::Option<wkt::Timestamp>,
2213
2214 /// Output only. Current state of the step
2215 pub completion_state: crate::model::CompletionState,
2216
2217 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2218}
2219
2220impl CustomerOnboardingStep {
2221 pub fn new() -> Self {
2222 std::default::Default::default()
2223 }
2224
2225 /// Sets the value of [step][crate::model::CustomerOnboardingStep::step].
2226 ///
2227 /// # Example
2228 /// ```ignore,no_run
2229 /// # use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingStep;
2230 /// use google_cloud_cloudcontrolspartner_v1::model::customer_onboarding_step::Step;
2231 /// let x0 = CustomerOnboardingStep::new().set_step(Step::KajEnrollment);
2232 /// let x1 = CustomerOnboardingStep::new().set_step(Step::CustomerEnvironment);
2233 /// ```
2234 pub fn set_step<T: std::convert::Into<crate::model::customer_onboarding_step::Step>>(
2235 mut self,
2236 v: T,
2237 ) -> Self {
2238 self.step = v.into();
2239 self
2240 }
2241
2242 /// Sets the value of [start_time][crate::model::CustomerOnboardingStep::start_time].
2243 ///
2244 /// # Example
2245 /// ```ignore,no_run
2246 /// # use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingStep;
2247 /// use wkt::Timestamp;
2248 /// let x = CustomerOnboardingStep::new().set_start_time(Timestamp::default()/* use setters */);
2249 /// ```
2250 pub fn set_start_time<T>(mut self, v: T) -> Self
2251 where
2252 T: std::convert::Into<wkt::Timestamp>,
2253 {
2254 self.start_time = std::option::Option::Some(v.into());
2255 self
2256 }
2257
2258 /// Sets or clears the value of [start_time][crate::model::CustomerOnboardingStep::start_time].
2259 ///
2260 /// # Example
2261 /// ```ignore,no_run
2262 /// # use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingStep;
2263 /// use wkt::Timestamp;
2264 /// let x = CustomerOnboardingStep::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2265 /// let x = CustomerOnboardingStep::new().set_or_clear_start_time(None::<Timestamp>);
2266 /// ```
2267 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2268 where
2269 T: std::convert::Into<wkt::Timestamp>,
2270 {
2271 self.start_time = v.map(|x| x.into());
2272 self
2273 }
2274
2275 /// Sets the value of [completion_time][crate::model::CustomerOnboardingStep::completion_time].
2276 ///
2277 /// # Example
2278 /// ```ignore,no_run
2279 /// # use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingStep;
2280 /// use wkt::Timestamp;
2281 /// let x = CustomerOnboardingStep::new().set_completion_time(Timestamp::default()/* use setters */);
2282 /// ```
2283 pub fn set_completion_time<T>(mut self, v: T) -> Self
2284 where
2285 T: std::convert::Into<wkt::Timestamp>,
2286 {
2287 self.completion_time = std::option::Option::Some(v.into());
2288 self
2289 }
2290
2291 /// Sets or clears the value of [completion_time][crate::model::CustomerOnboardingStep::completion_time].
2292 ///
2293 /// # Example
2294 /// ```ignore,no_run
2295 /// # use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingStep;
2296 /// use wkt::Timestamp;
2297 /// let x = CustomerOnboardingStep::new().set_or_clear_completion_time(Some(Timestamp::default()/* use setters */));
2298 /// let x = CustomerOnboardingStep::new().set_or_clear_completion_time(None::<Timestamp>);
2299 /// ```
2300 pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
2301 where
2302 T: std::convert::Into<wkt::Timestamp>,
2303 {
2304 self.completion_time = v.map(|x| x.into());
2305 self
2306 }
2307
2308 /// Sets the value of [completion_state][crate::model::CustomerOnboardingStep::completion_state].
2309 ///
2310 /// # Example
2311 /// ```ignore,no_run
2312 /// # use google_cloud_cloudcontrolspartner_v1::model::CustomerOnboardingStep;
2313 /// use google_cloud_cloudcontrolspartner_v1::model::CompletionState;
2314 /// let x0 = CustomerOnboardingStep::new().set_completion_state(CompletionState::Pending);
2315 /// let x1 = CustomerOnboardingStep::new().set_completion_state(CompletionState::Succeeded);
2316 /// let x2 = CustomerOnboardingStep::new().set_completion_state(CompletionState::Failed);
2317 /// ```
2318 pub fn set_completion_state<T: std::convert::Into<crate::model::CompletionState>>(
2319 mut self,
2320 v: T,
2321 ) -> Self {
2322 self.completion_state = v.into();
2323 self
2324 }
2325}
2326
2327impl wkt::message::Message for CustomerOnboardingStep {
2328 fn typename() -> &'static str {
2329 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.CustomerOnboardingStep"
2330 }
2331}
2332
2333/// Defines additional types related to [CustomerOnboardingStep].
2334pub mod customer_onboarding_step {
2335 #[allow(unused_imports)]
2336 use super::*;
2337
2338 /// Enum for possible onboarding steps
2339 ///
2340 /// # Working with unknown values
2341 ///
2342 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2343 /// additional enum variants at any time. Adding new variants is not considered
2344 /// a breaking change. Applications should write their code in anticipation of:
2345 ///
2346 /// - New values appearing in future releases of the client library, **and**
2347 /// - New values received dynamically, without application changes.
2348 ///
2349 /// Please consult the [Working with enums] section in the user guide for some
2350 /// guidelines.
2351 ///
2352 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2353 #[derive(Clone, Debug, PartialEq)]
2354 #[non_exhaustive]
2355 pub enum Step {
2356 /// Unspecified step
2357 Unspecified,
2358 /// KAJ Enrollment
2359 KajEnrollment,
2360 /// Customer Environment
2361 CustomerEnvironment,
2362 /// If set, the enum was initialized with an unknown value.
2363 ///
2364 /// Applications can examine the value using [Step::value] or
2365 /// [Step::name].
2366 UnknownValue(step::UnknownValue),
2367 }
2368
2369 #[doc(hidden)]
2370 pub mod step {
2371 #[allow(unused_imports)]
2372 use super::*;
2373 #[derive(Clone, Debug, PartialEq)]
2374 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2375 }
2376
2377 impl Step {
2378 /// Gets the enum value.
2379 ///
2380 /// Returns `None` if the enum contains an unknown value deserialized from
2381 /// the string representation of enums.
2382 pub fn value(&self) -> std::option::Option<i32> {
2383 match self {
2384 Self::Unspecified => std::option::Option::Some(0),
2385 Self::KajEnrollment => std::option::Option::Some(1),
2386 Self::CustomerEnvironment => std::option::Option::Some(2),
2387 Self::UnknownValue(u) => u.0.value(),
2388 }
2389 }
2390
2391 /// Gets the enum value as a string.
2392 ///
2393 /// Returns `None` if the enum contains an unknown value deserialized from
2394 /// the integer representation of enums.
2395 pub fn name(&self) -> std::option::Option<&str> {
2396 match self {
2397 Self::Unspecified => std::option::Option::Some("STEP_UNSPECIFIED"),
2398 Self::KajEnrollment => std::option::Option::Some("KAJ_ENROLLMENT"),
2399 Self::CustomerEnvironment => std::option::Option::Some("CUSTOMER_ENVIRONMENT"),
2400 Self::UnknownValue(u) => u.0.name(),
2401 }
2402 }
2403 }
2404
2405 impl std::default::Default for Step {
2406 fn default() -> Self {
2407 use std::convert::From;
2408 Self::from(0)
2409 }
2410 }
2411
2412 impl std::fmt::Display for Step {
2413 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2414 wkt::internal::display_enum(f, self.name(), self.value())
2415 }
2416 }
2417
2418 impl std::convert::From<i32> for Step {
2419 fn from(value: i32) -> Self {
2420 match value {
2421 0 => Self::Unspecified,
2422 1 => Self::KajEnrollment,
2423 2 => Self::CustomerEnvironment,
2424 _ => Self::UnknownValue(step::UnknownValue(
2425 wkt::internal::UnknownEnumValue::Integer(value),
2426 )),
2427 }
2428 }
2429 }
2430
2431 impl std::convert::From<&str> for Step {
2432 fn from(value: &str) -> Self {
2433 use std::string::ToString;
2434 match value {
2435 "STEP_UNSPECIFIED" => Self::Unspecified,
2436 "KAJ_ENROLLMENT" => Self::KajEnrollment,
2437 "CUSTOMER_ENVIRONMENT" => Self::CustomerEnvironment,
2438 _ => Self::UnknownValue(step::UnknownValue(
2439 wkt::internal::UnknownEnumValue::String(value.to_string()),
2440 )),
2441 }
2442 }
2443 }
2444
2445 impl serde::ser::Serialize for Step {
2446 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2447 where
2448 S: serde::Serializer,
2449 {
2450 match self {
2451 Self::Unspecified => serializer.serialize_i32(0),
2452 Self::KajEnrollment => serializer.serialize_i32(1),
2453 Self::CustomerEnvironment => serializer.serialize_i32(2),
2454 Self::UnknownValue(u) => u.0.serialize(serializer),
2455 }
2456 }
2457 }
2458
2459 impl<'de> serde::de::Deserialize<'de> for Step {
2460 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2461 where
2462 D: serde::Deserializer<'de>,
2463 {
2464 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Step>::new(
2465 ".google.cloud.cloudcontrolspartner.v1.CustomerOnboardingStep.Step",
2466 ))
2467 }
2468 }
2469}
2470
2471/// Request to update a customer
2472#[derive(Clone, Default, PartialEq)]
2473#[non_exhaustive]
2474pub struct UpdateCustomerRequest {
2475 /// Required. The customer to update
2476 /// Format:
2477 /// `organizations/{organization}/locations/{location}/customers/{customer}`
2478 pub customer: std::option::Option<crate::model::Customer>,
2479
2480 /// Optional. The list of fields to update
2481 pub update_mask: std::option::Option<wkt::FieldMask>,
2482
2483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2484}
2485
2486impl UpdateCustomerRequest {
2487 pub fn new() -> Self {
2488 std::default::Default::default()
2489 }
2490
2491 /// Sets the value of [customer][crate::model::UpdateCustomerRequest::customer].
2492 ///
2493 /// # Example
2494 /// ```ignore,no_run
2495 /// # use google_cloud_cloudcontrolspartner_v1::model::UpdateCustomerRequest;
2496 /// use google_cloud_cloudcontrolspartner_v1::model::Customer;
2497 /// let x = UpdateCustomerRequest::new().set_customer(Customer::default()/* use setters */);
2498 /// ```
2499 pub fn set_customer<T>(mut self, v: T) -> Self
2500 where
2501 T: std::convert::Into<crate::model::Customer>,
2502 {
2503 self.customer = std::option::Option::Some(v.into());
2504 self
2505 }
2506
2507 /// Sets or clears the value of [customer][crate::model::UpdateCustomerRequest::customer].
2508 ///
2509 /// # Example
2510 /// ```ignore,no_run
2511 /// # use google_cloud_cloudcontrolspartner_v1::model::UpdateCustomerRequest;
2512 /// use google_cloud_cloudcontrolspartner_v1::model::Customer;
2513 /// let x = UpdateCustomerRequest::new().set_or_clear_customer(Some(Customer::default()/* use setters */));
2514 /// let x = UpdateCustomerRequest::new().set_or_clear_customer(None::<Customer>);
2515 /// ```
2516 pub fn set_or_clear_customer<T>(mut self, v: std::option::Option<T>) -> Self
2517 where
2518 T: std::convert::Into<crate::model::Customer>,
2519 {
2520 self.customer = v.map(|x| x.into());
2521 self
2522 }
2523
2524 /// Sets the value of [update_mask][crate::model::UpdateCustomerRequest::update_mask].
2525 ///
2526 /// # Example
2527 /// ```ignore,no_run
2528 /// # use google_cloud_cloudcontrolspartner_v1::model::UpdateCustomerRequest;
2529 /// use wkt::FieldMask;
2530 /// let x = UpdateCustomerRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2531 /// ```
2532 pub fn set_update_mask<T>(mut self, v: T) -> Self
2533 where
2534 T: std::convert::Into<wkt::FieldMask>,
2535 {
2536 self.update_mask = std::option::Option::Some(v.into());
2537 self
2538 }
2539
2540 /// Sets or clears the value of [update_mask][crate::model::UpdateCustomerRequest::update_mask].
2541 ///
2542 /// # Example
2543 /// ```ignore,no_run
2544 /// # use google_cloud_cloudcontrolspartner_v1::model::UpdateCustomerRequest;
2545 /// use wkt::FieldMask;
2546 /// let x = UpdateCustomerRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2547 /// let x = UpdateCustomerRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2548 /// ```
2549 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2550 where
2551 T: std::convert::Into<wkt::FieldMask>,
2552 {
2553 self.update_mask = v.map(|x| x.into());
2554 self
2555 }
2556}
2557
2558impl wkt::message::Message for UpdateCustomerRequest {
2559 fn typename() -> &'static str {
2560 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.UpdateCustomerRequest"
2561 }
2562}
2563
2564/// Message for deleting customer
2565#[derive(Clone, Default, PartialEq)]
2566#[non_exhaustive]
2567pub struct DeleteCustomerRequest {
2568 /// Required. name of the resource to be deleted
2569 /// format: name=organizations/*/locations/*/customers/*
2570 pub name: std::string::String,
2571
2572 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2573}
2574
2575impl DeleteCustomerRequest {
2576 pub fn new() -> Self {
2577 std::default::Default::default()
2578 }
2579
2580 /// Sets the value of [name][crate::model::DeleteCustomerRequest::name].
2581 ///
2582 /// # Example
2583 /// ```ignore,no_run
2584 /// # use google_cloud_cloudcontrolspartner_v1::model::DeleteCustomerRequest;
2585 /// let x = DeleteCustomerRequest::new().set_name("example");
2586 /// ```
2587 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2588 self.name = v.into();
2589 self
2590 }
2591}
2592
2593impl wkt::message::Message for DeleteCustomerRequest {
2594 fn typename() -> &'static str {
2595 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.DeleteCustomerRequest"
2596 }
2597}
2598
2599/// The EKM connections associated with a workload
2600#[derive(Clone, Default, PartialEq)]
2601#[non_exhaustive]
2602pub struct EkmConnections {
2603 /// Identifier. Format:
2604 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/ekmConnections`
2605 pub name: std::string::String,
2606
2607 /// The EKM connections associated with the workload
2608 pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
2609
2610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2611}
2612
2613impl EkmConnections {
2614 pub fn new() -> Self {
2615 std::default::Default::default()
2616 }
2617
2618 /// Sets the value of [name][crate::model::EkmConnections::name].
2619 ///
2620 /// # Example
2621 /// ```ignore,no_run
2622 /// # use google_cloud_cloudcontrolspartner_v1::model::EkmConnections;
2623 /// let x = EkmConnections::new().set_name("example");
2624 /// ```
2625 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2626 self.name = v.into();
2627 self
2628 }
2629
2630 /// Sets the value of [ekm_connections][crate::model::EkmConnections::ekm_connections].
2631 ///
2632 /// # Example
2633 /// ```ignore,no_run
2634 /// # use google_cloud_cloudcontrolspartner_v1::model::EkmConnections;
2635 /// use google_cloud_cloudcontrolspartner_v1::model::EkmConnection;
2636 /// let x = EkmConnections::new()
2637 /// .set_ekm_connections([
2638 /// EkmConnection::default()/* use setters */,
2639 /// EkmConnection::default()/* use (different) setters */,
2640 /// ]);
2641 /// ```
2642 pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
2643 where
2644 T: std::iter::IntoIterator<Item = V>,
2645 V: std::convert::Into<crate::model::EkmConnection>,
2646 {
2647 use std::iter::Iterator;
2648 self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
2649 self
2650 }
2651}
2652
2653impl wkt::message::Message for EkmConnections {
2654 fn typename() -> &'static str {
2655 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.EkmConnections"
2656 }
2657}
2658
2659/// Request for getting the EKM connections associated with a workload
2660#[derive(Clone, Default, PartialEq)]
2661#[non_exhaustive]
2662pub struct GetEkmConnectionsRequest {
2663 /// Required. Format:
2664 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/ekmConnections`
2665 pub name: std::string::String,
2666
2667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2668}
2669
2670impl GetEkmConnectionsRequest {
2671 pub fn new() -> Self {
2672 std::default::Default::default()
2673 }
2674
2675 /// Sets the value of [name][crate::model::GetEkmConnectionsRequest::name].
2676 ///
2677 /// # Example
2678 /// ```ignore,no_run
2679 /// # use google_cloud_cloudcontrolspartner_v1::model::GetEkmConnectionsRequest;
2680 /// let x = GetEkmConnectionsRequest::new().set_name("example");
2681 /// ```
2682 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2683 self.name = v.into();
2684 self
2685 }
2686}
2687
2688impl wkt::message::Message for GetEkmConnectionsRequest {
2689 fn typename() -> &'static str {
2690 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.GetEkmConnectionsRequest"
2691 }
2692}
2693
2694/// Details about the EKM connection
2695#[derive(Clone, Default, PartialEq)]
2696#[non_exhaustive]
2697pub struct EkmConnection {
2698 /// Resource name of the EKM connection in the format:
2699 /// projects/{project}/locations/{location}/ekmConnections/{ekm_connection}
2700 pub connection_name: std::string::String,
2701
2702 /// Output only. The connection state
2703 pub connection_state: crate::model::ekm_connection::ConnectionState,
2704
2705 /// The connection error that occurred if any
2706 pub connection_error: std::option::Option<crate::model::ekm_connection::ConnectionError>,
2707
2708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2709}
2710
2711impl EkmConnection {
2712 pub fn new() -> Self {
2713 std::default::Default::default()
2714 }
2715
2716 /// Sets the value of [connection_name][crate::model::EkmConnection::connection_name].
2717 ///
2718 /// # Example
2719 /// ```ignore,no_run
2720 /// # use google_cloud_cloudcontrolspartner_v1::model::EkmConnection;
2721 /// let x = EkmConnection::new().set_connection_name("example");
2722 /// ```
2723 pub fn set_connection_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2724 self.connection_name = v.into();
2725 self
2726 }
2727
2728 /// Sets the value of [connection_state][crate::model::EkmConnection::connection_state].
2729 ///
2730 /// # Example
2731 /// ```ignore,no_run
2732 /// # use google_cloud_cloudcontrolspartner_v1::model::EkmConnection;
2733 /// use google_cloud_cloudcontrolspartner_v1::model::ekm_connection::ConnectionState;
2734 /// let x0 = EkmConnection::new().set_connection_state(ConnectionState::Available);
2735 /// let x1 = EkmConnection::new().set_connection_state(ConnectionState::NotAvailable);
2736 /// let x2 = EkmConnection::new().set_connection_state(ConnectionState::Error);
2737 /// ```
2738 pub fn set_connection_state<
2739 T: std::convert::Into<crate::model::ekm_connection::ConnectionState>,
2740 >(
2741 mut self,
2742 v: T,
2743 ) -> Self {
2744 self.connection_state = v.into();
2745 self
2746 }
2747
2748 /// Sets the value of [connection_error][crate::model::EkmConnection::connection_error].
2749 ///
2750 /// # Example
2751 /// ```ignore,no_run
2752 /// # use google_cloud_cloudcontrolspartner_v1::model::EkmConnection;
2753 /// use google_cloud_cloudcontrolspartner_v1::model::ekm_connection::ConnectionError;
2754 /// let x = EkmConnection::new().set_connection_error(ConnectionError::default()/* use setters */);
2755 /// ```
2756 pub fn set_connection_error<T>(mut self, v: T) -> Self
2757 where
2758 T: std::convert::Into<crate::model::ekm_connection::ConnectionError>,
2759 {
2760 self.connection_error = std::option::Option::Some(v.into());
2761 self
2762 }
2763
2764 /// Sets or clears the value of [connection_error][crate::model::EkmConnection::connection_error].
2765 ///
2766 /// # Example
2767 /// ```ignore,no_run
2768 /// # use google_cloud_cloudcontrolspartner_v1::model::EkmConnection;
2769 /// use google_cloud_cloudcontrolspartner_v1::model::ekm_connection::ConnectionError;
2770 /// let x = EkmConnection::new().set_or_clear_connection_error(Some(ConnectionError::default()/* use setters */));
2771 /// let x = EkmConnection::new().set_or_clear_connection_error(None::<ConnectionError>);
2772 /// ```
2773 pub fn set_or_clear_connection_error<T>(mut self, v: std::option::Option<T>) -> Self
2774 where
2775 T: std::convert::Into<crate::model::ekm_connection::ConnectionError>,
2776 {
2777 self.connection_error = v.map(|x| x.into());
2778 self
2779 }
2780}
2781
2782impl wkt::message::Message for EkmConnection {
2783 fn typename() -> &'static str {
2784 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.EkmConnection"
2785 }
2786}
2787
2788/// Defines additional types related to [EkmConnection].
2789pub mod ekm_connection {
2790 #[allow(unused_imports)]
2791 use super::*;
2792
2793 /// Information around the error that occurred if the connection state is
2794 /// anything other than available or unspecified
2795 #[derive(Clone, Default, PartialEq)]
2796 #[non_exhaustive]
2797 pub struct ConnectionError {
2798 /// The error domain for the error
2799 pub error_domain: std::string::String,
2800
2801 /// The error message for the error
2802 pub error_message: std::string::String,
2803
2804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2805 }
2806
2807 impl ConnectionError {
2808 pub fn new() -> Self {
2809 std::default::Default::default()
2810 }
2811
2812 /// Sets the value of [error_domain][crate::model::ekm_connection::ConnectionError::error_domain].
2813 ///
2814 /// # Example
2815 /// ```ignore,no_run
2816 /// # use google_cloud_cloudcontrolspartner_v1::model::ekm_connection::ConnectionError;
2817 /// let x = ConnectionError::new().set_error_domain("example");
2818 /// ```
2819 pub fn set_error_domain<T: std::convert::Into<std::string::String>>(
2820 mut self,
2821 v: T,
2822 ) -> Self {
2823 self.error_domain = v.into();
2824 self
2825 }
2826
2827 /// Sets the value of [error_message][crate::model::ekm_connection::ConnectionError::error_message].
2828 ///
2829 /// # Example
2830 /// ```ignore,no_run
2831 /// # use google_cloud_cloudcontrolspartner_v1::model::ekm_connection::ConnectionError;
2832 /// let x = ConnectionError::new().set_error_message("example");
2833 /// ```
2834 pub fn set_error_message<T: std::convert::Into<std::string::String>>(
2835 mut self,
2836 v: T,
2837 ) -> Self {
2838 self.error_message = v.into();
2839 self
2840 }
2841 }
2842
2843 impl wkt::message::Message for ConnectionError {
2844 fn typename() -> &'static str {
2845 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.EkmConnection.ConnectionError"
2846 }
2847 }
2848
2849 /// The EKM connection state.
2850 ///
2851 /// # Working with unknown values
2852 ///
2853 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2854 /// additional enum variants at any time. Adding new variants is not considered
2855 /// a breaking change. Applications should write their code in anticipation of:
2856 ///
2857 /// - New values appearing in future releases of the client library, **and**
2858 /// - New values received dynamically, without application changes.
2859 ///
2860 /// Please consult the [Working with enums] section in the user guide for some
2861 /// guidelines.
2862 ///
2863 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2864 #[derive(Clone, Debug, PartialEq)]
2865 #[non_exhaustive]
2866 pub enum ConnectionState {
2867 /// Unspecified EKM connection state
2868 Unspecified,
2869 /// Available EKM connection state
2870 Available,
2871 /// Not available EKM connection state
2872 NotAvailable,
2873 /// Error EKM connection state
2874 Error,
2875 /// Permission denied EKM connection state
2876 PermissionDenied,
2877 /// If set, the enum was initialized with an unknown value.
2878 ///
2879 /// Applications can examine the value using [ConnectionState::value] or
2880 /// [ConnectionState::name].
2881 UnknownValue(connection_state::UnknownValue),
2882 }
2883
2884 #[doc(hidden)]
2885 pub mod connection_state {
2886 #[allow(unused_imports)]
2887 use super::*;
2888 #[derive(Clone, Debug, PartialEq)]
2889 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2890 }
2891
2892 impl ConnectionState {
2893 /// Gets the enum value.
2894 ///
2895 /// Returns `None` if the enum contains an unknown value deserialized from
2896 /// the string representation of enums.
2897 pub fn value(&self) -> std::option::Option<i32> {
2898 match self {
2899 Self::Unspecified => std::option::Option::Some(0),
2900 Self::Available => std::option::Option::Some(1),
2901 Self::NotAvailable => std::option::Option::Some(2),
2902 Self::Error => std::option::Option::Some(3),
2903 Self::PermissionDenied => std::option::Option::Some(4),
2904 Self::UnknownValue(u) => u.0.value(),
2905 }
2906 }
2907
2908 /// Gets the enum value as a string.
2909 ///
2910 /// Returns `None` if the enum contains an unknown value deserialized from
2911 /// the integer representation of enums.
2912 pub fn name(&self) -> std::option::Option<&str> {
2913 match self {
2914 Self::Unspecified => std::option::Option::Some("CONNECTION_STATE_UNSPECIFIED"),
2915 Self::Available => std::option::Option::Some("AVAILABLE"),
2916 Self::NotAvailable => std::option::Option::Some("NOT_AVAILABLE"),
2917 Self::Error => std::option::Option::Some("ERROR"),
2918 Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
2919 Self::UnknownValue(u) => u.0.name(),
2920 }
2921 }
2922 }
2923
2924 impl std::default::Default for ConnectionState {
2925 fn default() -> Self {
2926 use std::convert::From;
2927 Self::from(0)
2928 }
2929 }
2930
2931 impl std::fmt::Display for ConnectionState {
2932 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2933 wkt::internal::display_enum(f, self.name(), self.value())
2934 }
2935 }
2936
2937 impl std::convert::From<i32> for ConnectionState {
2938 fn from(value: i32) -> Self {
2939 match value {
2940 0 => Self::Unspecified,
2941 1 => Self::Available,
2942 2 => Self::NotAvailable,
2943 3 => Self::Error,
2944 4 => Self::PermissionDenied,
2945 _ => Self::UnknownValue(connection_state::UnknownValue(
2946 wkt::internal::UnknownEnumValue::Integer(value),
2947 )),
2948 }
2949 }
2950 }
2951
2952 impl std::convert::From<&str> for ConnectionState {
2953 fn from(value: &str) -> Self {
2954 use std::string::ToString;
2955 match value {
2956 "CONNECTION_STATE_UNSPECIFIED" => Self::Unspecified,
2957 "AVAILABLE" => Self::Available,
2958 "NOT_AVAILABLE" => Self::NotAvailable,
2959 "ERROR" => Self::Error,
2960 "PERMISSION_DENIED" => Self::PermissionDenied,
2961 _ => Self::UnknownValue(connection_state::UnknownValue(
2962 wkt::internal::UnknownEnumValue::String(value.to_string()),
2963 )),
2964 }
2965 }
2966 }
2967
2968 impl serde::ser::Serialize for ConnectionState {
2969 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2970 where
2971 S: serde::Serializer,
2972 {
2973 match self {
2974 Self::Unspecified => serializer.serialize_i32(0),
2975 Self::Available => serializer.serialize_i32(1),
2976 Self::NotAvailable => serializer.serialize_i32(2),
2977 Self::Error => serializer.serialize_i32(3),
2978 Self::PermissionDenied => serializer.serialize_i32(4),
2979 Self::UnknownValue(u) => u.0.serialize(serializer),
2980 }
2981 }
2982 }
2983
2984 impl<'de> serde::de::Deserialize<'de> for ConnectionState {
2985 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2986 where
2987 D: serde::Deserializer<'de>,
2988 {
2989 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectionState>::new(
2990 ".google.cloud.cloudcontrolspartner.v1.EkmConnection.ConnectionState",
2991 ))
2992 }
2993 }
2994}
2995
2996/// The permissions granted to the partner for a workload
2997#[derive(Clone, Default, PartialEq)]
2998#[non_exhaustive]
2999pub struct PartnerPermissions {
3000 /// Identifier. Format:
3001 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/partnerPermissions`
3002 pub name: std::string::String,
3003
3004 /// The partner permissions granted for the workload
3005 pub partner_permissions: std::vec::Vec<crate::model::partner_permissions::Permission>,
3006
3007 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3008}
3009
3010impl PartnerPermissions {
3011 pub fn new() -> Self {
3012 std::default::Default::default()
3013 }
3014
3015 /// Sets the value of [name][crate::model::PartnerPermissions::name].
3016 ///
3017 /// # Example
3018 /// ```ignore,no_run
3019 /// # use google_cloud_cloudcontrolspartner_v1::model::PartnerPermissions;
3020 /// let x = PartnerPermissions::new().set_name("example");
3021 /// ```
3022 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3023 self.name = v.into();
3024 self
3025 }
3026
3027 /// Sets the value of [partner_permissions][crate::model::PartnerPermissions::partner_permissions].
3028 ///
3029 /// # Example
3030 /// ```ignore,no_run
3031 /// # use google_cloud_cloudcontrolspartner_v1::model::PartnerPermissions;
3032 /// use google_cloud_cloudcontrolspartner_v1::model::partner_permissions::Permission;
3033 /// let x = PartnerPermissions::new().set_partner_permissions([
3034 /// Permission::AccessTransparencyAndEmergencyAccessLogs,
3035 /// Permission::AssuredWorkloadsMonitoring,
3036 /// Permission::AccessApprovalRequests,
3037 /// ]);
3038 /// ```
3039 pub fn set_partner_permissions<T, V>(mut self, v: T) -> Self
3040 where
3041 T: std::iter::IntoIterator<Item = V>,
3042 V: std::convert::Into<crate::model::partner_permissions::Permission>,
3043 {
3044 use std::iter::Iterator;
3045 self.partner_permissions = v.into_iter().map(|i| i.into()).collect();
3046 self
3047 }
3048}
3049
3050impl wkt::message::Message for PartnerPermissions {
3051 fn typename() -> &'static str {
3052 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.PartnerPermissions"
3053 }
3054}
3055
3056/// Defines additional types related to [PartnerPermissions].
3057pub mod partner_permissions {
3058 #[allow(unused_imports)]
3059 use super::*;
3060
3061 ///
3062 /// # Working with unknown values
3063 ///
3064 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3065 /// additional enum variants at any time. Adding new variants is not considered
3066 /// a breaking change. Applications should write their code in anticipation of:
3067 ///
3068 /// - New values appearing in future releases of the client library, **and**
3069 /// - New values received dynamically, without application changes.
3070 ///
3071 /// Please consult the [Working with enums] section in the user guide for some
3072 /// guidelines.
3073 ///
3074 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3075 #[derive(Clone, Debug, PartialEq)]
3076 #[non_exhaustive]
3077 pub enum Permission {
3078 /// Unspecified partner permission
3079 Unspecified,
3080 /// Permission for Access Transparency and emergency logs
3081 AccessTransparencyAndEmergencyAccessLogs,
3082 /// Permission for Assured Workloads monitoring violations
3083 AssuredWorkloadsMonitoring,
3084 /// Permission for Access Approval requests
3085 AccessApprovalRequests,
3086 /// Permission for External Key Manager connection status
3087 AssuredWorkloadsEkmConnectionStatus,
3088 /// Permission for support case details for Access Transparency log entries
3089 AccessTransparencyLogsSupportCaseViewer,
3090 /// If set, the enum was initialized with an unknown value.
3091 ///
3092 /// Applications can examine the value using [Permission::value] or
3093 /// [Permission::name].
3094 UnknownValue(permission::UnknownValue),
3095 }
3096
3097 #[doc(hidden)]
3098 pub mod permission {
3099 #[allow(unused_imports)]
3100 use super::*;
3101 #[derive(Clone, Debug, PartialEq)]
3102 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3103 }
3104
3105 impl Permission {
3106 /// Gets the enum value.
3107 ///
3108 /// Returns `None` if the enum contains an unknown value deserialized from
3109 /// the string representation of enums.
3110 pub fn value(&self) -> std::option::Option<i32> {
3111 match self {
3112 Self::Unspecified => std::option::Option::Some(0),
3113 Self::AccessTransparencyAndEmergencyAccessLogs => std::option::Option::Some(1),
3114 Self::AssuredWorkloadsMonitoring => std::option::Option::Some(2),
3115 Self::AccessApprovalRequests => std::option::Option::Some(3),
3116 Self::AssuredWorkloadsEkmConnectionStatus => std::option::Option::Some(4),
3117 Self::AccessTransparencyLogsSupportCaseViewer => std::option::Option::Some(5),
3118 Self::UnknownValue(u) => u.0.value(),
3119 }
3120 }
3121
3122 /// Gets the enum value as a string.
3123 ///
3124 /// Returns `None` if the enum contains an unknown value deserialized from
3125 /// the integer representation of enums.
3126 pub fn name(&self) -> std::option::Option<&str> {
3127 match self {
3128 Self::Unspecified => std::option::Option::Some("PERMISSION_UNSPECIFIED"),
3129 Self::AccessTransparencyAndEmergencyAccessLogs => {
3130 std::option::Option::Some("ACCESS_TRANSPARENCY_AND_EMERGENCY_ACCESS_LOGS")
3131 }
3132 Self::AssuredWorkloadsMonitoring => {
3133 std::option::Option::Some("ASSURED_WORKLOADS_MONITORING")
3134 }
3135 Self::AccessApprovalRequests => {
3136 std::option::Option::Some("ACCESS_APPROVAL_REQUESTS")
3137 }
3138 Self::AssuredWorkloadsEkmConnectionStatus => {
3139 std::option::Option::Some("ASSURED_WORKLOADS_EKM_CONNECTION_STATUS")
3140 }
3141 Self::AccessTransparencyLogsSupportCaseViewer => {
3142 std::option::Option::Some("ACCESS_TRANSPARENCY_LOGS_SUPPORT_CASE_VIEWER")
3143 }
3144 Self::UnknownValue(u) => u.0.name(),
3145 }
3146 }
3147 }
3148
3149 impl std::default::Default for Permission {
3150 fn default() -> Self {
3151 use std::convert::From;
3152 Self::from(0)
3153 }
3154 }
3155
3156 impl std::fmt::Display for Permission {
3157 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3158 wkt::internal::display_enum(f, self.name(), self.value())
3159 }
3160 }
3161
3162 impl std::convert::From<i32> for Permission {
3163 fn from(value: i32) -> Self {
3164 match value {
3165 0 => Self::Unspecified,
3166 1 => Self::AccessTransparencyAndEmergencyAccessLogs,
3167 2 => Self::AssuredWorkloadsMonitoring,
3168 3 => Self::AccessApprovalRequests,
3169 4 => Self::AssuredWorkloadsEkmConnectionStatus,
3170 5 => Self::AccessTransparencyLogsSupportCaseViewer,
3171 _ => Self::UnknownValue(permission::UnknownValue(
3172 wkt::internal::UnknownEnumValue::Integer(value),
3173 )),
3174 }
3175 }
3176 }
3177
3178 impl std::convert::From<&str> for Permission {
3179 fn from(value: &str) -> Self {
3180 use std::string::ToString;
3181 match value {
3182 "PERMISSION_UNSPECIFIED" => Self::Unspecified,
3183 "ACCESS_TRANSPARENCY_AND_EMERGENCY_ACCESS_LOGS" => {
3184 Self::AccessTransparencyAndEmergencyAccessLogs
3185 }
3186 "ASSURED_WORKLOADS_MONITORING" => Self::AssuredWorkloadsMonitoring,
3187 "ACCESS_APPROVAL_REQUESTS" => Self::AccessApprovalRequests,
3188 "ASSURED_WORKLOADS_EKM_CONNECTION_STATUS" => {
3189 Self::AssuredWorkloadsEkmConnectionStatus
3190 }
3191 "ACCESS_TRANSPARENCY_LOGS_SUPPORT_CASE_VIEWER" => {
3192 Self::AccessTransparencyLogsSupportCaseViewer
3193 }
3194 _ => Self::UnknownValue(permission::UnknownValue(
3195 wkt::internal::UnknownEnumValue::String(value.to_string()),
3196 )),
3197 }
3198 }
3199 }
3200
3201 impl serde::ser::Serialize for Permission {
3202 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3203 where
3204 S: serde::Serializer,
3205 {
3206 match self {
3207 Self::Unspecified => serializer.serialize_i32(0),
3208 Self::AccessTransparencyAndEmergencyAccessLogs => serializer.serialize_i32(1),
3209 Self::AssuredWorkloadsMonitoring => serializer.serialize_i32(2),
3210 Self::AccessApprovalRequests => serializer.serialize_i32(3),
3211 Self::AssuredWorkloadsEkmConnectionStatus => serializer.serialize_i32(4),
3212 Self::AccessTransparencyLogsSupportCaseViewer => serializer.serialize_i32(5),
3213 Self::UnknownValue(u) => u.0.serialize(serializer),
3214 }
3215 }
3216 }
3217
3218 impl<'de> serde::de::Deserialize<'de> for Permission {
3219 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3220 where
3221 D: serde::Deserializer<'de>,
3222 {
3223 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Permission>::new(
3224 ".google.cloud.cloudcontrolspartner.v1.PartnerPermissions.Permission",
3225 ))
3226 }
3227 }
3228}
3229
3230/// Request for getting the partner permissions granted for a workload
3231#[derive(Clone, Default, PartialEq)]
3232#[non_exhaustive]
3233pub struct GetPartnerPermissionsRequest {
3234 /// Required. Name of the resource to get in the format:
3235 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/partnerPermissions`
3236 pub name: std::string::String,
3237
3238 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3239}
3240
3241impl GetPartnerPermissionsRequest {
3242 pub fn new() -> Self {
3243 std::default::Default::default()
3244 }
3245
3246 /// Sets the value of [name][crate::model::GetPartnerPermissionsRequest::name].
3247 ///
3248 /// # Example
3249 /// ```ignore,no_run
3250 /// # use google_cloud_cloudcontrolspartner_v1::model::GetPartnerPermissionsRequest;
3251 /// let x = GetPartnerPermissionsRequest::new().set_name("example");
3252 /// ```
3253 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3254 self.name = v.into();
3255 self
3256 }
3257}
3258
3259impl wkt::message::Message for GetPartnerPermissionsRequest {
3260 fn typename() -> &'static str {
3261 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.GetPartnerPermissionsRequest"
3262 }
3263}
3264
3265/// Message describing Partner resource
3266#[derive(Clone, Default, PartialEq)]
3267#[non_exhaustive]
3268pub struct Partner {
3269 /// Identifier. The resource name of the partner.
3270 /// Format: `organizations/{organization}/locations/{location}/partner`
3271 /// Example: "organizations/123456/locations/us-central1/partner"
3272 pub name: std::string::String,
3273
3274 /// List of SKUs the partner is offering
3275 pub skus: std::vec::Vec<crate::model::Sku>,
3276
3277 /// List of Google Cloud supported EKM partners supported by the partner
3278 pub ekm_solutions: std::vec::Vec<crate::model::EkmMetadata>,
3279
3280 /// List of Google Cloud regions that the partner sells services to customers.
3281 /// Valid Google Cloud regions found here:
3282 /// <https://cloud.google.com/compute/docs/regions-zones>
3283 pub operated_cloud_regions: std::vec::Vec<std::string::String>,
3284
3285 /// Google Cloud project ID in the partner's Google Cloud organization for
3286 /// receiving enhanced Logs for Partners.
3287 pub partner_project_id: std::string::String,
3288
3289 /// Output only. Time the resource was created
3290 pub create_time: std::option::Option<wkt::Timestamp>,
3291
3292 /// Output only. The last time the resource was updated
3293 pub update_time: std::option::Option<wkt::Timestamp>,
3294
3295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3296}
3297
3298impl Partner {
3299 pub fn new() -> Self {
3300 std::default::Default::default()
3301 }
3302
3303 /// Sets the value of [name][crate::model::Partner::name].
3304 ///
3305 /// # Example
3306 /// ```ignore,no_run
3307 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3308 /// let x = Partner::new().set_name("example");
3309 /// ```
3310 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3311 self.name = v.into();
3312 self
3313 }
3314
3315 /// Sets the value of [skus][crate::model::Partner::skus].
3316 ///
3317 /// # Example
3318 /// ```ignore,no_run
3319 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3320 /// use google_cloud_cloudcontrolspartner_v1::model::Sku;
3321 /// let x = Partner::new()
3322 /// .set_skus([
3323 /// Sku::default()/* use setters */,
3324 /// Sku::default()/* use (different) setters */,
3325 /// ]);
3326 /// ```
3327 pub fn set_skus<T, V>(mut self, v: T) -> Self
3328 where
3329 T: std::iter::IntoIterator<Item = V>,
3330 V: std::convert::Into<crate::model::Sku>,
3331 {
3332 use std::iter::Iterator;
3333 self.skus = v.into_iter().map(|i| i.into()).collect();
3334 self
3335 }
3336
3337 /// Sets the value of [ekm_solutions][crate::model::Partner::ekm_solutions].
3338 ///
3339 /// # Example
3340 /// ```ignore,no_run
3341 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3342 /// use google_cloud_cloudcontrolspartner_v1::model::EkmMetadata;
3343 /// let x = Partner::new()
3344 /// .set_ekm_solutions([
3345 /// EkmMetadata::default()/* use setters */,
3346 /// EkmMetadata::default()/* use (different) setters */,
3347 /// ]);
3348 /// ```
3349 pub fn set_ekm_solutions<T, V>(mut self, v: T) -> Self
3350 where
3351 T: std::iter::IntoIterator<Item = V>,
3352 V: std::convert::Into<crate::model::EkmMetadata>,
3353 {
3354 use std::iter::Iterator;
3355 self.ekm_solutions = v.into_iter().map(|i| i.into()).collect();
3356 self
3357 }
3358
3359 /// Sets the value of [operated_cloud_regions][crate::model::Partner::operated_cloud_regions].
3360 ///
3361 /// # Example
3362 /// ```ignore,no_run
3363 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3364 /// let x = Partner::new().set_operated_cloud_regions(["a", "b", "c"]);
3365 /// ```
3366 pub fn set_operated_cloud_regions<T, V>(mut self, v: T) -> Self
3367 where
3368 T: std::iter::IntoIterator<Item = V>,
3369 V: std::convert::Into<std::string::String>,
3370 {
3371 use std::iter::Iterator;
3372 self.operated_cloud_regions = v.into_iter().map(|i| i.into()).collect();
3373 self
3374 }
3375
3376 /// Sets the value of [partner_project_id][crate::model::Partner::partner_project_id].
3377 ///
3378 /// # Example
3379 /// ```ignore,no_run
3380 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3381 /// let x = Partner::new().set_partner_project_id("example");
3382 /// ```
3383 pub fn set_partner_project_id<T: std::convert::Into<std::string::String>>(
3384 mut self,
3385 v: T,
3386 ) -> Self {
3387 self.partner_project_id = v.into();
3388 self
3389 }
3390
3391 /// Sets the value of [create_time][crate::model::Partner::create_time].
3392 ///
3393 /// # Example
3394 /// ```ignore,no_run
3395 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3396 /// use wkt::Timestamp;
3397 /// let x = Partner::new().set_create_time(Timestamp::default()/* use setters */);
3398 /// ```
3399 pub fn set_create_time<T>(mut self, v: T) -> Self
3400 where
3401 T: std::convert::Into<wkt::Timestamp>,
3402 {
3403 self.create_time = std::option::Option::Some(v.into());
3404 self
3405 }
3406
3407 /// Sets or clears the value of [create_time][crate::model::Partner::create_time].
3408 ///
3409 /// # Example
3410 /// ```ignore,no_run
3411 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3412 /// use wkt::Timestamp;
3413 /// let x = Partner::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3414 /// let x = Partner::new().set_or_clear_create_time(None::<Timestamp>);
3415 /// ```
3416 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3417 where
3418 T: std::convert::Into<wkt::Timestamp>,
3419 {
3420 self.create_time = v.map(|x| x.into());
3421 self
3422 }
3423
3424 /// Sets the value of [update_time][crate::model::Partner::update_time].
3425 ///
3426 /// # Example
3427 /// ```ignore,no_run
3428 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3429 /// use wkt::Timestamp;
3430 /// let x = Partner::new().set_update_time(Timestamp::default()/* use setters */);
3431 /// ```
3432 pub fn set_update_time<T>(mut self, v: T) -> Self
3433 where
3434 T: std::convert::Into<wkt::Timestamp>,
3435 {
3436 self.update_time = std::option::Option::Some(v.into());
3437 self
3438 }
3439
3440 /// Sets or clears the value of [update_time][crate::model::Partner::update_time].
3441 ///
3442 /// # Example
3443 /// ```ignore,no_run
3444 /// # use google_cloud_cloudcontrolspartner_v1::model::Partner;
3445 /// use wkt::Timestamp;
3446 /// let x = Partner::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3447 /// let x = Partner::new().set_or_clear_update_time(None::<Timestamp>);
3448 /// ```
3449 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3450 where
3451 T: std::convert::Into<wkt::Timestamp>,
3452 {
3453 self.update_time = v.map(|x| x.into());
3454 self
3455 }
3456}
3457
3458impl wkt::message::Message for Partner {
3459 fn typename() -> &'static str {
3460 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Partner"
3461 }
3462}
3463
3464/// Message for getting a Partner
3465#[derive(Clone, Default, PartialEq)]
3466#[non_exhaustive]
3467pub struct GetPartnerRequest {
3468 /// Required. Format:
3469 /// `organizations/{organization}/locations/{location}/partner`
3470 pub name: std::string::String,
3471
3472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3473}
3474
3475impl GetPartnerRequest {
3476 pub fn new() -> Self {
3477 std::default::Default::default()
3478 }
3479
3480 /// Sets the value of [name][crate::model::GetPartnerRequest::name].
3481 ///
3482 /// # Example
3483 /// ```ignore,no_run
3484 /// # use google_cloud_cloudcontrolspartner_v1::model::GetPartnerRequest;
3485 /// let x = GetPartnerRequest::new().set_name("example");
3486 /// ```
3487 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3488 self.name = v.into();
3489 self
3490 }
3491}
3492
3493impl wkt::message::Message for GetPartnerRequest {
3494 fn typename() -> &'static str {
3495 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.GetPartnerRequest"
3496 }
3497}
3498
3499/// Represents the SKU a partner owns inside Google Cloud to sell to customers.
3500#[derive(Clone, Default, PartialEq)]
3501#[non_exhaustive]
3502pub struct Sku {
3503 /// Argentum product SKU, that is associated with the partner offerings to
3504 /// customers used by Syntro for billing purposes. SKUs can represent resold
3505 /// Google products or support services.
3506 pub id: std::string::String,
3507
3508 /// Display name of the product identified by the SKU. A partner may want to
3509 /// show partner branded names for their offerings such as local sovereign
3510 /// cloud solutions.
3511 pub display_name: std::string::String,
3512
3513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3514}
3515
3516impl Sku {
3517 pub fn new() -> Self {
3518 std::default::Default::default()
3519 }
3520
3521 /// Sets the value of [id][crate::model::Sku::id].
3522 ///
3523 /// # Example
3524 /// ```ignore,no_run
3525 /// # use google_cloud_cloudcontrolspartner_v1::model::Sku;
3526 /// let x = Sku::new().set_id("example");
3527 /// ```
3528 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3529 self.id = v.into();
3530 self
3531 }
3532
3533 /// Sets the value of [display_name][crate::model::Sku::display_name].
3534 ///
3535 /// # Example
3536 /// ```ignore,no_run
3537 /// # use google_cloud_cloudcontrolspartner_v1::model::Sku;
3538 /// let x = Sku::new().set_display_name("example");
3539 /// ```
3540 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3541 self.display_name = v.into();
3542 self
3543 }
3544}
3545
3546impl wkt::message::Message for Sku {
3547 fn typename() -> &'static str {
3548 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Sku"
3549 }
3550}
3551
3552/// Holds information needed by Mudbray to use partner EKMs for workloads.
3553#[derive(Clone, Default, PartialEq)]
3554#[non_exhaustive]
3555pub struct EkmMetadata {
3556 /// The Cloud EKM partner.
3557 pub ekm_solution: crate::model::ekm_metadata::EkmSolution,
3558
3559 /// Endpoint for sending requests to the EKM for key provisioning during
3560 /// Assured Workload creation.
3561 pub ekm_endpoint_uri: std::string::String,
3562
3563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3564}
3565
3566impl EkmMetadata {
3567 pub fn new() -> Self {
3568 std::default::Default::default()
3569 }
3570
3571 /// Sets the value of [ekm_solution][crate::model::EkmMetadata::ekm_solution].
3572 ///
3573 /// # Example
3574 /// ```ignore,no_run
3575 /// # use google_cloud_cloudcontrolspartner_v1::model::EkmMetadata;
3576 /// use google_cloud_cloudcontrolspartner_v1::model::ekm_metadata::EkmSolution;
3577 /// let x0 = EkmMetadata::new().set_ekm_solution(EkmSolution::Fortanix);
3578 /// let x1 = EkmMetadata::new().set_ekm_solution(EkmSolution::Futurex);
3579 /// let x2 = EkmMetadata::new().set_ekm_solution(EkmSolution::Thales);
3580 /// ```
3581 pub fn set_ekm_solution<T: std::convert::Into<crate::model::ekm_metadata::EkmSolution>>(
3582 mut self,
3583 v: T,
3584 ) -> Self {
3585 self.ekm_solution = v.into();
3586 self
3587 }
3588
3589 /// Sets the value of [ekm_endpoint_uri][crate::model::EkmMetadata::ekm_endpoint_uri].
3590 ///
3591 /// # Example
3592 /// ```ignore,no_run
3593 /// # use google_cloud_cloudcontrolspartner_v1::model::EkmMetadata;
3594 /// let x = EkmMetadata::new().set_ekm_endpoint_uri("example");
3595 /// ```
3596 pub fn set_ekm_endpoint_uri<T: std::convert::Into<std::string::String>>(
3597 mut self,
3598 v: T,
3599 ) -> Self {
3600 self.ekm_endpoint_uri = v.into();
3601 self
3602 }
3603}
3604
3605impl wkt::message::Message for EkmMetadata {
3606 fn typename() -> &'static str {
3607 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.EkmMetadata"
3608 }
3609}
3610
3611/// Defines additional types related to [EkmMetadata].
3612pub mod ekm_metadata {
3613 #[allow(unused_imports)]
3614 use super::*;
3615
3616 /// Represents Google Cloud supported external key management partners
3617 /// [Google Cloud EKM partners
3618 /// docs](https://cloud.google.com/kms/docs/ekm#supported_partners).
3619 ///
3620 /// # Working with unknown values
3621 ///
3622 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3623 /// additional enum variants at any time. Adding new variants is not considered
3624 /// a breaking change. Applications should write their code in anticipation of:
3625 ///
3626 /// - New values appearing in future releases of the client library, **and**
3627 /// - New values received dynamically, without application changes.
3628 ///
3629 /// Please consult the [Working with enums] section in the user guide for some
3630 /// guidelines.
3631 ///
3632 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3633 #[derive(Clone, Debug, PartialEq)]
3634 #[non_exhaustive]
3635 pub enum EkmSolution {
3636 /// Unspecified EKM solution
3637 Unspecified,
3638 /// EKM Partner Fortanix
3639 Fortanix,
3640 /// EKM Partner FutureX
3641 Futurex,
3642 /// EKM Partner Thales
3643 Thales,
3644 /// This enum value is never used.
3645 #[deprecated]
3646 Virtru,
3647 /// If set, the enum was initialized with an unknown value.
3648 ///
3649 /// Applications can examine the value using [EkmSolution::value] or
3650 /// [EkmSolution::name].
3651 UnknownValue(ekm_solution::UnknownValue),
3652 }
3653
3654 #[doc(hidden)]
3655 pub mod ekm_solution {
3656 #[allow(unused_imports)]
3657 use super::*;
3658 #[derive(Clone, Debug, PartialEq)]
3659 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3660 }
3661
3662 impl EkmSolution {
3663 /// Gets the enum value.
3664 ///
3665 /// Returns `None` if the enum contains an unknown value deserialized from
3666 /// the string representation of enums.
3667 pub fn value(&self) -> std::option::Option<i32> {
3668 match self {
3669 Self::Unspecified => std::option::Option::Some(0),
3670 Self::Fortanix => std::option::Option::Some(1),
3671 Self::Futurex => std::option::Option::Some(2),
3672 Self::Thales => std::option::Option::Some(3),
3673 Self::Virtru => std::option::Option::Some(4),
3674 Self::UnknownValue(u) => u.0.value(),
3675 }
3676 }
3677
3678 /// Gets the enum value as a string.
3679 ///
3680 /// Returns `None` if the enum contains an unknown value deserialized from
3681 /// the integer representation of enums.
3682 pub fn name(&self) -> std::option::Option<&str> {
3683 match self {
3684 Self::Unspecified => std::option::Option::Some("EKM_SOLUTION_UNSPECIFIED"),
3685 Self::Fortanix => std::option::Option::Some("FORTANIX"),
3686 Self::Futurex => std::option::Option::Some("FUTUREX"),
3687 Self::Thales => std::option::Option::Some("THALES"),
3688 Self::Virtru => std::option::Option::Some("VIRTRU"),
3689 Self::UnknownValue(u) => u.0.name(),
3690 }
3691 }
3692 }
3693
3694 impl std::default::Default for EkmSolution {
3695 fn default() -> Self {
3696 use std::convert::From;
3697 Self::from(0)
3698 }
3699 }
3700
3701 impl std::fmt::Display for EkmSolution {
3702 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3703 wkt::internal::display_enum(f, self.name(), self.value())
3704 }
3705 }
3706
3707 impl std::convert::From<i32> for EkmSolution {
3708 fn from(value: i32) -> Self {
3709 match value {
3710 0 => Self::Unspecified,
3711 1 => Self::Fortanix,
3712 2 => Self::Futurex,
3713 3 => Self::Thales,
3714 4 => Self::Virtru,
3715 _ => Self::UnknownValue(ekm_solution::UnknownValue(
3716 wkt::internal::UnknownEnumValue::Integer(value),
3717 )),
3718 }
3719 }
3720 }
3721
3722 impl std::convert::From<&str> for EkmSolution {
3723 fn from(value: &str) -> Self {
3724 use std::string::ToString;
3725 match value {
3726 "EKM_SOLUTION_UNSPECIFIED" => Self::Unspecified,
3727 "FORTANIX" => Self::Fortanix,
3728 "FUTUREX" => Self::Futurex,
3729 "THALES" => Self::Thales,
3730 "VIRTRU" => Self::Virtru,
3731 _ => Self::UnknownValue(ekm_solution::UnknownValue(
3732 wkt::internal::UnknownEnumValue::String(value.to_string()),
3733 )),
3734 }
3735 }
3736 }
3737
3738 impl serde::ser::Serialize for EkmSolution {
3739 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3740 where
3741 S: serde::Serializer,
3742 {
3743 match self {
3744 Self::Unspecified => serializer.serialize_i32(0),
3745 Self::Fortanix => serializer.serialize_i32(1),
3746 Self::Futurex => serializer.serialize_i32(2),
3747 Self::Thales => serializer.serialize_i32(3),
3748 Self::Virtru => serializer.serialize_i32(4),
3749 Self::UnknownValue(u) => u.0.serialize(serializer),
3750 }
3751 }
3752 }
3753
3754 impl<'de> serde::de::Deserialize<'de> for EkmSolution {
3755 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3756 where
3757 D: serde::Deserializer<'de>,
3758 {
3759 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EkmSolution>::new(
3760 ".google.cloud.cloudcontrolspartner.v1.EkmMetadata.EkmSolution",
3761 ))
3762 }
3763 }
3764}
3765
3766/// Details of resource Violation
3767#[derive(Clone, Default, PartialEq)]
3768#[non_exhaustive]
3769pub struct Violation {
3770 /// Identifier. Format:
3771 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/violations/{violation}`
3772 pub name: std::string::String,
3773
3774 /// Output only. Description for the Violation.
3775 /// e.g. OrgPolicy gcp.resourceLocations has non compliant value.
3776 pub description: std::string::String,
3777
3778 /// Output only. Time of the event which triggered the Violation.
3779 pub begin_time: std::option::Option<wkt::Timestamp>,
3780
3781 /// Output only. The last time when the Violation record was updated.
3782 pub update_time: std::option::Option<wkt::Timestamp>,
3783
3784 /// Output only. Time of the event which fixed the Violation.
3785 /// If the violation is ACTIVE this will be empty.
3786 pub resolve_time: std::option::Option<wkt::Timestamp>,
3787
3788 /// Output only. Category under which this violation is mapped.
3789 /// e.g. Location, Service Usage, Access, Encryption, etc.
3790 pub category: std::string::String,
3791
3792 /// Output only. State of the violation
3793 pub state: crate::model::violation::State,
3794
3795 /// Output only. Immutable. Name of the OrgPolicy which was modified with
3796 /// non-compliant change and resulted this violation. Format:
3797 /// `projects/{project_number}/policies/{constraint_name}`
3798 /// `folders/{folder_id}/policies/{constraint_name}`
3799 /// `organizations/{organization_id}/policies/{constraint_name}`
3800 pub non_compliant_org_policy: std::string::String,
3801
3802 /// The folder_id of the violation
3803 pub folder_id: i64,
3804
3805 /// Output only. Compliance violation remediation
3806 pub remediation: std::option::Option<crate::model::violation::Remediation>,
3807
3808 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3809}
3810
3811impl Violation {
3812 pub fn new() -> Self {
3813 std::default::Default::default()
3814 }
3815
3816 /// Sets the value of [name][crate::model::Violation::name].
3817 ///
3818 /// # Example
3819 /// ```ignore,no_run
3820 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3821 /// let x = Violation::new().set_name("example");
3822 /// ```
3823 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3824 self.name = v.into();
3825 self
3826 }
3827
3828 /// Sets the value of [description][crate::model::Violation::description].
3829 ///
3830 /// # Example
3831 /// ```ignore,no_run
3832 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3833 /// let x = Violation::new().set_description("example");
3834 /// ```
3835 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3836 self.description = v.into();
3837 self
3838 }
3839
3840 /// Sets the value of [begin_time][crate::model::Violation::begin_time].
3841 ///
3842 /// # Example
3843 /// ```ignore,no_run
3844 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3845 /// use wkt::Timestamp;
3846 /// let x = Violation::new().set_begin_time(Timestamp::default()/* use setters */);
3847 /// ```
3848 pub fn set_begin_time<T>(mut self, v: T) -> Self
3849 where
3850 T: std::convert::Into<wkt::Timestamp>,
3851 {
3852 self.begin_time = std::option::Option::Some(v.into());
3853 self
3854 }
3855
3856 /// Sets or clears the value of [begin_time][crate::model::Violation::begin_time].
3857 ///
3858 /// # Example
3859 /// ```ignore,no_run
3860 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3861 /// use wkt::Timestamp;
3862 /// let x = Violation::new().set_or_clear_begin_time(Some(Timestamp::default()/* use setters */));
3863 /// let x = Violation::new().set_or_clear_begin_time(None::<Timestamp>);
3864 /// ```
3865 pub fn set_or_clear_begin_time<T>(mut self, v: std::option::Option<T>) -> Self
3866 where
3867 T: std::convert::Into<wkt::Timestamp>,
3868 {
3869 self.begin_time = v.map(|x| x.into());
3870 self
3871 }
3872
3873 /// Sets the value of [update_time][crate::model::Violation::update_time].
3874 ///
3875 /// # Example
3876 /// ```ignore,no_run
3877 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3878 /// use wkt::Timestamp;
3879 /// let x = Violation::new().set_update_time(Timestamp::default()/* use setters */);
3880 /// ```
3881 pub fn set_update_time<T>(mut self, v: T) -> Self
3882 where
3883 T: std::convert::Into<wkt::Timestamp>,
3884 {
3885 self.update_time = std::option::Option::Some(v.into());
3886 self
3887 }
3888
3889 /// Sets or clears the value of [update_time][crate::model::Violation::update_time].
3890 ///
3891 /// # Example
3892 /// ```ignore,no_run
3893 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3894 /// use wkt::Timestamp;
3895 /// let x = Violation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3896 /// let x = Violation::new().set_or_clear_update_time(None::<Timestamp>);
3897 /// ```
3898 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3899 where
3900 T: std::convert::Into<wkt::Timestamp>,
3901 {
3902 self.update_time = v.map(|x| x.into());
3903 self
3904 }
3905
3906 /// Sets the value of [resolve_time][crate::model::Violation::resolve_time].
3907 ///
3908 /// # Example
3909 /// ```ignore,no_run
3910 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3911 /// use wkt::Timestamp;
3912 /// let x = Violation::new().set_resolve_time(Timestamp::default()/* use setters */);
3913 /// ```
3914 pub fn set_resolve_time<T>(mut self, v: T) -> Self
3915 where
3916 T: std::convert::Into<wkt::Timestamp>,
3917 {
3918 self.resolve_time = std::option::Option::Some(v.into());
3919 self
3920 }
3921
3922 /// Sets or clears the value of [resolve_time][crate::model::Violation::resolve_time].
3923 ///
3924 /// # Example
3925 /// ```ignore,no_run
3926 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3927 /// use wkt::Timestamp;
3928 /// let x = Violation::new().set_or_clear_resolve_time(Some(Timestamp::default()/* use setters */));
3929 /// let x = Violation::new().set_or_clear_resolve_time(None::<Timestamp>);
3930 /// ```
3931 pub fn set_or_clear_resolve_time<T>(mut self, v: std::option::Option<T>) -> Self
3932 where
3933 T: std::convert::Into<wkt::Timestamp>,
3934 {
3935 self.resolve_time = v.map(|x| x.into());
3936 self
3937 }
3938
3939 /// Sets the value of [category][crate::model::Violation::category].
3940 ///
3941 /// # Example
3942 /// ```ignore,no_run
3943 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3944 /// let x = Violation::new().set_category("example");
3945 /// ```
3946 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3947 self.category = v.into();
3948 self
3949 }
3950
3951 /// Sets the value of [state][crate::model::Violation::state].
3952 ///
3953 /// # Example
3954 /// ```ignore,no_run
3955 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3956 /// use google_cloud_cloudcontrolspartner_v1::model::violation::State;
3957 /// let x0 = Violation::new().set_state(State::Resolved);
3958 /// let x1 = Violation::new().set_state(State::Unresolved);
3959 /// let x2 = Violation::new().set_state(State::Exception);
3960 /// ```
3961 pub fn set_state<T: std::convert::Into<crate::model::violation::State>>(
3962 mut self,
3963 v: T,
3964 ) -> Self {
3965 self.state = v.into();
3966 self
3967 }
3968
3969 /// Sets the value of [non_compliant_org_policy][crate::model::Violation::non_compliant_org_policy].
3970 ///
3971 /// # Example
3972 /// ```ignore,no_run
3973 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3974 /// let x = Violation::new().set_non_compliant_org_policy("example");
3975 /// ```
3976 pub fn set_non_compliant_org_policy<T: std::convert::Into<std::string::String>>(
3977 mut self,
3978 v: T,
3979 ) -> Self {
3980 self.non_compliant_org_policy = v.into();
3981 self
3982 }
3983
3984 /// Sets the value of [folder_id][crate::model::Violation::folder_id].
3985 ///
3986 /// # Example
3987 /// ```ignore,no_run
3988 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
3989 /// let x = Violation::new().set_folder_id(42);
3990 /// ```
3991 pub fn set_folder_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3992 self.folder_id = v.into();
3993 self
3994 }
3995
3996 /// Sets the value of [remediation][crate::model::Violation::remediation].
3997 ///
3998 /// # Example
3999 /// ```ignore,no_run
4000 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
4001 /// use google_cloud_cloudcontrolspartner_v1::model::violation::Remediation;
4002 /// let x = Violation::new().set_remediation(Remediation::default()/* use setters */);
4003 /// ```
4004 pub fn set_remediation<T>(mut self, v: T) -> Self
4005 where
4006 T: std::convert::Into<crate::model::violation::Remediation>,
4007 {
4008 self.remediation = std::option::Option::Some(v.into());
4009 self
4010 }
4011
4012 /// Sets or clears the value of [remediation][crate::model::Violation::remediation].
4013 ///
4014 /// # Example
4015 /// ```ignore,no_run
4016 /// # use google_cloud_cloudcontrolspartner_v1::model::Violation;
4017 /// use google_cloud_cloudcontrolspartner_v1::model::violation::Remediation;
4018 /// let x = Violation::new().set_or_clear_remediation(Some(Remediation::default()/* use setters */));
4019 /// let x = Violation::new().set_or_clear_remediation(None::<Remediation>);
4020 /// ```
4021 pub fn set_or_clear_remediation<T>(mut self, v: std::option::Option<T>) -> Self
4022 where
4023 T: std::convert::Into<crate::model::violation::Remediation>,
4024 {
4025 self.remediation = v.map(|x| x.into());
4026 self
4027 }
4028}
4029
4030impl wkt::message::Message for Violation {
4031 fn typename() -> &'static str {
4032 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Violation"
4033 }
4034}
4035
4036/// Defines additional types related to [Violation].
4037pub mod violation {
4038 #[allow(unused_imports)]
4039 use super::*;
4040
4041 /// Represents remediation guidance to resolve compliance violation for
4042 /// AssuredWorkload
4043 #[derive(Clone, Default, PartialEq)]
4044 #[non_exhaustive]
4045 pub struct Remediation {
4046 /// Required. Remediation instructions to resolve violations
4047 pub instructions: std::option::Option<crate::model::violation::remediation::Instructions>,
4048
4049 /// Values that can resolve the violation
4050 /// For example: for list org policy violations, this will either be the list
4051 /// of allowed or denied values
4052 pub compliant_values: std::vec::Vec<std::string::String>,
4053
4054 /// Output only. Remediation type based on the type of org policy values
4055 /// violated
4056 pub remediation_type: crate::model::violation::remediation::RemediationType,
4057
4058 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4059 }
4060
4061 impl Remediation {
4062 pub fn new() -> Self {
4063 std::default::Default::default()
4064 }
4065
4066 /// Sets the value of [instructions][crate::model::violation::Remediation::instructions].
4067 ///
4068 /// # Example
4069 /// ```ignore,no_run
4070 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::Remediation;
4071 /// use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::Instructions;
4072 /// let x = Remediation::new().set_instructions(Instructions::default()/* use setters */);
4073 /// ```
4074 pub fn set_instructions<T>(mut self, v: T) -> Self
4075 where
4076 T: std::convert::Into<crate::model::violation::remediation::Instructions>,
4077 {
4078 self.instructions = std::option::Option::Some(v.into());
4079 self
4080 }
4081
4082 /// Sets or clears the value of [instructions][crate::model::violation::Remediation::instructions].
4083 ///
4084 /// # Example
4085 /// ```ignore,no_run
4086 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::Remediation;
4087 /// use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::Instructions;
4088 /// let x = Remediation::new().set_or_clear_instructions(Some(Instructions::default()/* use setters */));
4089 /// let x = Remediation::new().set_or_clear_instructions(None::<Instructions>);
4090 /// ```
4091 pub fn set_or_clear_instructions<T>(mut self, v: std::option::Option<T>) -> Self
4092 where
4093 T: std::convert::Into<crate::model::violation::remediation::Instructions>,
4094 {
4095 self.instructions = v.map(|x| x.into());
4096 self
4097 }
4098
4099 /// Sets the value of [compliant_values][crate::model::violation::Remediation::compliant_values].
4100 ///
4101 /// # Example
4102 /// ```ignore,no_run
4103 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::Remediation;
4104 /// let x = Remediation::new().set_compliant_values(["a", "b", "c"]);
4105 /// ```
4106 pub fn set_compliant_values<T, V>(mut self, v: T) -> Self
4107 where
4108 T: std::iter::IntoIterator<Item = V>,
4109 V: std::convert::Into<std::string::String>,
4110 {
4111 use std::iter::Iterator;
4112 self.compliant_values = v.into_iter().map(|i| i.into()).collect();
4113 self
4114 }
4115
4116 /// Sets the value of [remediation_type][crate::model::violation::Remediation::remediation_type].
4117 ///
4118 /// # Example
4119 /// ```ignore,no_run
4120 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::Remediation;
4121 /// use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::RemediationType;
4122 /// let x0 = Remediation::new().set_remediation_type(RemediationType::RemediationBooleanOrgPolicyViolation);
4123 /// let x1 = Remediation::new().set_remediation_type(RemediationType::RemediationListAllowedValuesOrgPolicyViolation);
4124 /// let x2 = Remediation::new().set_remediation_type(RemediationType::RemediationListDeniedValuesOrgPolicyViolation);
4125 /// ```
4126 pub fn set_remediation_type<
4127 T: std::convert::Into<crate::model::violation::remediation::RemediationType>,
4128 >(
4129 mut self,
4130 v: T,
4131 ) -> Self {
4132 self.remediation_type = v.into();
4133 self
4134 }
4135 }
4136
4137 impl wkt::message::Message for Remediation {
4138 fn typename() -> &'static str {
4139 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Violation.Remediation"
4140 }
4141 }
4142
4143 /// Defines additional types related to [Remediation].
4144 pub mod remediation {
4145 #[allow(unused_imports)]
4146 use super::*;
4147
4148 /// Instructions to remediate violation
4149 #[derive(Clone, Default, PartialEq)]
4150 #[non_exhaustive]
4151 pub struct Instructions {
4152 /// Remediation instructions to resolve violation via gcloud cli
4153 pub gcloud_instructions:
4154 std::option::Option<crate::model::violation::remediation::instructions::Gcloud>,
4155
4156 /// Remediation instructions to resolve violation via cloud console
4157 pub console_instructions:
4158 std::option::Option<crate::model::violation::remediation::instructions::Console>,
4159
4160 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4161 }
4162
4163 impl Instructions {
4164 pub fn new() -> Self {
4165 std::default::Default::default()
4166 }
4167
4168 /// Sets the value of [gcloud_instructions][crate::model::violation::remediation::Instructions::gcloud_instructions].
4169 ///
4170 /// # Example
4171 /// ```ignore,no_run
4172 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::Instructions;
4173 /// use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Gcloud;
4174 /// let x = Instructions::new().set_gcloud_instructions(Gcloud::default()/* use setters */);
4175 /// ```
4176 pub fn set_gcloud_instructions<T>(mut self, v: T) -> Self
4177 where
4178 T: std::convert::Into<crate::model::violation::remediation::instructions::Gcloud>,
4179 {
4180 self.gcloud_instructions = std::option::Option::Some(v.into());
4181 self
4182 }
4183
4184 /// Sets or clears the value of [gcloud_instructions][crate::model::violation::remediation::Instructions::gcloud_instructions].
4185 ///
4186 /// # Example
4187 /// ```ignore,no_run
4188 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::Instructions;
4189 /// use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Gcloud;
4190 /// let x = Instructions::new().set_or_clear_gcloud_instructions(Some(Gcloud::default()/* use setters */));
4191 /// let x = Instructions::new().set_or_clear_gcloud_instructions(None::<Gcloud>);
4192 /// ```
4193 pub fn set_or_clear_gcloud_instructions<T>(mut self, v: std::option::Option<T>) -> Self
4194 where
4195 T: std::convert::Into<crate::model::violation::remediation::instructions::Gcloud>,
4196 {
4197 self.gcloud_instructions = v.map(|x| x.into());
4198 self
4199 }
4200
4201 /// Sets the value of [console_instructions][crate::model::violation::remediation::Instructions::console_instructions].
4202 ///
4203 /// # Example
4204 /// ```ignore,no_run
4205 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::Instructions;
4206 /// use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Console;
4207 /// let x = Instructions::new().set_console_instructions(Console::default()/* use setters */);
4208 /// ```
4209 pub fn set_console_instructions<T>(mut self, v: T) -> Self
4210 where
4211 T: std::convert::Into<crate::model::violation::remediation::instructions::Console>,
4212 {
4213 self.console_instructions = std::option::Option::Some(v.into());
4214 self
4215 }
4216
4217 /// Sets or clears the value of [console_instructions][crate::model::violation::remediation::Instructions::console_instructions].
4218 ///
4219 /// # Example
4220 /// ```ignore,no_run
4221 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::Instructions;
4222 /// use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Console;
4223 /// let x = Instructions::new().set_or_clear_console_instructions(Some(Console::default()/* use setters */));
4224 /// let x = Instructions::new().set_or_clear_console_instructions(None::<Console>);
4225 /// ```
4226 pub fn set_or_clear_console_instructions<T>(mut self, v: std::option::Option<T>) -> Self
4227 where
4228 T: std::convert::Into<crate::model::violation::remediation::instructions::Console>,
4229 {
4230 self.console_instructions = v.map(|x| x.into());
4231 self
4232 }
4233 }
4234
4235 impl wkt::message::Message for Instructions {
4236 fn typename() -> &'static str {
4237 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Violation.Remediation.Instructions"
4238 }
4239 }
4240
4241 /// Defines additional types related to [Instructions].
4242 pub mod instructions {
4243 #[allow(unused_imports)]
4244 use super::*;
4245
4246 /// Remediation instructions to resolve violation via gcloud cli
4247 #[derive(Clone, Default, PartialEq)]
4248 #[non_exhaustive]
4249 pub struct Gcloud {
4250 /// Gcloud command to resolve violation
4251 pub gcloud_commands: std::vec::Vec<std::string::String>,
4252
4253 /// Steps to resolve violation via gcloud cli
4254 pub steps: std::vec::Vec<std::string::String>,
4255
4256 /// Additional urls for more information about steps
4257 pub additional_links: std::vec::Vec<std::string::String>,
4258
4259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4260 }
4261
4262 impl Gcloud {
4263 pub fn new() -> Self {
4264 std::default::Default::default()
4265 }
4266
4267 /// Sets the value of [gcloud_commands][crate::model::violation::remediation::instructions::Gcloud::gcloud_commands].
4268 ///
4269 /// # Example
4270 /// ```ignore,no_run
4271 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Gcloud;
4272 /// let x = Gcloud::new().set_gcloud_commands(["a", "b", "c"]);
4273 /// ```
4274 pub fn set_gcloud_commands<T, V>(mut self, v: T) -> Self
4275 where
4276 T: std::iter::IntoIterator<Item = V>,
4277 V: std::convert::Into<std::string::String>,
4278 {
4279 use std::iter::Iterator;
4280 self.gcloud_commands = v.into_iter().map(|i| i.into()).collect();
4281 self
4282 }
4283
4284 /// Sets the value of [steps][crate::model::violation::remediation::instructions::Gcloud::steps].
4285 ///
4286 /// # Example
4287 /// ```ignore,no_run
4288 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Gcloud;
4289 /// let x = Gcloud::new().set_steps(["a", "b", "c"]);
4290 /// ```
4291 pub fn set_steps<T, V>(mut self, v: T) -> Self
4292 where
4293 T: std::iter::IntoIterator<Item = V>,
4294 V: std::convert::Into<std::string::String>,
4295 {
4296 use std::iter::Iterator;
4297 self.steps = v.into_iter().map(|i| i.into()).collect();
4298 self
4299 }
4300
4301 /// Sets the value of [additional_links][crate::model::violation::remediation::instructions::Gcloud::additional_links].
4302 ///
4303 /// # Example
4304 /// ```ignore,no_run
4305 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Gcloud;
4306 /// let x = Gcloud::new().set_additional_links(["a", "b", "c"]);
4307 /// ```
4308 pub fn set_additional_links<T, V>(mut self, v: T) -> Self
4309 where
4310 T: std::iter::IntoIterator<Item = V>,
4311 V: std::convert::Into<std::string::String>,
4312 {
4313 use std::iter::Iterator;
4314 self.additional_links = v.into_iter().map(|i| i.into()).collect();
4315 self
4316 }
4317 }
4318
4319 impl wkt::message::Message for Gcloud {
4320 fn typename() -> &'static str {
4321 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Violation.Remediation.Instructions.Gcloud"
4322 }
4323 }
4324
4325 /// Remediation instructions to resolve violation via cloud console
4326 #[derive(Clone, Default, PartialEq)]
4327 #[non_exhaustive]
4328 pub struct Console {
4329 /// Link to console page where violations can be resolved
4330 pub console_uris: std::vec::Vec<std::string::String>,
4331
4332 /// Steps to resolve violation via cloud console
4333 pub steps: std::vec::Vec<std::string::String>,
4334
4335 /// Additional urls for more information about steps
4336 pub additional_links: std::vec::Vec<std::string::String>,
4337
4338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4339 }
4340
4341 impl Console {
4342 pub fn new() -> Self {
4343 std::default::Default::default()
4344 }
4345
4346 /// Sets the value of [console_uris][crate::model::violation::remediation::instructions::Console::console_uris].
4347 ///
4348 /// # Example
4349 /// ```ignore,no_run
4350 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Console;
4351 /// let x = Console::new().set_console_uris(["a", "b", "c"]);
4352 /// ```
4353 pub fn set_console_uris<T, V>(mut self, v: T) -> Self
4354 where
4355 T: std::iter::IntoIterator<Item = V>,
4356 V: std::convert::Into<std::string::String>,
4357 {
4358 use std::iter::Iterator;
4359 self.console_uris = v.into_iter().map(|i| i.into()).collect();
4360 self
4361 }
4362
4363 /// Sets the value of [steps][crate::model::violation::remediation::instructions::Console::steps].
4364 ///
4365 /// # Example
4366 /// ```ignore,no_run
4367 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Console;
4368 /// let x = Console::new().set_steps(["a", "b", "c"]);
4369 /// ```
4370 pub fn set_steps<T, V>(mut self, v: T) -> Self
4371 where
4372 T: std::iter::IntoIterator<Item = V>,
4373 V: std::convert::Into<std::string::String>,
4374 {
4375 use std::iter::Iterator;
4376 self.steps = v.into_iter().map(|i| i.into()).collect();
4377 self
4378 }
4379
4380 /// Sets the value of [additional_links][crate::model::violation::remediation::instructions::Console::additional_links].
4381 ///
4382 /// # Example
4383 /// ```ignore,no_run
4384 /// # use google_cloud_cloudcontrolspartner_v1::model::violation::remediation::instructions::Console;
4385 /// let x = Console::new().set_additional_links(["a", "b", "c"]);
4386 /// ```
4387 pub fn set_additional_links<T, V>(mut self, v: T) -> Self
4388 where
4389 T: std::iter::IntoIterator<Item = V>,
4390 V: std::convert::Into<std::string::String>,
4391 {
4392 use std::iter::Iterator;
4393 self.additional_links = v.into_iter().map(|i| i.into()).collect();
4394 self
4395 }
4396 }
4397
4398 impl wkt::message::Message for Console {
4399 fn typename() -> &'static str {
4400 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.Violation.Remediation.Instructions.Console"
4401 }
4402 }
4403 }
4404
4405 /// Classifying remediation into various types based on the kind of
4406 /// violation. For example, violations caused due to changes in boolean org
4407 /// policy requires different remediation instructions compared to violation
4408 /// caused due to changes in allowed values of list org policy.
4409 ///
4410 /// # Working with unknown values
4411 ///
4412 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4413 /// additional enum variants at any time. Adding new variants is not considered
4414 /// a breaking change. Applications should write their code in anticipation of:
4415 ///
4416 /// - New values appearing in future releases of the client library, **and**
4417 /// - New values received dynamically, without application changes.
4418 ///
4419 /// Please consult the [Working with enums] section in the user guide for some
4420 /// guidelines.
4421 ///
4422 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4423 #[derive(Clone, Debug, PartialEq)]
4424 #[non_exhaustive]
4425 pub enum RemediationType {
4426 /// Unspecified remediation type
4427 Unspecified,
4428 /// Remediation type for boolean org policy
4429 RemediationBooleanOrgPolicyViolation,
4430 /// Remediation type for list org policy which have allowed values in the
4431 /// monitoring rule
4432 RemediationListAllowedValuesOrgPolicyViolation,
4433 /// Remediation type for list org policy which have denied values in the
4434 /// monitoring rule
4435 RemediationListDeniedValuesOrgPolicyViolation,
4436 /// Remediation type for gcp.restrictCmekCryptoKeyProjects
4437 RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation,
4438 /// Remediation type for resource violation.
4439 RemediationResourceViolation,
4440 /// If set, the enum was initialized with an unknown value.
4441 ///
4442 /// Applications can examine the value using [RemediationType::value] or
4443 /// [RemediationType::name].
4444 UnknownValue(remediation_type::UnknownValue),
4445 }
4446
4447 #[doc(hidden)]
4448 pub mod remediation_type {
4449 #[allow(unused_imports)]
4450 use super::*;
4451 #[derive(Clone, Debug, PartialEq)]
4452 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4453 }
4454
4455 impl RemediationType {
4456 /// Gets the enum value.
4457 ///
4458 /// Returns `None` if the enum contains an unknown value deserialized from
4459 /// the string representation of enums.
4460 pub fn value(&self) -> std::option::Option<i32> {
4461 match self {
4462 Self::Unspecified => std::option::Option::Some(0),
4463 Self::RemediationBooleanOrgPolicyViolation => std::option::Option::Some(1),
4464 Self::RemediationListAllowedValuesOrgPolicyViolation => {
4465 std::option::Option::Some(2)
4466 }
4467 Self::RemediationListDeniedValuesOrgPolicyViolation => {
4468 std::option::Option::Some(3)
4469 }
4470 Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation => {
4471 std::option::Option::Some(4)
4472 }
4473 Self::RemediationResourceViolation => std::option::Option::Some(5),
4474 Self::UnknownValue(u) => u.0.value(),
4475 }
4476 }
4477
4478 /// Gets the enum value as a string.
4479 ///
4480 /// Returns `None` if the enum contains an unknown value deserialized from
4481 /// the integer representation of enums.
4482 pub fn name(&self) -> std::option::Option<&str> {
4483 match self {
4484 Self::Unspecified => std::option::Option::Some("REMEDIATION_TYPE_UNSPECIFIED"),
4485 Self::RemediationBooleanOrgPolicyViolation => {
4486 std::option::Option::Some("REMEDIATION_BOOLEAN_ORG_POLICY_VIOLATION")
4487 }
4488 Self::RemediationListAllowedValuesOrgPolicyViolation => {
4489 std::option::Option::Some(
4490 "REMEDIATION_LIST_ALLOWED_VALUES_ORG_POLICY_VIOLATION",
4491 )
4492 }
4493 Self::RemediationListDeniedValuesOrgPolicyViolation => {
4494 std::option::Option::Some(
4495 "REMEDIATION_LIST_DENIED_VALUES_ORG_POLICY_VIOLATION",
4496 )
4497 }
4498 Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation => {
4499 std::option::Option::Some(
4500 "REMEDIATION_RESTRICT_CMEK_CRYPTO_KEY_PROJECTS_ORG_POLICY_VIOLATION",
4501 )
4502 }
4503 Self::RemediationResourceViolation => {
4504 std::option::Option::Some("REMEDIATION_RESOURCE_VIOLATION")
4505 }
4506 Self::UnknownValue(u) => u.0.name(),
4507 }
4508 }
4509 }
4510
4511 impl std::default::Default for RemediationType {
4512 fn default() -> Self {
4513 use std::convert::From;
4514 Self::from(0)
4515 }
4516 }
4517
4518 impl std::fmt::Display for RemediationType {
4519 fn fmt(
4520 &self,
4521 f: &mut std::fmt::Formatter<'_>,
4522 ) -> std::result::Result<(), std::fmt::Error> {
4523 wkt::internal::display_enum(f, self.name(), self.value())
4524 }
4525 }
4526
4527 impl std::convert::From<i32> for RemediationType {
4528 fn from(value: i32) -> Self {
4529 match value {
4530 0 => Self::Unspecified,
4531 1 => Self::RemediationBooleanOrgPolicyViolation,
4532 2 => Self::RemediationListAllowedValuesOrgPolicyViolation,
4533 3 => Self::RemediationListDeniedValuesOrgPolicyViolation,
4534 4 => Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation,
4535 5 => Self::RemediationResourceViolation,
4536 _ => Self::UnknownValue(remediation_type::UnknownValue(
4537 wkt::internal::UnknownEnumValue::Integer(value),
4538 )),
4539 }
4540 }
4541 }
4542
4543 impl std::convert::From<&str> for RemediationType {
4544 fn from(value: &str) -> Self {
4545 use std::string::ToString;
4546 match value {
4547 "REMEDIATION_TYPE_UNSPECIFIED" => Self::Unspecified,
4548 "REMEDIATION_BOOLEAN_ORG_POLICY_VIOLATION" => {
4549 Self::RemediationBooleanOrgPolicyViolation
4550 }
4551 "REMEDIATION_LIST_ALLOWED_VALUES_ORG_POLICY_VIOLATION" => {
4552 Self::RemediationListAllowedValuesOrgPolicyViolation
4553 }
4554 "REMEDIATION_LIST_DENIED_VALUES_ORG_POLICY_VIOLATION" => {
4555 Self::RemediationListDeniedValuesOrgPolicyViolation
4556 }
4557 "REMEDIATION_RESTRICT_CMEK_CRYPTO_KEY_PROJECTS_ORG_POLICY_VIOLATION" => {
4558 Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation
4559 }
4560 "REMEDIATION_RESOURCE_VIOLATION" => Self::RemediationResourceViolation,
4561 _ => Self::UnknownValue(remediation_type::UnknownValue(
4562 wkt::internal::UnknownEnumValue::String(value.to_string()),
4563 )),
4564 }
4565 }
4566 }
4567
4568 impl serde::ser::Serialize for RemediationType {
4569 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4570 where
4571 S: serde::Serializer,
4572 {
4573 match self {
4574 Self::Unspecified => serializer.serialize_i32(0),
4575 Self::RemediationBooleanOrgPolicyViolation => serializer.serialize_i32(1),
4576 Self::RemediationListAllowedValuesOrgPolicyViolation => {
4577 serializer.serialize_i32(2)
4578 }
4579 Self::RemediationListDeniedValuesOrgPolicyViolation => {
4580 serializer.serialize_i32(3)
4581 }
4582 Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation => {
4583 serializer.serialize_i32(4)
4584 }
4585 Self::RemediationResourceViolation => serializer.serialize_i32(5),
4586 Self::UnknownValue(u) => u.0.serialize(serializer),
4587 }
4588 }
4589 }
4590
4591 impl<'de> serde::de::Deserialize<'de> for RemediationType {
4592 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4593 where
4594 D: serde::Deserializer<'de>,
4595 {
4596 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RemediationType>::new(
4597 ".google.cloud.cloudcontrolspartner.v1.Violation.Remediation.RemediationType",
4598 ))
4599 }
4600 }
4601 }
4602
4603 /// Violation State Values
4604 ///
4605 /// # Working with unknown values
4606 ///
4607 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4608 /// additional enum variants at any time. Adding new variants is not considered
4609 /// a breaking change. Applications should write their code in anticipation of:
4610 ///
4611 /// - New values appearing in future releases of the client library, **and**
4612 /// - New values received dynamically, without application changes.
4613 ///
4614 /// Please consult the [Working with enums] section in the user guide for some
4615 /// guidelines.
4616 ///
4617 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4618 #[derive(Clone, Debug, PartialEq)]
4619 #[non_exhaustive]
4620 pub enum State {
4621 /// Unspecified state.
4622 Unspecified,
4623 /// Violation is resolved.
4624 Resolved,
4625 /// Violation is Unresolved
4626 Unresolved,
4627 /// Violation is Exception
4628 Exception,
4629 /// If set, the enum was initialized with an unknown value.
4630 ///
4631 /// Applications can examine the value using [State::value] or
4632 /// [State::name].
4633 UnknownValue(state::UnknownValue),
4634 }
4635
4636 #[doc(hidden)]
4637 pub mod state {
4638 #[allow(unused_imports)]
4639 use super::*;
4640 #[derive(Clone, Debug, PartialEq)]
4641 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4642 }
4643
4644 impl State {
4645 /// Gets the enum value.
4646 ///
4647 /// Returns `None` if the enum contains an unknown value deserialized from
4648 /// the string representation of enums.
4649 pub fn value(&self) -> std::option::Option<i32> {
4650 match self {
4651 Self::Unspecified => std::option::Option::Some(0),
4652 Self::Resolved => std::option::Option::Some(1),
4653 Self::Unresolved => std::option::Option::Some(2),
4654 Self::Exception => std::option::Option::Some(3),
4655 Self::UnknownValue(u) => u.0.value(),
4656 }
4657 }
4658
4659 /// Gets the enum value as a string.
4660 ///
4661 /// Returns `None` if the enum contains an unknown value deserialized from
4662 /// the integer representation of enums.
4663 pub fn name(&self) -> std::option::Option<&str> {
4664 match self {
4665 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4666 Self::Resolved => std::option::Option::Some("RESOLVED"),
4667 Self::Unresolved => std::option::Option::Some("UNRESOLVED"),
4668 Self::Exception => std::option::Option::Some("EXCEPTION"),
4669 Self::UnknownValue(u) => u.0.name(),
4670 }
4671 }
4672 }
4673
4674 impl std::default::Default for State {
4675 fn default() -> Self {
4676 use std::convert::From;
4677 Self::from(0)
4678 }
4679 }
4680
4681 impl std::fmt::Display for State {
4682 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4683 wkt::internal::display_enum(f, self.name(), self.value())
4684 }
4685 }
4686
4687 impl std::convert::From<i32> for State {
4688 fn from(value: i32) -> Self {
4689 match value {
4690 0 => Self::Unspecified,
4691 1 => Self::Resolved,
4692 2 => Self::Unresolved,
4693 3 => Self::Exception,
4694 _ => Self::UnknownValue(state::UnknownValue(
4695 wkt::internal::UnknownEnumValue::Integer(value),
4696 )),
4697 }
4698 }
4699 }
4700
4701 impl std::convert::From<&str> for State {
4702 fn from(value: &str) -> Self {
4703 use std::string::ToString;
4704 match value {
4705 "STATE_UNSPECIFIED" => Self::Unspecified,
4706 "RESOLVED" => Self::Resolved,
4707 "UNRESOLVED" => Self::Unresolved,
4708 "EXCEPTION" => Self::Exception,
4709 _ => Self::UnknownValue(state::UnknownValue(
4710 wkt::internal::UnknownEnumValue::String(value.to_string()),
4711 )),
4712 }
4713 }
4714 }
4715
4716 impl serde::ser::Serialize for State {
4717 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4718 where
4719 S: serde::Serializer,
4720 {
4721 match self {
4722 Self::Unspecified => serializer.serialize_i32(0),
4723 Self::Resolved => serializer.serialize_i32(1),
4724 Self::Unresolved => serializer.serialize_i32(2),
4725 Self::Exception => serializer.serialize_i32(3),
4726 Self::UnknownValue(u) => u.0.serialize(serializer),
4727 }
4728 }
4729 }
4730
4731 impl<'de> serde::de::Deserialize<'de> for State {
4732 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4733 where
4734 D: serde::Deserializer<'de>,
4735 {
4736 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4737 ".google.cloud.cloudcontrolspartner.v1.Violation.State",
4738 ))
4739 }
4740 }
4741}
4742
4743/// Message for requesting list of Violations
4744#[derive(Clone, Default, PartialEq)]
4745#[non_exhaustive]
4746pub struct ListViolationsRequest {
4747 /// Required. Parent resource
4748 /// Format
4749 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
4750 pub parent: std::string::String,
4751
4752 /// Optional. The maximum number of customers row to return. The service may
4753 /// return fewer than this value. If unspecified, at most 10 customers will be
4754 /// returned.
4755 pub page_size: i32,
4756
4757 /// Optional. A page token, received from a previous `ListViolations` call.
4758 /// Provide this to retrieve the subsequent page.
4759 pub page_token: std::string::String,
4760
4761 /// Optional. Filtering results
4762 pub filter: std::string::String,
4763
4764 /// Optional. Hint for how to order the results
4765 pub order_by: std::string::String,
4766
4767 /// Optional. Specifies the interval for retrieving violations.
4768 /// if unspecified, all violations will be returned.
4769 pub interval: std::option::Option<gtype::model::Interval>,
4770
4771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4772}
4773
4774impl ListViolationsRequest {
4775 pub fn new() -> Self {
4776 std::default::Default::default()
4777 }
4778
4779 /// Sets the value of [parent][crate::model::ListViolationsRequest::parent].
4780 ///
4781 /// # Example
4782 /// ```ignore,no_run
4783 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsRequest;
4784 /// let x = ListViolationsRequest::new().set_parent("example");
4785 /// ```
4786 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4787 self.parent = v.into();
4788 self
4789 }
4790
4791 /// Sets the value of [page_size][crate::model::ListViolationsRequest::page_size].
4792 ///
4793 /// # Example
4794 /// ```ignore,no_run
4795 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsRequest;
4796 /// let x = ListViolationsRequest::new().set_page_size(42);
4797 /// ```
4798 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4799 self.page_size = v.into();
4800 self
4801 }
4802
4803 /// Sets the value of [page_token][crate::model::ListViolationsRequest::page_token].
4804 ///
4805 /// # Example
4806 /// ```ignore,no_run
4807 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsRequest;
4808 /// let x = ListViolationsRequest::new().set_page_token("example");
4809 /// ```
4810 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4811 self.page_token = v.into();
4812 self
4813 }
4814
4815 /// Sets the value of [filter][crate::model::ListViolationsRequest::filter].
4816 ///
4817 /// # Example
4818 /// ```ignore,no_run
4819 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsRequest;
4820 /// let x = ListViolationsRequest::new().set_filter("example");
4821 /// ```
4822 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4823 self.filter = v.into();
4824 self
4825 }
4826
4827 /// Sets the value of [order_by][crate::model::ListViolationsRequest::order_by].
4828 ///
4829 /// # Example
4830 /// ```ignore,no_run
4831 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsRequest;
4832 /// let x = ListViolationsRequest::new().set_order_by("example");
4833 /// ```
4834 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4835 self.order_by = v.into();
4836 self
4837 }
4838
4839 /// Sets the value of [interval][crate::model::ListViolationsRequest::interval].
4840 ///
4841 /// # Example
4842 /// ```ignore,no_run
4843 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsRequest;
4844 /// use gtype::model::Interval;
4845 /// let x = ListViolationsRequest::new().set_interval(Interval::default()/* use setters */);
4846 /// ```
4847 pub fn set_interval<T>(mut self, v: T) -> Self
4848 where
4849 T: std::convert::Into<gtype::model::Interval>,
4850 {
4851 self.interval = std::option::Option::Some(v.into());
4852 self
4853 }
4854
4855 /// Sets or clears the value of [interval][crate::model::ListViolationsRequest::interval].
4856 ///
4857 /// # Example
4858 /// ```ignore,no_run
4859 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsRequest;
4860 /// use gtype::model::Interval;
4861 /// let x = ListViolationsRequest::new().set_or_clear_interval(Some(Interval::default()/* use setters */));
4862 /// let x = ListViolationsRequest::new().set_or_clear_interval(None::<Interval>);
4863 /// ```
4864 pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
4865 where
4866 T: std::convert::Into<gtype::model::Interval>,
4867 {
4868 self.interval = v.map(|x| x.into());
4869 self
4870 }
4871}
4872
4873impl wkt::message::Message for ListViolationsRequest {
4874 fn typename() -> &'static str {
4875 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.ListViolationsRequest"
4876 }
4877}
4878
4879/// Response message for list customer violation requests
4880#[derive(Clone, Default, PartialEq)]
4881#[non_exhaustive]
4882pub struct ListViolationsResponse {
4883 /// List of violation
4884 pub violations: std::vec::Vec<crate::model::Violation>,
4885
4886 /// A token that can be sent as `page_token` to retrieve the next page.
4887 /// If this field is omitted, there are no subsequent pages.
4888 pub next_page_token: std::string::String,
4889
4890 /// Workloads that could not be reached due to permission errors or any other
4891 /// error. Ref: <https://google.aip.dev/217>
4892 pub unreachable: std::vec::Vec<std::string::String>,
4893
4894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4895}
4896
4897impl ListViolationsResponse {
4898 pub fn new() -> Self {
4899 std::default::Default::default()
4900 }
4901
4902 /// Sets the value of [violations][crate::model::ListViolationsResponse::violations].
4903 ///
4904 /// # Example
4905 /// ```ignore,no_run
4906 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsResponse;
4907 /// use google_cloud_cloudcontrolspartner_v1::model::Violation;
4908 /// let x = ListViolationsResponse::new()
4909 /// .set_violations([
4910 /// Violation::default()/* use setters */,
4911 /// Violation::default()/* use (different) setters */,
4912 /// ]);
4913 /// ```
4914 pub fn set_violations<T, V>(mut self, v: T) -> Self
4915 where
4916 T: std::iter::IntoIterator<Item = V>,
4917 V: std::convert::Into<crate::model::Violation>,
4918 {
4919 use std::iter::Iterator;
4920 self.violations = v.into_iter().map(|i| i.into()).collect();
4921 self
4922 }
4923
4924 /// Sets the value of [next_page_token][crate::model::ListViolationsResponse::next_page_token].
4925 ///
4926 /// # Example
4927 /// ```ignore,no_run
4928 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsResponse;
4929 /// let x = ListViolationsResponse::new().set_next_page_token("example");
4930 /// ```
4931 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4932 self.next_page_token = v.into();
4933 self
4934 }
4935
4936 /// Sets the value of [unreachable][crate::model::ListViolationsResponse::unreachable].
4937 ///
4938 /// # Example
4939 /// ```ignore,no_run
4940 /// # use google_cloud_cloudcontrolspartner_v1::model::ListViolationsResponse;
4941 /// let x = ListViolationsResponse::new().set_unreachable(["a", "b", "c"]);
4942 /// ```
4943 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4944 where
4945 T: std::iter::IntoIterator<Item = V>,
4946 V: std::convert::Into<std::string::String>,
4947 {
4948 use std::iter::Iterator;
4949 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4950 self
4951 }
4952}
4953
4954impl wkt::message::Message for ListViolationsResponse {
4955 fn typename() -> &'static str {
4956 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.ListViolationsResponse"
4957 }
4958}
4959
4960#[doc(hidden)]
4961impl gax::paginator::internal::PageableResponse for ListViolationsResponse {
4962 type PageItem = crate::model::Violation;
4963
4964 fn items(self) -> std::vec::Vec<Self::PageItem> {
4965 self.violations
4966 }
4967
4968 fn next_page_token(&self) -> std::string::String {
4969 use std::clone::Clone;
4970 self.next_page_token.clone()
4971 }
4972}
4973
4974/// Message for getting a Violation
4975#[derive(Clone, Default, PartialEq)]
4976#[non_exhaustive]
4977pub struct GetViolationRequest {
4978 /// Required. Format:
4979 /// `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/violations/{violation}`
4980 pub name: std::string::String,
4981
4982 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4983}
4984
4985impl GetViolationRequest {
4986 pub fn new() -> Self {
4987 std::default::Default::default()
4988 }
4989
4990 /// Sets the value of [name][crate::model::GetViolationRequest::name].
4991 ///
4992 /// # Example
4993 /// ```ignore,no_run
4994 /// # use google_cloud_cloudcontrolspartner_v1::model::GetViolationRequest;
4995 /// let x = GetViolationRequest::new().set_name("example");
4996 /// ```
4997 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4998 self.name = v.into();
4999 self
5000 }
5001}
5002
5003impl wkt::message::Message for GetViolationRequest {
5004 fn typename() -> &'static str {
5005 "type.googleapis.com/google.cloud.cloudcontrolspartner.v1.GetViolationRequest"
5006 }
5007}
5008
5009/// Enum for possible completion states.
5010///
5011/// # Working with unknown values
5012///
5013/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5014/// additional enum variants at any time. Adding new variants is not considered
5015/// a breaking change. Applications should write their code in anticipation of:
5016///
5017/// - New values appearing in future releases of the client library, **and**
5018/// - New values received dynamically, without application changes.
5019///
5020/// Please consult the [Working with enums] section in the user guide for some
5021/// guidelines.
5022///
5023/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5024#[derive(Clone, Debug, PartialEq)]
5025#[non_exhaustive]
5026pub enum CompletionState {
5027 /// Unspecified completion state.
5028 Unspecified,
5029 /// Task started (has start date) but not yet completed.
5030 Pending,
5031 /// Succeeded state.
5032 Succeeded,
5033 /// Failed state.
5034 Failed,
5035 /// Not applicable state.
5036 NotApplicable,
5037 /// If set, the enum was initialized with an unknown value.
5038 ///
5039 /// Applications can examine the value using [CompletionState::value] or
5040 /// [CompletionState::name].
5041 UnknownValue(completion_state::UnknownValue),
5042}
5043
5044#[doc(hidden)]
5045pub mod completion_state {
5046 #[allow(unused_imports)]
5047 use super::*;
5048 #[derive(Clone, Debug, PartialEq)]
5049 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5050}
5051
5052impl CompletionState {
5053 /// Gets the enum value.
5054 ///
5055 /// Returns `None` if the enum contains an unknown value deserialized from
5056 /// the string representation of enums.
5057 pub fn value(&self) -> std::option::Option<i32> {
5058 match self {
5059 Self::Unspecified => std::option::Option::Some(0),
5060 Self::Pending => std::option::Option::Some(1),
5061 Self::Succeeded => std::option::Option::Some(2),
5062 Self::Failed => std::option::Option::Some(3),
5063 Self::NotApplicable => std::option::Option::Some(4),
5064 Self::UnknownValue(u) => u.0.value(),
5065 }
5066 }
5067
5068 /// Gets the enum value as a string.
5069 ///
5070 /// Returns `None` if the enum contains an unknown value deserialized from
5071 /// the integer representation of enums.
5072 pub fn name(&self) -> std::option::Option<&str> {
5073 match self {
5074 Self::Unspecified => std::option::Option::Some("COMPLETION_STATE_UNSPECIFIED"),
5075 Self::Pending => std::option::Option::Some("PENDING"),
5076 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
5077 Self::Failed => std::option::Option::Some("FAILED"),
5078 Self::NotApplicable => std::option::Option::Some("NOT_APPLICABLE"),
5079 Self::UnknownValue(u) => u.0.name(),
5080 }
5081 }
5082}
5083
5084impl std::default::Default for CompletionState {
5085 fn default() -> Self {
5086 use std::convert::From;
5087 Self::from(0)
5088 }
5089}
5090
5091impl std::fmt::Display for CompletionState {
5092 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5093 wkt::internal::display_enum(f, self.name(), self.value())
5094 }
5095}
5096
5097impl std::convert::From<i32> for CompletionState {
5098 fn from(value: i32) -> Self {
5099 match value {
5100 0 => Self::Unspecified,
5101 1 => Self::Pending,
5102 2 => Self::Succeeded,
5103 3 => Self::Failed,
5104 4 => Self::NotApplicable,
5105 _ => Self::UnknownValue(completion_state::UnknownValue(
5106 wkt::internal::UnknownEnumValue::Integer(value),
5107 )),
5108 }
5109 }
5110}
5111
5112impl std::convert::From<&str> for CompletionState {
5113 fn from(value: &str) -> Self {
5114 use std::string::ToString;
5115 match value {
5116 "COMPLETION_STATE_UNSPECIFIED" => Self::Unspecified,
5117 "PENDING" => Self::Pending,
5118 "SUCCEEDED" => Self::Succeeded,
5119 "FAILED" => Self::Failed,
5120 "NOT_APPLICABLE" => Self::NotApplicable,
5121 _ => Self::UnknownValue(completion_state::UnknownValue(
5122 wkt::internal::UnknownEnumValue::String(value.to_string()),
5123 )),
5124 }
5125 }
5126}
5127
5128impl serde::ser::Serialize for CompletionState {
5129 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5130 where
5131 S: serde::Serializer,
5132 {
5133 match self {
5134 Self::Unspecified => serializer.serialize_i32(0),
5135 Self::Pending => serializer.serialize_i32(1),
5136 Self::Succeeded => serializer.serialize_i32(2),
5137 Self::Failed => serializer.serialize_i32(3),
5138 Self::NotApplicable => serializer.serialize_i32(4),
5139 Self::UnknownValue(u) => u.0.serialize(serializer),
5140 }
5141 }
5142}
5143
5144impl<'de> serde::de::Deserialize<'de> for CompletionState {
5145 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5146 where
5147 D: serde::Deserializer<'de>,
5148 {
5149 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionState>::new(
5150 ".google.cloud.cloudcontrolspartner.v1.CompletionState",
5151 ))
5152 }
5153}