Skip to main content

google_cloud_privilegedaccessmanager_v1/
model.rs

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